add RNA_define_animate_sdna() so animation can be easily disabled when defining many properties - currently use to disable animating brushes and toolsettings.

This commit is contained in:
Campbell Barton
2013-02-05 14:25:22 +00:00
parent fa671fd0d5
commit 4c3d5a4294
6 changed files with 34 additions and 5 deletions

View File

@@ -43,6 +43,7 @@ BlenderRNA *RNA_create(void);
void RNA_define_free(BlenderRNA *brna);
void RNA_free(BlenderRNA *brna);
void RNA_define_verify_sdna(int verify);
void RNA_define_animate_sdna(int animate);
void RNA_init(void);
void RNA_exit(void);

View File

@@ -3882,6 +3882,13 @@ static int rna_preprocess(const char *outfile)
if (PROCESS_ITEMS[i].define) {
PROCESS_ITEMS[i].define(brna);
/* sanity check */
if (!DefRNA.animate) {
fprintf(stderr,
"Error: DefRNA.animate left disabled in %s\n",
PROCESS_ITEMS[i].filename);
}
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
if (!ds->filename)
ds->filename = PROCESS_ITEMS[i].filename;

View File

@@ -61,7 +61,7 @@
/* Global used during defining */
BlenderDefRNA DefRNA = {NULL, {NULL, NULL}, {NULL, NULL}, NULL, 0, 0, 0, 1};
BlenderDefRNA DefRNA = {NULL, {NULL, NULL}, {NULL, NULL}, NULL, 0, 0, 0, 1, 1};
/* Duplicated code since we can't link in blenkernel or blenlib */
@@ -506,6 +506,13 @@ void RNA_define_verify_sdna(int verify)
DefRNA.verify = verify;
}
#ifndef RNA_RUNTIME
void RNA_define_animate_sdna(int animate)
{
DefRNA.animate = animate;
}
#endif
void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *ext)
{
#ifdef RNA_RUNTIME
@@ -1031,8 +1038,15 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
if (type != PROP_COLLECTION && type != PROP_POINTER) {
prop->flag = PROP_EDITABLE;
if (type != PROP_STRING)
if (type != PROP_STRING) {
#ifdef RNA_RUNTIME
prop->flag |= PROP_ANIMATABLE;
#else
if (DefRNA.animate) {
prop->flag |= PROP_ANIMATABLE;
}
#endif
}
}
if (type == PROP_STRING) {

View File

@@ -117,7 +117,7 @@ typedef struct BlenderDefRNA {
ListBase structs;
ListBase allocs;
struct StructRNA *laststruct;
int error, silent, preprocess, verify;
int error, silent, preprocess, verify, animate;
} BlenderDefRNA;
extern BlenderDefRNA DefRNA;

View File

@@ -4708,15 +4708,19 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Sequencer Color Space Settings", "Settings of color space sequencer is working in");
/* Nestled Data */
/* *** Non-Animated *** */
RNA_define_animate_sdna(false);
rna_def_tool_settings(brna);
rna_def_unified_paint_settings(brna);
rna_def_unit_settings(brna);
rna_def_scene_image_format_data(brna);
rna_def_scene_render_data(brna);
rna_def_scene_game_data(brna);
rna_def_scene_render_layer(brna);
rna_def_transform_orientation(brna);
rna_def_selected_uv_element(brna);
RNA_define_animate_sdna(true);
/* *** Animated *** */
rna_def_scene_render_data(brna);
rna_def_scene_render_layer(brna);
/* Scene API */
RNA_api_scene(srna);

View File

@@ -676,12 +676,15 @@ static void rna_def_particle_edit(BlenderRNA *brna)
void RNA_def_sculpt_paint(BlenderRNA *brna)
{
/* *** Non-Animated *** */
RNA_define_animate_sdna(false);
rna_def_paint(brna);
rna_def_sculpt(brna);
rna_def_uv_sculpt(brna);
rna_def_vertex_paint(brna);
rna_def_image_paint(brna);
rna_def_particle_edit(brna);
RNA_define_animate_sdna(true);
}
#endif