diff options
author | Joseph Eagar <joeedh@gmail.com> | 2009-11-29 03:53:23 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2009-11-29 03:53:23 +0300 |
commit | abd16aac5af56a37a3435b94039d77b74223abab (patch) | |
tree | 47ba926d0e8e2c3a903a5d2f1b8290d274cb381c /source/blender/makesrna | |
parent | 3d0db91f820a509bc6c93718499ffe8ff49515d3 (diff) | |
parent | d459c9c9abd2ad0819e5c096f6e3e5a93a02a219 (diff) |
ok, apparently didn't commit this either. apparently includes a merge with trunk/2.5 at r24811 I thought I'd committed but did not, yeek.
Diffstat (limited to 'source/blender/makesrna')
47 files changed, 1946 insertions, 789 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index dc730ee46f9..f8d9b4d333b 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -203,6 +203,7 @@ extern StructRNA RNA_FModifierGenerator; extern StructRNA RNA_FModifierLimits; extern StructRNA RNA_FModifierNoise; extern StructRNA RNA_FModifierPython; +extern StructRNA RNA_FModifierSound; extern StructRNA RNA_FieldSettings; extern StructRNA RNA_FileSelectParams; extern StructRNA RNA_FloatProperty; @@ -310,10 +311,12 @@ extern StructRNA RNA_NlaStrip; extern StructRNA RNA_NlaTrack; extern StructRNA RNA_Node; extern StructRNA RNA_NodeTree; +extern StructRNA RNA_NodeSocket; extern StructRNA RNA_NoiseTexture; extern StructRNA RNA_NorController; extern StructRNA RNA_Nurb; extern StructRNA RNA_Object; +extern StructRNA RNA_ObjectBase; extern StructRNA RNA_ObstacleFluidSettings; extern StructRNA RNA_Operator; extern StructRNA RNA_OperatorFileListElement; @@ -345,7 +348,7 @@ extern StructRNA RNA_PointDensityTexture; extern StructRNA RNA_PointLamp; extern StructRNA RNA_PointerProperty; extern StructRNA RNA_Pose; -extern StructRNA RNA_PoseChannel; +extern StructRNA RNA_PoseBone; extern StructRNA RNA_Property; extern StructRNA RNA_PropertySensor; extern StructRNA RNA_PythonConstraint; @@ -358,6 +361,7 @@ extern StructRNA RNA_RenderEngine; extern StructRNA RNA_RenderLayer; extern StructRNA RNA_RenderPass; extern StructRNA RNA_RenderResult; +extern StructRNA RNA_RGBANodeSocket; extern StructRNA RNA_RigidBodyJointConstraint; extern StructRNA RNA_Scene; extern StructRNA RNA_SceneGameData; @@ -515,7 +519,9 @@ extern StructRNA RNA_UserPreferencesFilePaths; extern StructRNA RNA_UserPreferencesSystem; extern StructRNA RNA_UserPreferencesView; extern StructRNA RNA_UserSolidLight; +extern StructRNA RNA_ValueNodeSocket; extern StructRNA RNA_VectorFont; +extern StructRNA RNA_VectorNodeSocket; extern StructRNA RNA_VertexGroup; extern StructRNA RNA_VertexGroupElement; extern StructRNA RNA_VertexPaint; @@ -578,6 +584,8 @@ void *RNA_struct_blender_type_get(StructRNA *srna); void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type); struct IDProperty *RNA_struct_idproperties(PointerRNA *ptr, int create); +int RNA_struct_idproperties_check(PointerRNA *ptr); + PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier); const struct ListBase *RNA_struct_defined_properties(StructRNA *srna); @@ -678,7 +686,7 @@ int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop); int RNA_property_collection_lookup_index(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *t_ptr); int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr); int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, const char *key, PointerRNA *r_ptr); -PropertyRNA *RNA_property_collection_active(PropertyRNA *prop); +int RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr); /* efficient functions to set properties for arrays */ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, PropertyRNA *itemprop, RawArray *array); @@ -809,6 +817,7 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name); /* check if the idproperty exists, for operators */ int RNA_property_is_set(PointerRNA *ptr, const char *name); +int RNA_property_is_idprop(PropertyRNA *prop); /* python compatible string representation of this property, (must be freed!) */ char *RNA_property_as_string(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop); diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index ed4a371b9c3..5ed0fb5194d 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -163,8 +163,8 @@ void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item); void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set); void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *typef); -void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *add, const char *remove); -void RNA_def_property_collection_active(PropertyRNA *prop, PropertyRNA *prop_act); +void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring); +void RNA_def_property_srna(PropertyRNA *prop, const char *type); /* Function */ diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 318178d1522..13e2d5a2dc2 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -67,6 +67,8 @@ extern EnumPropertyItem object_type_items[]; extern EnumPropertyItem space_type_items[]; +extern EnumPropertyItem keymap_propvalue_items[]; + struct bContext; struct PointerRNA; EnumPropertyItem *rna_TransformOrientation_itemf(struct bContext *C, struct PointerRNA *ptr, int *free); diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index e814a7891ca..d06d81c9d81 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -30,6 +30,7 @@ if env['WITH_BF_OGG']: if env['WITH_BF_QUICKTIME']: defs.append('WITH_QUICKTIME') + incs += ' ../quicktime' if env['WITH_BF_LCMS']: defs.append('WITH_LCMS') diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index c9c02fbecde..113dfc51138 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -63,6 +63,7 @@ IF(WITH_DDS) ENDIF(WITH_DDS) IF(WITH_QUICKTIME) + SET(INC "${INC} ../../quicktime") ADD_DEFINITIONS(-DWITH_QUICKTIME) ENDIF(WITH_QUICKTIME) diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index 317f3a9779e..c0a9089ab29 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -52,6 +52,7 @@ if env['WITH_BF_OGG']: if env['WITH_BF_QUICKTIME']: defs.append('WITH_QUICKTIME') + incs += ' ../../quicktime' if env['WITH_BF_LCMS']: defs.append('WITH_LCMS') diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 6f1e61e6869..526178d7b26 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -369,7 +369,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr if(strcmp(manualfunc, "rna_iterator_listbase_get") == 0 || strcmp(manualfunc, "rna_iterator_array_get") == 0 || strcmp(manualfunc, "rna_iterator_array_dereference_get") == 0) - fprintf(f, " return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n", (cprop->type)? (char*)cprop->type: "UnknownType", manualfunc); + fprintf(f, " return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n", (cprop->item_type)? (char*)cprop->item_type: "UnknownType", manualfunc); else fprintf(f, " return %s(iter);\n", manualfunc); } @@ -965,7 +965,7 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) DefRNA.error= 1; } } - if(!cprop->type) { + if(!cprop->item_type) { fprintf(stderr, "rna_def_property_funcs: %s.%s, collection must have a struct type.\n", srna->identifier, prop->identifier); DefRNA.error= 1; } @@ -1132,8 +1132,8 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property case PROP_COLLECTION: { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop; - if(cprop->type) - fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (char*)cprop->type, srna->identifier, prop->identifier); + if(cprop->item_type) + fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (char*)cprop->item_type, srna->identifier, prop->identifier); else fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, prop->identifier); break; @@ -1357,8 +1357,8 @@ static void rna_auto_types() else if(dp->prop->type== PROP_COLLECTION) { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop; - if(!cprop->type && !cprop->get && strcmp(dp->dnatype, "ListBase")==0) - cprop->type= (StructRNA*)rna_find_type(dp->dnatype); + if(!cprop->item_type && !cprop->get && strcmp(dp->dnatype, "ListBase")==0) + cprop->item_type= (StructRNA*)rna_find_type(dp->dnatype); } } } @@ -1767,6 +1767,11 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr if(prop->flag & PROP_RAW_ACCESS) rna_set_raw_offset(f, srna, prop); else fprintf(f, "\t0, 0"); + + /* our own type - collections/arrays only */ + if(prop->srna) fprintf(f, ", &RNA_%s", (char*)prop->srna); + else fprintf(f, ", NULL"); + fprintf(f, "},\n"); switch(prop->type) { @@ -1830,13 +1835,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr case PROP_COLLECTION: { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, ", rna_function_string(cprop->begin), rna_function_string(cprop->next), rna_function_string(cprop->end), rna_function_string(cprop->get), rna_function_string(cprop->length), rna_function_string(cprop->lookupint), rna_function_string(cprop->lookupstring)); - if(cprop->add) fprintf(f, "&rna_%s_%s_func, ", srna->identifier, (char*)cprop->add); - else fprintf(f, "NULL, "); - if(cprop->remove) fprintf(f, "&rna_%s_%s_func, ", srna->identifier, (char*)cprop->remove); - else fprintf(f, "NULL, "); - if(cprop->active) fprintf(f, "(PropertyRNA*)&rna_%s%s_%s, ", srna->identifier, strnest, cprop->active->identifier); - else fprintf(f, "NULL, "); - if(cprop->type) fprintf(f, "&RNA_%s\n", (char*)cprop->type); + if(cprop->item_type) fprintf(f, "&RNA_%s\n", (char*)cprop->item_type); else fprintf(f, "NULL\n"); break; } diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 3de347cf80e..cb1a1211d24 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -53,7 +53,7 @@ EnumPropertyItem id_type_items[] = { {ID_MA, "MATERIAL", ICON_MATERIAL_DATA, "Material", ""}, {ID_MB, "META", ICON_META_DATA, "MetaBall", ""}, {ID_ME, "MESH", ICON_MESH_DATA, "Mesh", ""}, - {ID_NT, "NODETREE", ICON_NODE, "NodeTree", ""}, + {ID_NT, "NODETREE", ICON_NODETREE, "NodeTree", ""}, {ID_OB, "OBJECT", ICON_OBJECT_DATA, "Object", ""}, {ID_PA, "PARTICLE", ICON_PARTICLE_DATA, "Particle", ""}, {ID_SCE, "SCENE", ICON_SCENE_DATA, "Scene", ""}, diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 93e83492efa..ce2e256004e 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -45,6 +45,11 @@ #include "RNA_define.h" #include "RNA_types.h" +/* flush updates */ +#include "DNA_object_types.h" +#include "BKE_depsgraph.h" +#include "WM_types.h" + #include "rna_internal.h" /* Init/Exit */ @@ -185,6 +190,29 @@ PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *da /* ID Properties */ +/* return a UI local ID prop definition for this prop */ +IDProperty *rna_idproperty_ui(PropertyRNA *prop) +{ + IDProperty *idprop; + + for(idprop= ((IDProperty *)prop)->prev; idprop; idprop= idprop->prev) { + if (strcmp(RNA_IDP_UI, idprop->name)==0) + break; + } + + if(idprop==NULL) { + for(idprop= ((IDProperty *)prop)->next; idprop; idprop= idprop->next) { + if (strcmp(RNA_IDP_UI, idprop->name)==0) + break; + } + } + + if (idprop) + return IDP_GetPropertyFromGroup(idprop, ((IDProperty *)prop)->name); + + return NULL; +} + IDProperty *RNA_struct_idproperties(PointerRNA *ptr, int create) { StructRNA *type= ptr->type; @@ -195,6 +223,12 @@ IDProperty *RNA_struct_idproperties(PointerRNA *ptr, int create) return NULL; } +int RNA_struct_idproperties_check(PointerRNA *ptr) +{ + StructRNA *type= ptr->type; + return (type && type->idproperties) ? 1 : 0; +} + static IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name) { IDProperty *group= RNA_struct_idproperties(ptr, 0); @@ -385,8 +419,19 @@ static const char *rna_ensure_property_description(PropertyRNA *prop) { if(prop->magic == RNA_MAGIC) return prop->description; - else + else { + /* attempt to get the local ID values */ + IDProperty *idp_ui= rna_idproperty_ui(prop); + + if(idp_ui) { /* TODO, type checking on ID props */ + + IDProperty *item= IDP_GetPropertyFromGroup(idp_ui, "description"); + if(item) + return (char *)item->data.pointer ; + } + return ((IDProperty*)prop)->name; /* XXX - not correct */ + } } static const char *rna_ensure_property_name(PropertyRNA *prop) @@ -459,11 +504,21 @@ int RNA_struct_is_a(StructRNA *type, StructRNA *srna) PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier) { - PropertyRNA *iterprop= RNA_struct_iterator_property(ptr->type); - PointerRNA propptr; + if(identifier[0]=='[' && identifier[1]=='"') { + /* id prop lookup, not so common */ + PropertyRNA *r_prop= NULL; + PointerRNA r_ptr; /* only support single level props */ + if(RNA_path_resolve(ptr, identifier, &r_ptr, &r_prop) && r_ptr.type==ptr->type && r_ptr.data==ptr->data) + return r_prop; + } + else { + /* most common case */ + PropertyRNA *iterprop= RNA_struct_iterator_property(ptr->type); + PointerRNA propptr; - if(RNA_property_collection_lookup_string(ptr, iterprop, identifier, &propptr)) - return propptr.data; + if(RNA_property_collection_lookup_string(ptr, iterprop, identifier, &propptr)) + return propptr.data; + } return NULL; } @@ -647,6 +702,22 @@ void RNA_property_int_range(PointerRNA *ptr, PropertyRNA *prop, int *hardmin, in { IntPropertyRNA *iprop= (IntPropertyRNA*)rna_ensure_property(prop); + if(prop->magic != RNA_MAGIC) { + /* attempt to get the local ID values */ + IDProperty *idp_ui= rna_idproperty_ui(prop); + IDProperty *item; + + if(idp_ui) { /* TODO, type checking on ID props */ + item= IDP_GetPropertyFromGroup(idp_ui, "min"); + *hardmin= item ? item->data.val : INT_MIN; + + item= IDP_GetPropertyFromGroup(idp_ui, "max"); + *hardmax= item ? item->data.val : INT_MAX; + + return; + } + } + if(iprop->range) { iprop->range(ptr, hardmin, hardmax); } @@ -661,6 +732,25 @@ void RNA_property_int_ui_range(PointerRNA *ptr, PropertyRNA *prop, int *softmin, IntPropertyRNA *iprop= (IntPropertyRNA*)rna_ensure_property(prop); int hardmin, hardmax; + if(prop->magic != RNA_MAGIC) { + /* attempt to get the local ID values */ + IDProperty *idp_ui= rna_idproperty_ui(prop); + IDProperty *item; + + if(idp_ui) { /* TODO, type checking on ID props */ + item= IDP_GetPropertyFromGroup(idp_ui, "soft_min"); + *softmin= item ? item->data.val : INT_MIN; + + item= IDP_GetPropertyFromGroup(idp_ui, "soft_max"); + *softmax= item ? item->data.val : INT_MAX; + + item= IDP_GetPropertyFromGroup(idp_ui, "step"); + *step= item ? item->data.val : 1; + + return; + } + } + if(iprop->range) { iprop->range(ptr, &hardmin, &hardmax); *softmin= MAX2(iprop->softmin, hardmin); @@ -678,6 +768,22 @@ void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin { FloatPropertyRNA *fprop= (FloatPropertyRNA*)rna_ensure_property(prop); + if(prop->magic != RNA_MAGIC) { + /* attempt to get the local ID values */ + IDProperty *idp_ui= rna_idproperty_ui(prop); + IDProperty *item; + + if(idp_ui) { /* TODO, type checking on ID props */ + item= IDP_GetPropertyFromGroup(idp_ui, "min"); + *hardmin= item ? *(double*)&item->data.val : FLT_MIN; + + item= IDP_GetPropertyFromGroup(idp_ui, "max"); + *hardmax= item ? *(double*)&item->data.val : FLT_MAX; + + return; + } + } + if(fprop->range) { fprop->range(ptr, hardmin, hardmax); } @@ -692,6 +798,28 @@ void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *soft FloatPropertyRNA *fprop= (FloatPropertyRNA*)rna_ensure_property(prop); float hardmin, hardmax; + if(prop->magic != RNA_MAGIC) { + /* attempt to get the local ID values */ + IDProperty *idp_ui= rna_idproperty_ui(prop); + IDProperty *item; + + if(idp_ui) { /* TODO, type checking on ID props */ + item= IDP_GetPropertyFromGroup(idp_ui, "soft_min"); + *softmin= item ? *(double*)&item->data.val : FLT_MIN; + + item= IDP_GetPropertyFromGroup(idp_ui, "soft_max"); + *softmax= item ? *(double*)&item->data.val : FLT_MAX; + + item= IDP_GetPropertyFromGroup(idp_ui, "step"); + *step= item ? *(double*)&item->data.val : 1.0f; + + item= IDP_GetPropertyFromGroup(idp_ui, "precision"); + *precision= item ? *(double*)&item->data.val : 3.0f; + + return; + } + } + if(fprop->range) { fprop->range(ptr, &hardmin, &hardmax); *softmin= MAX2(fprop->softmin, hardmin); @@ -727,8 +855,8 @@ StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop) else if(prop->type == PROP_COLLECTION) { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; - if(cprop->type) - return cprop->type; + if(cprop->item_type) + return cprop->item_type; } return &RNA_UnknownType; @@ -829,7 +957,7 @@ const char *RNA_property_ui_name(PropertyRNA *prop) const char *RNA_property_ui_description(PropertyRNA *prop) { - return rna_ensure_property(prop)->description; + return rna_ensure_property_description(prop); } int RNA_property_ui_icon(PropertyRNA *prop) @@ -880,12 +1008,21 @@ int RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop) void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop) { + int is_rna = (prop->magic == RNA_MAGIC); prop= rna_ensure_property(prop); - if(prop->update) - prop->update(C, ptr); - if(prop->noteflag) - WM_event_add_notifier(C, prop->noteflag, ptr->id.data); + if(is_rna) { + if(prop->update) + prop->update(C, ptr); + if(prop->noteflag) + WM_event_add_notifier(C, prop->noteflag, ptr->id.data); + } + else { + /* WARNING! This is so property drivers update the display! + * not especially nice */ + DAG_id_flush_update(ptr->id.data, OB_RECALC_OB); + WM_event_add_notifier(C, NC_WINDOW, NULL); + } } /* Property Data */ @@ -1248,8 +1385,12 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa int i; if((idprop=rna_idproperty_check(&prop, ptr))) { - if(prop->arraydimension == 0) - IDP_Double(idprop)= values[0]; + if(prop->arraydimension == 0) { + if(idprop->type == IDP_FLOAT) + IDP_Float(idprop)= values[0]; + else + IDP_Double(idprop)= values[0]; + } else if(idprop->subtype == IDP_FLOAT) { memcpy(IDP_Array(idprop), values, sizeof(float)*idprop->len); } @@ -1486,8 +1627,8 @@ static void rna_property_collection_get_idp(CollectionPropertyIterator *iter) CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)iter->prop; iter->ptr.data= rna_iterator_array_get(iter); - iter->ptr.type= cprop->type; - rna_pointer_inherit_id(cprop->type, &iter->parent, &iter->ptr); + iter->ptr.type= cprop->item_type; + rna_pointer_inherit_id(cprop->item_type, &iter->parent, &iter->ptr); } void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, CollectionPropertyIterator *iter) @@ -1567,7 +1708,7 @@ int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop) void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr) { IDProperty *idprop; - CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; +// CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; if((idprop=rna_idproperty_check(&prop, ptr))) { IDPropertyTemplate val = {0}; @@ -1593,6 +1734,9 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA MEM_freeN(item); } } + + /* py api calls directly */ +#if 0 else if(cprop->add){ if(!(cprop->add->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */ ParameterList params; @@ -1603,13 +1747,14 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA } /*else printf("RNA_property_collection_add %s.%s: not implemented for this property.\n", ptr->type->identifier, prop->identifier);*/ +#endif if(r_ptr) { if(idprop) { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; r_ptr->data= IDP_GetIndexArray(idprop, idprop->len-1); - r_ptr->type= cprop->type; + r_ptr->type= cprop->item_type; rna_pointer_inherit_id(NULL, ptr, r_ptr); } else @@ -1620,7 +1765,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key) { IDProperty *idprop; - CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; +// CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; if((idprop=rna_idproperty_check(&prop, ptr))) { IDProperty tmp, *array; @@ -1644,6 +1789,9 @@ int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key) } else if(prop->flag & PROP_IDPROPERTY) return 1; + + /* py api calls directly */ +#if 0 else if(cprop->remove){ if(!(cprop->remove->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */ ParameterList params; @@ -1656,7 +1804,7 @@ int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key) } /*else printf("RNA_property_collection_remove %s.%s: only supported for id properties.\n", ptr->type->identifier, prop->identifier);*/ - +#endif return 0; } @@ -1761,10 +1909,10 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, co } } -PropertyRNA *RNA_property_collection_active(PropertyRNA *prop) +int RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr) { - CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; - return cprop->active; + *r_ptr= *ptr; + return ((r_ptr->type = prop->srna) ? 1:0); } int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, PropertyRNA *itemprop, RawArray *array) @@ -2262,6 +2410,19 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int return buf; } +static int rna_token_strip_quotes(char *token) +{ + if(token[0]=='"') { + int len = strlen(token); + if (len >= 2 && token[len-1]=='"') { + /* strip away "" */ + token[len-1]= '\0'; + return 1; + } + } + return 0; +} + /* Resolve the given RNA path to find the pointer+property indicated at the end of the path */ int RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop) { @@ -2273,17 +2434,29 @@ int RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, Prope prop= NULL; curptr= *ptr; - if(path==NULL) + if(path==NULL || *path=='\0') return 0; while(*path) { + int use_id_prop = (*path=='[') ? 1:0; + /* custom property lookup ? + * C.object["someprop"] + */ + /* look up property name in current struct */ - token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 0); + token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), use_id_prop); if(!token) return 0; - prop= RNA_struct_find_property(&curptr, token); + if(use_id_prop) { /* look up property name in current struct */ + IDProperty *group= RNA_struct_idproperties(&curptr, 0); + if(group && rna_token_strip_quotes(token)) + prop= (PropertyRNA *)IDP_GetPropertyFromGroup(group, token+1); + } + else { + prop= RNA_struct_find_property(&curptr, token); + } if(token != fixedbuf) MEM_freeN(token); @@ -2312,9 +2485,7 @@ int RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, Prope len= strlen(token); /* check for "" to see if it is a string */ - if(len >= 2 && token[0] == '"' && token[len-1] == '"') { - /* strip away "" */ - token[len-1]= 0; + if(rna_token_strip_quotes(token)) { RNA_property_collection_lookup_string(&curptr, prop, token+1, &nextptr); } else { @@ -2339,6 +2510,7 @@ int RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, Prope return 1; } + char *RNA_path_append(const char *path, PointerRNA *ptr, PropertyRNA *prop, int intkey, const char *strkey) { DynStr *dynstr; @@ -2473,6 +2645,7 @@ char *RNA_path_from_ID_to_struct(PointerRNA *ptr) char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop) { + int is_rna = (prop->magic == RNA_MAGIC); const char *propname; char *ptrpath, *path; @@ -2485,12 +2658,16 @@ char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop) propname= RNA_property_identifier(prop); if(ptrpath) { - path= BLI_sprintfN("%s.%s", ptrpath, propname); + path= BLI_sprintfN(is_rna ? "%s.%s":"%s[\"%s\"]", ptrpath, propname); MEM_freeN(ptrpath); } - else - path= BLI_strdup(propname); - + else { + if(is_rna) + path= BLI_strdup(propname); + else + path= BLI_sprintfN("[\"%s\"]", propname); + } + return path; } @@ -2697,8 +2874,6 @@ int RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **ident return 0; } - - void RNA_string_get(PointerRNA *ptr, const char *name, char *value) { PropertyRNA *prop= RNA_struct_find_property(ptr, name); @@ -2843,6 +3018,11 @@ int RNA_property_is_set(PointerRNA *ptr, const char *name) } } +int RNA_property_is_idprop(PropertyRNA *prop) +{ + return (prop->magic!=RNA_MAGIC); +} + /* string representation of a property, python * compatible but can be used for display too*/ char *RNA_pointer_as_string(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 23a9c48710e..3e7638b3d51 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -78,6 +78,16 @@ static int rna_ksPath_id_editable(PointerRNA *ptr) return (ksp->idtype)? PROP_EDITABLE : 0; } +static void rna_ksPath_id_type_set(PointerRNA *ptr, int value) +{ + KS_Path *data= (KS_Path*)(ptr->data); + + /* set the driver type, then clear the id-block if the type is invalid */ + data->idtype= value; + if ((data->id) && (GS(data->id->name) != data->idtype)) + data->id= NULL; +} + static void rna_ksPath_RnaPath_get(PointerRNA *ptr, char *value) { KS_Path *ksp= (KS_Path *)ptr->data; @@ -179,6 +189,7 @@ static void rna_def_keyingset_path(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "idtype"); RNA_def_property_enum_items(prop, id_type_items); RNA_def_property_enum_default(prop, ID_OB); + RNA_def_property_enum_funcs(prop, NULL, "rna_ksPath_id_type_set", NULL); RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used."); /* Group */ diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index e79d8091917..f1164cda675 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -623,10 +623,63 @@ static void rna_def_edit_bone(BlenderRNA *brna) RNA_define_verify_sdna(1); } + +/* armature.bones.* */ +static void rna_def_armature_bones(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *prop; + +// FunctionRNA *func; +// PropertyRNA *parm; + + RNA_def_property_srna(cprop, "ArmatureBones"); + srna= RNA_def_struct(brna, "ArmatureBones", NULL); + RNA_def_struct_sdna(srna, "bArmature"); + RNA_def_struct_ui_text(srna, "Armature Bones", "Collection of armature bones."); + + + prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Bone"); + RNA_def_property_pointer_sdna(prop, NULL, "act_bone"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Active Bone", "Armatures active bone."); + RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_bone_set", NULL); + + /* todo, redraw */ +// RNA_def_property_collection_active(prop, prop_act); +} + +/* armature.bones.* */ +static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *prop; + +// FunctionRNA *func; +// PropertyRNA *parm; + + RNA_def_property_srna(cprop, "ArmatureEditBones"); + srna= RNA_def_struct(brna, "ArmatureEditBones", NULL); + RNA_def_struct_sdna(srna, "bArmature"); + RNA_def_struct_ui_text(srna, "Armature EditBones", "Collection of armature edit bones."); + + prop= RNA_def_property(srna, "edit_bones", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "EditBone"); + RNA_def_property_pointer_sdna(prop, NULL, "act_edbone"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone."); + //RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update"); + RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL); + + /* todo, redraw */ +// RNA_def_property_collection_active(prop, prop_act); +} + static void rna_def_armature(BlenderRNA *brna) { StructRNA *srna; - PropertyRNA *prop, *prop_act; + PropertyRNA *prop; static EnumPropertyItem prop_drawtype_items[] = { {ARM_OCTA, "OCTAHEDRAL", 0, "Octahedral", "Display bones as octahedral shape (default)."}, @@ -663,37 +716,16 @@ static void rna_def_armature(BlenderRNA *brna) /* Collections */ prop= RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "bonebase", NULL); - RNA_def_property_collection_funcs(prop, 0, "rna_Armature_bones_next", 0, 0, 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, 0, "rna_Armature_bones_next", 0, 0, 0, 0, 0); RNA_def_property_struct_type(prop, "Bone"); RNA_def_property_ui_text(prop, "Bones", ""); - - { /* Collection active property */ - prop_act= RNA_def_property(srna, "bones_active", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop_act, "Bone"); - RNA_def_property_pointer_sdna(prop_act, NULL, "act_bone"); - RNA_def_property_flag(prop_act, PROP_EDITABLE); - RNA_def_property_ui_text(prop_act, "Active Bone", "Armatures active bone."); - RNA_def_property_pointer_funcs(prop_act, NULL, "rna_Armature_act_bone_set", NULL); - - /* todo, redraw */ - RNA_def_property_collection_active(prop, prop_act); - } + rna_def_armature_bones(brna, prop); prop= RNA_def_property(srna, "edit_bones", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "edbo", NULL); RNA_def_property_struct_type(prop, "EditBone"); RNA_def_property_ui_text(prop, "Edit Bones", ""); - - { /* Collection active property */ - prop_act= RNA_def_property(srna, "edit_bones_active", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop_act, "EditBone"); - RNA_def_property_pointer_sdna(prop_act, NULL, "act_edbone"); - RNA_def_property_flag(prop_act, PROP_EDITABLE); - RNA_def_property_ui_text(prop_act, "Active EditBone", "Armatures active edit bone."); - //RNA_def_property_update(prop_act, 0, "rna_Armature_act_editbone_update"); - RNA_def_property_pointer_funcs(prop_act, NULL, "rna_Armature_act_edit_bone_set", NULL); - RNA_def_property_collection_active(prop, prop_act); - } + rna_def_armature_edit_bones(brna, prop); /* Enum values */ // prop= RNA_def_property(srna, "rest_position", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index d78544634bc..0e298c1f6be 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -53,6 +53,18 @@ static void rna_cloth_update(bContext *C, PointerRNA *ptr) WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); } +static void rna_cloth_reset(bContext *C, PointerRNA *ptr) +{ + Object *ob= (Object*)ptr->id.data; + ClothSimSettings *settings = (ClothSimSettings*)ptr->data; + + settings->reset = 1; + + DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); +} + + static void rna_ClothSettings_max_bend_set(struct PointerRNA *ptr, float value) { ClothSimSettings *settings = (ClothSimSettings*)ptr->data; @@ -272,7 +284,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "structural_stiffness", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "structural"); - RNA_def_property_range(prop, 1.0f, 10000.0f); + RNA_def_property_range(prop, 0.0f, 10000.0f); RNA_def_property_ui_text(prop, "Structural Stiffness", "Overall stiffness of structure."); RNA_def_property_update(prop, 0, "rna_cloth_update"); @@ -311,6 +323,13 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Effector Weights", ""); + prop= RNA_def_property(srna, "pre_roll", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "preroll"); + RNA_def_property_range(prop, 0, 200); + RNA_def_property_ui_text(prop, "Pre Roll", "Simulation starts on this frame."); + RNA_def_property_update(prop, 0, "rna_cloth_reset"); + + /* unused */ /* unused still @@ -338,12 +357,6 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Effector Wind Scale", ""); */ /* unused still - prop= RNA_def_property(srna, "pre_roll", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "preroll"); - RNA_def_property_range(prop, 10, 80; - RNA_def_property_ui_text(prop, "Pre Roll", "Simulation starts on this frame."); */ - - /* unused still prop= RNA_def_property(srna, "tearing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_TEARING); RNA_def_property_ui_text(prop, "Tearing", "");*/ diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 4cef6fa481f..2a97eb78382 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -212,7 +212,7 @@ static void rna_def_curvemapping(BlenderRNA *brna) RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxy_range"); prop= RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_funcs(prop, "rna_CurveMapping_curves_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_CurveMapping_curves_length", 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_CurveMapping_curves_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_CurveMapping_curves_length", 0, 0); RNA_def_property_struct_type(prop, "CurveMap"); RNA_def_property_ui_text(prop, "Curves", ""); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 7f7976c365f..9ad06ec51d9 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -40,31 +40,30 @@ EnumPropertyItem constraint_type_items[] ={ {0, "", 0, "Transform", ""}, - {CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", ICON_CONSTRAINT_DATA, "Transformation", ""}, {CONSTRAINT_TYPE_LOCLIKE, "COPY_LOCATION", ICON_CONSTRAINT_DATA, "Copy Location", ""}, {CONSTRAINT_TYPE_ROTLIKE, "COPY_ROTATION", ICON_CONSTRAINT_DATA, "Copy Rotation", ""}, {CONSTRAINT_TYPE_SIZELIKE, "COPY_SCALE", ICON_CONSTRAINT_DATA, "Copy Scale", ""}, + {CONSTRAINT_TYPE_DISTLIMIT, "LIMIT_DISTANCE", ICON_CONSTRAINT_DATA, "Limit Distance", ""}, {CONSTRAINT_TYPE_LOCLIMIT, "LIMIT_LOCATION", ICON_CONSTRAINT_DATA, "Limit Location", ""}, {CONSTRAINT_TYPE_ROTLIMIT, "LIMIT_ROTATION", ICON_CONSTRAINT_DATA, "Limit Rotation", ""}, {CONSTRAINT_TYPE_SIZELIMIT, "LIMIT_SCALE", ICON_CONSTRAINT_DATA, "Limit Scale", ""}, - {CONSTRAINT_TYPE_DISTLIMIT, "LIMIT_DISTANCE", ICON_CONSTRAINT_DATA, "Limit Distance", ""}, + {CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", ICON_CONSTRAINT_DATA, "Transformation", ""}, {0, "", 0, "Tracking", ""}, - {CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", ICON_CONSTRAINT_DATA, "Track To", "Legacy tracking constraint prone to twisting artifacts"}, - {CONSTRAINT_TYPE_LOCKTRACK, "LOCKED_TRACK", ICON_CONSTRAINT_DATA, "Locked Track", "Tracking along a single axis"}, - {CONSTRAINT_TYPE_DAMPTRACK, "DAMPED_TRACK", ICON_CONSTRAINT_DATA, "Damped Track", "Tracking by taking the shortest path"}, {CONSTRAINT_TYPE_CLAMPTO, "CLAMP_TO", ICON_CONSTRAINT_DATA, "Clamp To", ""}, - {CONSTRAINT_TYPE_STRETCHTO, "STRETCH_TO",ICON_CONSTRAINT_DATA, "Stretch To", ""}, + {CONSTRAINT_TYPE_DAMPTRACK, "DAMPED_TRACK", ICON_CONSTRAINT_DATA, "Damped Track", "Tracking by taking the shortest path"}, {CONSTRAINT_TYPE_KINEMATIC, "IK", ICON_CONSTRAINT_DATA, "Inverse Kinematics", ""}, + {CONSTRAINT_TYPE_LOCKTRACK, "LOCKED_TRACK", ICON_CONSTRAINT_DATA, "Locked Track", "Tracking along a single axis"}, {CONSTRAINT_TYPE_SPLINEIK, "SPLINE_IK", ICON_CONSTRAINT_DATA, "Spline IK", ""}, + {CONSTRAINT_TYPE_STRETCHTO, "STRETCH_TO",ICON_CONSTRAINT_DATA, "Stretch To", ""}, + {CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", ICON_CONSTRAINT_DATA, "Track To", "Legacy tracking constraint prone to twisting artifacts"}, {0, "", 0, "Relationship", ""}, + {CONSTRAINT_TYPE_ACTION, "ACTION", ICON_CONSTRAINT_DATA, "Action", ""}, {CONSTRAINT_TYPE_CHILDOF, "CHILD_OF", ICON_CONSTRAINT_DATA, "Child Of", ""}, {CONSTRAINT_TYPE_MINMAX, "FLOOR", ICON_CONSTRAINT_DATA, "Floor", ""}, - {CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", ICON_CONSTRAINT_DATA, "Shrinkwrap", ""}, {CONSTRAINT_TYPE_FOLLOWPATH, "FOLLOW_PATH", ICON_CONSTRAINT_DATA, "Follow Path", ""}, {CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", ICON_CONSTRAINT_DATA, "Rigid Body Joint", ""}, - {CONSTRAINT_TYPE_ACTION, "ACTION", ICON_CONSTRAINT_DATA, "Action", ""}, {CONSTRAINT_TYPE_PYTHON, "SCRIPT", ICON_CONSTRAINT_DATA, "Script", ""}, - + {CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", ICON_CONSTRAINT_DATA, "Shrinkwrap", ""}, {0, NULL, 0, NULL, NULL}}; EnumPropertyItem space_pchan_items[] = { @@ -194,7 +193,7 @@ static char *rna_Constraint_path(PointerRNA *ptr) /* if constraint is in the list, the list is for the active bone... */ if ((inList) && (actlist != &ob->constraints) && (pchan)) - return BLI_sprintfN("pose.pose_channels[\"%s\"].constraints[\"%s\"]", pchan->name, con->name); + return BLI_sprintfN("pose.bones[\"%s\"].constraints[\"%s\"]", pchan->name, con->name); else return BLI_sprintfN("constraints[\"%s\"]", con->name); } @@ -287,7 +286,6 @@ static void rna_ActionConstraint_minmax_range(PointerRNA *ptr, float *min, float } } - #else EnumPropertyItem constraint_distance_items[] = { @@ -1681,9 +1679,9 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem splineik_xz_scale_mode[] = { - {CONSTRAINT_SPLINEIK_XZS_NONE, "NONE", 0, "None", "Don't scale the x and z axes, giving a volume preservation effect. (Default)"}, - {CONSTRAINT_SPLINEIK_XZS_RADIUS, "CURVE_RADIUS", 0, "Curve Radius", "Use the radius of the curve."}, - {CONSTRAINT_SPLINEIK_XZS_ORIGINAL, "ORIGINAL", 0, "Original", "Use the original scaling of the bones."}, + {CONSTRAINT_SPLINEIK_XZS_NONE, "NONE", 0, "None", "Don't scale the X and Z axes (Default)"}, + {CONSTRAINT_SPLINEIK_XZS_ORIGINAL, "BONE_ORIGINAL", 0, "Bone Original", "Use the original scaling of the bones."}, + {CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC, "VOLUME_PRESERVE", 0, "Volume Preservation", "Scale of the X and Z axes is the inverse of the Y-Scale."}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "SplineIKConstraint", "Constraint"); @@ -1703,12 +1701,16 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the chain"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); - // TODO: add access to the positions array to allow more flexible aligning? + /* direct access to bindings */ + // NOTE: only to be used by experienced users + //prop= RNA_def_property(srna, "joint_bindings", PROP_FLOAT, PROP_FACTOR); + //RNA_def_property_collection_sdna(prop, NULL, "points", "numpoints"); + //RNA_def_property_ui_text(prop, "Joint Bindings", "(EXPERIENCED USERS ONLY) The relative positions of the joints along the chain as percentages."); /* settings */ - prop= RNA_def_property(srna, "affect_root", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_ROOT); - RNA_def_property_ui_text(prop, "Affect Root", "Include the root joint in the calculations."); + prop= RNA_def_property(srna, "chain_offset", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_ROOT); + RNA_def_property_ui_text(prop, "Chain Offset", "Offset the entire chain relative to the root joint."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "even_divisions", PROP_BOOLEAN, PROP_NONE); @@ -1716,15 +1718,20 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Even Divisions", "Ignore the relative lengths of the bones when fitting to the curve."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "keep_max_length", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_SCALE_LIMITED); - RNA_def_property_ui_text(prop, "Keep Max Length", "Maintain the maximum length of the chain when spline is stretched."); + prop= RNA_def_property(srna, "y_streching", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_SCALE_LIMITED); + RNA_def_property_ui_text(prop, "Y Stretch", "Stretch the Y axis of the bones to fit the curve."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + prop= RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_CURVERAD); + RNA_def_property_ui_text(prop, "Use Curve Radius", "Average radius of the endpoints is used to tweak the X and Z Scaling of the bones, on top of XZ Scale mode."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "xz_scaling_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "xzScaleMode"); RNA_def_property_enum_items(prop, splineik_xz_scale_mode); - RNA_def_property_ui_text(prop, "XZ Scale Mode", "Method used for determining the scaling of the X and Z axes of the bone."); + RNA_def_property_ui_text(prop, "XZ Scale Mode", "Method used for determining the scaling of the X and Z axes of the bones."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 2ebf47bac99..4c7a88d304b 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -67,6 +67,8 @@ EnumPropertyItem beztriple_keyframe_type_items[] = { #include "WM_api.h" +#include "MEM_guardedalloc.h" + static StructRNA *rna_Curve_refine(PointerRNA *ptr) { Curve *cu= (Curve*)ptr->data; @@ -227,6 +229,38 @@ static void rna_Curve_update_deps(bContext *C, PointerRNA *ptr) rna_Curve_update_data(C, ptr); } +/* name functions that ignore the first two ID characters */ +void rna_Curve_body_get(PointerRNA *ptr, char *value) +{ + Curve *cu= (Curve*)ptr->id.data; + strcpy(value, cu->str); +} + +int rna_Curve_body_length(PointerRNA *ptr) +{ + Curve *cu= (Curve*)ptr->id.data; + return strlen(cu->str); +} + +/* TODO - check UTF & python play nice */ +void rna_Curve_body_set(PointerRNA *ptr, const char *value) +{ + int len= strlen(value); + Curve *cu= (Curve*)ptr->id.data; + + cu->pos = len; + cu->len = len; + + if(cu->str) MEM_freeN(cu->str); + if(cu->strinfo) MEM_freeN(cu->strinfo); + + cu->str = MEM_callocN(len + sizeof(wchar_t), "str"); + cu->strinfo = MEM_callocN( (len+4) *sizeof(CharInfo), "strinfo"); /* don't know why this is +4, just duplicating load_editText() */ + + //wcs2utf8s(cu->str, value); // value is not wchar_t + BLI_strncpy(cu->str, value, len+1); +} + static void rna_Nurb_update_handle_data(bContext *C, PointerRNA *ptr) { Nurb *nu= (Nurb*)ptr->data; @@ -257,8 +291,6 @@ static void rna_Nurb_update_knot_v(bContext *C, PointerRNA *ptr) rna_Curve_update_data(C, ptr); } - - #else static void rna_def_bpoint(BlenderRNA *brna) @@ -546,12 +578,13 @@ static void rna_def_font(BlenderRNA *brna, StructRNA *srna) RNA_def_property_ui_text(prop, "Object Font", "Use Blender Objects as font characters. Give font objects a common name followed by the character it represents, eg. familya, familyb etc, and turn on Verts Duplication"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); - prop= RNA_def_property(srna, "str", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "body", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "str"); - RNA_def_property_ui_text(prop, "String", ""); - RNA_def_property_string_funcs(prop, "rna_ID_name_get", "rna_ID_name_length", "rna_ID_name_set"); + RNA_def_property_ui_text(prop, "Body Text", "contence of this text object"); + RNA_def_property_string_funcs(prop, "rna_Curve_body_get", "rna_Curve_body_length", "rna_Curve_body_set"); RNA_def_property_string_maxlength(prop, 8192); /* note that originally str did not have a limit! */ RNA_def_struct_name_property(srna, prop); + RNA_def_property_update(prop, 0, "rna_Curve_update_data"); /* pointers */ prop= RNA_def_property(srna, "text_on_curve", PROP_POINTER, PROP_NONE); @@ -856,7 +889,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna) prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "bp", NULL); RNA_def_property_struct_type(prop, "CurvePoint"); - RNA_def_property_collection_funcs(prop, "rna_BPoint_array_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_Nurb_length", 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_BPoint_array_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_Nurb_length", 0, 0); RNA_def_property_ui_text(prop, "Points", "Collection of points that make up this poly or nurbs spline."); prop= RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 46c4a8af73a..891911d5765 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -654,7 +654,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * if(DefRNA.preprocess) { RNA_def_property_struct_type(prop, "Property"); - RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next", "rna_iterator_listbase_end", "rna_builtin_properties_get", 0, 0, "rna_builtin_properties_lookup_string", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next", "rna_iterator_listbase_end", "rna_builtin_properties_get", 0, 0, "rna_builtin_properties_lookup_string"); } else { #ifdef RNA_RUNTIME @@ -662,7 +662,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * cprop->begin= rna_builtin_properties_begin; cprop->next= rna_builtin_properties_next; cprop->get= rna_builtin_properties_get; - cprop->type= &RNA_Property; + cprop->item_type= &RNA_Property; #endif } @@ -1158,7 +1158,7 @@ void RNA_def_property_struct_type(PropertyRNA *prop, const char *type) } case PROP_COLLECTION: { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; - cprop->type = (StructRNA*)type; + cprop->item_type = (StructRNA*)type; break; } default: @@ -1189,7 +1189,7 @@ void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type) } case PROP_COLLECTION: { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; - cprop->type = type; + cprop->item_type = type; break; } default: @@ -1926,7 +1926,7 @@ void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const ch } } -void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *add, const char *remove) +void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring) { StructRNA *srna= DefRNA.laststruct; @@ -1946,8 +1946,6 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con if(length) cprop->length= (PropCollectionLengthFunc)length; if(lookupint) cprop->lookupint= (PropCollectionLookupIntFunc)lookupint; if(lookupstring) cprop->lookupstring= (PropCollectionLookupStringFunc)lookupstring; - if(add) cprop->add= (FunctionRNA*)add; - if(remove) cprop->remove= (FunctionRNA*)remove; break; } default: @@ -1957,24 +1955,9 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con } } -void RNA_def_property_collection_active(PropertyRNA *prop, PropertyRNA *prop_act) +void RNA_def_property_srna(PropertyRNA *prop, const char *type) { - if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_collection_active: only during preprocessing.\n"); - return; - } - - switch(prop->type) { - case PROP_COLLECTION: { - CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; - cprop->active= prop_act; - break; - } - default: - fprintf(stderr, "RNA_def_property_collection_active: %s.%s, type is not collection.\n", prop->identifier, prop_act->identifier); - DefRNA.error= 1; - break; - } + prop->srna= (StructRNA*)type; } /* Compact definitions */ diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index cdaebb2a3db..67d562da23b 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -34,6 +34,7 @@ #include "DNA_anim_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_sound_types.h" #include "MEM_guardedalloc.h" @@ -49,6 +50,7 @@ EnumPropertyItem fmodifier_type_items[] = { {FMODIFIER_TYPE_FILTER, "FILTER", 0, "Filter", ""}, {FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""}, {FMODIFIER_TYPE_LIMITS, "LIMITS", 0, "Limits", ""}, + {FMODIFIER_TYPE_SOUND, "SOUND", 0, "Sound", ""}, {0, NULL, 0, NULL, NULL}}; #ifdef RNA_RUNTIME @@ -76,6 +78,8 @@ static StructRNA *rna_FModifierType_refine(struct PointerRNA *ptr) return &RNA_FModifierPython; case FMODIFIER_TYPE_LIMITS: return &RNA_FModifierLimits; + case FMODIFIER_TYPE_SOUND: + return &RNA_FModifierSound; default: return &RNA_UnknownType; } @@ -111,6 +115,16 @@ static int rna_DriverTarget_id_editable(PointerRNA *ptr) return (dtar->idtype)? PROP_EDITABLE : 0; } +static void rna_DriverTarget_id_type_set(PointerRNA *ptr, int value) +{ + DriverTarget *data= (DriverTarget*)(ptr->data); + + /* set the driver type, then clear the id-block if the type is invalid */ + data->idtype= value; + if ((data->id) && (GS(data->id->name) != data->idtype)) + data->id= NULL; +} + static void rna_DriverTarget_RnaPath_get(PointerRNA *ptr, char *value) { DriverTarget *dtar= (DriverTarget *)ptr->data; @@ -180,9 +194,43 @@ static void rna_FCurve_RnaPath_set(PointerRNA *ptr, const char *value) fcu->rna_path= NULL; } -#else +DriverTarget *rna_Driver_new_target(ChannelDriver *driver) +{ + return driver_add_new_target(driver); +} + +void rna_Driver_remove_target(ChannelDriver *driver, DriverTarget *dtar) +{ + /* call the API function for this */ + driver_free_target(driver, dtar); +} +static PointerRNA rna_FCurve_active_modifier_get(PointerRNA *ptr) +{ + FCurve *fcu= (FCurve*)ptr->data; + FModifier *fcm= find_active_fmodifier(&fcu->modifiers); + return rna_pointer_inherit_refine(ptr, &RNA_FModifier, fcm); +} + +static void rna_FCurve_active_modifier_set(PointerRNA *ptr, PointerRNA value) +{ + FCurve *fcu= (FCurve*)ptr->data; + set_active_fmodifier(&fcu->modifiers, (FModifier *)value.data); +} + +static FModifier *rna_FCurve_modifiers_new(FCurve *fcu, bContext *C, int type) +{ + return add_fmodifier(&fcu->modifiers, type); +} + +static int rna_FCurve_modifiers_remove(FCurve *fcu, bContext *C, int index) +{ + return remove_fmodifier_index(&fcu->modifiers, index); +} + +#else + static void rna_def_fmodifier_generator(BlenderRNA *brna) { StructRNA *srna; @@ -491,6 +539,46 @@ static void rna_def_fmodifier_noise(BlenderRNA *brna) /* --------- */ +static void rna_def_fmodifier_sound(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem prop_modification_items[] = { + {FCM_SOUND_MODIF_REPLACE, "REPLACE", 0, "Replace", ""}, + {FCM_SOUND_MODIF_ADD, "ADD", 0, "Add", ""}, + {FCM_SOUND_MODIF_SUBTRACT, "SUBTRACT", 0, "Subtract", ""}, + {FCM_SOUND_MODIF_MULTIPLY, "MULTIPLY", 0, "Multiply", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "FModifierSound", "FModifier"); + RNA_def_struct_ui_text(srna, "Sound F-Modifier", "Modifies an F-Curve based on the amplitudes in a sound."); + RNA_def_struct_sdna_from(srna, "FMod_Sound", "data"); + + prop= RNA_def_property(srna, "modification", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, prop_modification_items); + RNA_def_property_ui_text(prop, "Modification", "Method of modifying the existing F-Curve."); + RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); + + prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "strength"); + RNA_def_property_ui_text(prop, "Strength", "Amplitude of the sound - the amount that it modifies the underlying curve"); + RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); + + prop= RNA_def_property(srna, "delay", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "delay"); + RNA_def_property_ui_text(prop, "delay", "The delay before the sound curve modification should start"); + RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); + + prop= RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Sound"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Sound", "Sound datablock used by this modifier."); + +} + +/* --------- */ + static void rna_def_fmodifier(BlenderRNA *brna) { StructRNA *srna; @@ -568,6 +656,7 @@ static void rna_def_drivertarget(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "idtype"); RNA_def_property_enum_items(prop, id_type_items); RNA_def_property_enum_default(prop, ID_OB); + RNA_def_property_enum_funcs(prop, NULL, "rna_DriverTarget_id_type_set", NULL); RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used."); //RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates @@ -582,6 +671,38 @@ static void rna_def_drivertarget(BlenderRNA *brna) //RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates } + +/* channeldriver.targets.* */ +static void rna_def_channeldriver_targets(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; +// PropertyRNA *prop; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "ChannelDriverTargets"); + srna= RNA_def_struct(brna, "ChannelDriverTargets", NULL); + RNA_def_struct_sdna(srna, "ChannelDriver"); + RNA_def_struct_ui_text(srna, "ChannelDriver Targets", "Collection of channel driver Targets."); + + + /* add target */ + func= RNA_def_function(srna, "new", "rna_Driver_new_target"); + RNA_def_function_ui_description(func, "Add a new target for the driver."); + /* return type */ + parm= RNA_def_pointer(func, "target", "DriverTarget", "", "Newly created Driver Target."); + RNA_def_function_return(func, parm); + + /* remove target */ + func= RNA_def_function(srna, "remove", "rna_Driver_remove_target"); + RNA_def_function_ui_description(func, "Remove an existing target from the driver."); + /* target to remove*/ + parm= RNA_def_pointer(func, "target", "DriverTarget", "", "Target to remove from the driver."); + RNA_def_property_flag(parm, PROP_REQUIRED); + +} + static void rna_def_channeldriver(BlenderRNA *brna) { StructRNA *srna; @@ -611,9 +732,9 @@ static void rna_def_channeldriver(BlenderRNA *brna) /* Collections */ prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "targets", NULL); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "add_target", "remove_target"); RNA_def_property_struct_type(prop, "DriverTarget"); RNA_def_property_ui_text(prop, "Target Variables", "Properties acting as targets for this driver."); + rna_def_channeldriver_targets(brna, prop); /* Functions */ RNA_api_drivers(srna); @@ -642,6 +763,52 @@ static void rna_def_fpoint(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Point", "Point coordinates"); } +/* channeldriver.targets.* */ +static void rna_def_fcurve_modifiers(BlenderRNA *brna, PropertyRNA *cprop) +{ + /* add target */ + StructRNA *srna; + PropertyRNA *prop; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "FCurveModifiers"); + srna= RNA_def_struct(brna, "FCurveModifiers", NULL); + RNA_def_struct_sdna(srna, "FCurve"); + RNA_def_struct_ui_text(srna, "FCurve Modifiers", "Collection of fcurve modifiers."); + + + /* Collection active property */ + prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "FModifier"); + RNA_def_property_pointer_funcs(prop, "rna_FCurve_active_modifier_get", "rna_FCurve_active_modifier_set", NULL); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Active fcurve modifier", "Active fcurve modifier."); + + + /* Constraint collection */ + func= RNA_def_function(srna, "new", "rna_FCurve_modifiers_new"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_function_ui_description(func, "Add a constraint to this object"); + /* return type */ + parm= RNA_def_pointer(func, "fmodifier", "FModifier", "", "New fmodifier."); + RNA_def_function_return(func, parm); + /* object to add */ + parm= RNA_def_enum(func, "type", fmodifier_type_items, 1, "", "Constraint type to add."); + RNA_def_property_flag(parm, PROP_REQUIRED); + + func= RNA_def_function(srna, "remove", "rna_FCurve_modifiers_remove"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_function_ui_description(func, "Remove a modifier from this fcurve."); + /* return type */ + parm= RNA_def_boolean(func, "success", 0, "Success", "Removed the constraint successfully."); + RNA_def_function_return(func, parm); + /* object to add */ + parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "", 0, INT_MAX); + RNA_def_property_flag(parm, PROP_REQUIRED); +} + static void rna_def_fcurve(BlenderRNA *brna) { StructRNA *srna; @@ -703,6 +870,8 @@ static void rna_def_fcurve(BlenderRNA *brna) prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "FModifier"); RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the shape of the F-Curve."); + + rna_def_fcurve_modifiers(brna, prop); } /* *********************** */ @@ -725,6 +894,7 @@ void RNA_def_fcurve(BlenderRNA *brna) rna_def_fmodifier_python(brna); rna_def_fmodifier_limits(brna); rna_def_fmodifier_noise(brna); + rna_def_fmodifier_sound(brna); } diff --git a/source/blender/makesrna/intern/rna_fcurve_api.c b/source/blender/makesrna/intern/rna_fcurve_api.c index 12ffb3e26fb..d066d4f63fb 100644 --- a/source/blender/makesrna/intern/rna_fcurve_api.c +++ b/source/blender/makesrna/intern/rna_fcurve_api.c @@ -43,48 +43,12 @@ #include "BKE_animsys.h" #include "BKE_fcurve.h" -DriverTarget *rna_Driver_add_target(ChannelDriver *driver, char *name) -{ - DriverTarget *dtar= driver_add_new_target(driver); - - /* set the name if given */ - if (name && name[0]) { - BLI_strncpy(dtar->name, name, 64); - BLI_uniquename(&driver->targets, dtar, "var", '_', offsetof(DriverTarget, name), 64); - } - - /* return this target for the users to play with */ - return dtar; -} - -void rna_Driver_remove_target(ChannelDriver *driver, DriverTarget *dtar) -{ - /* call the API function for this */ - driver_free_target(driver, dtar); -} - #else void RNA_api_drivers(StructRNA *srna) { - FunctionRNA *func; - PropertyRNA *parm; - - /* add target */ - func= RNA_def_function(srna, "add_target", "rna_Driver_add_target"); - RNA_def_function_ui_description(func, "Add a new target for the driver."); - /* return type */ - parm= RNA_def_pointer(func, "target", "DriverTarget", "", "Newly created Driver Target."); - RNA_def_function_return(func, parm); - /* optional name parameter */ - parm= RNA_def_string(func, "name", "", 64, "Name", "Name to use in scripted expressions/functions. (No spaces or dots are allowed. Also, must not start with a symbol or digit)"); - - /* remove target */ - func= RNA_def_function(srna, "remove_target", "rna_Driver_remove_target"); - RNA_def_function_ui_description(func, "Remove an existing target from the driver."); - /* target to remove*/ - parm= RNA_def_pointer(func, "target", "DriverTarget", "", "Target to remove from the driver."); - RNA_def_property_flag(parm, PROP_REQUIRED); +// FunctionRNA *func; +// PropertyRNA *parm; } #endif diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c index dddc2062f07..a05485986d1 100644 --- a/source/blender/makesrna/intern/rna_group.c +++ b/source/blender/makesrna/intern/rna_group.c @@ -33,6 +33,14 @@ #ifdef RNA_RUNTIME +#include "DNA_scene_types.h" +#include "DNA_object_types.h" + +#include "BKE_group.h" + +#include "WM_api.h" +#include "WM_types.h" + static PointerRNA rna_Group_objects_get(CollectionPropertyIterator *iter) { ListBaseIterator *internal= iter->internal; @@ -41,8 +49,60 @@ static PointerRNA rna_Group_objects_get(CollectionPropertyIterator *iter) return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((GroupObject*)internal->link)->ob); } +static void rna_Group_objects_link(Group *group, bContext *C, ReportList *reports, Object *object) +{ + if(!add_to_group(group, object, CTX_data_scene(C), NULL)) { + BKE_reportf(reports, RPT_ERROR, "Object \"%s\" already in group \"%s\".", object->id.name+2, group->id.name+2); + return; + } + + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, &object->id); +} + +static void rna_Group_objects_unlink(Group *group, bContext *C, ReportList *reports, Object *object) +{ + if(!rem_from_group(group, object, CTX_data_scene(C), NULL)) { + BKE_reportf(reports, RPT_ERROR, "Object \"%s\" not in group \"%s\".", object->id.name+2, group->id.name+2); + return; + } + + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, &object->id); +} + #else +/* group.objects */ +static void rna_def_group_objects(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; +// PropertyRNA *prop; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "GroupObjects"); + srna= RNA_def_struct(brna, "GroupObjects", NULL); + RNA_def_struct_sdna(srna, "Group"); + RNA_def_struct_ui_text(srna, "Group Objects", "Collection of group objects."); + + /* add object */ + func= RNA_def_function(srna, "link", "rna_Group_objects_link"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Add this object to a group"); + /* object to add */ + parm= RNA_def_pointer(func, "object", "Object", "", "Object to add."); + RNA_def_property_flag(parm, PROP_REQUIRED); + + /* remove object */ + func= RNA_def_function(srna, "unlink", "rna_Group_objects_unlink"); + RNA_def_function_ui_description(func, "Remove this object to a group"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); + /* object to remove */ + parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED); +} + + void RNA_def_group(BlenderRNA *brna) { StructRNA *srna; @@ -56,17 +116,21 @@ void RNA_def_group(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "dupli_ofs"); RNA_def_property_ui_text(prop, "Dupli Offset", "Offset from the center to use when instancing as DupliGroup."); RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4); - + + prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_LAYER); + RNA_def_property_boolean_sdna(prop, NULL, "layer", 1); + RNA_def_property_array(prop, 20); + RNA_def_property_ui_text(prop, "Dupli Layers", "Layers visible when this groups is instanced as a dupli."); + + prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "gobject", NULL); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Objects", "A collection of this groups objects."); - RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Group_objects_get", 0, 0, 0, 0, 0); - - prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_LAYER); - RNA_def_property_boolean_sdna(prop, NULL, "layer", 1); - RNA_def_property_array(prop, 20); - RNA_def_property_ui_text(prop, "Dupli Layers", "Layers visible when this groups is instanced as a dupli."); + RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Group_objects_get", 0, 0, 0); + + rna_def_group_objects(brna, prop); + } #endif diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index d90b4f17c85..64af7e07fd5 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -213,6 +213,7 @@ void RNA_api_main(struct StructRNA *srna); void RNA_api_material(StructRNA *srna); void RNA_api_mesh(struct StructRNA *srna); void RNA_api_object(struct StructRNA *srna); +void RNA_api_pose_channel(struct StructRNA *srna); void RNA_api_scene(struct StructRNA *srna); void RNA_api_text(struct StructRNA *srna); void RNA_api_ui_layout(struct StructRNA *srna); diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index 434e4ee6fe9..46ed1fa055f 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -47,6 +47,10 @@ struct GHash; #define RNA_MAX_ARRAY_DIMENSION 3 + +/* store local properties here */ +#define RNA_IDP_UI "_RNA_UI" + /* Function Callbacks */ typedef void (*UpdateFunc)(struct bContext *C, struct PointerRNA *ptr); @@ -154,6 +158,11 @@ struct PropertyRNA { /* raw access */ int rawoffset; RawPropertyType rawtype; + + /* This is used for accessing props/functions of this property + * any property can have this but should only be used for collections and arrays + * since python will convert int/bool/pointer's */ + struct StructRNA *srna; /* attributes attached directly to this collection */ }; /* Property Types */ @@ -255,11 +264,8 @@ typedef struct CollectionPropertyRNA { PropCollectionLengthFunc length; /* optional */ PropCollectionLookupIntFunc lookupint; /* optional */ PropCollectionLookupStringFunc lookupstring; /* optional */ - FunctionRNA *add, *remove; - PropertyRNA *active; - - struct StructRNA *type; + struct StructRNA *item_type; /* the type of this item */ } CollectionPropertyRNA; diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index ca36da5d03b..49dd96241cd 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -434,7 +434,7 @@ static void rna_def_keyblock(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "data", "totelem"); RNA_def_property_struct_type(prop, "UnknownType"); RNA_def_property_ui_text(prop, "Data", ""); - RNA_def_property_collection_funcs(prop, "rna_ShapeKey_data_begin", 0, 0, "rna_ShapeKey_data_get", "rna_ShapeKey_data_length", 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_ShapeKey_data_begin", 0, 0, "rna_ShapeKey_data_get", "rna_ShapeKey_data_length", 0, 0); } static void rna_def_key(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index 1f7eee4d2d8..aff38ebdd74 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -183,7 +183,7 @@ static void rna_def_latticepoint(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Lattice_update_data"); prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_funcs(prop, "rna_LatticePoint_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_LatticePoint_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0); RNA_def_property_struct_type(prop, "VertexGroupElement"); RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this point is member of."); } @@ -254,7 +254,7 @@ static void rna_def_lattice(BlenderRNA *brna) prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "LatticePoint"); - RNA_def_property_collection_funcs(prop, "rna_Lattice_points_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Lattice_points_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0); RNA_def_property_ui_text(prop, "Points", "Points of the lattice."); } diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 910a15890cb..82988a06af9 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -129,11 +129,13 @@ static void rna_Main_camera_begin(CollectionPropertyIterator *iter, PointerRNA * rna_iterator_listbase_begin(iter, &bmain->camera, NULL); } +#if 0 static void rna_Main_key_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { Main *bmain= (Main*)ptr->data; rna_iterator_listbase_begin(iter, &bmain->key, NULL); } +#endif static void rna_Main_world_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { @@ -238,35 +240,35 @@ void RNA_def_main(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - const char *lists[][7]= { - {"cameras", "Camera", "rna_Main_camera_begin", "Cameras", "Camera datablocks.", NULL, NULL}, - {"scenes", "Scene", "rna_Main_scene_begin", "Scenes", "Scene datablocks.", NULL, NULL}, - {"objects", "Object", "rna_Main_object_begin", "Objects", "Object datablocks.", NULL, NULL}, - {"materials", "Material", "rna_Main_mat_begin", "Materials", "Material datablocks.", NULL, NULL}, - {"nodegroups", "NodeTree", "rna_Main_nodetree_begin", "Node Groups", "Node group datablocks.", NULL, NULL}, - {"meshes", "Mesh", "rna_Main_mesh_begin", "Meshes", "Mesh datablocks.", "add_mesh", "remove_mesh"}, - {"lamps", "Lamp", "rna_Main_lamp_begin", "Lamps", "Lamp datablocks.", NULL, NULL}, - {"libraries", "Library", "rna_Main_library_begin", "Libraries", "Library datablocks.", NULL, NULL}, - {"screens", "Screen", "rna_Main_screen_begin", "Screens", "Screen datablocks.", NULL, NULL}, - {"windowmanagers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager datablocks.", NULL, NULL}, - {"images", "Image", "rna_Main_image_begin", "Images", "Image datablocks.", NULL, NULL}, - {"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice datablocks.", NULL, NULL}, - {"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve datablocks.", NULL, NULL} , - {"metaballs", "MetaBall", "rna_Main_mball_begin", "Metaballs", "Metaball datablocks.", NULL, NULL}, - {"vfonts", "VectorFont", "rna_Main_vfont_begin", "Vector Fonts", "Vector font datablocks.", NULL, NULL}, - {"textures", "Texture", "rna_Main_tex_begin", "Textures", "Texture datablocks.", NULL, NULL}, - {"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush datablocks.", NULL, NULL}, - {"worlds", "World", "rna_Main_world_begin", "Worlds", "World datablocks.", NULL, NULL}, - {"groups", "Group", "rna_Main_group_begin", "Groups", "Group datablocks.", NULL, NULL}, - {"keys", "Key", "rna_Main_key_begin", "Keys", "Key datablocks.", NULL, NULL}, - {"scripts", "ID", "rna_Main_script_begin", "Scripts", "Script datablocks (DEPRECATED).", NULL, NULL}, - {"texts", "Text", "rna_Main_text_begin", "Texts", "Text datablocks.", NULL, NULL}, - {"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound datablocks.", NULL, NULL}, - {"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks.", NULL, NULL}, - {"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks.", NULL, NULL}, - {"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle datablocks.", NULL, NULL}, - {"gpencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil datablocks.", NULL, NULL}, - {NULL, NULL, NULL, NULL, NULL, NULL, NULL}}; + const char *lists[][5]= { + {"cameras", "Camera", "rna_Main_camera_begin", "Cameras", "Camera datablocks."}, + {"scenes", "Scene", "rna_Main_scene_begin", "Scenes", "Scene datablocks."}, + {"objects", "Object", "rna_Main_object_begin", "Objects", "Object datablocks."}, + {"materials", "Material", "rna_Main_mat_begin", "Materials", "Material datablocks."}, + {"nodegroups", "NodeTree", "rna_Main_nodetree_begin", "Node Groups", "Node group datablocks."}, + {"meshes", "Mesh", "rna_Main_mesh_begin", "Meshes", "Mesh datablocks."}, // "add_mesh", "remove_mesh" + {"lamps", "Lamp", "rna_Main_lamp_begin", "Lamps", "Lamp datablocks."}, + {"libraries", "Library", "rna_Main_library_begin", "Libraries", "Library datablocks."}, + {"screens", "Screen", "rna_Main_screen_begin", "Screens", "Screen datablocks."}, + {"windowmanagers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager datablocks."}, + {"images", "Image", "rna_Main_image_begin", "Images", "Image datablocks."}, + {"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice datablocks."}, + {"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve datablocks."} , + {"metaballs", "MetaBall", "rna_Main_mball_begin", "Metaballs", "Metaball datablocks."}, + {"vfonts", "VectorFont", "rna_Main_vfont_begin", "Vector Fonts", "Vector font datablocks."}, + {"textures", "Texture", "rna_Main_tex_begin", "Textures", "Texture datablocks."}, + {"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush datablocks."}, + {"worlds", "World", "rna_Main_world_begin", "Worlds", "World datablocks."}, + {"groups", "Group", "rna_Main_group_begin", "Groups", "Group datablocks."}, +/* {"keys", "Key", "rna_Main_key_begin", "Keys", "Key datablocks."}, */ + {"scripts", "ID", "rna_Main_script_begin", "Scripts", "Script datablocks (DEPRECATED)."}, + {"texts", "Text", "rna_Main_text_begin", "Texts", "Text datablocks."}, + {"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound datablocks."}, + {"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks."}, + {"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks."}, + {"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle datablocks."}, + {"gpencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil datablocks."}, + {NULL, NULL, NULL, NULL, NULL}}; int i; srna= RNA_def_struct(brna, "Main", NULL); @@ -283,7 +285,7 @@ void RNA_def_main(BlenderRNA *brna) { prop= RNA_def_property(srna, lists[i][0], PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, lists[i][1]); - RNA_def_property_collection_funcs(prop, lists[i][2], "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, lists[i][5], lists[i][6]); + RNA_def_property_collection_funcs(prop, lists[i][2], "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); RNA_def_property_ui_text(prop, lists[i][3], lists[i][4]); } diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index e311cad4568..5ff8bffe715 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -1437,7 +1437,7 @@ static void rna_def_material_physics(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Material Physics", "Physics settings for a Material datablock."); prop= RNA_def_property(srna, "align_to_normal", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FH_NOR); + RNA_def_property_boolean_sdna(prop, NULL, "dynamode", MA_FH_NOR); RNA_def_property_ui_text(prop, "Align to Normal", "Align dynamic game objects along the surface normal, when inside the physics distance area"); prop= RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE); @@ -1748,7 +1748,7 @@ void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeg /* mtex */ prop= RNA_def_property(srna, "textures", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, structname); - RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", 0, 0, 0); RNA_def_property_ui_text(prop, "Textures", "Texture slots defining the mapping and influence of textures."); prop= RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index d192be5e81e..d6c41fa4368 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -904,7 +904,7 @@ static void rna_def_mvert(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_funcs(prop, "rna_MeshVertex_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_MeshVertex_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0); RNA_def_property_struct_type(prop, "VertexGroupElement"); RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this vertex is member of."); @@ -1079,7 +1079,7 @@ static void rna_def_mtexpoly(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshTextureFace"); RNA_def_property_ui_text(prop, "Data", ""); - RNA_def_property_collection_funcs(prop, "rna_MeshTextureFaceLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshTextureFaceLayer_data_length", 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_MeshTextureFaceLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshTextureFaceLayer_data_length", 0, 0); srna= RNA_def_struct(brna, "MeshTextureFace", NULL); RNA_def_struct_sdna(srna, "MTexPoly"); @@ -1228,7 +1228,7 @@ static void rna_def_mloopcol(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshColor"); RNA_def_property_ui_text(prop, "Data", ""); - RNA_def_property_collection_funcs(prop, "rna_MeshColorLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshColorLayer_data_length", 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_MeshColorLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshColorLayer_data_length", 0, 0); srna= RNA_def_struct(brna, "MeshColor", NULL); RNA_def_struct_sdna(srna, "MCol"); @@ -1257,7 +1257,7 @@ static void rna_def_mproperties(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshFloatProperty"); RNA_def_property_ui_text(prop, "Data", ""); - RNA_def_property_collection_funcs(prop, "rna_MeshFloatPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshFloatPropertyLayer_data_length", 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_MeshFloatPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshFloatPropertyLayer_data_length", 0, 0); srna= RNA_def_struct(brna, "MeshFloatProperty", NULL); RNA_def_struct_sdna(srna, "MFloatProperty"); @@ -1283,7 +1283,7 @@ static void rna_def_mproperties(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshIntProperty"); RNA_def_property_ui_text(prop, "Data", ""); - RNA_def_property_collection_funcs(prop, "rna_MeshIntPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshIntPropertyLayer_data_length", 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_MeshIntPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshIntPropertyLayer_data_length", 0, 0); srna= RNA_def_struct(brna, "MeshIntProperty", NULL); RNA_def_struct_sdna(srna, "MIntProperty"); @@ -1309,7 +1309,7 @@ static void rna_def_mproperties(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshStringProperty"); RNA_def_property_ui_text(prop, "Data", ""); - RNA_def_property_collection_funcs(prop, "rna_MeshStringPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshStringPropertyLayer_data_length", 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_MeshStringPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshStringPropertyLayer_data_length", 0, 0); srna= RNA_def_struct(brna, "MeshStringProperty", NULL); RNA_def_struct_sdna(srna, "MStringProperty"); @@ -1395,7 +1395,7 @@ static void rna_def_mesh(BlenderRNA *brna) /* UV textures */ prop= RNA_def_property(srna, "uv_textures", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", 0, 0, 0, "rna_Mesh_uv_textures_length", 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", 0, 0, 0, "rna_Mesh_uv_textures_length", 0, 0); RNA_def_property_struct_type(prop, "MeshTextureFaceLayer"); RNA_def_property_ui_text(prop, "UV Textures", ""); @@ -1415,7 +1415,7 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "vertex_colors", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", 0, 0, 0, "rna_Mesh_vertex_colors_length", 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", 0, 0, 0, "rna_Mesh_vertex_colors_length", 0, 0); RNA_def_property_struct_type(prop, "MeshColorLayer"); RNA_def_property_ui_text(prop, "Vertex Colors", ""); @@ -1433,19 +1433,19 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "float_layers", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", 0, 0, 0, "rna_Mesh_float_layers_length", 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", 0, 0, 0, "rna_Mesh_float_layers_length", 0, 0); RNA_def_property_struct_type(prop, "MeshFloatPropertyLayer"); RNA_def_property_ui_text(prop, "Float Property Layers", ""); prop= RNA_def_property(srna, "int_layers", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", 0, 0, 0, "rna_Mesh_int_layers_length", 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", 0, 0, 0, "rna_Mesh_int_layers_length", 0, 0); RNA_def_property_struct_type(prop, "MeshIntPropertyLayer"); RNA_def_property_ui_text(prop, "Int Property Layers", ""); prop= RNA_def_property(srna, "string_layers", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", 0, 0, 0, "rna_Mesh_string_layers_length", 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", 0, 0, 0, "rna_Mesh_string_layers_length", 0, 0); RNA_def_property_struct_type(prop, "MeshStringPropertyLayer"); RNA_def_property_ui_text(prop, "String Property Layers", ""); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index a35bde95c7b..690a2b667ef 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -216,8 +216,17 @@ static void rna_Smoke_set_type(bContext *C, PointerRNA *ptr) smokeModifier_free(smd); // XXX TODO: completely free all 3 pointers smokeModifier_createType(smd); // create regarding of selected type - if(smd->type & MOD_SMOKE_TYPE_DOMAIN) - ob->dt = OB_WIRE; + switch (smd->type) { + case MOD_SMOKE_TYPE_DOMAIN: + ob->dt = OB_WIRE; + break; + case MOD_SMOKE_TYPE_FLOW: + case MOD_SMOKE_TYPE_COLL: + case 0: + default: + ob->dt = OB_SHADED; + break; + } // update dependancy since a domain - other type switch could have happened rna_Modifier_dependency_update(C, ptr); @@ -507,7 +516,7 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna) prop= RNA_def_property(srna, "subsurf_uv", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_SubsurfUv); - RNA_def_property_ui_text(prop, "Subsurf UV", "Use subsurf to subdivide UVs."); + RNA_def_property_ui_text(prop, "Subdivide UVs", "Use subsurf to subdivide UVs."); RNA_def_property_update(prop, 0, "rna_Modifier_update"); } @@ -669,7 +678,7 @@ static void rna_def_modifier_mirror(BlenderRNA *brna) prop= RNA_def_property(srna, "merge_limit", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "tolerance"); RNA_def_property_range(prop, 0, FLT_MAX); - RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_range(prop, 0, 1, 0.01, 6); RNA_def_property_ui_text(prop, "Merge Limit", "Distance from axis within which mirrored vertices are merged."); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -1224,7 +1233,7 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna) prop= RNA_def_property(srna, "projectors", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "UVProjector"); - RNA_def_property_collection_funcs(prop, "rna_UVProject_projectors_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_UVProject_projectors_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0); RNA_def_property_ui_text(prop, "Projectors", ""); prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); @@ -1843,9 +1852,9 @@ static void rna_def_modifier_mask(BlenderRNA *brna) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskModifier_vgroup_set"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop= RNA_def_property(srna, "inverse", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MASK_INV); - RNA_def_property_ui_text(prop, "Inverse", "Use vertices that are not part of region defined."); + RNA_def_property_ui_text(prop, "Invert", "Use vertices that are not part of region defined."); RNA_def_property_update(prop, 0, "rna_Modifier_update"); } diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index e5b8ce3be0b..1aec395b43f 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -36,90 +36,13 @@ #include "DNA_scene_types.h" #include "DNA_texture_types.h" +#include "BKE_animsys.h" #include "BKE_main.h" #include "BKE_node.h" #include "BKE_image.h" #include "BKE_texture.h" -static EnumPropertyItem node_blend_type_items[] = { - { 0, "MIX", 0, "Mix", ""}, - { 1, "ADD", 0, "Add", ""}, - { 3, "SUBTRACT", 0, "Subtract", ""}, - { 2, "MULTIPLY", 0, "Multiply", ""}, - { 4, "SCREEN", 0, "Screen", ""}, - { 9, "OVERLAY", 0, "Overlay", ""}, - { 5, "DIVIDE", 0, "Divide", ""}, - { 6, "DIFFERENCE", 0, "Difference", ""}, - { 7, "DARKEN", 0, "Darken", ""}, - { 8, "LIGHTEN", 0, "Lighten", ""}, - {10, "DODGE", 0, "Dodge", ""}, - {11, "BURN", 0, "Burn", ""}, - {15, "COLOR", 0, "Color", ""}, - {14, "VALUE", 0, "Value", ""}, - {13, "SATURATION", 0, "Saturation", ""}, - {12, "HUE", 0, "Hue", ""}, - {16, "SOFT_LIGHT", 0, "Soft Light", ""}, - {17, "LINEAR_LIGHT", 0, "Linear Light",""}, - {0, NULL, 0, NULL, NULL}}; - -static EnumPropertyItem node_flip_items[] = { - {0, "X", 0, "Flip X", ""}, - {1, "Y", 0, "Flip Y", ""}, - {2, "XY", 0, "Flip X & Y", ""}, - {0, NULL, 0, NULL, NULL}}; - -static EnumPropertyItem node_math_items[] = { - { 0, "ADD", 0, "Add", ""}, - { 1, "SUBTRACT", 0, "Subtract", ""}, - { 2, "MULTIPLY", 0, "Multiply", ""}, - { 3, "DIVIDE", 0, "Divide", ""}, - { 4, "SINE", 0, "Sine", ""}, - { 5, "COSINE", 0, "Cosine", ""}, - { 6, "TANGENT", 0, "Tangent", ""}, - { 7, "ARCSINE", 0, "Arcsine", ""}, - { 8, "ARCCOSINE", 0, "Arccosine", ""}, - { 9, "ARCTANGENT", 0, "Arctangent", ""}, - {10, "POWER", 0, "Power", ""}, - {11, "LOGARITHM", 0, "Logarithm", ""}, - {12, "MINIMUM", 0, "Minimum", ""}, - {13, "MAXIMUM", 0, "Maximum", ""}, - {14, "ROUND", 0, "Round", ""}, - {15, "LESS_THAN", 0, "Less Than", ""}, - {16, "GREATER_THAN", 0, "Greater Than", ""}, - {0, NULL, 0, NULL, NULL}}; - -static EnumPropertyItem node_vec_math_items[] = { - {0, "ADD", 0, "Add", ""}, - {1, "SUBTRACT", 0, "Subtract", ""}, - {2, "AVERAGE", 0, "Average", ""}, - {3, "DOT_PRODUCT", 0, "Dot Product", ""}, - {4, "CROSS_PRODUCT", 0, "Cross Product", ""}, - {5, "NORMALIZE", 0, "Normalize", ""}, - {0, NULL, 0, NULL, NULL}}; - -static EnumPropertyItem node_filter_items[] = { - {0, "SOFTEN", 0, "Soften", ""}, - {1, "SHARPEN", 0, "Sharpen", ""}, - {2, "LAPLACE", 0, "Laplace", ""}, - {3, "SOBEL", 0, "Sobel", ""}, - {4, "PREWITT", 0, "Prewitt", ""}, - {5, "KIRSCH", 0, "Kirsch", ""}, - {6, "SHADOW", 0, "Shadow", ""}, - {0, NULL, 0, NULL, NULL}}; - -static EnumPropertyItem prop_image_layer_items[] = { - { 0, "PLACEHOLDER", 0, "Placeholder", ""}, - {0, NULL, 0, NULL, NULL}}; - -static EnumPropertyItem prop_scene_layer_items[] = { - { 0, "PLACEHOLDER", 0, "Placeholder", ""}, - {0, NULL, 0, NULL, NULL}}; - -static EnumPropertyItem prop_tri_channel_items[] = { - { 1, "R", 0, "R", ""}, - { 2, "G", 0, "G", ""}, - { 3, "B", 0, "B", ""}, - {0, NULL, 0, NULL, NULL}}; +#include "WM_types.h" #ifdef RNA_RUNTIME @@ -145,13 +68,47 @@ static StructRNA *rna_Node_refine(struct PointerRNA *ptr) } } +static StructRNA *rna_NodeSocketType_refine(struct PointerRNA *ptr) +{ + bNodeSocket *ns= (bNodeSocket*)ptr->data; + + switch(ns->type) { + case SOCK_VALUE: + return &RNA_ValueNodeSocket; + case SOCK_VECTOR: + return &RNA_VectorNodeSocket; + case SOCK_RGBA: + return &RNA_RGBANodeSocket; + default: + return &RNA_UnknownType; + } +} + static char *rna_Node_path(PointerRNA *ptr) { - bNodeTree *ntree= (bNodeTree*)ptr->id.data; bNode *node= (bNode*)ptr->data; - int index = BLI_findindex(&ntree->nodes, node); + + return BLI_sprintfN("nodes[\"%s\"]", node->name); +} + +static char *rna_NodeSocket_path(PointerRNA *ptr) +{ + bNodeTree *ntree= (bNodeTree*)ptr->id.data; + bNodeSocket *sock= (bNodeSocket*)ptr->data; + bNode *node; + int socketindex; + + if (!nodeFindNode(ntree, sock, &node, NULL)) return NULL; + + socketindex = BLI_findindex(&node->inputs, sock); + if (socketindex != -1) + return BLI_sprintfN("nodes[\"%s\"].inputs[%d]", node->name, socketindex); + + socketindex = BLI_findindex(&node->outputs, sock); + if (socketindex != -1) + return BLI_sprintfN("nodes[\"%s\"].outputs[%d]", node->name, socketindex); - return BLI_sprintfN("nodes[%d]", index); + return NULL; } static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup) @@ -192,68 +149,119 @@ static void rna_Matte_t2_set(PointerRNA *ptr, float value) chroma->t2 = value; } -static void rna_Node_update(bContext *C, PointerRNA *ptr) +static void node_update(bContext *C, bNodeTree *ntree, bNode *node) { Main *bmain= CTX_data_main(C); - bNodeTree *ntree= (bNodeTree*)ptr->id.data; - bNode *node= (bNode*)ptr->data; Material *ma; Tex *tex; Scene *sce; - + /* look through all datablocks, to support groups */ for(ma=bmain->mat.first; ma; ma=ma->id.next) if(ma->nodetree && ma->use_nodes && has_nodetree(ma->nodetree, ntree)) ED_node_changed_update(&ma->id, node); - + for(tex=bmain->tex.first; tex; tex=tex->id.next) if(tex->nodetree && tex->use_nodes && has_nodetree(tex->nodetree, ntree)) ED_node_changed_update(&tex->id, node); - + for(sce=bmain->scene.first; sce; sce=sce->id.next) if(sce->nodetree && sce->use_nodes && has_nodetree(sce->nodetree, ntree)) ED_node_changed_update(&sce->id, node); } +static void rna_Node_update(bContext *C, PointerRNA *ptr) +{ + bNodeTree *ntree= (bNodeTree*)ptr->id.data; + bNode *node= (bNode*)ptr->data; + + node_update(C, ntree, node); +} + static void rna_Node_update_name(bContext *C, PointerRNA *ptr) { + bNodeTree *ntree= (bNodeTree*)ptr->id.data; + bNode *node= (bNode*)ptr->data; + char oldname[32]; + + /* make a copy of the old name first */ + BLI_strncpy(oldname, node->name, sizeof(oldname)); + + nodeUniqueName(ntree, node); + node->flag |= NODE_CUSTOM_NAME; + + /* fix all the animation data which may link to this */ + BKE_all_animdata_fix_paths_rename("nodes", oldname, node->name); + + node_update(C, ntree, node); +} + +/* this should be done at display time! if no custom names are set */ +#if 0 +static void rna_Node_update_username(bContext *C, PointerRNA *ptr) +{ bNode *node= (bNode*)ptr->data; const char *name; - if(node->id) { - BLI_strncpy(node->name, node->id->name+2, NODE_MAXSTR); - } - else { - switch(node->typeinfo->type) { - case SH_NODE_MIX_RGB: - case CMP_NODE_MIX_RGB: - case TEX_NODE_MIX_RGB: - if(RNA_enum_name(node_blend_type_items, node->custom1, &name)) - BLI_strncpy(node->name, name, NODE_MAXSTR); - break; - case CMP_NODE_FILTER: - if(RNA_enum_name(node_filter_items, node->custom1, &name)) - BLI_strncpy(node->name, name, NODE_MAXSTR); - break; - case CMP_NODE_FLIP: - if(RNA_enum_name(node_flip_items, node->custom1, &name)) - BLI_strncpy(node->name, name, NODE_MAXSTR); - break; - case SH_NODE_MATH: - case CMP_NODE_MATH: - case TEX_NODE_MATH: - if(RNA_enum_name(node_math_items, node->custom1, &name)) - BLI_strncpy(node->name, name, NODE_MAXSTR); - break; - case SH_NODE_VECT_MATH: - if(RNA_enum_name(node_vec_math_items, node->custom1, &name)) - BLI_strncpy(node->name, name, NODE_MAXSTR); - break; + + /* + if (!node->username[0]) { + if(node->id) { + BLI_strncpy(node->username, node->id->name+2, NODE_MAXSTR); + } + else { + + switch(node->typeinfo->type) { + case SH_NODE_MIX_RGB: + case CMP_NODE_MIX_RGB: + case TEX_NODE_MIX_RGB: + if(RNA_enum_name(node_blend_type_items, node->custom1, &name)) + BLI_strncpy(node->username, name, NODE_MAXSTR); + break; + case CMP_NODE_FILTER: + if(RNA_enum_name(node_filter_items, node->custom1, &name)) + BLI_strncpy(node->username, name, NODE_MAXSTR); + break; + case CMP_NODE_FLIP: + if(RNA_enum_name(node_flip_items, node->custom1, &name)) + BLI_strncpy(node->username, name, NODE_MAXSTR); + break; + case SH_NODE_MATH: + case CMP_NODE_MATH: + case TEX_NODE_MATH: + if(RNA_enum_name(node_math_items, node->custom1, &name)) + BLI_strncpy(node->username, name, NODE_MAXSTR); + break; + case SH_NODE_VECT_MATH: + if(RNA_enum_name(node_vec_math_items, node->custom1, &name)) + BLI_strncpy(node->username, name, NODE_MAXSTR); + break; + } + */ } } rna_Node_update(C, ptr); } +#endif + +static void rna_NodeSocket_update(bContext *C, PointerRNA *ptr) +{ + bNodeTree *ntree= (bNodeTree*)ptr->id.data; + bNodeSocket *sock= (bNodeSocket*)ptr->data; + bNode *node; + + if (nodeFindNode(ntree, sock, &node, NULL)) + node_update(C, ntree, node); +} + +static void rna_NodeSocket_defvalue_range(PointerRNA *ptr, float *min, float *max) +{ + bNodeSocket *sock= (bNodeSocket*)ptr->data; + + *min = sock->ns.min; + *max = sock->ns.max; +} static void rna_Node_mapping_update(bContext *C, PointerRNA *ptr) { @@ -276,29 +284,18 @@ static void rna_Node_image_layer_update(bContext *C, PointerRNA *ptr) rna_Node_update(C, ptr); } -static void rna_Node_scene_layer_update(bContext *C, PointerRNA *ptr) -{ - bNode *node= (bNode*)ptr->data; - Image *ima = (Image *)node->id; - ImageUser *iuser= node->storage; - - BKE_image_multilayer_index(ima->rr, iuser); - - rna_Node_update(C, ptr); -} - - static EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl) { EnumPropertyItem *item= NULL; EnumPropertyItem tmp = {0, "", 0, "", ""}; int i=0, totitem=0; - for (rl; rl; rl=rl->next) { + while (rl) { tmp.identifier = rl->name; tmp.name= rl->name; tmp.value = i++; RNA_enum_item_add(&item, &totitem, &tmp); + rl=rl->next; } RNA_enum_item_end(&item, &totitem); @@ -328,7 +325,6 @@ static EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *C, PointerRNA *ptr bNode *node= (bNode*)ptr->data; Scene *sce = (Scene *)node->id; EnumPropertyItem *item= NULL; - EnumPropertyItem tmp = {0, "", 0, "", ""}; RenderLayer *rl; if (!sce) return NULL; @@ -394,6 +390,87 @@ static EnumPropertyItem *rna_Node_channel_itemf(bContext *C, PointerRNA *ptr, in #else +static EnumPropertyItem prop_image_layer_items[] = { +{ 0, "PLACEHOLDER", 0, "Placeholder", ""}, +{0, NULL, 0, NULL, NULL}}; + +static EnumPropertyItem prop_scene_layer_items[] = { +{ 0, "PLACEHOLDER", 0, "Placeholder", ""}, +{0, NULL, 0, NULL, NULL}}; + +static EnumPropertyItem prop_tri_channel_items[] = { +{ 1, "R", 0, "R", ""}, +{ 2, "G", 0, "G", ""}, +{ 3, "B", 0, "B", ""}, +{0, NULL, 0, NULL, NULL}}; + +static EnumPropertyItem node_blend_type_items[] = { +{ 0, "MIX", 0, "Mix", ""}, +{ 1, "ADD", 0, "Add", ""}, +{ 3, "SUBTRACT", 0, "Subtract", ""}, +{ 2, "MULTIPLY", 0, "Multiply", ""}, +{ 4, "SCREEN", 0, "Screen", ""}, +{ 9, "OVERLAY", 0, "Overlay", ""}, +{ 5, "DIVIDE", 0, "Divide", ""}, +{ 6, "DIFFERENCE", 0, "Difference", ""}, +{ 7, "DARKEN", 0, "Darken", ""}, +{ 8, "LIGHTEN", 0, "Lighten", ""}, +{10, "DODGE", 0, "Dodge", ""}, +{11, "BURN", 0, "Burn", ""}, +{15, "COLOR", 0, "Color", ""}, +{14, "VALUE", 0, "Value", ""}, +{13, "SATURATION", 0, "Saturation", ""}, +{12, "HUE", 0, "Hue", ""}, +{16, "SOFT_LIGHT", 0, "Soft Light", ""}, +{17, "LINEAR_LIGHT", 0, "Linear Light",""}, +{0, NULL, 0, NULL, NULL}}; + +static EnumPropertyItem node_flip_items[] = { +{0, "X", 0, "Flip X", ""}, +{1, "Y", 0, "Flip Y", ""}, +{2, "XY", 0, "Flip X & Y", ""}, +{0, NULL, 0, NULL, NULL}}; + +static EnumPropertyItem node_math_items[] = { +{ 0, "ADD", 0, "Add", ""}, +{ 1, "SUBTRACT", 0, "Subtract", ""}, +{ 2, "MULTIPLY", 0, "Multiply", ""}, +{ 3, "DIVIDE", 0, "Divide", ""}, +{ 4, "SINE", 0, "Sine", ""}, +{ 5, "COSINE", 0, "Cosine", ""}, +{ 6, "TANGENT", 0, "Tangent", ""}, +{ 7, "ARCSINE", 0, "Arcsine", ""}, +{ 8, "ARCCOSINE", 0, "Arccosine", ""}, +{ 9, "ARCTANGENT", 0, "Arctangent", ""}, +{10, "POWER", 0, "Power", ""}, +{11, "LOGARITHM", 0, "Logarithm", ""}, +{12, "MINIMUM", 0, "Minimum", ""}, +{13, "MAXIMUM", 0, "Maximum", ""}, +{14, "ROUND", 0, "Round", ""}, +{15, "LESS_THAN", 0, "Less Than", ""}, +{16, "GREATER_THAN", 0, "Greater Than", ""}, +{0, NULL, 0, NULL, NULL}}; + +static EnumPropertyItem node_vec_math_items[] = { +{0, "ADD", 0, "Add", ""}, +{1, "SUBTRACT", 0, "Subtract", ""}, +{2, "AVERAGE", 0, "Average", ""}, +{3, "DOT_PRODUCT", 0, "Dot Product", ""}, +{4, "CROSS_PRODUCT", 0, "Cross Product", ""}, +{5, "NORMALIZE", 0, "Normalize", ""}, +{0, NULL, 0, NULL, NULL}}; + +static EnumPropertyItem node_filter_items[] = { +{0, "SOFTEN", 0, "Soften", ""}, +{1, "SHARPEN", 0, "Sharpen", ""}, +{2, "LAPLACE", 0, "Laplace", ""}, +{3, "SOBEL", 0, "Sobel", ""}, +{4, "PREWITT", 0, "Prewitt", ""}, +{5, "KIRSCH", 0, "Kirsch", ""}, +{6, "SHADOW", 0, "Shadow", ""}, +{0, NULL, 0, NULL, NULL}}; + + #define MaxNodes 1000 enum @@ -418,15 +495,9 @@ typedef struct NodeInfo static NodeInfo nodes[MaxNodes]; -static void reg_node( - int ID, - int category, - const char *enum_name, - const char *struct_name, - const char *base_name, - const char *ui_name, - const char *ui_desc -){ +static void reg_node(int ID, int category, const char *enum_name, const char *struct_name, + const char *base_name, const char *ui_name, const char *ui_desc) +{ NodeInfo *ni = nodes + ID; ni->defined = 1; @@ -513,7 +584,7 @@ static void def_math(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, node_math_items); RNA_def_property_ui_text(prop, "Operation", ""); - RNA_def_property_update(prop, 0, "rna_Node_update_name"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_vector_math(StructRNA *srna) @@ -524,7 +595,7 @@ static void def_vector_math(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, node_vec_math_items); RNA_def_property_ui_text(prop, "Operation", ""); - RNA_def_property_update(prop, 0, "rna_Node_update_name"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_rgb_curve(StructRNA *srna) @@ -535,7 +606,7 @@ static void def_rgb_curve(StructRNA *srna) RNA_def_property_pointer_sdna(prop, NULL, "storage"); RNA_def_property_struct_type(prop, "CurveMapping"); RNA_def_property_ui_text(prop, "Mapping", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_vector_curve(StructRNA *srna) @@ -546,7 +617,7 @@ static void def_vector_curve(StructRNA *srna) RNA_def_property_pointer_sdna(prop, NULL, "storage"); RNA_def_property_struct_type(prop, "CurveMapping"); RNA_def_property_ui_text(prop, "Mapping", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_time(StructRNA *srna) @@ -557,17 +628,17 @@ static void def_time(StructRNA *srna) RNA_def_property_pointer_sdna(prop, NULL, "storage"); RNA_def_property_struct_type(prop, "CurveMapping"); RNA_def_property_ui_text(prop, "Curve", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "start", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "custom1"); RNA_def_property_ui_text(prop, "Start Frame", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "end", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "custom2"); RNA_def_property_ui_text(prop, "End Frame", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_colorramp(StructRNA *srna) @@ -578,7 +649,7 @@ static void def_colorramp(StructRNA *srna) RNA_def_property_pointer_sdna(prop, NULL, "storage"); RNA_def_property_struct_type(prop, "ColorRamp"); RNA_def_property_ui_text(prop, "Color Ramp", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_mix_rgb(StructRNA *srna) @@ -589,12 +660,12 @@ static void def_mix_rgb(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, node_blend_type_items); RNA_def_property_ui_text(prop, "Blend Type", ""); - RNA_def_property_update(prop, 0, "rna_Node_update_name"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1); RNA_def_property_ui_text(prop, "Alpha", "Include alpha of second input in this operation"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_texture(StructRNA *srna) @@ -606,12 +677,12 @@ static void def_texture(StructRNA *srna) RNA_def_property_struct_type(prop, "Texture"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Texture", ""); - RNA_def_property_update(prop, 0, "rna_Node_update_name"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "node_output", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "custom1"); RNA_def_property_ui_text(prop, "Node Output", "For node-based textures, which output node to use"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } @@ -626,22 +697,22 @@ static void def_sh_material(StructRNA *srna) RNA_def_property_struct_type(prop, "Material"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Material", ""); - RNA_def_property_update(prop, 0, "rna_Node_update_name"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "diffuse", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_DIFF); RNA_def_property_ui_text(prop, "Diffuse", "Material Node outputs Diffuse"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "specular", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_SPEC); RNA_def_property_ui_text(prop, "Specular", "Material Node outputs Specular"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "invert_normal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_NEG); RNA_def_property_ui_text(prop, "Invert Normal", "Material Node uses inverted normal"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_sh_mapping(StructRNA *srna) @@ -654,41 +725,41 @@ static void def_sh_mapping(StructRNA *srna) RNA_def_property_float_sdna(prop, NULL, "loc"); RNA_def_property_ui_text(prop, "Location", "Location offset for the input coordinate"); RNA_def_property_ui_range(prop, -10.f, 10.f, 0.1f, 2); - RNA_def_property_update(prop, 0, "rna_Node_mapping_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_mapping_update"); prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER); RNA_def_property_float_sdna(prop, NULL, "rot"); RNA_def_property_ui_text(prop, "Rotation", "Rotation offset for the input coordinate"); RNA_def_property_ui_range(prop, -360.f, 360.f, 1.f, 2); - RNA_def_property_update(prop, 0, "rna_Node_mapping_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_mapping_update"); prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "size"); RNA_def_property_ui_text(prop, "Scale", "Scale adjustment for the input coordinate"); RNA_def_property_ui_range(prop, -10.f, 10.f, 0.1f, 2); - RNA_def_property_update(prop, 0, "rna_Node_mapping_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_mapping_update"); prop = RNA_def_property(srna, "clamp_minimum", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN); RNA_def_property_ui_text(prop, "Clamp Minimum", "Clamp the output coordinate to a minimum value"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop= RNA_def_property(srna, "minimum", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "min"); RNA_def_property_ui_text(prop, "Minimum", "Minimum value to clamp coordinate to"); RNA_def_property_ui_range(prop, -10.f, 10.f, 0.1f, 2); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "clamp_maximum", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX); RNA_def_property_ui_text(prop, "Clamp Maximum", "Clamp the output coordinate to a maximum value"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop= RNA_def_property(srna, "maximum", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "max"); RNA_def_property_ui_text(prop, "Maximum", "Maximum value to clamp coordinate to"); RNA_def_property_ui_range(prop, -10.f, 10.f, 0.1f, 2); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_sh_geometry(StructRNA *srna) @@ -700,12 +771,12 @@ static void def_sh_geometry(StructRNA *srna) prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "uvname"); RNA_def_property_ui_text(prop, "UV Layer", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "color_layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "colname"); RNA_def_property_ui_text(prop, "Vertex Color Layer", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } @@ -719,7 +790,7 @@ static void def_cmp_alpha_over(StructRNA *srna) prop = RNA_def_property(srna, "convert_premul", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1); RNA_def_property_ui_text(prop, "Convert Premul", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); RNA_def_struct_sdna_from(srna, "NodeTwoFloats", "storage"); @@ -727,7 +798,7 @@ static void def_cmp_alpha_over(StructRNA *srna) RNA_def_property_float_sdna(prop, NULL, "x"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Premul", "Mix Factor"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_hue_saturation(StructRNA *srna) @@ -740,19 +811,19 @@ static void def_cmp_hue_saturation(StructRNA *srna) RNA_def_property_float_sdna(prop, NULL, "hue"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Hue", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "sat", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "sat"); RNA_def_property_range(prop, 0.0f, 2.0f); RNA_def_property_ui_text(prop, "Saturation", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "val", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "val"); RNA_def_property_range(prop, 0.0f, 2.0f); RNA_def_property_ui_text(prop, "Value", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_blur(StructRNA *srna) @@ -776,52 +847,52 @@ static void def_cmp_blur(StructRNA *srna) RNA_def_property_int_sdna(prop, NULL, "sizex"); RNA_def_property_range(prop, 0, 256); RNA_def_property_ui_text(prop, "Size X", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "sizey", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "sizey"); RNA_def_property_range(prop, 0, 256); RNA_def_property_ui_text(prop, "Size Y", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "relative", 1); RNA_def_property_ui_text(prop, "Relative", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "fac"); RNA_def_property_range(prop, 0.0f, 2.0f); RNA_def_property_ui_text(prop, "Factor", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "factor_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "percentx"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Relative Size X", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "factor_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "percenty"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Relative Size Y", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "filtertype"); RNA_def_property_enum_items(prop, filter_type_items); RNA_def_property_ui_text(prop, "Filter Type", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "bokeh", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bokeh", 1); RNA_def_property_ui_text(prop, "Bokeh", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "gamma", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gamma", 1); RNA_def_property_ui_text(prop, "Gamma", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } @@ -833,7 +904,7 @@ static void def_cmp_filter(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, node_filter_items); RNA_def_property_ui_text(prop, "Filter Type", ""); - RNA_def_property_update(prop, 0, "rna_Node_update_name"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_map_value(StructRNA *srna) @@ -847,38 +918,38 @@ static void def_cmp_map_value(StructRNA *srna) RNA_def_property_array(prop, 1); RNA_def_property_range(prop, -1000.0f, 1000.0f); RNA_def_property_ui_text(prop, "Offset", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "size"); RNA_def_property_array(prop, 1); RNA_def_property_range(prop, -1000.0f, 1000.0f); RNA_def_property_ui_text(prop, "Size", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN); RNA_def_property_ui_text(prop, "Use Minimum", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX); RNA_def_property_ui_text(prop, "Use Maximum", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "min"); RNA_def_property_array(prop, 1); RNA_def_property_range(prop, -1000.0f, 1000.0f); RNA_def_property_ui_text(prop, "Minimum", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "max"); RNA_def_property_array(prop, 1); RNA_def_property_range(prop, -1000.0f, 1000.0f); RNA_def_property_ui_text(prop, "Maximum", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_vector_blur(StructRNA *srna) @@ -890,27 +961,27 @@ static void def_cmp_vector_blur(StructRNA *srna) prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "samples"); RNA_def_property_ui_text(prop, "Samples", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "min_speed", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "minspeed"); RNA_def_property_ui_text(prop, "Min Speed", "Minimum speed for a pixel to be blurred; used to separate background from foreground"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "max_speed", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "maxspeed"); RNA_def_property_ui_text(prop, "Max Speed", "Maximum speed, or zero for none"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "fac"); RNA_def_property_ui_text(prop, "Blur Factor", "Scaling factor for motion vectors; actually 'shutter speed' in frames"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "curved", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "curved", 1); RNA_def_property_ui_text(prop, "Curved", "Interpolate between frames in a bezier curve, rather than linearly"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_levels(StructRNA *srna) @@ -929,7 +1000,7 @@ static void def_cmp_levels(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, channel_items); RNA_def_property_ui_text(prop, "Channel", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_image(StructRNA *srna) @@ -950,7 +1021,7 @@ static void def_cmp_image(StructRNA *srna) RNA_def_property_struct_type(prop, "Image"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Image", ""); - RNA_def_property_update(prop, 0, "rna_Node_update_name"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); RNA_def_struct_sdna_from(srna, "ImageUser", "storage"); @@ -958,36 +1029,36 @@ static void def_cmp_image(StructRNA *srna) RNA_def_property_int_sdna(prop, NULL, "frames"); RNA_def_property_range(prop, 1, MAXFRAMEF); RNA_def_property_ui_text(prop, "Frames", "Number of images used in animation"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "start", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "sfra"); RNA_def_property_range(prop, 1, MAXFRAMEF); RNA_def_property_ui_text(prop, "Start Frame", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "offset", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "offset"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); RNA_def_property_ui_text(prop, "Offset", "Offsets the number of the frame to use in the animation"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "cyclic", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "cycl", 1); RNA_def_property_ui_text(prop, "Cyclic", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "auto_refresh", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_ANIM_ALWAYS); RNA_def_property_ui_text(prop, "Auto-Refresh", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop= RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "layer"); RNA_def_property_enum_items(prop, prop_image_layer_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_image_layer_itemf"); RNA_def_property_ui_text(prop, "Layer", ""); - RNA_def_property_update(prop, 0, "rna_Node_image_layer_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_image_layer_update"); } static void def_cmp_render_layers(StructRNA *srna) @@ -999,20 +1070,20 @@ static void def_cmp_render_layers(StructRNA *srna) RNA_def_property_struct_type(prop, "Scene"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Scene", ""); - RNA_def_property_update(prop, 0, "rna_Node_update_name"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop= RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, prop_scene_layer_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_scene_layer_itemf"); RNA_def_property_ui_text(prop, "Layer", ""); - RNA_def_property_update(prop, 0, "rna_Node_scene_layer_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); /* TODO: comments indicate this might be a hack */ prop = RNA_def_property(srna, "re_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1); RNA_def_property_ui_text(prop, "Re-render", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_output_file(StructRNA *srna) @@ -1045,37 +1116,42 @@ static void def_cmp_output_file(StructRNA *srna) prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Filename", ""); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "image_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "imtype"); RNA_def_property_enum_items(prop, type_items); RNA_def_property_ui_text(prop, "Image Type", ""); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "exr_half", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "subimtype", R_OPENEXR_HALF); RNA_def_property_ui_text(prop, "Half", ""); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "exr_codec", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "codec"); RNA_def_property_enum_items(prop, openexr_codec_items); RNA_def_property_ui_text(prop, "Codec", ""); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "quality", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "quality"); RNA_def_property_range(prop, 1, 100); RNA_def_property_ui_text(prop, "Quality", ""); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "start_frame", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "sfra"); RNA_def_property_range(prop, MINFRAMEF, MAXFRAMEF); RNA_def_property_ui_text(prop, "Start Frame", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "end_frame", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "efra"); RNA_def_property_range(prop, MINFRAMEF, MAXFRAMEF); RNA_def_property_ui_text(prop, "End Frame", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_dilate_erode(StructRNA *srna) @@ -1086,7 +1162,7 @@ static void def_cmp_dilate_erode(StructRNA *srna) RNA_def_property_int_sdna(prop, NULL, "custom2"); RNA_def_property_range(prop, -100, 100); RNA_def_property_ui_text(prop, "Distance", "Distance to grow/shrink (number of iterations)"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_scale(StructRNA *srna) @@ -1103,7 +1179,7 @@ static void def_cmp_scale(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, space_items); RNA_def_property_ui_text(prop, "Space", "Coordinate space to scale relative to"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_diff_matte(StructRNA *srna) @@ -1117,14 +1193,14 @@ static void def_cmp_diff_matte(StructRNA *srna) RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed."); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "t2"); RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed."); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_color_matte(StructRNA *srna) @@ -1137,19 +1213,19 @@ static void def_cmp_color_matte(StructRNA *srna) RNA_def_property_float_sdna(prop, NULL, "t1"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "H", "Hue tolerance for colors to be considered a keying color"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "s", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "t2"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "S", "Saturation Tolerance for the color"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "v", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "t3"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "V", "Value Tolerance for the color"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_distance_matte(StructRNA *srna) @@ -1163,14 +1239,14 @@ static void def_cmp_distance_matte(StructRNA *srna) RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed."); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "t2"); RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed."); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_color_spill(StructRNA *srna) @@ -1187,7 +1263,7 @@ static void def_cmp_color_spill(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, channel_items); RNA_def_property_ui_text(prop, "Channel", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); RNA_def_struct_sdna_from(srna, "NodeChroma", "storage"); @@ -1195,7 +1271,7 @@ static void def_cmp_color_spill(StructRNA *srna) RNA_def_property_float_sdna(prop, NULL, "t1"); RNA_def_property_range(prop, 0.0f, 0.5f); RNA_def_property_ui_text(prop, "Amount", "How much the selected channel is affected by"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_luma_matte(StructRNA *srna) @@ -1209,14 +1285,14 @@ static void def_cmp_luma_matte(StructRNA *srna) RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "low", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "t2"); RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_chroma_matte(StructRNA *srna) @@ -1230,32 +1306,32 @@ static void def_cmp_chroma_matte(StructRNA *srna) RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL); RNA_def_property_range(prop, 1.0f, 80.0f); RNA_def_property_ui_text(prop, "Acceptance", "Tolerance for a color to be considered a keying color"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "cutoff", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "t2"); RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL); RNA_def_property_range(prop, 0.0f, 30.0f); RNA_def_property_ui_text(prop, "Cutoff", "Tolerance below which colors will be considered as exact matches"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "fsize"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Lift", "Alpha lift"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "fstrength"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Gain", "Alpha gain"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "shadow_adjust", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "t3"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Shadow Adjust", "Adjusts the brightness of any shadows captured"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_channel_matte(StructRNA *srna) @@ -1273,7 +1349,7 @@ static void def_cmp_channel_matte(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, color_space_items); RNA_def_property_ui_text(prop, "Color Space", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop= RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE); @@ -1281,7 +1357,7 @@ static void def_cmp_channel_matte(StructRNA *srna) RNA_def_property_enum_items(prop, prop_tri_channel_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf"); RNA_def_property_ui_text(prop, "Channel", "Channel used to determine matte"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); RNA_def_struct_sdna_from(srna, "NodeChroma", "storage"); @@ -1290,14 +1366,14 @@ static void def_cmp_channel_matte(StructRNA *srna) RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "low", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "t2"); RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_flip(StructRNA *srna) @@ -1308,7 +1384,7 @@ static void def_cmp_flip(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, node_flip_items); RNA_def_property_ui_text(prop, "Axis", ""); - RNA_def_property_update(prop, 0, "rna_Node_update_name"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_splitviewer(StructRNA *srna) @@ -1324,13 +1400,13 @@ static void def_cmp_splitviewer(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "custom2"); RNA_def_property_enum_items(prop, axis_items); RNA_def_property_ui_text(prop, "Axis", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "factor", PROP_INT, PROP_FACTOR); RNA_def_property_int_sdna(prop, NULL, "custom1"); RNA_def_property_range(prop, 0, 100); RNA_def_property_ui_text(prop, "Factor", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_id_mask(StructRNA *srna) @@ -1341,7 +1417,7 @@ static void def_cmp_id_mask(StructRNA *srna) RNA_def_property_int_sdna(prop, NULL, "custom1"); RNA_def_property_range(prop, 0, 10000); RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_map_uv(StructRNA *srna) @@ -1352,7 +1428,7 @@ static void def_cmp_map_uv(StructRNA *srna) RNA_def_property_int_sdna(prop, NULL, "custom1"); RNA_def_property_range(prop, 0, 100); RNA_def_property_ui_text(prop, "Alpha", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_defocus(StructRNA *srna) @@ -1375,60 +1451,60 @@ static void def_cmp_defocus(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "bktype"); RNA_def_property_enum_items(prop, bokeh_items); RNA_def_property_ui_text(prop, "Bokeh Type", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); /* TODO: angle in degrees */ prop = RNA_def_property(srna, "angle", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "rotation"); RNA_def_property_range(prop, 0, 90); RNA_def_property_ui_text(prop, "Angle", "Bokeh shape rotation offset in degrees"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "gamma_correction", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gamco", 1); RNA_def_property_ui_text(prop, "Gamma Correction", "Enable gamma correction before and after main process"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); /* TODO */ prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "fstop"); RNA_def_property_range(prop, 0.0f, 128.0f); RNA_def_property_ui_text(prop, "fStop", "Amount of focal blur, 128=infinity=perfect focus, half the value doubles the blur radius"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "max_blur", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "maxblur"); RNA_def_property_range(prop, 0.0f, 10000.0f); RNA_def_property_ui_text(prop, "Max Blur", "blur limit, maximum CoC radius, 0=no limit"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "bthresh"); RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_text(prop, "Threshold", "CoC radius threshold, prevents background bleed on in-focus midground, 0=off"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "preview", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "preview", 1); RNA_def_property_ui_text(prop, "Preview", "Enable sampling mode, useful for preview when using low samplecounts"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "samples"); RNA_def_property_range(prop, 16, 256); RNA_def_property_ui_text(prop, "Samples", "Number of samples (16=grainy, higher=less noise)"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "no_zbuf", 1); + RNA_def_property_boolean_negative_sdna(prop, NULL, "no_zbuf", 1); RNA_def_property_ui_text(prop, "Use Z-Buffer", "Disable when using an image as input instead of actual zbuffer (auto enabled if node not image based, eg. time node)"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "z_scale", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "scale"); RNA_def_property_range(prop, 0.0f, 1000.0f); RNA_def_property_ui_text(prop, "Z-Scale", "Scales the Z input when not using a zbuffer, controls maximum blur designated by the color white or input value 1"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_invert(StructRNA *srna) @@ -1438,12 +1514,12 @@ static void def_cmp_invert(StructRNA *srna) prop = RNA_def_property(srna, "rgb", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_RGB); RNA_def_property_ui_text(prop, "RGB", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_A); RNA_def_property_ui_text(prop, "Alpha", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_crop(StructRNA *srna) @@ -1453,7 +1529,7 @@ static void def_cmp_crop(StructRNA *srna) prop = RNA_def_property(srna, "crop_size", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1); RNA_def_property_ui_text(prop, "Crop Image Size", "Whether to crop the size of the input image"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); RNA_def_struct_sdna_from(srna, "NodeTwoXYs", "storage"); @@ -1461,25 +1537,25 @@ static void def_cmp_crop(StructRNA *srna) RNA_def_property_int_sdna(prop, NULL, "x1"); RNA_def_property_range(prop, 0, 10000); RNA_def_property_ui_text(prop, "X1", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "x2", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "x2"); RNA_def_property_range(prop, 0, 10000); RNA_def_property_ui_text(prop, "X2", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "y1", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "y1"); RNA_def_property_range(prop, 0, 10000); RNA_def_property_ui_text(prop, "Y1", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "y2", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "y2"); RNA_def_property_range(prop, 0, 10000); RNA_def_property_ui_text(prop, "Y2", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_dblur(StructRNA *srna) @@ -1492,48 +1568,48 @@ static void def_cmp_dblur(StructRNA *srna) RNA_def_property_int_sdna(prop, NULL, "iter"); RNA_def_property_range(prop, 1, 32); RNA_def_property_ui_text(prop, "Iterations", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "wrap", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "wrap", 1); RNA_def_property_ui_text(prop, "Wrap", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "center_x"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Center X", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "center_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "center_y"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Center Y", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "distance"); RNA_def_property_range(prop, -1.0f, 1.0f); RNA_def_property_ui_text(prop, "Distance", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "angle"); RNA_def_property_range(prop, 0.0f, 360.0f); RNA_def_property_ui_text(prop, "Angle", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "spin", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "spin"); RNA_def_property_range(prop, -360.0f, 360.0f); RNA_def_property_ui_text(prop, "Spin", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "zoom"); RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_text(prop, "Zoom", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_bilateral_blur(StructRNA *srna) @@ -1546,19 +1622,19 @@ static void def_cmp_bilateral_blur(StructRNA *srna) RNA_def_property_int_sdna(prop, NULL, "iter"); RNA_def_property_range(prop, 1, 128); RNA_def_property_ui_text(prop, "Iterations", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "sigma_color", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "sigma_color"); RNA_def_property_range(prop, 0.01f, 3.0f); RNA_def_property_ui_text(prop, "Color Sigma", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "sigma_space", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "sigma_space"); RNA_def_property_range(prop, 0.01f, 30.0f); RNA_def_property_ui_text(prop, "Space Sigma", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_premul_key(StructRNA *srna) @@ -1574,7 +1650,7 @@ static void def_cmp_premul_key(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, type_items); RNA_def_property_ui_text(prop, "Mapping", "Conversion between premultiplied alpha and key alpha"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } @@ -1601,66 +1677,66 @@ static void def_cmp_glare(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, type_items); RNA_def_property_ui_text(prop, "Glare Type", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "quality"); RNA_def_property_enum_items(prop, quality_items); RNA_def_property_ui_text(prop, "Quality", "If not set to high quality, the effect will be applied to a low-res copy of the source image"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "iter"); RNA_def_property_range(prop, 2, 5); RNA_def_property_ui_text(prop, "Iterations", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "color_modulation", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "colmod"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Color Modulation", "Amount of Color Modulation, modulates colors of streaks and ghosts for a spectral dispersion effect"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "mix", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "mix"); RNA_def_property_range(prop, -1.0f, 1.0f); RNA_def_property_ui_text(prop, "Mix", "-1 is original image only, 0 is exact 50/50 mix, 1 is processed image only"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "threshold"); RNA_def_property_range(prop, 0.0f, 1000.0f); RNA_def_property_ui_text(prop, "Threshold", "The glare filter will only be applied to pixels brighter than this value"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "streaks", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "angle"); RNA_def_property_range(prop, 2, 16); RNA_def_property_ui_text(prop, "Streaks", "Total number of streaks"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "angle_offset", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "angle_ofs"); RNA_def_property_range(prop, 0.0f, 180.0f); RNA_def_property_ui_text(prop, "Angle Offset", "Streak angle offset in degrees"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "fade", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "fade"); RNA_def_property_range(prop, 0.75f, 1.0f); RNA_def_property_ui_text(prop, "Fade", "Streak fade-out factor"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "rotate_45", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "angle", 1); RNA_def_property_ui_text(prop, "Rotate 45", "Simple star filter: add 45 degree rotation offset"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "size"); RNA_def_property_range(prop, 6, 9); RNA_def_property_ui_text(prop, "Size", "Glow/glare size (not actual size; relative to initial size of bright area of pixels)"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); /* TODO */ } @@ -1680,49 +1756,49 @@ static void def_cmp_tonemap(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, type_items); RNA_def_property_ui_text(prop, "Tonemap Type", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "key", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "key"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Key", "The value the average luminance is mapped to"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "offset"); RNA_def_property_range(prop, 0.001f, 10.0f); RNA_def_property_ui_text(prop, "Offset", "Normally always 1, but can be used as an extra control to alter the brightness curve"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "gamma"); RNA_def_property_range(prop, 0.001f, 3.0f); RNA_def_property_ui_text(prop, "Gamma", "If not used, set to 1"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f"); RNA_def_property_range(prop, -8.0f, 8.0f); RNA_def_property_ui_text(prop, "Intensity", "If less than zero, darkens image; otherwise, makes it brighter"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "m"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Contrast", "Set to 0 to use estimate from input image"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "adaptation", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "a"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Adaptation", "If 0, global; if 1, based on pixel intensity"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "c"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Color Correction", "If 0, same for all channels; if 1, each independent"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_lensdist(StructRNA *srna) @@ -1734,17 +1810,17 @@ static void def_cmp_lensdist(StructRNA *srna) prop = RNA_def_property(srna, "projector", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "proj", 1); RNA_def_property_ui_text(prop, "Projector", "Enable/disable projector mode. Effect is applied in horizontal direction only."); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "jitter", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "jit", 1); RNA_def_property_ui_text(prop, "Jitter", "Enable/disable jittering; faster, but also noisier"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "fit", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "fit", 1); RNA_def_property_ui_text(prop, "Fit", "For positive distortion factor only: scale image such that black areas are not visible"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } @@ -1760,18 +1836,27 @@ static void def_tex_output(StructRNA *srna) prop = RNA_def_property(srna, "output_name", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Output Name", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_tex_image(StructRNA *srna) { PropertyRNA *prop; + prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "id"); + RNA_def_property_struct_type(prop, "Image"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Image", ""); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + + /* is this supposed to be exposed? not sure.. prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "storage"); RNA_def_property_struct_type(prop, "ImageUser"); RNA_def_property_ui_text(prop, "Settings", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + */ } static void def_tex_bricks(StructRNA *srna) @@ -1782,25 +1867,25 @@ static void def_tex_bricks(StructRNA *srna) RNA_def_property_float_sdna(prop, NULL, "custom3"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Offset Amount", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "custom1"); RNA_def_property_range(prop, 2, 99); RNA_def_property_ui_text(prop, "Offset Frequency", "Offset every N rows"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "custom4"); RNA_def_property_range(prop, 0.0f, 99.0f); RNA_def_property_ui_text(prop, "Squash Amount", ""); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "custom2"); RNA_def_property_range(prop, 2, 99); RNA_def_property_ui_text(prop, "Squash Frequency", "Squash every N rows"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } /* -------------------------------------------------------------------------- */ @@ -1861,6 +1946,91 @@ static void rna_def_texture_node(BlenderRNA *brna) /* -------------------------------------------------------------------------- */ +static void rna_def_node_socket(BlenderRNA *brna) +{ + StructRNA *srna; + + srna = RNA_def_struct(brna, "NodeSocket", NULL); + RNA_def_struct_ui_text(srna, "Node Socket", "Input or output socket of a node"); + RNA_def_struct_refine_func(srna, "rna_NodeSocketType_refine"); + RNA_def_struct_sdna(srna, "bNodeSocket"); + RNA_def_struct_ui_icon(srna, ICON_PLUG); + RNA_def_struct_path_func(srna, "rna_NodeSocket_path"); + +} + +static void rna_def_node_socket_value(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "ValueNodeSocket", NULL); + RNA_def_struct_ui_text(srna, "Value Node Socket", "Input or output socket of a node"); + RNA_def_struct_sdna(srna, "bNodeSocket"); + RNA_def_struct_ui_icon(srna, ICON_PLUG); + RNA_def_struct_path_func(srna, "rna_NodeSocket_path"); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Name", "Socket name."); + RNA_def_struct_name_property(srna, prop); + + prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "ns.vec"); + RNA_def_property_array(prop, 1); + RNA_def_property_ui_text(prop, "Default Value", "Default value of the socket when no link is attached."); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeSocket_update"); + RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocket_defvalue_range"); +} + +static void rna_def_node_socket_vector(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "VectorNodeSocket", NULL); + RNA_def_struct_ui_text(srna, "Vector Node Socket", "Input or output socket of a node"); + RNA_def_struct_sdna(srna, "bNodeSocket"); + RNA_def_struct_ui_icon(srna, ICON_PLUG); + RNA_def_struct_path_func(srna, "rna_NodeSocket_path"); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Name", "Socket name."); + RNA_def_struct_name_property(srna, prop); + + prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "ns.vec"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Default Value", "Default value of the socket when no link is attached."); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeSocket_update"); + RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocket_defvalue_range"); +} + +static void rna_def_node_socket_rgba(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "RGBANodeSocket", NULL); + RNA_def_struct_ui_text(srna, "RGBA Node Socket", "Input or output socket of a node"); + RNA_def_struct_sdna(srna, "bNodeSocket"); + RNA_def_struct_ui_icon(srna, ICON_PLUG); + RNA_def_struct_path_func(srna, "rna_NodeSocket_path"); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Name", "Socket name."); + RNA_def_struct_name_property(srna, prop); + + prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "ns.vec"); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Default Value", "Default value of the socket when no link is attached."); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeSocket_update"); + RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocket_defvalue_range"); +} + static void rna_def_node(BlenderRNA *brna) { StructRNA *srna; @@ -1869,6 +2039,7 @@ static void rna_def_node(BlenderRNA *brna) srna = RNA_def_struct(brna, "Node", NULL); RNA_def_struct_ui_text(srna, "Node", "Node in a node tree."); RNA_def_struct_sdna(srna, "bNode"); + RNA_def_struct_ui_icon(srna, ICON_NODE); RNA_def_struct_refine_func(srna, "rna_Node_refine"); RNA_def_struct_path_func(srna, "rna_Node_path"); @@ -1877,10 +2048,22 @@ static void rna_def_node(BlenderRNA *brna) RNA_def_property_array(prop, 2); RNA_def_property_range(prop, -10000.0f, 10000.0f); RNA_def_property_ui_text(prop, "Location", ""); + RNA_def_property_update(prop, NC_NODE, "rna_Node_update"); prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", "Node name."); RNA_def_struct_name_property(srna, prop); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update_name"); + + prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL); + RNA_def_property_struct_type(prop, "NodeSocket"); + RNA_def_property_ui_text(prop, "Inputs", ""); + + prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL); + RNA_def_property_struct_type(prop, "NodeSocket"); + RNA_def_property_ui_text(prop, "Outputs", ""); } static void rna_def_nodetree(BlenderRNA *brna) @@ -1891,14 +2074,23 @@ static void rna_def_nodetree(BlenderRNA *brna) srna = RNA_def_struct(brna, "NodeTree", "ID"); RNA_def_struct_ui_text(srna, "Node Tree", "Node tree consisting of linked nodes used for materials, textures and compositing."); RNA_def_struct_sdna(srna, "bNodeTree"); - RNA_def_struct_ui_icon(srna, ICON_NODE); + RNA_def_struct_ui_icon(srna, ICON_NODETREE); + /* AnimData */ rna_def_animdata_common(srna); - + + /* Nodes Collection */ prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL); RNA_def_property_struct_type(prop, "Node"); RNA_def_property_ui_text(prop, "Nodes", ""); + + /* Grease Pencil */ + prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "gpd"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_struct_type(prop, "GreasePencil"); + RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil datablock"); } static void define_specific_node(BlenderRNA *brna, int id, void (*func)(StructRNA*)) @@ -1913,6 +2105,10 @@ void RNA_def_nodetree(BlenderRNA *brna) { init(); rna_def_nodetree(brna); + rna_def_node_socket(brna); + rna_def_node_socket_value(brna); + rna_def_node_socket_vector(brna); + rna_def_node_socket_rgba(brna); rna_def_node(brna); rna_def_shader_node(brna); rna_def_compositor_node(brna); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index f018742dc10..d5b0abeba41 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -28,6 +28,7 @@ #include "RNA_access.h" #include "RNA_define.h" #include "RNA_types.h" +#include "RNA_enum_types.h" #include "rna_internal.h" @@ -88,9 +89,11 @@ EnumPropertyItem object_type_items[] = { #include "BLI_math.h" #include "DNA_key_types.h" +#include "DNA_constraint_types.h" #include "BKE_armature.h" #include "BKE_bullet.h" +#include "BKE_constraint.h" #include "BKE_context.h" #include "BKE_curve.h" #include "BKE_depsgraph.h" @@ -861,6 +864,36 @@ static PointerRNA rna_Object_collision_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd); } +static PointerRNA rna_Object_active_constraint_get(PointerRNA *ptr) +{ + Object *ob= (Object*)ptr->id.data; + bConstraint *con= constraints_get_active(&ob->constraints); + return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con); +} + +static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value) +{ + Object *ob= (Object*)ptr->id.data; + constraints_set_active(&ob->constraints, (bConstraint *)value.data); +} + +static bConstraint *rna_Object_constraints_new(Object *object, bContext *C, int type) +{ + WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object); + return add_ob_constraint(object, NULL, type); +} + +static int rna_Object_constraints_remove(Object *object, bContext *C, int index) +{ + int ok = remove_constraint_index(&object->constraints, index); + if(ok) { + ED_object_constraint_set_active(object, NULL); + WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, object); + } + + return ok; +} + #else static void rna_def_vertex_group(BlenderRNA *brna) @@ -1129,6 +1162,50 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Debug State", "Print state debug info in the game engine."); } +static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *prop; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "ObjectConstraints"); + srna= RNA_def_struct(brna, "ObjectConstraints", NULL); + RNA_def_struct_sdna(srna, "Object"); + RNA_def_struct_ui_text(srna, "Object Constraints", "Collection of object constraints."); + + + /* Collection active property */ + prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Constraint"); + RNA_def_property_pointer_funcs(prop, "rna_Object_active_constraint_get", "rna_Object_active_constraint_set", NULL); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Active Constraint", "Active Object constraint."); + + + /* Constraint collection */ + func= RNA_def_function(srna, "new", "rna_Object_constraints_new"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_function_ui_description(func, "Add a new constraint to this object"); + /* return type */ + parm= RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint."); + RNA_def_function_return(func, parm); + /* object to add */ + parm= RNA_def_enum(func, "type", constraint_type_items, 1, "", "Constraint type to add."); + RNA_def_property_flag(parm, PROP_REQUIRED); + + func= RNA_def_function(srna, "remove", "rna_Object_constraints_remove"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_function_ui_description(func, "Remove a constraint from this object."); + /* return type */ + parm= RNA_def_boolean(func, "success", 0, "Success", "Removed the constraint successfully."); + RNA_def_function_return(func, parm); + /* object to add */ + parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "", 0, INT_MAX); + RNA_def_property_flag(parm, PROP_REQUIRED); +} + static void rna_def_object(BlenderRNA *brna) { StructRNA *srna; @@ -1303,7 +1380,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol"); RNA_def_property_struct_type(prop, "MaterialSlot"); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", 0, 0, 0, 0, 0); /* don't dereference pointer! */ + RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", 0, 0, 0); /* don't dereference pointer! */ RNA_def_property_ui_text(prop, "Materials", "Material slots in the object."); prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE); @@ -1430,6 +1507,8 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Constraint"); RNA_def_property_ui_text(prop, "Constraints", "Constraints of the object."); +// RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, 0, 0, 0, "constraints__add", "constraints__remove"); + rna_def_object_constraints(brna, prop); prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Modifier"); @@ -1723,6 +1802,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "shapenr"); + RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE); // XXX this is really unpredictable... RNA_def_property_int_funcs(prop, "rna_Object_active_shape_key_index_get", "rna_Object_active_shape_key_index_set", "rna_Object_active_shape_key_index_range"); RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index."); RNA_def_property_update(prop, 0, "rna_Object_active_shape_update"); @@ -1765,7 +1845,7 @@ static void rna_def_base(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "Base", NULL); + srna= RNA_def_struct(brna, "ObjectBase", NULL); RNA_def_struct_sdna(srna, "Base"); RNA_def_struct_ui_text(srna, "Object Base", "An objects instance in a scene."); RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA); diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 8fcc4e49986..827e0cc60d9 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -64,6 +64,7 @@ #include "DNA_meshdata_types.h" #include "DNA_curve_types.h" #include "DNA_modifier_types.h" +#include "DNA_constraint_types.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index d6239d92911..9e764419f19 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -756,7 +756,7 @@ static void rna_def_pointcache(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change"); prop= RNA_def_property(srna, "point_cache_list", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); RNA_def_property_struct_type(prop, "PointCache"); RNA_def_property_ui_text(prop, "Point Cache List", "Point cache list"); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 5d2c281fb62..5b5b331fea8 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -27,6 +27,7 @@ #include "RNA_define.h" #include "RNA_types.h" +#include "RNA_enum_types.h" #include "rna_internal.h" @@ -48,6 +49,7 @@ #include "DNA_userdef_types.h" #include "BKE_context.h" +#include "BKE_constraint.h" #include "BKE_depsgraph.h" #include "BKE_idprop.h" @@ -72,9 +74,9 @@ static void rna_Pose_IK_update(bContext *C, PointerRNA *ptr) BIK_clear_data(ob->pose); } -static char *rna_PoseChannel_path(PointerRNA *ptr) +static char *rna_PoseBone_path(PointerRNA *ptr) { - return BLI_sprintfN("pose.pose_channels[\"%s\"]", ((bPoseChannel*)ptr->data)->name); + return BLI_sprintfN("pose.bones[\"%s\"]", ((bPoseChannel*)ptr->data)->name); } static void rna_BoneGroup_color_set_set(PointerRNA *ptr, int value) @@ -112,7 +114,7 @@ static void rna_BoneGroup_color_set_set(PointerRNA *ptr, int value) } } -static IDProperty *rna_PoseChannel_idproperties(PointerRNA *ptr, int create) +static IDProperty *rna_PoseBone_idproperties(PointerRNA *ptr, int create) { bPoseChannel *pchan= ptr->data; @@ -414,6 +416,35 @@ static void rna_pose_pgroup_name_set(PointerRNA *ptr, const char *value, char *r } #endif +static PointerRNA rna_PoseChannel_active_constraint_get(PointerRNA *ptr) +{ + bPoseChannel *pchan= (bPoseChannel*)ptr->data; + bConstraint *con= constraints_get_active(&pchan->constraints); + return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con); +} + +static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr, PointerRNA value) +{ + bPoseChannel *pchan= (bPoseChannel*)ptr->data; + constraints_set_active(&pchan->constraints, (bConstraint *)value.data); +} + +static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, bContext *C, int type) +{ + //WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object); + // TODO, pass object also + // TODO, new pose bones don't have updated draw flags + return add_pose_constraint(NULL, pchan, NULL, type); +} + +static int rna_PoseChannel_constraints_remove(bPoseChannel *pchan, bContext *C, int index) +{ + // TODO + //ED_object_constraint_set_active(object, NULL); + //WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, object); + return remove_constraint_index(&pchan->constraints, index); +} + #else static void rna_def_bone_group(BlenderRNA *brna) @@ -486,6 +517,50 @@ static EnumPropertyItem prop_solver_items[] = { {ITASC_SOLVER_DLS, "DLS", 0, "DLS", "Damped Least Square with Numerical Filtering"}, {0, NULL, 0, NULL, NULL}}; + +static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *prop; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "PoseBoneConstraints"); + srna= RNA_def_struct(brna, "PoseBoneConstraints", NULL); + RNA_def_struct_sdna(srna, "bPoseChannel"); + RNA_def_struct_ui_text(srna, "PoseBone Constraints", "Collection of pose bone constraints."); + + /* Collection active property */ + prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Constraint"); + RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_active_constraint_get", "rna_PoseChannel_active_constraint_set", NULL); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Active Constraint", "Active PoseChannel constraint."); + + + /* Constraint collection */ + func= RNA_def_function(srna, "new", "rna_PoseChannel_constraints_new"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_function_ui_description(func, "Add a constraint to this object"); + /* return type */ + parm= RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint."); + RNA_def_function_return(func, parm); + /* object to add */ + parm= RNA_def_enum(func, "type", constraint_type_items, 1, "", "Constraint type to add."); + RNA_def_property_flag(parm, PROP_REQUIRED); + + func= RNA_def_function(srna, "remove", "rna_PoseChannel_constraints_remove"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_function_ui_description(func, "Remove a constraint from this object."); + /* return type */ + parm= RNA_def_boolean(func, "success", 0, "Success", "Removed the constraint successfully."); + RNA_def_function_return(func, parm); + /* object to add */ + parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "", 0, INT_MAX); + RNA_def_property_flag(parm, PROP_REQUIRED); +} + static void rna_def_pose_channel(BlenderRNA *brna) { // XXX: this RNA enum define is currently duplicated for objects, since there is some text here which is not applicable @@ -503,16 +578,18 @@ static void rna_def_pose_channel(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "PoseChannel", NULL); + srna= RNA_def_struct(brna, "PoseBone", NULL); RNA_def_struct_sdna(srna, "bPoseChannel"); - RNA_def_struct_ui_text(srna, "Pose Channel", "Channel defining pose data for a bone in a Pose."); - RNA_def_struct_path_func(srna, "rna_PoseChannel_path"); - RNA_def_struct_idproperties_func(srna, "rna_PoseChannel_idproperties"); + RNA_def_struct_ui_text(srna, "Pose Bone", "Channel defining pose data for a bone in a Pose."); + RNA_def_struct_path_func(srna, "rna_PoseBone_path"); + RNA_def_struct_idproperties_func(srna, "rna_PoseBone_idproperties"); /* Bone Constraints */ prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Constraint"); - RNA_def_property_ui_text(prop, "Constraints", "Constraints that act on this PoseChannel."); + RNA_def_property_ui_text(prop, "Constraints", "Constraints that act on this PoseChannel."); + + rna_def_pose_channel_constraints(brna, prop); /* Name + Selection Status */ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); @@ -542,17 +619,17 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "Bone"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Bone", "Bone associated with this Pose Channel."); + RNA_def_property_ui_text(prop, "Bone", "Bone associated with this PoseBone."); prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "PoseChannel"); + RNA_def_property_struct_type(prop, "PoseBone"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Parent", "Parent of this pose channel."); + RNA_def_property_ui_text(prop, "Parent", "Parent of this pose bone."); prop= RNA_def_property(srna, "child", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "PoseChannel"); + RNA_def_property_struct_type(prop, "PoseBone"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Child", "Child of this pose channel."); + RNA_def_property_ui_text(prop, "Child", "Child of this pose bone."); /* Transformation settings */ prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION); @@ -791,6 +868,8 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface."); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); + + RNA_api_pose_channel(srna); } static void rna_def_pose_itasc(BlenderRNA *brna) @@ -918,10 +997,10 @@ static void rna_def_pose(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Pose", "A collection of pose channels, including settings for animating bones."); /* pose channels */ - prop= RNA_def_property(srna, "pose_channels", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "chanbase", NULL); - RNA_def_property_struct_type(prop, "PoseChannel"); - RNA_def_property_ui_text(prop, "Pose Channels", "Individual pose channels for the armature."); + RNA_def_property_struct_type(prop, "PoseBone"); + RNA_def_property_ui_text(prop, "Pose Bones", "Individual pose bones for the armature."); /* bone groups */ prop= RNA_def_property(srna, "bone_groups", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_pose_api.c b/source/blender/makesrna/intern/rna_pose_api.c index c6791405109..d1a1513ec3a 100644 --- a/source/blender/makesrna/intern/rna_pose_api.c +++ b/source/blender/makesrna/intern/rna_pose_api.c @@ -43,14 +43,21 @@ /* #include "DNA_anim_types.h" */ #include "DNA_action_types.h" /* bPose */ + #else void RNA_api_pose(StructRNA *srna) { /* FunctionRNA *func; */ /* PropertyRNA *parm; */ +} +void RNA_api_pose_channel(StructRNA *srna) +{ +// FunctionRNA *func; +// PropertyRNA *parm; } + #endif diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 3505253b60f..5a80db74c38 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -307,7 +307,7 @@ static void rna_def_render_result(BlenderRNA *brna) prop= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "RenderLayer"); - RNA_def_property_collection_funcs(prop, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); RNA_define_verify_sdna(1); } @@ -333,7 +333,7 @@ static void rna_def_render_layer(BlenderRNA *brna) prop= RNA_def_property(srna, "passes", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "RenderPass"); - RNA_def_property_collection_funcs(prop, "rna_RenderLayer_passes_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_RenderLayer_passes_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); prop= RNA_def_property(srna, "rect", PROP_FLOAT, PROP_NONE); RNA_def_property_flag(prop, PROP_DYNAMIC); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 31aecbb8a76..4218724d7df 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -283,7 +283,6 @@ PointerRNA rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key { StructRNA *srna; PropertyRNA *prop; - IDProperty *group, *idp; PointerRNA propptr; memset(&propptr, 0, sizeof(propptr)); @@ -309,7 +308,13 @@ PointerRNA rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key } } while((srna=srna->base)); + /* this was used pre 2.5beta0, now ID property access uses python's + * getitem style access + * - ob["foo"] rather then ob.foo */ +#if 0 if(ptr->data) { + IDProperty *group, *idp; + group= RNA_struct_idproperties(ptr, 0); if(group) { @@ -322,7 +327,7 @@ PointerRNA rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key } } } - +#endif return propptr; } @@ -406,6 +411,13 @@ static int rna_Property_subtype_get(PointerRNA *ptr) return prop->subtype; } +static PointerRNA rna_Property_srna_get(PointerRNA *ptr) +{ + PropertyRNA *prop= (PropertyRNA*)ptr->data; + rna_idproperty_check(&prop, ptr); + return rna_pointer_inherit_refine(ptr, &RNA_Struct, prop->srna); +} + static int rna_Property_unit_get(PointerRNA *ptr) { PropertyRNA *prop= (PropertyRNA*)ptr->data; @@ -715,7 +727,7 @@ static PointerRNA rna_CollectionProperty_fixed_type_get(PointerRNA *ptr) { PropertyRNA *prop= (PropertyRNA*)ptr->data; rna_idproperty_check(&prop, ptr); - return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((CollectionPropertyRNA*)prop)->type); + return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((CollectionPropertyRNA*)prop)->item_type); } /* Function */ @@ -812,13 +824,13 @@ static void rna_def_struct(BlenderRNA *brna) prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "Property"); - RNA_def_property_collection_funcs(prop, "rna_Struct_properties_begin", "rna_Struct_properties_next", "rna_iterator_listbase_end", "rna_Struct_properties_get", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Struct_properties_begin", "rna_Struct_properties_next", "rna_iterator_listbase_end", "rna_Struct_properties_get", 0, 0, 0); RNA_def_property_ui_text(prop, "Properties", "Properties in the struct."); prop= RNA_def_property(srna, "functions", PROP_COLLECTION, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "Function"); - RNA_def_property_collection_funcs(prop, "rna_Struct_functions_begin", "rna_Struct_functions_next", "rna_iterator_listbase_end", "rna_Struct_functions_get", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Struct_functions_begin", "rna_Struct_functions_next", "rna_iterator_listbase_end", "rna_Struct_functions_get", 0, 0, 0); RNA_def_property_ui_text(prop, "Functions", ""); } @@ -900,6 +912,12 @@ static void rna_def_property(BlenderRNA *brna) RNA_def_property_enum_funcs(prop, "rna_Property_subtype_get", NULL, NULL); RNA_def_property_ui_text(prop, "Subtype", "Semantic interpretation of the property."); + prop= RNA_def_property(srna, "srna", PROP_POINTER, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_struct_type(prop, "Struct"); + RNA_def_property_pointer_funcs(prop, "rna_Property_srna_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Base", "Struct definition used for properties assigned to this item."); + prop= RNA_def_property(srna, "unit", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_enum_items(prop, unit_items); @@ -950,7 +968,7 @@ static void rna_def_function(BlenderRNA *brna) prop= RNA_def_property(srna, "parameters", PROP_COLLECTION, PROP_NONE); /*RNA_def_property_clear_flag(prop, PROP_EDITABLE);*/ RNA_def_property_struct_type(prop, "Property"); - RNA_def_property_collection_funcs(prop, "rna_Function_parameters_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Function_parameters_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); RNA_def_property_ui_text(prop, "Parameters", "Parameters for the function."); prop= RNA_def_property(srna, "registered", PROP_BOOLEAN, PROP_NONE); @@ -1088,7 +1106,7 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna) prop= RNA_def_property(srna, "items", PROP_COLLECTION, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "EnumPropertyItem"); - RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0); RNA_def_property_ui_text(prop, "Items", "Possible values for the property."); srna= RNA_def_struct(brna, "EnumPropertyItem", NULL); @@ -1188,7 +1206,7 @@ void RNA_def_rna(BlenderRNA *brna) prop= RNA_def_property(srna, "structs", PROP_COLLECTION, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "Struct"); - RNA_def_property_collection_funcs(prop, "rna_BlenderRNA_structs_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_BlenderRNA_structs_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); RNA_def_property_ui_text(prop, "Structs", ""); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 1ea342de163..babbf701bd6 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -35,6 +35,10 @@ /* Include for Bake Options */ #include "RE_pipeline.h" +#ifdef WITH_QUICKTIME +#include "quicktime_export.h" +#endif + #ifdef WITH_FFMPEG #include "BKE_writeffmpeg.h" #include <libavcodec/avcodec.h> @@ -80,12 +84,14 @@ EnumPropertyItem proportional_editing_items[] = { #include "BKE_node.h" #include "BKE_pointcache.h" #include "BKE_scene.h" +#include "BKE_depsgraph.h" #include "BLI_threads.h" #include "ED_info.h" #include "ED_node.h" #include "ED_view3d.h" +#include "ED_object.h" #include "RE_pipeline.h" @@ -97,6 +103,34 @@ static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter) return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base*)internal->link)->object); } +static void rna_Scene_link_object(Scene *sce, ReportList *reports, Object *ob) +{ + Base *base= object_in_scene(ob, sce); + if (base) { + BKE_report(reports, RPT_ERROR, "Object is already in this scene."); + return; + } + base= scene_add_base(sce, ob); + ob->id.us++; + + /* this is similar to what object_add_type and add_object do */ + ob->lay= base->lay= sce->lay; + ob->recalc |= OB_RECALC; + + DAG_scene_sort(sce); +} + +static void rna_Scene_unlink_object(Scene *sce, ReportList *reports, Object *ob) +{ + Base *base= object_in_scene(ob, sce); + if (!base) { + BKE_report(reports, RPT_ERROR, "Object is not in this scene."); + return; + } + /* as long as ED_base_object_free_and_unlink calls free_libblock_us, we don't have to decrement ob->id.us */ + ED_base_object_free_and_unlink(sce, base); +} + static void rna_Scene_skgen_etch_template_set(PointerRNA *ptr, PointerRNA value) { ToolSettings *ts = (ToolSettings*)ptr->data; @@ -320,6 +354,9 @@ static void rna_SceneRenderData_file_format_set(PointerRNA *ptr, int value) #ifdef WITH_FFMPEG ffmpeg_verify_image_type(rd); #endif +#ifdef WITH_QUICKTIME + quicktime_verify_image_type(rd); +#endif } void rna_SceneRenderData_jpeg2k_preset_update(RenderData *rd) @@ -612,31 +649,37 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP); RNA_def_property_ui_text(prop, "Snap", "Snap while Ctrl is held during transform."); RNA_def_property_ui_icon(prop, ICON_SNAP_GEAR, 1); + RNA_def_property_update(prop, NC_SCENE|ND_MODE, NULL); /* header redraw */ prop= RNA_def_property(srna, "snap_align_rotation", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ROTATE); RNA_def_property_ui_text(prop, "Snap Align Rotation", "Align rotation with the snapping target."); RNA_def_property_ui_icon(prop, ICON_SNAP_NORMAL, 0); + RNA_def_property_update(prop, NC_SCENE|ND_MODE, NULL); /* header redraw */ prop= RNA_def_property(srna, "snap_element", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "snap_mode"); RNA_def_property_enum_items(prop, snap_element_items); RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to."); + RNA_def_property_update(prop, NC_SCENE|ND_MODE, NULL); /* header redraw */ prop= RNA_def_property(srna, "snap_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "snap_target"); RNA_def_property_enum_items(prop, snap_mode_items); RNA_def_property_ui_text(prop, "Snap Mode", "Which part to snap onto the target."); + RNA_def_property_update(prop, NC_SCENE|ND_MODE, NULL); /* header redraw */ prop= RNA_def_property(srna, "snap_peel_object", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PEEL_OBJECT); RNA_def_property_ui_text(prop, "Snap Peel Object", "Consider objects as whole when finding volume center."); RNA_def_property_ui_icon(prop, ICON_SNAP_PEEL_OBJECT, 0); + RNA_def_property_update(prop, NC_SCENE|ND_MODE, NULL); /* header redraw */ prop= RNA_def_property(srna, "snap_project", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT); RNA_def_property_ui_text(prop, "Project Individual Elements", "DOC_BROKEN"); RNA_def_property_ui_icon(prop, ICON_RETOPO, 0); + RNA_def_property_update(prop, NC_SCENE|ND_MODE, NULL); /* header redraw */ /* Auto Keying */ prop= RNA_def_property(srna, "enable_auto_key", PROP_BOOLEAN, PROP_NONE); @@ -1017,20 +1060,18 @@ static void rna_def_scene_game_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem stereo_modes_items[] ={ -// {STEREO_NOSTEREO, "NO_STEREO", 0, "No Stereo", ""}, {STEREO_QUADBUFFERED, "QUADBUFFERED", 0, "Quad-Buffer", ""}, {STEREO_ABOVEBELOW, "ABOVEBELOW", 0, "Above-Below", ""}, {STEREO_INTERLACED, "INTERLACED", 0, "Interlaced", ""}, {STEREO_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", ""}, {STEREO_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-side", ""}, {STEREO_VINTERLACE, "VINTERLACE", 0, "Vinterlace", ""}, -// {STEREO_DOME, "DOME", 0, "Dome", ""}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem stereo_items[] ={ - {STEREO_NOSTEREO, "NONE", 0, "None", ""}, - {STEREO_ENABLED, "STEREO", 0, "Stereo", ""}, - {STEREO_DOME, "DOME", 0, "Dome", ""}, + {STEREO_NOSTEREO, "NONE", 0, "None", "Disable Stereo and Dome environments"}, + {STEREO_ENABLED, "STEREO", 0, "Stereo", "Enable Stereo environment"}, + {STEREO_DOME, "DOME", 0, "Dome", "Enable Dome environment"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem physics_engine_items[] = { @@ -1093,7 +1134,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "framing_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "framing.col"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "", ""); + RNA_def_property_ui_text(prop, "Framing Color", "Set colour of the bars"); RNA_def_property_update(prop, NC_SCENE, NULL); /* Stereo */ @@ -1106,14 +1147,14 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "stereo_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "stereomode"); RNA_def_property_enum_items(prop, stereo_modes_items); - RNA_def_property_ui_text(prop, "Stereo Mode", ""); + RNA_def_property_ui_text(prop, "Stereo Mode", "Stereographic techniques"); RNA_def_property_update(prop, NC_SCENE, NULL); /* Dome */ prop= RNA_def_property(srna, "dome_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "dome.mode"); RNA_def_property_enum_items(prop, dome_modes_items); - RNA_def_property_ui_text(prop, "Dome Mode", ""); + RNA_def_property_ui_text(prop, "Dome Mode", "Dome physical configurations"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "dome_tesselation", PROP_INT, PROP_NONE); @@ -1412,7 +1453,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {R_AVICODEC, "AVICODEC", ICON_FILE_MOVIE, "AVI Codec", ""}, #endif #ifdef WITH_QUICKTIME +# ifdef USE_QTKIT + {R_QUICKTIME, "QUICKTIME_QTKIT", ICON_FILE_MOVIE, "QuickTime", ""}, +# else {R_QUICKTIME, "QUICKTIME", ICON_FILE_MOVIE, "QuickTime", ""}, +# endif #endif #ifdef __sgi {R_MOVIE, "MOVIE", ICON_FILE_MOVIE, "Movie", ""}, @@ -1459,6 +1504,23 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {16, "16", 0, "16", "16 bit color channels"}, {0, NULL, 0, NULL, NULL}}; #endif + +#ifdef WITH_QUICKTIME + static EnumPropertyItem quicktime_codec_type_items[] = { + {QT_CODECTYPE_RAW, "RAW", 0, "Uncompressed", ""}, + {QT_CODECTYPE_JPEG, "JPEG", 0, "JPEG", ""}, + {QT_CODECTYPE_MJPEGA, "MJPEG_A", 0, "M-JPEG A", ""}, + {QT_CODECTYPE_MJPEGB, "MJPEG_B", 0, "M-JPEG B", ""}, + {QT_CODECTYPE_DVCPAL, "DVCPAL", 0, "DV PAL", ""}, + {QT_CODECTYPE_DVCNTSC, "DVCNTSC", 0, "DV/DVCPRO NTSC", ""}, + {QT_CODECTYPE_DVCPROHD720p, "DVCPROHD720P", 0, "DVCPRO HD 720p"}, + {QT_CODECTYPE_DVCPROHD1080i50, "DVCPROHD1080I50", 0, "DVCPRO HD 1080i50"}, + {QT_CODECTYPE_DVCPROHD1080i60, "DVCPROHD1080I60", 0, "DVCPRO HD 1080i60"}, + {QT_CODECTYPE_MPEG4, "MPEG4", 0, "MPEG4", ""}, + {QT_CODECTYPE_H263, "H263", 0, "H.263", ""}, + {QT_CODECTYPE_H264, "H264", 0, "H.264", ""}, + {0, NULL, 0, NULL, NULL}}; +#endif #ifdef WITH_FFMPEG static EnumPropertyItem ffmpeg_format_items[] = { @@ -1649,6 +1711,22 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); #endif +#ifdef WITH_QUICKTIME + /* QuickTime */ + + prop= RNA_def_property(srna, "quicktime_codec_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "qtcodecsettings.codecType"); + RNA_def_property_enum_items(prop, quicktime_codec_type_items); + RNA_def_property_ui_text(prop, "Codec", "QuickTime codec type"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + prop= RNA_def_property(srna, "quicktime_codec_spatial_quality", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "qtcodecsettings.codecSpatialQuality"); + RNA_def_property_range(prop, 0, 100); + RNA_def_property_ui_text(prop, "Spatial quality", "Intra-frame spatial quality level"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); +#endif + #ifdef WITH_FFMPEG /* FFMPEG Video*/ @@ -2171,11 +2249,71 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Use Game Engine", "Current rendering engine is a game engine."); } + +/* scene.objects */ +static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *prop; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "SceneObjects"); + srna= RNA_def_struct(brna, "SceneObjects", NULL); + RNA_def_struct_sdna(srna, "Scene"); + RNA_def_struct_ui_text(srna, "Scene Objects", "Collection of scene objects."); + + func= RNA_def_function(srna, "link", "rna_Scene_link_object"); + RNA_def_function_ui_description(func, "Link object to scene."); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm= RNA_def_pointer(func, "object", "Object", "", "Object to add to scene."); + RNA_def_property_flag(parm, PROP_REQUIRED); + + func= RNA_def_function(srna, "unlink", "rna_Scene_unlink_object"); + RNA_def_function_ui_description(func, "Unlink object from scene."); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove from scene."); + RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_pointer_funcs(prop, "rna_Scene_active_object_get", "rna_Scene_active_object_set", NULL); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Active Object", "Active object for this scene."); + /* Could call: ED_base_object_activate(C, scene->basact); + * but would be a bad level call and it seems the notifier is enough */ + RNA_def_property_update(prop, NC_SCENE|ND_OB_ACTIVE, NULL); +} + + +/* scene.bases.* */ +static void rna_def_scene_bases(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *prop; + +// FunctionRNA *func; +// PropertyRNA *parm; + + RNA_def_property_srna(cprop, "SceneBases"); + srna= RNA_def_struct(brna, "SceneBases", NULL); + RNA_def_struct_sdna(srna, "Scene"); + RNA_def_struct_ui_text(srna, "Scene Bases", "Collection of scene bases."); + + prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "ObjectBase"); + RNA_def_property_pointer_sdna(prop, NULL, "basact"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Active Base", "Active object base in the scene."); + RNA_def_property_update(prop, NC_SCENE|ND_OB_ACTIVE, NULL); +} + void RNA_def_scene(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - PropertyRNA *prop_act; +// PropertyRNA *prop_act; FunctionRNA *func; static EnumPropertyItem audio_distance_model_items[] = { @@ -2202,7 +2340,6 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "set", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "set"); RNA_def_property_struct_type(prop, "Scene"); - //RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_set_set", NULL); RNA_def_property_ui_text(prop, "Set Scene", "Background set scene."); @@ -2221,37 +2358,16 @@ void RNA_def_scene(BlenderRNA *brna) /* Bases/Objects */ prop= RNA_def_property(srna, "bases", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "base", NULL); - RNA_def_property_struct_type(prop, "Base"); + RNA_def_property_struct_type(prop, "ObjectBase"); RNA_def_property_ui_text(prop, "Bases", ""); - - { /* Collection active property */ - prop_act= RNA_def_property(srna, "base_active", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop_act, "Base"); - RNA_def_property_pointer_sdna(prop_act, NULL, "basact"); - RNA_def_property_flag(prop_act, PROP_EDITABLE); - RNA_def_property_ui_text(prop_act, "Active Base", "Active object in the scene."); - RNA_def_property_update(prop_act, NC_SCENE|ND_OB_ACTIVE, NULL); - RNA_def_property_collection_active(prop, prop_act); - } + rna_def_scene_bases(brna, prop); prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "base", NULL); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Objects", ""); - RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Scene_objects_get", 0, 0, 0, 0, 0); - - { /* Collection active property */ - prop_act= RNA_def_property(srna, "objects_active", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop_act, "Object"); - RNA_def_property_pointer_funcs(prop_act, "rna_Scene_active_object_get", "rna_Scene_active_object_set", NULL); - RNA_def_property_flag(prop_act, PROP_EDITABLE); - RNA_def_property_ui_text(prop_act, "Object", "Object to use as projector transform."); - /* Could call: ED_base_object_activate(C, scene->basact); - * but would be a bad level call and it seems the notifier is enough */ - RNA_def_property_update(prop_act, NC_SCENE|ND_OB_ACTIVE, NULL); - - RNA_def_property_collection_active(prop, prop_act); - } + RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Scene_objects_get", 0, 0, 0); + rna_def_scene_objects(brna, prop); /* Layers */ prop= RNA_def_property(srna, "visible_layers", PROP_BOOLEAN, PROP_LAYER_MEMBER); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 40f2db6d4a4..6b21f886712 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -47,34 +47,6 @@ #include "WM_api.h" -static void rna_Scene_add_object(Scene *sce, ReportList *reports, Object *ob) -{ - Base *base= object_in_scene(ob, sce); - if (base) { - BKE_report(reports, RPT_ERROR, "Object is already in this scene."); - return; - } - base= scene_add_base(sce, ob); - ob->id.us++; - - /* this is similar to what object_add_type and add_object do */ - ob->lay= base->lay= sce->lay; - ob->recalc |= OB_RECALC; - - DAG_scene_sort(sce); -} - -static void rna_Scene_remove_object(Scene *sce, ReportList *reports, Object *ob) -{ - Base *base= object_in_scene(ob, sce); - if (!base) { - BKE_report(reports, RPT_ERROR, "Object is not in this scene."); - return; - } - /* as long as ED_base_object_free_and_unlink calls free_libblock_us, we don't have to decrement ob->id.us */ - ED_base_object_free_and_unlink(sce, base); -} - static void rna_Scene_set_frame(Scene *sce, bContext *C, int frame) { sce->r.cfra= frame; @@ -118,18 +90,6 @@ void RNA_api_scene(StructRNA *srna) FunctionRNA *func; PropertyRNA *parm; - func= RNA_def_function(srna, "add_object", "rna_Scene_add_object"); - RNA_def_function_ui_description(func, "Add object to scene."); - RNA_def_function_flag(func, FUNC_USE_REPORTS); - parm= RNA_def_pointer(func, "object", "Object", "", "Object to add to scene."); - RNA_def_property_flag(parm, PROP_REQUIRED); - - func= RNA_def_function(srna, "remove_object", "rna_Scene_remove_object"); - RNA_def_function_ui_description(func, "Remove object from scene."); - RNA_def_function_flag(func, FUNC_USE_REPORTS); - parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove from scene."); - RNA_def_property_flag(parm, PROP_REQUIRED); - func= RNA_def_function(srna, "set_frame", "rna_Scene_set_frame"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_function_ui_description(func, "Set scene frame updating all objects immediately."); diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 004c57eedfc..79a5d3d5cd1 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -148,6 +148,16 @@ static void rna_def_region(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "swinid"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Region ID", "Uniqute ID for this region."); + + prop= RNA_def_property(srna, "width", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "winx"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Width", "Region width."); + + prop= RNA_def_property(srna, "height", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "winy"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Height", "Region height."); } static void rna_def_screen(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 481abc983c2..db100c38257 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -142,6 +142,21 @@ static int rna_ParticleEdit_hair_get(PointerRNA *ptr) return (edit && edit->psys); } + +static void rna_Paint_active_brush_index_set(PointerRNA *ptr, int value) +{ + Paint *p= ptr->data; + CLAMP(value, 0, p->brush_count-1); + p->active_brush_index= value; +} + +static void rna_Paint_active_brush_index_range(PointerRNA *ptr, int *min, int *max) +{ + Paint *p= ptr->data; + *min= 0; + *max= MAX2(p->brush_count-1, 0); +} + #else static void rna_def_paint(BlenderRNA *brna) @@ -158,11 +173,13 @@ static void rna_def_paint(BlenderRNA *brna) "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", - "rna_Paint_brushes_length", 0, 0, 0, 0); + "rna_Paint_brushes_length", 0, 0); RNA_def_property_ui_text(prop, "Brushes", "Brushes selected for this paint mode."); prop= RNA_def_property(srna, "active_brush_index", PROP_INT, PROP_NONE); - RNA_def_property_range(prop, 0, INT_MAX); + RNA_def_property_int_funcs(prop, NULL, "rna_Paint_active_brush_index_set", "rna_Paint_active_brush_index_range"); + RNA_def_property_range(prop, 0, INT_MAX); + RNA_def_property_update(prop, NC_BRUSH|NA_EDITED, NULL); /* Fake property to get active brush directly, rather than integer index */ prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); @@ -170,6 +187,7 @@ static void rna_def_paint(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, "rna_Paint_active_brush_get", "rna_Paint_active_brush_set", NULL); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Brush", "Active paint brush."); + RNA_def_property_update(prop, NC_BRUSH|NA_EDITED, NULL); } static void rna_def_sculpt(BlenderRNA *brna) @@ -238,11 +256,7 @@ static void rna_def_vertex_paint(BlenderRNA *brna) prop= RNA_def_property(srna, "all_faces", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_AREA); RNA_def_property_ui_text(prop, "All Faces", "Paint on all faces inside brush."); - - prop= RNA_def_property(srna, "vertex_dist", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SOFT); - RNA_def_property_ui_text(prop, "Vertex Dist", "Use distances to vertices (instead of paint entire faces)."); - + prop= RNA_def_property(srna, "normals", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_NORMALS); RNA_def_property_ui_text(prop, "Normals", "Applies the vertex normal before painting."); @@ -250,14 +264,6 @@ static void rna_def_vertex_paint(BlenderRNA *brna) prop= RNA_def_property(srna, "spray", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SPRAY); RNA_def_property_ui_text(prop, "Spray", "Keep applying paint effect while holding mouse."); - - prop= RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.1f, 5.0f); - RNA_def_property_ui_text(prop, "Gamma", "Vertex paint Gamma."); - - prop= RNA_def_property(srna, "mul", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.1f, 50.0f); - RNA_def_property_ui_text(prop, "Mul", "Vertex paint Mul."); } static void rna_def_image_paint(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_sequence.c b/source/blender/makesrna/intern/rna_sequence.c index 8bbffa4425a..9f9298c66f6 100644 --- a/source/blender/makesrna/intern/rna_sequence.c +++ b/source/blender/makesrna/intern/rna_sequence.c @@ -42,16 +42,6 @@ #ifdef RNA_RUNTIME -static int rna_SequenceEditor_name_length(PointerRNA *ptr) -{ - return strlen("Sequence Editor"); -} - -static void rna_SequenceEditor_name_get(PointerRNA *ptr, char *str) -{ - strcpy(str, "Sequence Editor"); -} - static void rna_SequenceEditor_start_frame_set(PointerRNA *ptr, int value) { Sequence *seq= (Sequence*)ptr->data; @@ -176,8 +166,10 @@ static int rna_Sequence_name_length(PointerRNA *ptr) static void rna_Sequence_name_set(PointerRNA *ptr, const char *value) { + Scene *sce= (Scene*)ptr->id.data; Sequence *seq= (Sequence*)ptr->data; BLI_strncpy(seq->name+2, value, sizeof(seq->name)-2); + seqUniqueName(&sce->ed->seqbase, seq); } static StructRNA* rna_Sequence_refine(struct PointerRNA *ptr) @@ -230,16 +222,11 @@ static char *rna_Sequence_path(PointerRNA *ptr) */ if (seq->name+2) return BLI_sprintfN("sequence_editor.sequences[\"%s\"]", seq->name+2); - else { - /* compromise for the frequent sitation when strips don't have names... */ - Scene *sce= (Scene*)ptr->id.data; - Editing *ed= seq_give_editing(sce, FALSE); - - return BLI_sprintfN("sequence_editor.sequences[%d]", BLI_findindex(&ed->seqbase, seq)); - } + else + return BLI_strdup(""); } -static PointerRNA rna_SequenceEdtior_meta_stack_get(CollectionPropertyIterator *iter) +static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator *iter) { ListBaseIterator *internal= iter->internal; MetaStack *ms= (MetaStack*)internal->link; @@ -545,6 +532,17 @@ static void rna_def_sequence(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Blend Opacity", ""); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + prop= RNA_def_property(srna, "effect_fader", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_float_sdna(prop, NULL, "effect_fader"); + RNA_def_property_ui_text(prop, "Effect fader position", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + + prop= RNA_def_property(srna, "speed_fader", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "speed_fader"); + RNA_def_property_ui_text(prop, "Speed effect fader position", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + /* functions */ func= RNA_def_function(srna, "getStripElem", "give_stripelem"); RNA_def_function_ui_description(func, "Return the strip element from a given frame or None."); @@ -563,12 +561,6 @@ static void rna_def_editor(BlenderRNA *brna) RNA_def_struct_ui_icon(srna, ICON_SEQUENCE); RNA_def_struct_sdna(srna, "Editing"); - prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_string_funcs(prop, "rna_SequenceEditor_name_get", "rna_SequenceEditor_name_length", NULL); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Name", ""); - RNA_def_struct_name_property(srna, prop); - prop= RNA_def_property(srna, "sequences", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL); RNA_def_property_struct_type(prop, "Sequence"); @@ -578,7 +570,7 @@ static void rna_def_editor(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "metastack", NULL); RNA_def_property_struct_type(prop, "Sequence"); RNA_def_property_ui_text(prop, "Meta Stack", "Meta strip stack, last is currently edited meta strip."); - RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_SequenceEdtior_meta_stack_get", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_SequenceEditor_meta_stack_get", 0, 0, 0); prop= RNA_def_property(srna, "active_strip", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "act_seq"); @@ -751,7 +743,9 @@ static void rna_def_scene(BlenderRNA *brna) RNA_def_struct_sdna(srna, "Sequence"); prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Scene", "Scene that this sequence uses."); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); rna_def_filter_video(srna); rna_def_proxy(srna); @@ -797,7 +791,7 @@ static void rna_def_sound(BlenderRNA *brna) prop= RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Sound"); - RNA_def_property_ui_text(prop, "Sound", "Sound datablock used by this sequence (RAM audio only)."); + RNA_def_property_ui_text(prop, "Sound", "Sound datablock used by this sequence."); prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "strip->stripdata->name"); @@ -807,8 +801,16 @@ static void rna_def_sound(BlenderRNA *brna) prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "strip->dir"); RNA_def_property_ui_text(prop, "Directory", ""); - + rna_def_input(srna); + + RNA_def_struct_sdna_from(srna, "SoundHandle", "sound_handle"); + + prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "volume"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound"); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); } static void rna_def_effect(BlenderRNA *brna) @@ -1054,6 +1056,7 @@ static void rna_def_speed_control(BlenderRNA *brna) prop= RNA_def_property(srna, "global_speed", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "globalSpeed"); + RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE); /* seq->facf0 is used to animate this */ RNA_def_property_ui_text(prop, "Global Speed", ""); RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 0); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index c77dabe5e4d..ac93f75156f 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -991,6 +991,11 @@ static void rna_def_space_sequencer(BlenderRNA *brna) RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); /* flag's */ + prop= RNA_def_property(srna, "show_cframe_indicator", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_NO_DRAW_CFRANUM); + RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line."); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); + prop= RNA_def_property(srna, "draw_frames", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES); RNA_def_property_ui_text(prop, "Draw Frames", "Draw frames rather then seconds."); diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index 8c9b2b58887..bed686ed360 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -194,6 +194,10 @@ static void rna_def_text(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Memory", "Text file is in memory, without a corresponding file on disk."); + prop= RNA_def_property(srna, "use_module", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISSCRIPT); + RNA_def_property_ui_text(prop, "Register", "Register this text as a module on loading."); + prop= RNA_def_property(srna, "lines", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "TextLine"); RNA_def_property_ui_text(prop, "Lines", "Lines of text."); diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 44e7d0f68d0..ceb78d8cddf 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -71,36 +71,36 @@ static StructRNA *rna_Texture_refine(struct PointerRNA *ptr) Tex *tex= (Tex*)ptr->data; switch(tex->type) { + case TEX_BLEND: + return &RNA_BlendTexture; case TEX_CLOUDS: return &RNA_CloudsTexture; - case TEX_WOOD: - return &RNA_WoodTexture; - case TEX_MARBLE: - return &RNA_MarbleTexture; + case TEX_DISTNOISE: + return &RNA_DistortedNoiseTexture; + case TEX_ENVMAP: + return &RNA_EnvironmentMapTexture; + case TEX_IMAGE: + return &RNA_ImageTexture; case TEX_MAGIC: return &RNA_MagicTexture; - case TEX_BLEND: - return &RNA_BlendTexture; - case TEX_STUCCI: - return &RNA_StucciTexture; + case TEX_MARBLE: + return &RNA_MarbleTexture; + case TEX_MUSGRAVE: + return &RNA_MusgraveTexture; case TEX_NOISE: return &RNA_NoiseTexture; - case TEX_IMAGE: - return &RNA_ImageTexture; case TEX_PLUGIN: return &RNA_PluginTexture; - case TEX_ENVMAP: - return &RNA_EnvironmentMapTexture; - case TEX_MUSGRAVE: - return &RNA_MusgraveTexture; - case TEX_VORONOI: - return &RNA_VoronoiTexture; - case TEX_DISTNOISE: - return &RNA_DistortedNoiseTexture; case TEX_POINTDENSITY: return &RNA_PointDensityTexture; + case TEX_STUCCI: + return &RNA_StucciTexture; + case TEX_VORONOI: + return &RNA_VoronoiTexture; case TEX_VOXELDATA: return &RNA_VoxelDataTexture; + case TEX_WOOD: + return &RNA_WoodTexture; default: return &RNA_Texture; } @@ -1780,21 +1780,21 @@ static void rna_def_texture(BlenderRNA *brna) static EnumPropertyItem prop_type_items[] = { {0, "NONE", 0, "None", ""}, - {TEX_PLUGIN, "PLUGIN", ICON_PLUGIN, "Plugin", ""}, - {TEX_IMAGE, "IMAGE", ICON_IMAGE_DATA, "Image or Movie", ""}, - {TEX_ENVMAP, "ENVIRONMENT_MAP", ICON_IMAGE_DATA, "Environment Map", ""}, + {TEX_BLEND, "BLEND", ICON_TEXTURE, "Blend", ""}, {TEX_CLOUDS, "CLOUDS", ICON_TEXTURE, "Clouds", ""}, - {TEX_WOOD, "WOOD", ICON_TEXTURE, "Wood", ""}, - {TEX_MARBLE, "MARBLE", ICON_TEXTURE, "Marble", ""}, + {TEX_DISTNOISE, "DISTORTED_NOISE", ICON_TEXTURE, "Distorted Noise", ""}, + {TEX_ENVMAP, "ENVIRONMENT_MAP", ICON_IMAGE_DATA, "Environment Map", ""}, + {TEX_IMAGE, "IMAGE", ICON_IMAGE_DATA, "Image or Movie", ""}, {TEX_MAGIC, "MAGIC", ICON_TEXTURE, "Magic", ""}, - {TEX_BLEND, "BLEND", ICON_TEXTURE, "Blend", ""}, - {TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", ""}, - {TEX_NOISE, "NOISE", ICON_TEXTURE, "Noise", ""}, + {TEX_MARBLE, "MARBLE", ICON_TEXTURE, "Marble", ""}, {TEX_MUSGRAVE, "MUSGRAVE", ICON_TEXTURE, "Musgrave", ""}, - {TEX_VORONOI, "VORONOI", ICON_TEXTURE, "Voronoi", ""}, - {TEX_DISTNOISE, "DISTORTED_NOISE", ICON_TEXTURE, "Distorted Noise", ""}, + {TEX_NOISE, "NOISE", ICON_TEXTURE, "Noise", ""}, + {TEX_PLUGIN, "PLUGIN", ICON_PLUGIN, "Plugin", ""}, {TEX_POINTDENSITY, "POINT_DENSITY", ICON_TEXTURE, "Point Density", ""}, + {TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", ""}, + {TEX_VORONOI, "VORONOI", ICON_TEXTURE, "Voronoi", ""}, {TEX_VOXELDATA, "VOXEL_DATA", ICON_TEXTURE, "Voxel Data", ""}, + {TEX_WOOD, "WOOD", ICON_TEXTURE, "Wood", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "Texture", "ID"); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index ad4557f76a1..025c8691652 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -51,10 +51,9 @@ static void rna_uiItemR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, uiItemR(layout, name, icon, ptr, propname, flag); } -static PointerRNA rna_uiItemO(uiLayout *layout, char *name, int icon, char *opname, int properties) +static PointerRNA rna_uiItemO(uiLayout *layout, char *name, int icon, char *opname) { - int flag= (properties)? UI_ITEM_O_RETURN_PROPS: 0; - return uiItemFullO(layout, name, icon, opname, NULL, uiLayoutGetOperatorContext(layout), flag); + return uiItemFullO(layout, name, icon, opname, NULL, uiLayoutGetOperatorContext(layout), UI_ITEM_O_RETURN_PROPS); } #else @@ -142,7 +141,7 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_float(func, "percentage", 0.0f, 0.0f, 1.0f, "Percentage", "Percentage of width to split at.", 0.0f, 1.0f); /* items */ - func= RNA_def_function(srna, "itemR", "rna_uiItemR"); + func= RNA_def_function(srna, "prop", "rna_uiItemR"); api_ui_item_common(func); api_ui_item_rna_common(func); RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail."); @@ -152,20 +151,20 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_boolean(func, "event", 0, "", "Use button to input key events."); RNA_def_boolean(func, "full_event", 0, "", "Use button to input full events including modifiers."); - func= RNA_def_function(srna, "items_enumR", "uiItemsEnumR"); + func= RNA_def_function(srna, "props_enum", "uiItemsEnumR"); api_ui_item_rna_common(func); - func= RNA_def_function(srna, "item_menu_enumR", "uiItemMenuEnumR"); + func= RNA_def_function(srna, "prop_menu_enum", "uiItemMenuEnumR"); api_ui_item_common(func); api_ui_item_rna_common(func); - func= RNA_def_function(srna, "item_enumR", "uiItemEnumR_string"); + func= RNA_def_function(srna, "prop_enum", "uiItemEnumR_string"); api_ui_item_common(func); api_ui_item_rna_common(func); parm= RNA_def_string(func, "value", "", 0, "", "Enum property value."); RNA_def_property_flag(parm, PROP_REQUIRED); - func= RNA_def_function(srna, "item_pointerR", "uiItemPointerR"); + func= RNA_def_function(srna, "prop_object", "uiItemPointerR"); api_ui_item_common(func); api_ui_item_rna_common(func); parm= RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in."); @@ -173,69 +172,68 @@ void RNA_api_ui_layout(StructRNA *srna) parm= RNA_def_string(func, "search_property", "", 0, "", "Identifier of search collection property."); RNA_def_property_flag(parm, PROP_REQUIRED); - func= RNA_def_function(srna, "itemO", "rna_uiItemO"); + func= RNA_def_function(srna, "operator", "rna_uiItemO"); api_ui_item_op_common(func); - parm= RNA_def_boolean(func, "properties", 0, "Properties", "Return operator properties to fill in manually."); - parm= RNA_def_pointer(func, "return_properties", "OperatorProperties", "", "Operator properties to fill in, return when 'properties' is set to true."); + parm= RNA_def_pointer(func, "properties", "OperatorProperties", "", "Operator properties to fill in, return when 'properties' is set to true."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); RNA_def_function_return(func, parm); - func= RNA_def_function(srna, "item_enumO", "uiItemEnumO_string"); +/* func= RNA_def_function(srna, "operator_enum", "uiItemEnumO_string"); api_ui_item_op_common(func); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator."); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_string(func, "value", "", 0, "", "Enum property value."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED); */ - func= RNA_def_function(srna, "items_enumO", "uiItemsEnumO"); + func= RNA_def_function(srna, "operator_enums", "uiItemsEnumO"); parm= RNA_def_string(func, "operator", "", 0, "", "Identifier of the operator."); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator."); RNA_def_property_flag(parm, PROP_REQUIRED); - func= RNA_def_function(srna, "item_menu_enumO", "uiItemMenuEnumO"); + func= RNA_def_function(srna, "operator_menu_enum", "uiItemMenuEnumO"); api_ui_item_op_common(func); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator."); RNA_def_property_flag(parm, PROP_REQUIRED); - func= RNA_def_function(srna, "item_booleanO", "uiItemBooleanO"); +/* func= RNA_def_function(srna, "operator_boolean", "uiItemBooleanO"); api_ui_item_op_common(func); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator."); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_boolean(func, "value", 0, "", "Value of the property to call the operator with."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED); */ - func= RNA_def_function(srna, "item_intO", "uiItemIntO"); +/* func= RNA_def_function(srna, "operator_int", "uiItemIntO"); api_ui_item_op_common(func); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator."); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_int(func, "value", 0, INT_MIN, INT_MAX, "", "Value of the property to call the operator with.", INT_MIN, INT_MAX); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED); */ - func= RNA_def_function(srna, "item_floatO", "uiItemFloatO"); +/* func= RNA_def_function(srna, "operator_float", "uiItemFloatO"); api_ui_item_op_common(func); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator."); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "", "Value of the property to call the operator with.", -FLT_MAX, FLT_MAX); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED); */ - func= RNA_def_function(srna, "item_stringO", "uiItemStringO"); +/* func= RNA_def_function(srna, "operator_string", "uiItemStringO"); api_ui_item_op_common(func); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator."); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_string(func, "value", "", 0, "", "Value of the property to call the operator with."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED); */ - func= RNA_def_function(srna, "itemL", "uiItemL"); + func= RNA_def_function(srna, "label", "uiItemL"); api_ui_item_common(func); - func= RNA_def_function(srna, "itemM", "uiItemM"); + func= RNA_def_function(srna, "menu", "uiItemM"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_common(func); parm= RNA_def_string(func, "menu", "", 0, "", "Identifier of the menu."); RNA_def_property_flag(parm, PROP_REQUIRED); - func= RNA_def_function(srna, "itemS", "uiItemS"); + func= RNA_def_function(srna, "separator", "uiItemS"); /* context */ func= RNA_def_function(srna, "set_context_pointer", "uiLayoutSetContextPointer"); @@ -343,10 +341,6 @@ void RNA_api_ui_layout(StructRNA *srna) func= RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); - - func= RNA_def_function(srna, "view3d_select_faceselmenu", "uiTemplate_view3d_select_faceselmenu"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); } - #endif diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 0ca59310abc..dfb1ccaa2b4 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -491,22 +491,22 @@ static void rna_def_userdef_theme_spaces_main(StructRNA *srna, int spacetype) /* window */ prop= RNA_def_property(srna, "back", PROP_FLOAT, PROP_COLOR); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Window Back", ""); + RNA_def_property_ui_text(prop, "Window Background", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "title", PROP_FLOAT, PROP_COLOR); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Window Title", ""); + 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); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Window Text", ""); + 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); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Window Text Highlight", ""); + RNA_def_property_ui_text(prop, "Text Highlight", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); /* header */ @@ -526,48 +526,48 @@ static void rna_def_userdef_theme_spaces_main(StructRNA *srna, int spacetype) 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); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Button Back", ""); - RNA_def_property_update(prop, 0, "rna_userdef_update"); - - prop= RNA_def_property(srna, "button_title", PROP_FLOAT, PROP_COLOR); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Button Title", ""); - RNA_def_property_update(prop, 0, "rna_userdef_update"); - - prop= RNA_def_property(srna, "button_text", PROP_FLOAT, PROP_COLOR); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Button Text", ""); - RNA_def_property_update(prop, 0, "rna_userdef_update"); - - prop= RNA_def_property(srna, "button_text_hi", PROP_FLOAT, PROP_COLOR); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Button Text Highlight", ""); - RNA_def_property_update(prop, 0, "rna_userdef_update"); - } +// if(! ELEM(spacetype, SPACE_BUTS, SPACE_OUTLINER)) { + prop= RNA_def_property(srna, "button", PROP_FLOAT, PROP_COLOR); + RNA_def_property_array(prop, 3); + 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); + 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); + 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); + 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 */ if(ELEM5(spacetype, SPACE_IPO, SPACE_ACTION, SPACE_NLA, SPACE_NODE, SPACE_FILE)) { prop= RNA_def_property(srna, "list", PROP_FLOAT, PROP_COLOR); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "List Back", ""); + RNA_def_property_ui_text(prop, "Source List", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "list_title", PROP_FLOAT, PROP_COLOR); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "List Title", ""); + RNA_def_property_ui_text(prop, "Source List Title", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "list_text", PROP_FLOAT, PROP_COLOR); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "List Text", ""); + RNA_def_property_ui_text(prop, "Source List Text", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "list_text_hi", PROP_FLOAT, PROP_COLOR); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "List Text Highlight", ""); + RNA_def_property_ui_text(prop, "Source List Text Highlight", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); } } @@ -1379,7 +1379,7 @@ static void rna_def_userdef_theme_space_nla(BlenderRNA *brna) prop= RNA_def_property(srna, "strips", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "strip"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "strips", ""); + RNA_def_property_ui_text(prop, "Strips", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "strips_selected", PROP_FLOAT, PROP_COLOR); @@ -1434,21 +1434,22 @@ static void rna_def_userdef_themes(BlenderRNA *brna) static EnumPropertyItem active_theme_group[] = { {0, "USER_INTERFACE", ICON_UI, "User Interface", ""}, - {1, "VIEW_3D", ICON_VIEW3D, "View 3D", ""}, - {2, "GRAPH_EDITOR", ICON_IPO, "Graph Editor", ""}, - {3, "FILE_BROWSER", ICON_FILESEL, "File Browser", ""}, - {4, "NLA_EDITOR", ICON_NLA, "NLA Editor", ""}, - {5, "DOPESHEET_EDITOR", ICON_ACTION, "Dopesheet Editor", ""}, - {6, "IMAGE_EDITOR", ICON_IMAGE_COL, "Image Editor", ""}, - {7, "SEQUENCE_EDITOR", ICON_SEQUENCE, "Sequence Editor", ""}, - {8, "PROPERTIES", ICON_BUTS, "Properties", ""}, - {9, "TEXT_EDITOR", ICON_TEXT, "Text Editor", ""}, - {10, "TIMELINE", ICON_TIME, "Timeline", ""}, - {11, "NODE_EDITOR", ICON_NODE, "Node Editor", ""}, - {12, "LOGIC_EDITOR", ICON_LOGIC, "Logic Editor", ""}, - {13, "OUTLINER", ICON_OOPS, "Outliner", ""}, - {14, "INFO", ICON_INFO, "Info", ""}, - {15, "USER_PREFERENCES", ICON_PREFERENCES, "User Preferences", ""}, + {1, "VIEW_3D", ICON_VIEW3D, "3D View", ""}, + {2, "TIMELINE", ICON_TIME, "Timeline", ""}, + {3, "GRAPH_EDITOR", ICON_IPO, "Graph Editor", ""}, + {4, "DOPESHEET_EDITOR", ICON_ACTION, "Dopesheet", ""}, + {5, "NLA_EDITOR", ICON_NLA, "NLA Editor", ""}, + {6, "IMAGE_EDITOR", ICON_IMAGE_COL, "UV/Image Editor", ""}, + {7, "SEQUENCE_EDITOR", ICON_SEQUENCE, "Video Sequence Editor", ""}, + {8, "TEXT_EDITOR", ICON_TEXT, "Text Editor", ""}, + {9, "NODE_EDITOR", ICON_NODETREE, "Node Editor", ""}, + {10, "LOGIC_EDITOR", ICON_LOGIC, "Logic Editor", ""}, + {11, "PROPERTIES", ICON_BUTS, "Properties", ""}, + {12, "OUTLINER", ICON_OOPS, "Outliner", ""}, + {14, "USER_PREFERENCES", ICON_PREFERENCES, "User Preferences", ""}, + {15, "INFO", ICON_INFO, "Info", ""}, + {16, "FILE_BROWSER", ICON_FILESEL, "File Browser", ""}, + {17, "CONSOLE", ICON_CONSOLE, "Console", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "Theme", NULL); @@ -2169,10 +2170,6 @@ static void rna_def_userdef_system(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_DONT_DOSCRIPTLINKS); RNA_def_property_ui_text(prop, "Auto Run Python Scripts", "Allow any .blend file to run scripts automatically (unsafe with blend files from an untrusted source)."); - prop= RNA_def_property(srna, "emulate_numpad", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_NONUMPAD); - RNA_def_property_ui_text(prop, "Emulate Numpad", "Causes the 1 to 0 keys to act as the numpad (useful for laptops)."); - prop= RNA_def_property(srna, "prefetch_frames", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "prefetchframes"); RNA_def_property_range(prop, 0, 500); @@ -2335,6 +2332,10 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TWOBUTTONMOUSE); RNA_def_property_boolean_funcs(prop, NULL, "rna_userdef_emulate_set"); RNA_def_property_ui_text(prop, "Emulate 3 Button Mouse", "Emulates Middle Mouse with Alt+LeftMouse (doesnt work with Left Mouse Select option.)"); + + prop= RNA_def_property(srna, "emulate_numpad", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_NONUMPAD); + RNA_def_property_ui_text(prop, "Emulate Numpad", "Causes the 1 to 0 keys to act as the numpad (useful for laptops)."); } static void rna_def_userdef_filepaths(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 39c4c340b97..3233c1d8443 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -230,6 +230,17 @@ EnumPropertyItem event_type_items[] = { {TIMER2, "TIMER2", 0, "Timer 2", ""}, {0, NULL, 0, NULL, NULL}}; +EnumPropertyItem keymap_propvalue_items[] = { + {0, "NONE", 0, "", ""}, + {0, NULL, 0, NULL, NULL}}; + +EnumPropertyItem keymap_modifiers_items[] = { + {KM_ANY, "ANY", 0, "Any", ""}, + {0, "NONE", 0, "None", ""}, + {1, "FIRST", 0, "First", ""}, + {2, "SECOND", 0, "Second", ""}, + {0, NULL, 0, NULL, NULL}}; + #define KMI_TYPE_KEYBOARD 0 #define KMI_TYPE_MOUSE 1 #define KMI_TYPE_TWEAK 2 @@ -291,7 +302,7 @@ static int rna_Operator_name_length(PointerRNA *ptr) static PointerRNA rna_Operator_properties_get(PointerRNA *ptr) { wmOperator *op= (wmOperator*)ptr->data; - return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties); + return rna_pointer_inherit_refine(ptr, op->type->srna, op->properties); } @@ -403,6 +414,73 @@ static EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *C, PointerRNA *ptr else return event_value_items; } +static EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + wmWindowManager *wm = CTX_wm_manager(C); + wmKeyConfig *kc; + wmKeyMap *km; + + /* check user keymaps */ + for(km=U.keymaps.first; km; km=km->next) { + wmKeyMapItem *ki; + for (ki=km->items.first; ki; ki=ki->next) { + if (ki == ptr->data) { + if (!km->modal_items) { + if (!WM_keymap_user_init(wm, km)) { + return keymap_propvalue_items; /* ERROR */ + } + } + + return km->modal_items; + } + } + } + + for(kc=wm->keyconfigs.first; kc; kc=kc->next) { + for(km=kc->keymaps.first; km; km=km->next) { + /* only check if it's a modal keymap */ + if (km->modal_items) { + wmKeyMapItem *ki; + for (ki=km->items.first; ki; ki=ki->next) { + if (ki == ptr->data) { + return km->modal_items; + } + } + } + } + } + + + return keymap_propvalue_items; /* ERROR */ +} + +static int rna_KeyMapItem_any_getf(PointerRNA *ptr) +{ + wmKeyMapItem *kmi = (wmKeyMapItem*)ptr->data; + + if (kmi->shift == KM_ANY && + kmi->ctrl == KM_ANY && + kmi->alt == KM_ANY && + kmi->oskey == KM_ANY) + + return 1; + else + return 0; +} + +static void rna_KeyMapItem_any_setf(PointerRNA *ptr, int value) +{ + wmKeyMapItem *kmi = (wmKeyMapItem*)ptr->data; + + if(value) { + kmi->shift= kmi->ctrl= kmi->alt= kmi->oskey= KM_ANY; + } + else { + kmi->shift= kmi->ctrl= kmi->alt= kmi->oskey= 0; + } +} + + static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr) { wmWindowManager *wm= ptr->data; @@ -734,6 +812,10 @@ static void rna_def_keyconfig(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_USER); RNA_def_property_ui_text(prop, "User Defined", "Keymap is defined by the user."); + prop= RNA_def_property(srna, "modal", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_MODAL); + RNA_def_property_ui_text(prop, "Modal Keymap", "Indicates that a keymap is used for translate modal events for an operator."); + RNA_api_keymap(srna); /* KeyMapItem */ @@ -770,20 +852,32 @@ static void rna_def_keyconfig(BlenderRNA *brna) RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_value_itemf"); RNA_def_property_ui_text(prop, "Value", ""); + prop= RNA_def_property(srna, "any", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_any_getf", "rna_KeyMapItem_any_setf"); + RNA_def_property_ui_text(prop, "Any", "Any modifier keys pressed."); + prop= RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "shift", 0); +// RNA_def_property_enum_sdna(prop, NULL, "shift"); +// RNA_def_property_enum_items(prop, keymap_modifiers_items); RNA_def_property_ui_text(prop, "Shift", "Shift key pressed."); prop= RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 0); +// RNA_def_property_enum_sdna(prop, NULL, "ctrl"); +// RNA_def_property_enum_items(prop, keymap_modifiers_items); RNA_def_property_ui_text(prop, "Ctrl", "Control key pressed."); prop= RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "alt", 0); +// RNA_def_property_enum_sdna(prop, NULL, "alt"); +// RNA_def_property_enum_items(prop, keymap_modifiers_items); RNA_def_property_ui_text(prop, "Alt", "Alt key pressed."); prop= RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "oskey", 0); +// RNA_def_property_enum_sdna(prop, NULL, "oskey"); +// RNA_def_property_enum_items(prop, keymap_modifiers_items); RNA_def_property_ui_text(prop, "OS Key", "Operating system key pressed."); prop= RNA_def_property(srna, "key_modifier", PROP_ENUM, PROP_NONE); @@ -795,6 +889,12 @@ static void rna_def_keyconfig(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_EXPANDED); RNA_def_property_ui_text(prop, "Expanded", "Expanded in the user interface."); + prop= RNA_def_property(srna, "propvalue", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "propvalue"); + RNA_def_property_enum_items(prop, keymap_propvalue_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_propvalue_itemf"); + RNA_def_property_ui_text(prop, "Property Value", "The value this event translates to in a modal keymap."); + prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", KMI_INACTIVE); RNA_def_property_ui_text(prop, "Active", "Activate or deactivate item."); diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 450b2e9fbc0..4c6bde0e8df 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -43,15 +43,79 @@ #include "WM_api.h" #include "WM_types.h" -static wmKeyMapItem *rna_KeyMap_add_item(wmKeyMap *km, char *idname, int type, int value, int shift, int ctrl, int alt, int oskey, int keymodifier) +static wmKeyMap *rna_keymap_add(wmKeyConfig *keyconf, char *idname, int spaceid, int regionid, int modal) { + if (modal == 0) { + return WM_keymap_find(keyconf, idname, spaceid, regionid); + } else { + return WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */ + } +} + +static wmKeyMap *rna_keymap_active(wmKeyMap *km, bContext *C) +{ + wmWindowManager *wm = CTX_wm_manager(C); + return WM_keymap_active(wm, km); +} + + +static wmKeyMapItem *rna_KeyMap_add_modal_item(wmKeyMap *km, bContext *C, ReportList *reports, char* propvalue_str, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier) +{ + wmWindowManager *wm = CTX_wm_manager(C); + int modifier= 0; + int propvalue = 0; + + /* only modal maps */ + if ((km->flag & KEYMAP_MODAL) == 0) { + BKE_report(reports, RPT_ERROR, "Not a modal keymap."); + return NULL; + } + + if (!km->modal_items) { + if(!WM_keymap_user_init(wm, km)) { + BKE_report(reports, RPT_ERROR, "User defined keymap doesn't correspond to a system keymap."); + return NULL; + } + } + + if (!km->modal_items) { + BKE_report(reports, RPT_ERROR, "No property values defined."); + return NULL; + } + + + if(RNA_enum_value_from_id(km->modal_items, propvalue_str, &propvalue)==0) { + BKE_report(reports, RPT_WARNING, "Property value not in enumeration."); + } + + if(shift) modifier |= KM_SHIFT; + if(ctrl) modifier |= KM_CTRL; + if(alt) modifier |= KM_ALT; + if(oskey) modifier |= KM_OSKEY; + + if(any) modifier = KM_ANY; + + return WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, propvalue); +} + +static wmKeyMapItem *rna_KeyMap_add_item(wmKeyMap *km, ReportList *reports, char *idname, int type, int any, int value, int shift, int ctrl, int alt, int oskey, int keymodifier) +{ +// wmWindowManager *wm = CTX_wm_manager(C); int modifier= 0; + /* only on non-modal maps */ + if (km->flag & KEYMAP_MODAL) { + BKE_report(reports, RPT_ERROR, "Not a non-modal keymap."); + return NULL; + } + if(shift) modifier |= KM_SHIFT; if(ctrl) modifier |= KM_CTRL; if(alt) modifier |= KM_ALT; if(oskey) modifier |= KM_OSKEY; + if(any) modifier = KM_ANY; + return WM_keymap_add_item(km, idname, type, value, modifier, keymodifier); } @@ -90,11 +154,12 @@ void RNA_api_keyconfig(StructRNA *srna) FunctionRNA *func; PropertyRNA *parm; - func= RNA_def_function(srna, "add_keymap", "WM_keymap_find"); + func= RNA_def_function(srna, "add_keymap", "rna_keymap_add"); parm= RNA_def_string(func, "name", "", 0, "Name", ""); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", ""); RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", ""); + RNA_def_boolean(func, "modal", 0, "Modal", ""); parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map."); RNA_def_function_return(func, parm); } @@ -105,12 +170,31 @@ void RNA_api_keymap(StructRNA *srna) PropertyRNA *parm; func= RNA_def_function(srna, "add_item", "rna_KeyMap_add_item"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); parm= RNA_def_string(func, "idname", "", 0, "Operator Identifier", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_enum(func, "type", event_type_items, 0, "Type", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_enum(func, "value", event_value_items, 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_boolean(func, "any", 0, "Any", ""); + RNA_def_boolean(func, "shift", 0, "Shift", ""); + RNA_def_boolean(func, "ctrl", 0, "Ctrl", ""); + RNA_def_boolean(func, "alt", 0, "Alt", ""); + RNA_def_boolean(func, "oskey", 0, "OS Key", ""); + RNA_def_enum(func, "key_modifier", event_type_items, 0, "Key Modifier", ""); + parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item."); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "add_modal_item", "rna_KeyMap_add_modal_item"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); + parm= RNA_def_string(func, "propvalue", "", 0, "Property Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_enum(func, "type", event_type_items, 0, "Type", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_enum(func, "value", event_value_items, 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_boolean(func, "any", 0, "Any", ""); RNA_def_boolean(func, "shift", 0, "Shift", ""); RNA_def_boolean(func, "ctrl", 0, "Ctrl", ""); RNA_def_boolean(func, "alt", 0, "Alt", ""); @@ -119,6 +203,11 @@ void RNA_api_keymap(StructRNA *srna) parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item."); RNA_def_function_return(func, parm); + func= RNA_def_function(srna, "active", "rna_keymap_active"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map."); + RNA_def_function_return(func, parm); + func= RNA_def_function(srna, "remove_item", "WM_keymap_remove_item"); parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", ""); RNA_def_property_flag(parm, PROP_REQUIRED); |