diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-01-12 06:02:53 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-01-12 06:02:53 +0400 |
commit | 94ae0232b0337ab70cecaef03cd845887cd36eaa (patch) | |
tree | caea2819c7fe0400fb91c9bdf0e99a9e0fd50cf6 /source/blender/makesrna | |
parent | 9a109c22ae1ef8a5c75932d661610b23ec685bd7 (diff) | |
parent | f68e9db583489d541d535791536ea20bc1ae1d76 (diff) |
Merged changes in the trunk up to revision 53729.
Conflicts resolved:
release/datafiles/startup.blend
source/blender/blenloader/intern/readfile.c
Diffstat (limited to 'source/blender/makesrna')
24 files changed, 687 insertions, 169 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 8956e9d9005..af182c467be 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -610,6 +610,7 @@ extern StructRNA RNA_ThemeOutliner; extern StructRNA RNA_ThemeProperties; extern StructRNA RNA_ThemeSequenceEditor; extern StructRNA RNA_ThemeSpaceGeneric; +extern StructRNA RNA_ThemeSpaceGradient; extern StructRNA RNA_ThemeSpaceListGeneric; extern StructRNA RNA_ThemeStyle; extern StructRNA RNA_ThemeTextEditor; diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 9939d0839e6..463e0e04679 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -49,6 +49,7 @@ void RNA_exit(void); /* Struct */ +StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRNA *srnafrom); StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from); void RNA_def_struct_sdna(StructRNA *srna, const char *structname); void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const char *propname); @@ -91,7 +92,6 @@ PropertyRNA *RNA_def_string_translate(StructOrFunctionRNA *cont, const char *ide PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description); PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description); void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc); -void RNA_def_enum_py_data(PropertyRNA *prop, void *py_data); PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax); PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax); @@ -177,6 +177,17 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con void RNA_def_property_srna(PropertyRNA *prop, const char *type); void RNA_def_py_data(PropertyRNA *prop, void *py_data); +void RNA_def_property_boolean_funcs_runtime(PropertyRNA *prop, BooleanPropertyGetFunc getfunc, BooleanPropertySetFunc setfunc); +void RNA_def_property_boolean_array_funcs_runtime(PropertyRNA *prop, BooleanArrayPropertyGetFunc getfunc, BooleanArrayPropertySetFunc setfunc); +void RNA_def_property_int_funcs_runtime(PropertyRNA *prop, IntPropertyGetFunc getfunc, IntPropertySetFunc setfunc, IntPropertyRangeFunc rangefunc); +void RNA_def_property_int_array_funcs_runtime(PropertyRNA *prop, IntArrayPropertyGetFunc getfunc, IntArrayPropertySetFunc setfunc, IntPropertyRangeFunc rangefunc); +void RNA_def_property_float_funcs_runtime(PropertyRNA *prop, FloatPropertyGetFunc getfunc, FloatPropertySetFunc setfunc, FloatPropertyRangeFunc rangefunc); +void RNA_def_property_float_array_funcs_runtime(PropertyRNA *prop, FloatArrayPropertyGetFunc getfunc, FloatArrayPropertySetFunc setfunc, FloatPropertyRangeFunc rangefunc); +void RNA_def_property_enum_funcs_runtime(PropertyRNA *prop, EnumPropertyGetFunc getfunc, EnumPropertySetFunc setfunc, EnumPropertyItemFunc itemfunc); +void RNA_def_property_string_funcs_runtime(PropertyRNA *prop, StringPropertyGetFunc getfunc, StringPropertyLengthFunc lengthfunc, StringPropertySetFunc setfunc); + +void RNA_def_property_enum_py_data(PropertyRNA *prop, void *py_data); + void RNA_def_property_translation_context(PropertyRNA *prop, const char *context); /* Function */ diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index dacb2fee212..c76f9824c73 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -269,7 +269,27 @@ typedef struct EnumPropertyItem { const char *description; } EnumPropertyItem; -/* this is a copy of 'PropEnumItemFunc' defined in rna_internal_types.h */ +/* extended versions with PropertyRNA argument */ +typedef int (*BooleanPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); +typedef void (*BooleanPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); +typedef void (*BooleanArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values); +typedef void (*BooleanArrayPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values); +typedef int (*IntPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); +typedef void (*IntPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); +typedef void (*IntArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values); +typedef void (*IntArrayPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values); +typedef void (*IntPropertyRangeFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *min, int *max, int *softmin, int *softmax); +typedef float (*FloatPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); +typedef void (*FloatPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, float value); +typedef void (*FloatArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, float *values); +typedef void (*FloatArrayPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const float *values); +typedef void (*FloatPropertyRangeFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, float *min, float *max, float *softmin, float *softmax); +typedef void (*StringPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, char *value); +typedef int (*StringPropertyLengthFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); +typedef void (*StringPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const char *value); +typedef int (*EnumPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); +typedef void (*EnumPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); +/* same as PropEnumItemFunc */ typedef EnumPropertyItem *(*EnumPropertyItemFunc)(struct bContext *C, PointerRNA *ptr, struct PropertyRNA *prop, int *free); typedef struct PropertyRNA PropertyRNA; diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index a9cb6cdf77e..0992153560f 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -2947,11 +2947,15 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr case PROP_BOOLEAN: { BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; - fprintf(f, "\t%s, %s, %s, %s, %d, ", + fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, %d, ", rna_function_string(bprop->get), rna_function_string(bprop->set), rna_function_string(bprop->getarray), rna_function_string(bprop->setarray), + rna_function_string(bprop->get_ex), + rna_function_string(bprop->set_ex), + rna_function_string(bprop->getarray_ex), + rna_function_string(bprop->setarray_ex), bprop->defaultvalue); if (prop->arraydimension && prop->totarraylength) fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier); @@ -2961,12 +2965,17 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr case PROP_INT: { IntPropertyRNA *iprop = (IntPropertyRNA *)prop; - fprintf(f, "\t%s, %s, %s, %s, %s,\n\t", + fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,\n\t", rna_function_string(iprop->get), rna_function_string(iprop->set), rna_function_string(iprop->getarray), rna_function_string(iprop->setarray), - rna_function_string(iprop->range)); + rna_function_string(iprop->range), + rna_function_string(iprop->get_ex), + rna_function_string(iprop->set_ex), + rna_function_string(iprop->getarray_ex), + rna_function_string(iprop->setarray_ex), + rna_function_string(iprop->range_ex)); rna_int_print(f, iprop->softmin); fprintf(f, ", "); rna_int_print(f, iprop->softmax); fprintf(f, ", "); rna_int_print(f, iprop->hardmin); fprintf(f, ", "); @@ -2981,12 +2990,17 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr case PROP_FLOAT: { FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; - fprintf(f, "\t%s, %s, %s, %s, %s, ", + fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, ", rna_function_string(fprop->get), rna_function_string(fprop->set), rna_function_string(fprop->getarray), rna_function_string(fprop->setarray), - rna_function_string(fprop->range)); + rna_function_string(fprop->range), + rna_function_string(fprop->get_ex), + rna_function_string(fprop->set_ex), + rna_function_string(fprop->getarray_ex), + rna_function_string(fprop->setarray_ex), + rna_function_string(fprop->range_ex)); rna_float_print(f, fprop->softmin); fprintf(f, ", "); rna_float_print(f, fprop->softmax); fprintf(f, ", "); rna_float_print(f, fprop->hardmin); fprintf(f, ", "); @@ -3002,10 +3016,13 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr case PROP_STRING: { StringPropertyRNA *sprop = (StringPropertyRNA *)prop; - fprintf(f, "\t%s, %s, %s, %d, ", + fprintf(f, "\t%s, %s, %s, %s, %s, %s, %d, ", rna_function_string(sprop->get), rna_function_string(sprop->length), rna_function_string(sprop->set), + rna_function_string(sprop->get_ex), + rna_function_string(sprop->length_ex), + rna_function_string(sprop->set_ex), sprop->maxlength); rna_print_c_string(f, sprop->defaultvalue); fprintf(f, "\n"); break; @@ -3013,10 +3030,12 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr case PROP_ENUM: { EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop; - fprintf(f, "\t%s, %s, %s, NULL, ", + fprintf(f, "\t%s, %s, %s, %s, %s, NULL, ", rna_function_string(eprop->get), rna_function_string(eprop->set), - rna_function_string(eprop->itemf)); + rna_function_string(eprop->itemf), + rna_function_string(eprop->get_ex), + rna_function_string(eprop->set_ex)); if (eprop->item) fprintf(f, "rna_%s%s_%s_items, ", srna->identifier, strnest, prop->identifier); else diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 092c9eb2b17..18281d4d251 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -257,7 +257,7 @@ StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain), ReportList *reports, return NULL; } - return RNA_def_struct(&BLENDER_RNA, identifier, "PropertyGroup"); /* XXX */ + return RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_PropertyGroup); /* XXX */ } StructRNA *rna_PropertyGroup_refine(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 0048e1c60c2..59bcb1506af 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -40,6 +40,7 @@ #include "BLI_utildefines.h" #include "BLI_dynstr.h" #include "BLI_ghash.h" +#include "BLI_math.h" #include "BLF_api.h" #include "BLF_translation.h" @@ -937,6 +938,12 @@ void RNA_property_int_range(PointerRNA *ptr, PropertyRNA *prop, int *hardmin, in iprop->range(ptr, hardmin, hardmax, &softmin, &softmax); } + else if (iprop->range_ex) { + *hardmin = INT_MIN; + *hardmax = INT_MAX; + + iprop->range_ex(ptr, prop, hardmin, hardmax, &softmin, &softmax); + } else { *hardmin = iprop->hardmin; *hardmax = iprop->hardmax; @@ -977,8 +984,17 @@ void RNA_property_int_ui_range(PointerRNA *ptr, PropertyRNA *prop, int *softmin, iprop->range(ptr, &hardmin, &hardmax, softmin, softmax); - *softmin = MAX2(*softmin, hardmin); - *softmax = MIN2(*softmax, hardmax); + *softmin = max_ii(*softmin, hardmin); + *softmax = min_ii(*softmax, hardmax); + } + else if (iprop->range_ex) { + hardmin = INT_MIN; + hardmax = INT_MAX; + + iprop->range_ex(ptr, prop, &hardmin, &hardmax, softmin, softmax); + + *softmin = max_ii(*softmin, hardmin); + *softmax = min_ii(*softmax, hardmax); } *step = iprop->step; @@ -1012,6 +1028,12 @@ void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin fprop->range(ptr, hardmin, hardmax, &softmin, &softmax); } + else if (fprop->range_ex) { + *hardmin = -FLT_MAX; + *hardmax = FLT_MAX; + + fprop->range_ex(ptr, prop, hardmin, hardmax, &softmin, &softmax); + } else { *hardmin = fprop->hardmin; *hardmax = fprop->hardmax; @@ -1056,8 +1078,17 @@ void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *soft fprop->range(ptr, &hardmin, &hardmax, softmin, softmax); - *softmin = MAX2(*softmin, hardmin); - *softmax = MIN2(*softmax, hardmax); + *softmin = max_ff(*softmin, hardmin); + *softmax = min_ff(*softmax, hardmax); + } + else if (fprop->range_ex) { + hardmin = -FLT_MAX; + hardmax = FLT_MAX; + + fprop->range_ex(ptr, prop, &hardmin, &hardmax, softmin, softmax); + + *softmin = max_ff(*softmin, hardmin); + *softmax = min_ff(*softmax, hardmax); } *step = fprop->step; @@ -1645,6 +1676,8 @@ int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop) return IDP_Int(idprop); else if (bprop->get) return bprop->get(ptr); + else if (bprop->get_ex) + return bprop->get_ex(ptr, prop); else return bprop->defaultvalue; } @@ -1667,6 +1700,9 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) else if (bprop->set) { bprop->set(ptr, value); } + else if (bprop->set_ex) { + bprop->set_ex(ptr, prop, value); + } else if (prop->flag & PROP_EDITABLE) { IDPropertyTemplate val = {0}; IDProperty *group; @@ -1697,6 +1733,8 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val values[0] = RNA_property_boolean_get(ptr, prop); else if (bprop->getarray) bprop->getarray(ptr, values); + else if (bprop->getarray_ex) + bprop->getarray_ex(ptr, prop, values); else if (bprop->defaultarray) memcpy(values, bprop->defaultarray, sizeof(int) * prop->totarraylength); else @@ -1747,6 +1785,8 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in RNA_property_boolean_set(ptr, prop, values[0]); else if (bprop->setarray) bprop->setarray(ptr, values); + else if (bprop->setarray_ex) + bprop->setarray_ex(ptr, prop, values); else if (prop->flag & PROP_EDITABLE) { IDPropertyTemplate val = {0}; IDProperty *group; @@ -1848,6 +1888,8 @@ int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop) return IDP_Int(idprop); else if (iprop->get) return iprop->get(ptr); + else if (iprop->get_ex) + return iprop->get_ex(ptr, prop); else return iprop->defaultvalue; } @@ -1868,6 +1910,8 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value) } else if (iprop->set) iprop->set(ptr, value); + else if (iprop->set_ex) + iprop->set_ex(ptr, prop, value); else if (prop->flag & PROP_EDITABLE) { IDPropertyTemplate val = {0}; IDProperty *group; @@ -1900,6 +1944,8 @@ void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values) values[0] = RNA_property_int_get(ptr, prop); else if (iprop->getarray) iprop->getarray(ptr, values); + else if (iprop->getarray_ex) + iprop->getarray_ex(ptr, prop, values); else if (iprop->defaultarray) memcpy(values, iprop->defaultarray, sizeof(int) * prop->totarraylength); else @@ -1987,6 +2033,8 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v RNA_property_int_set(ptr, prop, values[0]); else if (iprop->setarray) iprop->setarray(ptr, values); + else if (iprop->setarray_ex) + iprop->setarray_ex(ptr, prop, values); else if (prop->flag & PROP_EDITABLE) { IDPropertyTemplate val = {0}; IDProperty *group; @@ -2087,6 +2135,8 @@ float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop) } else if (fprop->get) return fprop->get(ptr); + else if (fprop->get_ex) + return fprop->get_ex(ptr, prop); else return fprop->defaultvalue; } @@ -2112,6 +2162,9 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value) else if (fprop->set) { fprop->set(ptr, value); } + else if (fprop->set_ex) { + fprop->set_ex(ptr, prop, value); + } else if (prop->flag & PROP_EDITABLE) { IDPropertyTemplate val = {0}; IDProperty *group; @@ -2150,6 +2203,8 @@ void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *val values[0] = RNA_property_float_get(ptr, prop); else if (fprop->getarray) fprop->getarray(ptr, values); + else if (fprop->getarray_ex) + fprop->getarray_ex(ptr, prop, values); else if (fprop->defaultarray) memcpy(values, fprop->defaultarray, sizeof(float) * prop->totarraylength); else @@ -2249,6 +2304,9 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa else if (fprop->setarray) { fprop->setarray(ptr, values); } + else if (fprop->setarray_ex) { + fprop->setarray_ex(ptr, prop, values); + } else if (prop->flag & PROP_EDITABLE) { IDPropertyTemplate val = {0}; IDProperty *group; @@ -2361,6 +2419,9 @@ void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value) else if (sprop->get) { sprop->get(ptr, value); } + else if (sprop->get_ex) { + sprop->get_ex(ptr, prop, value); + } else { strcpy(value, sprop->defaultvalue); } @@ -2421,6 +2482,8 @@ int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop) } else if (sprop->length) return sprop->length(ptr); + else if (sprop->length_ex) + return sprop->length_ex(ptr, prop); else return strlen(sprop->defaultvalue); } @@ -2439,6 +2502,8 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val } else if (sprop->set) sprop->set(ptr, value); /* set function needs to clamp its self */ + else if (sprop->set_ex) + sprop->set_ex(ptr, prop, value); /* set function needs to clamp its self */ else if (prop->flag & PROP_EDITABLE) { IDProperty *group; @@ -2497,6 +2562,8 @@ int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop) return IDP_Int(idprop); else if (eprop->get) return eprop->get(ptr); + else if (eprop->get_ex) + return eprop->get_ex(ptr, prop); else return eprop->defaultvalue; } @@ -2515,6 +2582,9 @@ void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value) else if (eprop->set) { eprop->set(ptr, value); } + else if (eprop->set_ex) { + eprop->set_ex(ptr, prop, value); + } else if (prop->flag & PROP_EDITABLE) { IDPropertyTemplate val = {0}; IDProperty *group; @@ -4034,8 +4104,9 @@ static char *rna_idp_path(PointerRNA *ptr, IDProperty *haystack, IDProperty *nee else { if (iter->type == IDP_GROUP) { /* ensure this is RNA */ - PointerRNA child_ptr = RNA_pointer_get(ptr, iter->name); - if (child_ptr.type) { + PropertyRNA *prop = RNA_struct_find_property(ptr, iter->name); + if (prop && prop->type == PROP_POINTER) { + PointerRNA child_ptr = RNA_property_pointer_get(ptr, prop); link.name = iter->name; link.index = -1; if ((path = rna_idp_path(&child_ptr, iter, needle, &link))) { diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 402d05a20b6..d6ea53f6ab3 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -198,6 +198,8 @@ static void rna_KeyingSetInfo_unregister(Main *bmain, StructRNA *type) RNA_struct_free_extension(type, &ksi->ext); RNA_struct_free(&BLENDER_RNA, type); + WM_main_add_notifier(NC_WINDOW, NULL); + /* unlink Blender-side data */ ANIM_keyingset_info_unregister(bmain, ksi); } @@ -234,7 +236,7 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, v memcpy(ksi, &dummyksi, sizeof(KeyingSetInfo)); /* set RNA-extensions info */ - ksi->ext.srna = RNA_def_struct(&BLENDER_RNA, ksi->idname, "KeyingSetInfo"); + ksi->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, ksi->idname, &RNA_KeyingSetInfo); ksi->ext.data = data; ksi->ext.call = call; ksi->ext.free = free; @@ -249,6 +251,8 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, v /* add and register with other info as needed */ ANIM_keyingset_info_register(ksi); + WM_main_add_notifier(NC_WINDOW, NULL); + /* return the struct-rna added */ return ksi->ext.srna; } @@ -577,7 +581,7 @@ static void rna_def_keyingset_info(BlenderRNA *brna) RNA_def_struct_name_property(srna, prop); RNA_def_property_flag(prop, PROP_REGISTER); - prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE); + prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "description"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); @@ -777,7 +781,7 @@ static void rna_def_keyingset(BlenderRNA *brna) RNA_def_struct_name_property(srna, prop); RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_RENAME, NULL); - prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE); + prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "description"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 36d5a575ab4..bc4194ebffb 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -462,7 +462,7 @@ static void rna_ColorManagedViewSettings_view_transform_set(PointerRNA *ptr, int } } -static EnumPropertyItem* rna_ColorManagedViewSettings_view_transform_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_ColorManagedViewSettings_view_transform_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) { Scene *scene = CTX_data_scene(C); EnumPropertyItem *items = NULL; diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 727b1e44931..b94d7eb691f 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -623,13 +623,12 @@ static StructDefRNA *rna_find_def_struct(StructRNA *srna) } /* Struct Definition */ - -StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from) +StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRNA *srnafrom) { - StructRNA *srna, *srnafrom = NULL; + StructRNA *srna; StructDefRNA *ds = NULL, *dsfrom = NULL; PropertyRNA *prop; - + if (DefRNA.preprocess) { char error[512]; @@ -638,18 +637,6 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * DefRNA.error = 1; } } - - if (from) { - /* find struct to derive from */ - for (srnafrom = brna->structs.first; srnafrom; srnafrom = srnafrom->cont.next) - if (strcmp(srnafrom->identifier, from) == 0) - break; - - if (!srnafrom) { - fprintf(stderr, "%s: struct %s not found to define %s.\n", __func__, from, identifier); - DefRNA.error = 1; - } - } srna = MEM_callocN(sizeof(StructRNA), "StructRNA"); DefRNA.laststruct = srna; @@ -670,7 +657,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * else srna->base = srnafrom; } - + srna->identifier = identifier; srna->name = identifier; /* may be overwritten later RNA_def_struct_ui_text */ srna->description = ""; @@ -741,6 +728,28 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * return srna; } +StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from) +{ + StructRNA *srnafrom = NULL; + + /* only use RNA_def_struct() while pre-processing, otherwise use RNA_def_struct_ptr() */ + BLI_assert(DefRNA.preprocess); + + if (from) { + /* find struct to derive from */ + for (srnafrom = brna->structs.first; srnafrom; srnafrom = srnafrom->cont.next) + if (strcmp(srnafrom->identifier, from) == 0) + break; + + if (!srnafrom) { + fprintf(stderr, "%s: struct %s not found to define %s.\n", __func__, from, identifier); + DefRNA.error = 1; + } + } + + return RNA_def_struct_ptr(brna, identifier, srnafrom); +} + void RNA_def_struct_sdna(StructRNA *srna, const char *structname) { StructDefRNA *ds; @@ -2017,6 +2026,38 @@ void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const ch } } +void RNA_def_property_boolean_funcs_runtime(PropertyRNA *prop, BooleanPropertyGetFunc getfunc, BooleanPropertySetFunc setfunc) +{ + BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; + + if (getfunc) bprop->get_ex = getfunc; + if (setfunc) bprop->set_ex = setfunc; + + if (getfunc || setfunc) { + /* don't save in id properties */ + prop->flag &= ~PROP_IDPROPERTY; + + if (!setfunc) + prop->flag &= ~PROP_EDITABLE; + } +} + +void RNA_def_property_boolean_array_funcs_runtime(PropertyRNA *prop, BooleanArrayPropertyGetFunc getfunc, BooleanArrayPropertySetFunc setfunc) +{ + BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; + + if (getfunc) bprop->getarray_ex = getfunc; + if (setfunc) bprop->setarray_ex = setfunc; + + if (getfunc || setfunc) { + /* don't save in id properties */ + prop->flag &= ~PROP_IDPROPERTY; + + if (!setfunc) + prop->flag &= ~PROP_EDITABLE; + } +} + void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range) { StructRNA *srna = DefRNA.laststruct; @@ -2049,6 +2090,38 @@ void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char * } } +void RNA_def_property_int_funcs_runtime(PropertyRNA *prop, IntPropertyGetFunc getfunc, IntPropertySetFunc setfunc, IntPropertyRangeFunc rangefunc) +{ + IntPropertyRNA *iprop = (IntPropertyRNA *)prop; + + if (getfunc) iprop->get_ex = getfunc; + if (setfunc) iprop->set_ex = setfunc; + + if (getfunc || setfunc) { + /* don't save in id properties */ + prop->flag &= ~PROP_IDPROPERTY; + + if (!setfunc) + prop->flag &= ~PROP_EDITABLE; + } +} + +void RNA_def_property_int_array_funcs_runtime(PropertyRNA *prop, IntArrayPropertyGetFunc getfunc, IntArrayPropertySetFunc setfunc, IntPropertyRangeFunc rangefunc) +{ + IntPropertyRNA *iprop = (IntPropertyRNA *)prop; + + if (getfunc) iprop->getarray_ex = getfunc; + if (setfunc) iprop->setarray_ex = setfunc; + + if (getfunc || setfunc) { + /* don't save in id properties */ + prop->flag &= ~PROP_IDPROPERTY; + + if (!setfunc) + prop->flag &= ~PROP_EDITABLE; + } +} + void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range) { StructRNA *srna = DefRNA.laststruct; @@ -2081,6 +2154,40 @@ void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char } } +void RNA_def_property_float_funcs_runtime(PropertyRNA *prop, FloatPropertyGetFunc getfunc, FloatPropertySetFunc setfunc, FloatPropertyRangeFunc rangefunc) +{ + FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; + + if (getfunc) fprop->get_ex = getfunc; + if (setfunc) fprop->set_ex = setfunc; + if (rangefunc) fprop->range_ex = rangefunc; + + if (getfunc || setfunc) { + /* don't save in id properties */ + prop->flag &= ~PROP_IDPROPERTY; + + if (!setfunc) + prop->flag &= ~PROP_EDITABLE; + } +} + +void RNA_def_property_float_array_funcs_runtime(PropertyRNA *prop, FloatArrayPropertyGetFunc getfunc, FloatArrayPropertySetFunc setfunc, FloatPropertyRangeFunc rangefunc) +{ + FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; + + if (getfunc) fprop->getarray_ex = getfunc; + if (setfunc) fprop->setarray_ex = setfunc; + if (rangefunc) fprop->range_ex = rangefunc; + + if (getfunc || setfunc) { + /* don't save in id properties */ + prop->flag &= ~PROP_IDPROPERTY; + + if (!setfunc) + prop->flag &= ~PROP_EDITABLE; + } +} + void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item) { StructRNA *srna = DefRNA.laststruct; @@ -2107,6 +2214,29 @@ void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char } } +void RNA_def_property_enum_funcs_runtime(PropertyRNA *prop, EnumPropertyGetFunc getfunc, EnumPropertySetFunc setfunc, EnumPropertyItemFunc itemfunc) +{ + EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop; + + if (getfunc) eprop->get_ex = getfunc; + if (setfunc) eprop->set_ex = setfunc; + if (itemfunc) eprop->itemf = itemfunc; + + if (getfunc || setfunc) { + /* don't save in id properties */ + prop->flag &= ~PROP_IDPROPERTY; + + if (!setfunc) + prop->flag &= ~PROP_EDITABLE; + } +} + +void RNA_def_property_enum_py_data(PropertyRNA *prop, void *py_data) +{ + EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop; + eprop->py_data = py_data; +} + void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set) { StructRNA *srna = DefRNA.laststruct; @@ -2133,6 +2263,23 @@ void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const cha } } +void RNA_def_property_string_funcs_runtime(PropertyRNA *prop, StringPropertyGetFunc getfunc, StringPropertyLengthFunc lengthfunc, StringPropertySetFunc setfunc) +{ + StringPropertyRNA *sprop = (StringPropertyRNA *)prop; + + if (getfunc) sprop->get_ex = getfunc; + if (lengthfunc) sprop->length_ex = lengthfunc; + if (setfunc) sprop->set_ex = setfunc; + + if (getfunc || setfunc) { + /* don't save in id properties */ + prop->flag &= ~PROP_IDPROPERTY; + + if (!setfunc) + prop->flag &= ~PROP_EDITABLE; + } +} + void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *typef, const char *poll) { @@ -2447,12 +2594,6 @@ void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc) eprop->itemf = itemfunc; } -void RNA_def_enum_py_data(PropertyRNA *prop, void *py_data) -{ - EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop; - eprop->py_data = py_data; -} - PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax) diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index ccfb83b61e3..43ec09de010 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -30,6 +30,8 @@ #include "DNA_listBase.h" +#include "RNA_types.h" + struct BlenderRNA; struct ContainerRNA; struct StructRNA; @@ -64,7 +66,7 @@ typedef void (*ContextPropUpdateFunc)(struct bContext *C, struct PointerRNA *ptr typedef void (*ContextUpdateFunc)(struct bContext *C, struct PointerRNA *ptr); typedef int (*EditableFunc)(struct PointerRNA *ptr); typedef int (*ItemEditableFunc)(struct PointerRNA *ptr, int index); -typedef struct IDProperty* (*IDPropertiesFunc)(struct PointerRNA *ptr, int create); +typedef struct IDProperty *(*IDPropertiesFunc)(struct PointerRNA *ptr, int create); typedef struct StructRNA *(*StructRefineFunc)(struct PointerRNA *ptr); typedef char *(*StructPathFunc)(struct PointerRNA *ptr); @@ -91,7 +93,7 @@ typedef void (*PropEnumSetFunc)(struct PointerRNA *ptr, int value); typedef EnumPropertyItem *(*PropEnumItemFunc)(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free); typedef PointerRNA (*PropPointerGetFunc)(struct PointerRNA *ptr); -typedef StructRNA* (*PropPointerTypeFunc)(struct PointerRNA *ptr); +typedef StructRNA *(*PropPointerTypeFunc)(struct PointerRNA *ptr); typedef void (*PropPointerSetFunc)(struct PointerRNA *ptr, const PointerRNA value); typedef int (*PropPointerPollFunc)(struct PointerRNA *ptr, const PointerRNA value); typedef void (*PropCollectionBeginFunc)(struct CollectionPropertyIterator *iter, struct PointerRNA *ptr); @@ -103,6 +105,27 @@ typedef int (*PropCollectionLookupIntFunc)(struct PointerRNA *ptr, int key, stru typedef int (*PropCollectionLookupStringFunc)(struct PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr); typedef int (*PropCollectionAssignIntFunc)(struct PointerRNA *ptr, int key, const struct PointerRNA *assign_ptr); +/* extended versions with PropertyRNA argument */ +typedef int (*PropBooleanGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop); +typedef void (*PropBooleanSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); +typedef void (*PropBooleanArrayGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values); +typedef void (*PropBooleanArraySetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values); +typedef int (*PropIntGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop); +typedef void (*PropIntSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); +typedef void (*PropIntArrayGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values); +typedef void (*PropIntArraySetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values); +typedef void (*PropIntRangeFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *min, int *max, int *softmin, int *softmax); +typedef float (*PropFloatGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop); +typedef void (*PropFloatSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, float value); +typedef void (*PropFloatArrayGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, float *values); +typedef void (*PropFloatArraySetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, const float *values); +typedef void (*PropFloatRangeFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, float *min, float *max, float *softmin, float *softmax); +typedef void (*PropStringGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, char *value); +typedef int (*PropStringLengthFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop); +typedef void (*PropStringSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, const char *value); +typedef int (*PropEnumGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop); +typedef void (*PropEnumSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); + /* Container - generic abstracted container of RNA properties */ typedef struct ContainerRNA { void *next, *prev; @@ -193,10 +216,14 @@ typedef struct BoolPropertyRNA { PropBooleanGetFunc get; PropBooleanSetFunc set; - PropBooleanArrayGetFunc getarray; PropBooleanArraySetFunc setarray; + PropBooleanGetFuncEx get_ex; + PropBooleanSetFuncEx set_ex; + PropBooleanArrayGetFuncEx getarray_ex; + PropBooleanArraySetFuncEx setarray_ex; + int defaultvalue; const int *defaultarray; } BoolPropertyRNA; @@ -206,12 +233,16 @@ typedef struct IntPropertyRNA { PropIntGetFunc get; PropIntSetFunc set; - PropIntArrayGetFunc getarray; PropIntArraySetFunc setarray; - PropIntRangeFunc range; + PropIntGetFuncEx get_ex; + PropIntSetFuncEx set_ex; + PropIntArrayGetFuncEx getarray_ex; + PropIntArraySetFuncEx setarray_ex; + PropIntRangeFuncEx range_ex; + int softmin, softmax; int hardmin, hardmax; int step; @@ -225,12 +256,16 @@ typedef struct FloatPropertyRNA { PropFloatGetFunc get; PropFloatSetFunc set; - PropFloatArrayGetFunc getarray; PropFloatArraySetFunc setarray; - PropFloatRangeFunc range; + PropFloatGetFuncEx get_ex; + PropFloatSetFuncEx set_ex; + PropFloatArrayGetFuncEx getarray_ex; + PropFloatArraySetFuncEx setarray_ex; + PropFloatRangeFuncEx range_ex; + float softmin, softmax; float hardmin, hardmax; float step; @@ -247,6 +282,10 @@ typedef struct StringPropertyRNA { PropStringLengthFunc length; PropStringSetFunc set; + PropStringGetFuncEx get_ex; + PropStringLengthFuncEx length_ex; + PropStringSetFuncEx set_ex; + int maxlength; /* includes string terminator! */ const char *defaultvalue; @@ -258,6 +297,9 @@ typedef struct EnumPropertyRNA { PropEnumGetFunc get; PropEnumSetFunc set; PropEnumItemFunc itemf; + + PropEnumGetFuncEx get_ex; + PropEnumSetFuncEx set_ex; void *py_data; /* store py callback here */ EnumPropertyItem *item; diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 31e27ebc982..8c8b7b4f637 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1233,6 +1233,26 @@ static char *rna_MeshStringProperty_path(PointerRNA *ptr) return rna_PolyCustomData_data_path(ptr, "layers_string", CD_PROP_STR); } +/* XXX, we dont have propper byte string support yet, so for now use the (bytes + 1) + * bmesh API exposes correct python/bytestring access */ +void rna_MeshStringProperty_s_get(PointerRNA *ptr, char *value) +{ + MStringProperty *ms = (MStringProperty *)ptr->data; + BLI_strncpy(value, ms->s, (int)ms->s_len + 1); +} + +int rna_MeshStringProperty_s_length(PointerRNA *ptr) +{ + MStringProperty *ms = (MStringProperty *)ptr->data; + return (int)ms->s_len + 1; +} + +void rna_MeshStringProperty_s_set(PointerRNA *ptr, const char *value) +{ + MStringProperty *ms = (MStringProperty *)ptr->data; + BLI_strncpy(ms->s, value, sizeof(ms->s)); +} + static int rna_Mesh_tot_vert_get(PointerRNA *ptr) { Mesh *me = rna_mesh(ptr); @@ -2182,6 +2202,7 @@ static void rna_def_mproperties(BlenderRNA *brna) /* low level mesh data access, treat as bytes */ prop = RNA_def_property(srna, "value", PROP_STRING, PROP_BYTESTRING); RNA_def_property_string_sdna(prop, NULL, "s"); + RNA_def_property_string_funcs(prop, "rna_MeshStringProperty_s_get", "rna_MeshStringProperty_s_length", "rna_MeshStringProperty_s_set"); RNA_def_property_ui_text(prop, "Value", ""); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); } @@ -3010,6 +3031,22 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_ui_icon(prop, ICON_VERTEXSEL, 0); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Mesh_update_vertmask"); + + + /* customdata flags */ + prop = RNA_def_property(srna, "use_customdata_vertex_bevel", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cd_flag", ME_CDFLAG_VERT_BWEIGHT); + RNA_def_property_ui_text(prop, "Store Vertex Bevel Weight", ""); + + prop = RNA_def_property(srna, "use_customdata_edge_bevel", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cd_flag", ME_CDFLAG_EDGE_BWEIGHT); + RNA_def_property_ui_text(prop, "Store Edge Bevel Weight", ""); + + prop = RNA_def_property(srna, "use_customdata_edge_crease", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cd_flag", ME_CDFLAG_EDGE_CREASE); + RNA_def_property_ui_text(prop, "Store Edge Crease", ""); + + /* readonly editmesh info - use for extrude menu */ prop = RNA_def_property(srna, "total_vert_sel", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_funcs(prop, "rna_Mesh_tot_vert_get", NULL, NULL); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 18dfd8aa6f9..eecdf13813c 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -288,6 +288,47 @@ static const char *rna_Node_get_node_type(StructRNA *type) return ""; } +static void rna_Node_parent_set(PointerRNA *ptr, PointerRNA value) +{ + bNode *node = ptr->data; + bNode *parent = value.data; + + if (parent) { + /* XXX only Frame node allowed for now, + * in the future should have a poll function or so to test possible attachment. + */ + if (parent->type != NODE_FRAME) + return; + + /* make sure parent is not attached to the node */ + if (nodeAttachNodeCheck(parent, node)) + return; + } + + nodeDetachNode(node); + if (parent) { + nodeAttachNode(node, parent); + } +} + +static int rna_Node_parent_poll(PointerRNA *ptr, PointerRNA value) +{ + bNode *node = ptr->data; + bNode *parent = value.data; + + /* XXX only Frame node allowed for now, + * in the future should have a poll function or so to test possible attachment. + */ + if (parent->type != NODE_FRAME) + return FALSE; + + /* make sure parent is not attached to the node */ + if (nodeAttachNodeCheck(parent, node)) + return FALSE; + + return TRUE; +} + static StructRNA *rna_NodeSocket_refine(PointerRNA *ptr) { bNodeSocket *sock = (bNodeSocket *)ptr->data; @@ -2480,7 +2521,7 @@ static void def_cmp_dilate_erode(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem type_items[] = { + static EnumPropertyItem mode_items[] = { {CMP_NODE_DILATEERODE_STEP, "STEP", 0, "Step", ""}, {CMP_NODE_DILATEERODE_DISTANCE_THRESH, "THRESHOLD", 0, "Threshold", ""}, {CMP_NODE_DILATEERODE_DISTANCE, "DISTANCE", 0, "Distance", ""}, @@ -2488,10 +2529,10 @@ static void def_cmp_dilate_erode(StructRNA *srna) {0, NULL, 0, NULL, NULL} }; - prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "custom1"); - RNA_def_property_enum_items(prop, type_items); - RNA_def_property_ui_text(prop, "Distance", "Distance to grow/shrink (number of iterations)"); + RNA_def_property_enum_items(prop, mode_items); + RNA_def_property_ui_text(prop, "Mode", "Growing/shrinking mode"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE); @@ -4689,8 +4730,9 @@ static void rna_def_node(BlenderRNA *brna) prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "parent"); + RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_parent_set", NULL, "rna_Node_parent_poll"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "Node"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Parent", "Parent this node is attached to"); prop = RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 80d74c3a9fe..a617c78019f 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -2469,6 +2469,15 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Slow Parent Offset", "Delay in the parent relationship"); RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update"); + /* depsgraph hack */ + prop = RNA_def_property(srna, "extra_recalc_object", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "depsflag", OB_DEPS_EXTRA_OB_RECALC); + RNA_def_property_ui_text(prop, "Extra Object Update", "Refresh this object again on frame changes, dependency graph hack"); + + prop = RNA_def_property(srna, "extra_recalc_data", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "depsflag", OB_DEPS_EXTRA_DATA_RECALC); + RNA_def_property_ui_text(prop, "Extra Data Update", "Refresh this object's data again on frame changes, dependency graph hack"); + /* duplicates */ prop = RNA_def_property(srna, "dupli_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag"); diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index d7115256fe5..40b8d4cce66 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -129,9 +129,6 @@ static Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int DerivedMesh *derivedFinal = NULL; int uv_from_orco; - int (*orco_index)[4] = NULL; - float (*orco)[3] = NULL; - /* copies object and modifiers (but not the data) */ tmpobj = BKE_object_copy_with_caches(ob); tmpcu = (Curve *)tmpobj->data; @@ -158,38 +155,12 @@ static Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int tmpobj->derivedFinal = derivedFinal; - uv_from_orco = (tmpcu->flag & CU_UV_ORCO) != 0; - - if (uv_from_orco) { - /* before curve conversion */ - orco = (float (*)[3])BKE_curve_make_orco(sce, tmpobj); - } - /* convert object type to mesh */ - BKE_mesh_from_nurbs_displist(tmpobj, &dispbase, uv_from_orco ? (int **)&orco_index : NULL); + uv_from_orco = (tmpcu->flag & CU_UV_ORCO) != 0; + BKE_mesh_from_nurbs_displist(tmpobj, &dispbase, uv_from_orco); tmpmesh = tmpobj->data; - if (uv_from_orco && orco && orco_index) { - const char *uvname = "Orco"; - /* add UV's */ - MTexPoly *mtpoly = CustomData_add_layer_named(&tmpmesh->pdata, CD_MTEXPOLY, CD_DEFAULT, NULL, tmpmesh->totpoly, uvname); - MLoopUV *mloopuvs = CustomData_add_layer_named(&tmpmesh->ldata, CD_MLOOPUV, CD_DEFAULT, NULL, tmpmesh->totloop, uvname); - - BKE_mesh_nurbs_to_mdata_orco(tmpmesh->mpoly, tmpmesh->totpoly, - tmpmesh->mloop, mloopuvs, - orco, orco_index); - - (void)mtpoly; - } - - if (orco_index) { - MEM_freeN(orco_index); - } - if (orco) { - MEM_freeN(orco); - } - BKE_displist_free(&dispbase); /* BKE_mesh_from_nurbs changes the type to a mesh, check it worked */ diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index be3cbfaece3..4a520cdc729 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -492,7 +492,7 @@ static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, P if (n_mcol && ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) { if (num != DMCACHE_NOTFOUND) { MFace *mface = modifier->dm->getTessFaceData(modifier->dm, num, CD_MFACE); - MCol *mc = (MCol*)CustomData_get_layer_n(&modifier->dm->faceData, CD_MCOL, vcol_no); + MCol *mc = (MCol *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MCOL, vcol_no); mc += num * 4; psys_interpolate_mcol(mc, mface->v4, particle->fuv, &mcol); @@ -517,7 +517,7 @@ static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, P if (n_mcol && ELEM(PART_FROM_FACE, PART_FROM_FACE, PART_FROM_VOLUME)) { if (cpa->num != DMCACHE_NOTFOUND) { MFace *mface = modifier->dm->getTessFaceData(modifier->dm, cpa->num, CD_MFACE); - MCol *mc = (MCol*)CustomData_get_layer_n(&modifier->dm->faceData, CD_MCOL, 0); + MCol *mc = (MCol *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MCOL, 0); mc += cpa->num * 4; psys_interpolate_mcol(mc, mface->v4, cpa->fuv, &mcol); @@ -543,7 +543,7 @@ static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, P if (n_mcol && ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) { if (num != DMCACHE_NOTFOUND) { MFace *mface = modifier->dm->getTessFaceData(modifier->dm, num, CD_MFACE); - MCol *mc = (MCol*)CustomData_get_layer_n(&modifier->dm->faceData, CD_MCOL, 0); + MCol *mc = (MCol *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MCOL, 0); mc += num * 4; psys_interpolate_mcol(mc, mface->v4, parent->fuv, &mcol); @@ -1545,9 +1545,9 @@ static void rna_def_fluid_settings(BlenderRNA *brna) /* Double density relaxation */ prop = RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "stiffness_k"); - RNA_def_property_range(prop, 0.0f, 100000.0f); + RNA_def_property_range(prop, 0.0f, 1000.0f); RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); - RNA_def_property_ui_text(prop, "Stiffness", "How incompressible the fluid is"); + RNA_def_property_ui_text(prop, "Stiffness", "How incompressible the fluid is (speed of sound)"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop = RNA_def_property(srna, "repulsion", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 93c5b45e642..5931440b422 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -196,7 +196,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo et = MEM_callocN(sizeof(RenderEngineType), "python render engine"); memcpy(et, &dummyet, sizeof(dummyet)); - et->ext.srna = RNA_def_struct(&BLENDER_RNA, et->idname, "RenderEngine"); + et->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, et->idname, &RNA_RenderEngine); et->ext.data = data; et->ext.call = call; et->ext.free = free; @@ -415,7 +415,7 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "type->idname"); RNA_def_property_flag(prop, PROP_REGISTER | PROP_NEVER_CLAMP); - prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); + prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->name"); RNA_def_property_flag(prop, PROP_REGISTER); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 8d99cecd9fa..f4059bc5846 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -278,9 +278,11 @@ EnumPropertyItem image_color_mode_items[] = { {0, NULL, 0, NULL, NULL} }; +#ifdef RNA_RUNTIME #define IMAGE_COLOR_MODE_BW image_color_mode_items[0] #define IMAGE_COLOR_MODE_RGB image_color_mode_items[1] #define IMAGE_COLOR_MODE_RGBA image_color_mode_items[2] +#endif EnumPropertyItem image_color_depth_items[] = { /* 1 (monochrome) not used */ diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 17edf2944aa..cc1895541df 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -222,7 +222,7 @@ static void rna_Sculpt_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNU if (ob->sculpt) { ob->sculpt->bm_smooth_shading = (scene->toolsettings->sculpt->flags & - SCULPT_DYNTOPO_SMOOTH_SHADING); + SCULPT_DYNTOPO_SMOOTH_SHADING); } } } diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index 69d35a3c2f0..386263c784e 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -82,14 +82,14 @@ static void rna_Sequence_swap_internal(Sequence *seq_self, ReportList *reports, BKE_report(reports, RPT_ERROR, error_msg); } -static Sequence *alloc_generic_sequence(Editing *ed, const char *name, int start_frame, +static Sequence *alloc_generic_sequence(Editing *ed, const char *name, int frame_start, int channel, int type, const char *file) { Sequence *seq; Strip *strip; StripElem *se; - seq = BKE_sequence_alloc(ed->seqbasep, start_frame, channel); + seq = BKE_sequence_alloc(ed->seqbasep, frame_start, channel); seq->type = type; BLI_strncpy(seq->name + 2, name, sizeof(seq->name) - 2); @@ -113,12 +113,12 @@ static Sequence *alloc_generic_sequence(Editing *ed, const char *name, int start static Sequence *rna_Sequences_new_clip(ID *id, Editing *ed, const char *name, MovieClip *clip, int channel, - int start_frame) + int frame_start) { Scene *scene = (Scene *)id; Sequence *seq; - seq = alloc_generic_sequence(ed, name, start_frame, channel, SEQ_TYPE_MOVIECLIP, clip->name); + seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MOVIECLIP, clip->name); seq->clip = clip; seq->len = BKE_movieclip_get_duration(clip); id_us_plus((ID *)clip); @@ -132,12 +132,12 @@ static Sequence *rna_Sequences_new_clip(ID *id, Editing *ed, static Sequence *rna_Sequences_new_mask(ID *id, Editing *ed, const char *name, Mask *mask, int channel, - int start_frame) + int frame_start) { Scene *scene = (Scene *)id; Sequence *seq; - seq = alloc_generic_sequence(ed, name, start_frame, channel, SEQ_TYPE_MASK, mask->id.name); + seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MASK, mask->id.name); seq->mask = mask; seq->len = BKE_mask_get_duration(mask); id_us_plus((ID *)mask); @@ -151,15 +151,15 @@ static Sequence *rna_Sequences_new_mask(ID *id, Editing *ed, static Sequence *rna_Sequences_new_scene(ID *id, Editing *ed, const char *name, Scene *sce_seq, int channel, - int start_frame) + int frame_start) { Scene *scene = (Scene *)id; Sequence *seq; - seq = alloc_generic_sequence(ed, name, start_frame, channel, SEQ_TYPE_SCENE, NULL); + seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_SCENE, NULL); seq->scene = sce_seq; seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1; - seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + seq->len, 0); + seq->scene_sound = sound_scene_add_scene_sound(scene, seq, frame_start, frame_start + seq->len, 0); id_us_plus((ID *)sce_seq); BKE_sequence_calc_disp(scene, seq); @@ -171,12 +171,12 @@ static Sequence *rna_Sequences_new_scene(ID *id, Editing *ed, static Sequence *rna_Sequences_new_image(ID *id, Editing *ed, ReportList *reports, const char *name, const char *file, int channel, - int start_frame) + int frame_start) { Scene *scene = (Scene *)id; Sequence *seq; - seq = alloc_generic_sequence(ed, name, start_frame, channel, SEQ_TYPE_IMAGE, file); + seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_IMAGE, file); seq->len = 1; if (seq->strip->stripdata->name[0] == '\0') { @@ -195,12 +195,11 @@ static Sequence *rna_Sequences_new_image(ID *id, Editing *ed, ReportList *report static Sequence *rna_Sequences_new_movie(ID *id, Editing *ed, ReportList *reports, const char *name, const char *file, int channel, - int start_frame) + int frame_start) { Scene *scene = (Scene *)id; Sequence *seq; - /* OCIO_TODO: support configurable color spaces for strips */ struct anim *an = openanim(file, IB_rect, 0, NULL); if (an == NULL) { @@ -208,7 +207,7 @@ static Sequence *rna_Sequences_new_movie(ID *id, Editing *ed, ReportList *report return NULL; } - seq = alloc_generic_sequence(ed, name, start_frame, channel, SEQ_TYPE_MOVIE, file); + seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MOVIE, file); seq->anim = an; seq->anim_preseek = IMB_anim_get_preseek(an); seq->len = IMB_anim_get_duration(an, IMB_TC_RECORD_RUN); @@ -222,7 +221,7 @@ static Sequence *rna_Sequences_new_movie(ID *id, Editing *ed, ReportList *report #ifdef WITH_AUDASPACE static Sequence *rna_Sequences_new_sound(ID *id, Editing *ed, Main *bmain, ReportList *reports, - const char *name, const char *file, int channel, int start_frame) + const char *name, const char *file, int channel, int frame_start) { Scene *scene = (Scene *)id; Sequence *seq; @@ -234,11 +233,11 @@ static Sequence *rna_Sequences_new_sound(ID *id, Editing *ed, Main *bmain, Repor return NULL; } - seq = alloc_generic_sequence(ed, name, start_frame, channel, SEQ_TYPE_SOUND_RAM, sound->name); + seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_SOUND_RAM, sound->name); seq->sound = sound; seq->len = ceil((double)sound_get_length(sound) * FPS); - seq->scene_sound = sound_add_scene_sound(scene, seq, start_frame, start_frame + seq->len, 0); + seq->scene_sound = sound_add_scene_sound(scene, seq, frame_start, frame_start + seq->len, 0); BKE_sequence_calc_disp(scene, seq); @@ -249,7 +248,7 @@ static Sequence *rna_Sequences_new_sound(ID *id, Editing *ed, Main *bmain, Repor #else /* WITH_AUDASPACE */ static Sequence *rna_Sequences_new_sound(ID *UNUSED(id), Editing *UNUSED(ed), Main *UNUSED(bmain), ReportList *reports, const char *UNUSED(name), const char *UNUSED(file), int UNUSED(channel), - int UNUSED(start_frame)) + int UNUSED(frame_start)) { BKE_report(reports, RPT_ERROR, "Blender compiled without Audaspace support"); return NULL; @@ -258,7 +257,7 @@ static Sequence *rna_Sequences_new_sound(ID *UNUSED(id), Editing *UNUSED(ed), Ma static Sequence *rna_Sequences_new_effect(ID *id, Editing *ed, ReportList *reports, const char *name, int type, int channel, - int start_frame, int end_frame, + int frame_start, int frame_end, Sequence *seq1, Sequence *seq2, Sequence *seq3) { Scene *scene = (Scene *)id; @@ -268,7 +267,7 @@ static Sequence *rna_Sequences_new_effect(ID *id, Editing *ed, ReportList *repor switch (num_inputs) { case 0: - if (end_frame <= start_frame) { + if (frame_end <= frame_start) { BKE_report(reports, RPT_ERROR, "Sequences.new_effect: end frame not set"); return NULL; } @@ -298,7 +297,7 @@ static Sequence *rna_Sequences_new_effect(ID *id, Editing *ed, ReportList *repor return NULL; } - seq = alloc_generic_sequence(ed, name, start_frame, channel, type, NULL); + seq = alloc_generic_sequence(ed, name, frame_start, channel, type, NULL); sh = BKE_sequence_get_effect(seq); @@ -310,7 +309,7 @@ static Sequence *rna_Sequences_new_effect(ID *id, Editing *ed, ReportList *repor if (!seq1) { /* effect has no deps */ seq->len = 1; - BKE_sequence_tx_set_final_right(seq, end_frame); + BKE_sequence_tx_set_final_right(seq, frame_end); } seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE; @@ -488,7 +487,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_int(func, "channel", 0, 0, MAXSEQ - 1, "Channel", "The channel for the new sequence", 0, MAXSEQ - 1); RNA_def_property_flag(parm, PROP_REQUIRED); - parm = RNA_def_int(func, "start_frame", 0, -MAXFRAME, MAXFRAME, "", + parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "", "The start frame for the new sequence", -MAXFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ @@ -505,7 +504,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_int(func, "channel", 0, 0, MAXSEQ - 1, "Channel", "The channel for the new sequence", 0, MAXSEQ - 1); RNA_def_property_flag(parm, PROP_REQUIRED); - parm = RNA_def_int(func, "start_frame", 0, -MAXFRAME, MAXFRAME, "", + parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "", "The start frame for the new sequence", -MAXFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ @@ -522,7 +521,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_int(func, "channel", 0, 0, MAXSEQ - 1, "Channel", "The channel for the new sequence", 0, MAXSEQ - 1); RNA_def_property_flag(parm, PROP_REQUIRED); - parm = RNA_def_int(func, "start_frame", 0, -MAXFRAME, MAXFRAME, "", + parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "", "The start frame for the new sequence", -MAXFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ @@ -539,7 +538,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_int(func, "channel", 0, 0, MAXSEQ - 1, "Channel", "The channel for the new sequence", 0, MAXSEQ - 1); RNA_def_property_flag(parm, PROP_REQUIRED); - parm = RNA_def_int(func, "start_frame", 0, -MAXFRAME, MAXFRAME, "", + parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "", "The start frame for the new sequence", -MAXFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ @@ -556,7 +555,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_int(func, "channel", 0, 0, MAXSEQ - 1, "Channel", "The channel for the new sequence", 0, MAXSEQ - 1); RNA_def_property_flag(parm, PROP_REQUIRED); - parm = RNA_def_int(func, "start_frame", 0, -MAXFRAME, MAXFRAME, "", + parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "", "The start frame for the new sequence", -MAXFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ @@ -573,7 +572,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_int(func, "channel", 0, 0, MAXSEQ - 1, "Channel", "The channel for the new sequence", 0, MAXSEQ - 1); RNA_def_property_flag(parm, PROP_REQUIRED); - parm = RNA_def_int(func, "start_frame", 0, -MAXFRAME, MAXFRAME, "", + parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "", "The start frame for the new sequence", -MAXFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ @@ -590,12 +589,13 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "channel", 0, 0, MAXSEQ - 1, "Channel", "The channel for the new sequence", 0, MAXSEQ - 1); + /* don't use MAXFRAME since it makes importer scripts fail */ RNA_def_property_flag(parm, PROP_REQUIRED); - parm = RNA_def_int(func, "start_frame", 0, -MAXFRAME, MAXFRAME, "", - "The start frame for the new sequence", -MAXFRAME, MAXFRAME); + parm = RNA_def_int(func, "frame_start", 0, INT_MIN, INT_MAX, "", + "The start frame for the new sequence", INT_MIN, INT_MAX); RNA_def_property_flag(parm, PROP_REQUIRED); - RNA_def_int(func, "end_frame", 0, -MAXFRAME, MAXFRAME, "", - "The end frame for the new sequence", -MAXFRAME, MAXFRAME); + RNA_def_int(func, "frame_end", 0, INT_MIN, INT_MAX, "", + "The end frame for the new sequence", INT_MIN, INT_MAX); RNA_def_pointer(func, "seq1", "Sequence", "", "Sequence 1 for effect"); RNA_def_pointer(func, "seq2", "Sequence", "", "Sequence 2 for effect"); RNA_def_pointer(func, "seq3", "Sequence", "", "Sequence 3 for effect"); diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index 7cc57947671..cd646f4849c 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -402,39 +402,52 @@ static void rna_trackingDopesheet_tagUpdate(Main *UNUSED(bmain), Scene *scene, P /* API */ -static void add_tracks_to_base(MovieClip *clip, MovieTracking *tracking, ListBase *tracksbase, int frame, int number) +static MovieTrackingTrack *add_track_to_base(MovieClip *clip, MovieTracking *tracking, ListBase *tracksbase, const char *name, int frame) { - int a, width, height; + int width, height; MovieClipUser user = {0}; + MovieTrackingTrack *track; user.framenr = 1; BKE_movieclip_get_size(clip, &user, &width, &height); - for (a = 0; a < number; a++) - BKE_tracking_track_add(tracking, tracksbase, 0, 0, frame, width, height); + track = BKE_tracking_track_add(tracking, tracksbase, 0, 0, frame, width, height); + + if (name && name[0]) { + BLI_strncpy(track->name, name, sizeof(track->name)); + BKE_tracking_track_unique_name(tracksbase, track); + } + + return track; } -static void rna_trackingTracks_add(ID *id, MovieTracking *tracking, int frame, int number) +static MovieTrackingTrack *rna_trackingTracks_new(ID *id, MovieTracking *tracking, const char *name, int frame) { MovieClip *clip = (MovieClip *) id; + MovieTrackingTrack *track; - add_tracks_to_base(clip, tracking, &tracking->tracks, frame, number); + track = add_track_to_base(clip, tracking, &tracking->tracks, name, frame); WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, clip); + + return track; } -static void rna_trackingObject_tracks_add(ID *id, MovieTrackingObject *object, int frame, int number) +static MovieTrackingTrack *rna_trackingObject_tracks_new(ID *id, MovieTrackingObject *object, const char *name, int frame) { MovieClip *clip = (MovieClip *) id; ListBase *tracksbase = &object->tracks; + MovieTrackingTrack *track; if (object->flag & TRACKING_OBJECT_CAMERA) tracksbase = &clip->tracking.tracks; - add_tracks_to_base(clip, &clip->tracking, tracksbase, frame, number); + track = add_track_to_base(clip, &clip->tracking, tracksbase, name, frame); WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL); + + return track; } static MovieTrackingObject *rna_trackingObject_new(MovieTracking *tracking, const char *name) @@ -475,6 +488,14 @@ static MovieTrackingMarker *rna_trackingMarkers_insert_frame(MovieTrackingTrack marker.framenr = framenr; copy_v2_v2(marker.pos, co); + /* a bit arbitrary, but better than creating markers with zero pattern + * which is forbidden actually + */ + copy_v2_v2(marker.pattern_corners[0], track->markers[0].pattern_corners[0]); + copy_v2_v2(marker.pattern_corners[1], track->markers[0].pattern_corners[1]); + copy_v2_v2(marker.pattern_corners[2], track->markers[0].pattern_corners[2]); + copy_v2_v2(marker.pattern_corners[3], track->markers[0].pattern_corners[3]); + new_marker = BKE_tracking_marker_insert(track, &marker); WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL); @@ -1318,16 +1339,19 @@ static void rna_def_trackingTracks(BlenderRNA *brna) StructRNA *srna; FunctionRNA *func; PropertyRNA *prop; + PropertyRNA *parm; srna = RNA_def_struct(brna, "MovieTrackingTracks", NULL); RNA_def_struct_sdna(srna, "MovieTracking"); RNA_def_struct_ui_text(srna, "Movie Tracks", "Collection of movie tracking tracks"); - func = RNA_def_function(srna, "add", "rna_trackingTracks_add"); + func = RNA_def_function(srna, "new", "rna_trackingTracks_new"); RNA_def_function_flag(func, FUNC_USE_SELF_ID); - RNA_def_function_ui_description(func, "Add a number of tracks to this movie clip"); - RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame", "Frame number to add tracks on", MINFRAME, MAXFRAME); - RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of tracks to add to the movie clip", 0, INT_MAX); + RNA_def_function_ui_description(func, "Create new motion track in this movie clip"); + RNA_def_string(func, "name", "", 0, "", "Name of new track"); + RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame", "Frame number to add track on", MINFRAME, MAXFRAME); + parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "Newly created track"); + RNA_def_function_return(func, parm); /* active track */ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); @@ -1342,16 +1366,19 @@ static void rna_def_trackingObjectTracks(BlenderRNA *brna) StructRNA *srna; FunctionRNA *func; PropertyRNA *prop; + PropertyRNA *parm; srna = RNA_def_struct(brna, "MovieTrackingObjectTracks", NULL); RNA_def_struct_sdna(srna, "MovieTrackingObject"); RNA_def_struct_ui_text(srna, "Movie Tracks", "Collection of movie tracking tracks"); - func = RNA_def_function(srna, "add", "rna_trackingObject_tracks_add"); + func = RNA_def_function(srna, "new", "rna_trackingObject_tracks_new"); RNA_def_function_flag(func, FUNC_USE_SELF_ID); - RNA_def_function_ui_description(func, "Add a number of tracks to this movie clip"); + RNA_def_function_ui_description(func, "create new motion track in this movie clip"); + RNA_def_string(func, "name", "", 0, "", "Name of new track"); RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame", "Frame number to add tracks on", MINFRAME, MAXFRAME); - RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of tracks to add to the movie clip", 0, INT_MAX); + parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "Newly created track"); + RNA_def_function_return(func, parm); /* active track */ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 14789a437b7..00124a82dd1 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -165,7 +165,7 @@ static void panel_draw_header(const bContext *C, Panel *pnl) RNA_parameter_list_free(&list); } -static void rna_Panel_unregister(Main *UNUSED(bmain), StructRNA *type) +static void rna_Panel_unregister(Main *bmain, StructRNA *type) { ARegionType *art; PanelType *pt = RNA_struct_blender_type_get(type); @@ -181,7 +181,7 @@ static void rna_Panel_unregister(Main *UNUSED(bmain), StructRNA *type) RNA_struct_free(&BLENDER_RNA, type); /* update while blender is running */ - WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); + WM_main_add_notifier(NC_WINDOW, NULL); } static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *data, const char *identifier, @@ -225,7 +225,7 @@ static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *dat pt = MEM_callocN(sizeof(PanelType), "python buttons panel"); memcpy(pt, &dummypt, sizeof(dummypt)); - pt->ext.srna = RNA_def_struct(&BLENDER_RNA, pt->idname, "Panel"); + pt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, pt->idname, &RNA_Panel); pt->ext.data = data; pt->ext.call = call; pt->ext.free = free; @@ -251,7 +251,7 @@ static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *dat BLI_addtail(&art->paneltypes, pt); /* update while blender is running */ - WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); + WM_main_add_notifier(NC_WINDOW, NULL); return pt->ext.srna; } @@ -303,7 +303,7 @@ static void rna_UIList_unregister(Main *UNUSED(bmain), StructRNA *type) RNA_struct_free(&BLENDER_RNA, type); /* update while blender is running */ - WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); + WM_main_add_notifier(NC_WINDOW, NULL); } static StructRNA *rna_UIList_register(Main *bmain, ReportList *reports, void *data, const char *identifier, @@ -338,7 +338,7 @@ static StructRNA *rna_UIList_register(Main *bmain, ReportList *reports, void *da ult = MEM_callocN(sizeof(uiListType) + over_alloc, "python uilist"); memcpy(ult, &dummyult, sizeof(dummyult)); - ult->ext.srna = RNA_def_struct(&BLENDER_RNA, ult->idname, "UIList"); + ult->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, ult->idname, &RNA_UIList); ult->ext.data = data; ult->ext.call = call; ult->ext.free = free; @@ -350,7 +350,7 @@ static StructRNA *rna_UIList_register(Main *bmain, ReportList *reports, void *da WM_uilisttype_add(ult); /* update while blender is running */ - WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); + WM_main_add_notifier(NC_WINDOW, NULL); return ult->ext.srna; } @@ -397,7 +397,7 @@ static void rna_Header_unregister(Main *UNUSED(bmain), StructRNA *type) RNA_struct_free(&BLENDER_RNA, type); /* update while blender is running */ - WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); + WM_main_add_notifier(NC_WINDOW, NULL); } static StructRNA *rna_Header_register(Main *bmain, ReportList *reports, void *data, const char *identifier, @@ -439,7 +439,7 @@ static StructRNA *rna_Header_register(Main *bmain, ReportList *reports, void *da ht = MEM_callocN(sizeof(HeaderType), "python buttons header"); memcpy(ht, &dummyht, sizeof(dummyht)); - ht->ext.srna = RNA_def_struct(&BLENDER_RNA, ht->idname, "Header"); + ht->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, ht->idname, &RNA_Header); ht->ext.data = data; ht->ext.call = call; ht->ext.free = free; @@ -450,7 +450,7 @@ static StructRNA *rna_Header_register(Main *bmain, ReportList *reports, void *da BLI_addtail(&art->headertypes, ht); /* update while blender is running */ - WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); + WM_main_add_notifier(NC_WINDOW, NULL); return ht->ext.srna; } @@ -520,7 +520,7 @@ static void rna_Menu_unregister(Main *UNUSED(bmain), StructRNA *type) RNA_struct_free(&BLENDER_RNA, type); /* update while blender is running */ - WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); + WM_main_add_notifier(NC_WINDOW, NULL); } static char _menu_descr[RNA_DYN_DESCR_MAX]; @@ -572,7 +572,7 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data mt->description = buf; } - mt->ext.srna = RNA_def_struct(&BLENDER_RNA, mt->idname, "Menu"); + mt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, mt->idname, &RNA_Menu); mt->ext.data = data; mt->ext.call = call; mt->ext.free = free; @@ -585,7 +585,7 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data WM_menutype_add(mt); /* update while blender is running */ - WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); + WM_main_add_notifier(NC_WINDOW, NULL); return mt->ext.srna; } @@ -1000,7 +1000,7 @@ static void rna_def_menu(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "Label", "The menu label"); - prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE); + prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->description"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Menu_bl_description_set"); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 7474ff40e32..f53b67c0e92 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -345,6 +345,11 @@ static PointerRNA rna_Theme_space_generic_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceGeneric, ptr->data); } +static PointerRNA rna_Theme_space_gradient_get(PointerRNA *ptr) +{ + return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceGradient, ptr->data); +} + static PointerRNA rna_Theme_space_list_generic_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceListGeneric, ptr->data); @@ -471,7 +476,7 @@ static void rna_AddonPref_unregister(Main *UNUSED(bmain), StructRNA *type) RNA_struct_free(&BLENDER_RNA, type); /* update while blender is running */ - WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); + WM_main_add_notifier(NC_WINDOW, NULL); } static StructRNA *rna_AddonPref_register(Main *bmain, ReportList *reports, void *data, const char *identifier, @@ -509,7 +514,7 @@ static StructRNA *rna_AddonPref_register(Main *bmain, ReportList *reports, void memcpy(apt, &dummyapt, sizeof(dummyapt)); BKE_addon_pref_type_add(apt); - apt->ext.srna = RNA_def_struct(&BLENDER_RNA, identifier, "AddonPreferences"); + apt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_AddonPreferences); apt->ext.data = data; apt->ext.call = call; apt->ext.free = free; @@ -518,7 +523,7 @@ static StructRNA *rna_AddonPref_register(Main *bmain, ReportList *reports, void // apt->draw = (have_function[0]) ? header_draw : NULL; /* update while blender is running */ - WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); + WM_main_add_notifier(NC_WINDOW, NULL); return apt->ext.srna; } @@ -758,6 +763,32 @@ static void rna_def_userdef_theme_ui_panel(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_userdef_update"); } +static void rna_def_userdef_theme_ui_gradient(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "ThemeGradientColors", NULL); + RNA_def_struct_sdna(srna, "uiGradientColors"); + RNA_def_struct_clear_flag(srna, STRUCT_UNDO); + RNA_def_struct_ui_text(srna, "Theme Background Color", "Theme settings for background colors and gradient"); + + prop = RNA_def_property(srna, "show_grad", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "Use Gradient", + "Do a gradient for the background of the viewport working area"); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "gradient", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Gradient Low", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "high_gradient", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Gradient High/Off", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); +} + static void rna_def_userdef_theme_ui(BlenderRNA *brna) { StructRNA *srna; @@ -766,7 +797,8 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna) rna_def_userdef_theme_ui_wcol(brna); rna_def_userdef_theme_ui_wcol_state(brna); rna_def_userdef_theme_ui_panel(brna); - + rna_def_userdef_theme_ui_gradient(brna); + srna = RNA_def_struct(brna, "ThemeUserInterface", NULL); RNA_def_struct_sdna(srna, "ThemeUI"); RNA_def_struct_clear_flag(srna, STRUCT_UNDO); @@ -976,6 +1008,83 @@ static void rna_def_userdef_theme_space_generic(BlenderRNA *brna) /* } */ } +static void rna_def_userdef_theme_space_gradient(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "ThemeSpaceGradient", NULL); + RNA_def_struct_sdna(srna, "ThemeSpace"); + RNA_def_struct_ui_text(srna, "Theme Space Settings", ""); + + /* window */ + prop = RNA_def_property(srna, "title", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Title", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "text", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Text", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "text_hi", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Text Highlight", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + /* header */ + prop = RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Header", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "header_text", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Header Text", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "header_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Header Text Highlight", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + /* panel settings */ + prop = RNA_def_property(srna, "panelcolors", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_ui_text(prop, "Panel Colors", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + /* gradient/background settings */ + prop = RNA_def_property(srna, "gradients", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_ui_text(prop, "Gradient Colors", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + /* buttons */ +/* if (! ELEM(spacetype, SPACE_BUTS, SPACE_OUTLINER)) { */ + prop = RNA_def_property(srna, "button", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Region Background", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "button_title", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Region Text Titles", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "button_text", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Region Text", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "button_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Region Text Highlight", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); +/* } */ +} + /* list / channels */ static void rna_def_userdef_theme_space_list_generic(BlenderRNA *brna) { @@ -1018,6 +1127,17 @@ static void rna_def_userdef_theme_spaces_main(StructRNA *srna) RNA_def_property_ui_text(prop, "Theme Space", "Settings for space"); } +static void rna_def_userdef_theme_spaces_gradient(StructRNA *srna) +{ + PropertyRNA *prop; + + prop = RNA_def_property(srna, "space", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "ThemeSpaceGradient"); + RNA_def_property_pointer_funcs(prop, "rna_Theme_space_gradient_get", NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "Theme Space", "Settings for space"); +} + static void rna_def_userdef_theme_spaces_list_main(StructRNA *srna) { PropertyRNA *prop; @@ -1236,7 +1356,7 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna) RNA_def_struct_clear_flag(srna, STRUCT_UNDO); RNA_def_struct_ui_text(srna, "Theme 3D View", "Theme settings for the 3D View"); - rna_def_userdef_theme_spaces_main(srna); + rna_def_userdef_theme_spaces_gradient(srna); prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 3); @@ -2550,6 +2670,7 @@ static void rna_def_userdef_dothemes(BlenderRNA *brna) rna_def_userdef_theme_ui(brna); rna_def_userdef_theme_space_generic(brna); + rna_def_userdef_theme_space_gradient(brna); rna_def_userdef_theme_space_list_generic(brna); rna_def_userdef_theme_space_view3d(brna); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index f123b564f8d..f416d3403ad 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1138,7 +1138,7 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void * * for now just remove from dir(bpy.types) */ /* create a new operator type */ - dummyot.ext.srna = RNA_def_struct(&BLENDER_RNA, dummyot.idname, "Operator"); + dummyot.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummyot.idname, &RNA_Operator); RNA_def_struct_flag(dummyot.ext.srna, STRUCT_NO_IDPROPERTIES); /* operator properties are registered separately */ dummyot.ext.data = data; dummyot.ext.call = call; @@ -1219,7 +1219,7 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, v * for now just remove from dir(bpy.types) */ /* create a new operator type */ - dummyot.ext.srna = RNA_def_struct(&BLENDER_RNA, dummyot.idname, "Operator"); + dummyot.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummyot.idname, &RNA_Operator); dummyot.ext.data = data; dummyot.ext.call = call; dummyot.ext.free = free; @@ -1340,7 +1340,7 @@ static void rna_def_operator(BlenderRNA *brna) /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */ RNA_def_property_flag(prop, PROP_REGISTER); - prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE); + prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->description"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set"); @@ -1407,7 +1407,7 @@ static void rna_def_macro_operator(BlenderRNA *brna) /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */ RNA_def_property_flag(prop, PROP_REGISTER); - prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE); + prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->description"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set"); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index a84b1124d44..7a94566c6ee 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -529,7 +529,7 @@ void RNA_def_world(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "zenr"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Zenith Color", "Color at the zenith"); - RNA_def_property_update(prop, 0, "rna_World_update"); + RNA_def_property_update(prop, NC_WORLD | ND_WORLD_DRAW, "rna_World_update"); prop = RNA_def_property(srna, "ambient_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "ambr"); @@ -554,17 +554,17 @@ void RNA_def_world(BlenderRNA *brna) prop = RNA_def_property(srna, "use_sky_blend", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "skytype", WO_SKYBLEND); RNA_def_property_ui_text(prop, "Blend Sky", "Render background with natural progression from horizon to zenith"); - RNA_def_property_update(prop, 0, "rna_World_update"); + RNA_def_property_update(prop, NC_WORLD | ND_WORLD_DRAW, "rna_World_update"); prop = RNA_def_property(srna, "use_sky_paper", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "skytype", WO_SKYPAPER); RNA_def_property_ui_text(prop, "Paper Sky", "Flatten blend or texture coordinates"); - RNA_def_property_update(prop, 0, "rna_World_update"); + RNA_def_property_update(prop, NC_WORLD | ND_WORLD_DRAW, "rna_World_update"); prop = RNA_def_property(srna, "use_sky_real", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "skytype", WO_SKYREAL); RNA_def_property_ui_text(prop, "Real Sky", "Render background with a real horizon, relative to the camera angle"); - RNA_def_property_update(prop, 0, "rna_World_update"); + RNA_def_property_update(prop, NC_WORLD | ND_WORLD_DRAW, "rna_World_update"); /* nested structs */ prop = RNA_def_property(srna, "light_settings", PROP_POINTER, PROP_NONE); |