diff options
Diffstat (limited to 'source/blender/makesrna')
24 files changed, 239 insertions, 83 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index d083063975b..65b1ef98b07 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -430,7 +430,9 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, co /* to create ID property groups */ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop); +void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr); +void RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key); void RNA_property_collection_clear(PointerRNA *ptr, PropertyRNA *prop); /* Path diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 5777553ed58..540b9ec6e1a 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -141,7 +141,7 @@ void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable); void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set); void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range); void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range); -void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set); +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); 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); diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 2c383c191d8..b6ea00a08e0 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -156,6 +156,17 @@ static char *rna_alloc_function_name(const char *structname, const char *propnam return result; } +static StructRNA *rna_find_struct(const char *identifier) +{ + StructDefRNA *ds; + + for(ds=DefRNA.structs.first; ds; ds=ds->cont.next) + if(strcmp(ds->srna->identifier, identifier)==0) + return ds->srna; + + return NULL; +} + static const char *rna_find_type(const char *type) { StructDefRNA *ds; @@ -250,8 +261,10 @@ static int rna_enum_bitmask(PropertyRNA *prop) EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop; int a, mask= 0; - for(a=0; a<eprop->totitem; a++) - mask |= eprop->item[a].value; + if(eprop->item) { + for(a=0; a<eprop->totitem; a++) + mask |= eprop->item[a].value; + } return mask; } @@ -496,8 +509,19 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr fprintf(f, " %s(ptr, value);\n", manualfunc); } else { + PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; + StructRNA *type= rna_find_struct((char*)pprop->type); + rna_print_data_get(f, dp); + + if(type && (type->flag & STRUCT_ID) && strcmp(type->identifier, "Object")!=0) { + fprintf(f, "\n if(data->%s)\n", dp->dnaname); + fprintf(f, " id_us_min((ID*)data->%s);\n", dp->dnaname); + fprintf(f, " if(value.data)\n"); + fprintf(f, " id_us_plus((ID*)value.data);\n\n"); + } fprintf(f, " data->%s= value.data;\n", dp->dnaname); + } fprintf(f, "}\n\n"); break; @@ -1454,6 +1478,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr DefRNA.error= 1; } } + else if(eprop->itemf); else { fprintf(stderr, "rna_generate_structs: %s%s.%s, enum must have items defined.\n", srna->identifier, errnest, prop->identifier); DefRNA.error= 1; @@ -1581,7 +1606,12 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr } case PROP_ENUM: { EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop; - fprintf(f, "\t%s, %s, rna_%s%s_%s_items, %d, %d\n", rna_function_string(eprop->get), rna_function_string(eprop->set), srna->identifier, strnest, prop->identifier, eprop->totitem, eprop->defaultvalue); + fprintf(f, "\t%s, %s, %s, ", rna_function_string(eprop->get), rna_function_string(eprop->set), rna_function_string(eprop->itemf)); + if(eprop->item) + fprintf(f, "rna_%s%s_%s_items, ", srna->identifier, strnest, prop->identifier); + else + fprintf(f, "NULL, "); + fprintf(f, "%d, %d\n", eprop->totitem, eprop->defaultvalue); break; } case PROP_POINTER: { @@ -1798,8 +1828,11 @@ static void rna_generate(BlenderRNA *brna, FILE *f, char *filename) fprintf(f, "#include <limits.h>\n"); fprintf(f, "#include <string.h>\n\n"); + fprintf(f, "#include \"DNA_ID.h\"\n"); + fprintf(f, "#include \"BLI_blenlib.h\"\n\n"); + fprintf(f, "#include \"BKE_library.h\"\n"); fprintf(f, "#include \"BKE_utildefines.h\"\n\n"); fprintf(f, "#include \"RNA_define.h\"\n"); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index dad02b2fadd..cc952528302 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -599,9 +599,17 @@ StructRNA *RNA_property_pointer_type(PropertyRNA *prop) void RNA_property_enum_items(PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **item, int *totitem) { EnumPropertyRNA *eprop= (EnumPropertyRNA*)rna_ensure_property(prop); + int tot; - *item= eprop->item; - *totitem= eprop->totitem; + if(eprop->itemf) { + *item= eprop->itemf(ptr); + for(tot=0; (*item)[tot].identifier; tot++); + *totitem= tot; + } + else { + *item= eprop->item; + *totitem= eprop->totitem; + } } int RNA_property_enum_value(PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value) @@ -1182,6 +1190,23 @@ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop) printf("RNA_property_pointer_add %s.%s: only supported for id properties.\n", ptr->type->identifier, prop->identifier); } +void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop) +{ + IDProperty *idprop, *group; + + if((idprop=rna_idproperty_check(&prop, ptr))) { + group= RNA_struct_idproperties(ptr, 0); + + if(group) { + IDP_RemFromGroup(group, idprop); + IDP_FreeProperty(idprop); + MEM_freeN(idprop); + } + } + else + printf("RNA_property_pointer_remove %s.%s: only supported for id properties.\n", ptr->type->identifier, prop->identifier); +} + static void rna_property_collection_get_idp(CollectionPropertyIterator *iter) { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)iter->prop; @@ -1309,6 +1334,33 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA } } +void RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key) +{ + IDProperty *idprop; + + if((idprop=rna_idproperty_check(&prop, ptr))) { + IDProperty tmp, *array; + int len; + + len= idprop->len; + array= IDP_IDPArray(idprop); + + if(key >= 0 && key < len) { + if(key+1 < len) { + /* move element to be removed to the back */ + memcpy(&tmp, &array[key], sizeof(IDProperty)); + memmove(array+key, array+key+1, sizeof(IDProperty)*(len-key+1)); + memcpy(&array[len-1], &tmp, sizeof(IDProperty)); + } + + IDP_ResizeIDPArray(idprop, len-1); + } + } + else if(prop->flag & PROP_IDPROPERTY); + else + printf("RNA_property_collection_remove %s.%s: only supported for id properties.\n", ptr->type->identifier, prop->identifier); +} + void RNA_property_collection_clear(PointerRNA *ptr, PropertyRNA *prop) { IDProperty *idprop; diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 9f5b3ba3af7..778485c6e20 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -189,7 +189,7 @@ void rna_def_brush(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FIXED_TEX); RNA_def_property_ui_text(prop, "Fixed Texture", "Keep texture origin in fixed position.");*/ - prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE); + prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_ui_text(prop, "Curve", "Editable falloff curve."); /* texture */ @@ -198,7 +198,7 @@ void rna_def_brush(BlenderRNA *brna) /* clone tool */ prop= RNA_def_property(srna, "clone_image", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "clone.image"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Clone Image", "Image for clone tool."); prop= RNA_def_property(srna, "clone_opacity", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 3b1bb3b0785..9877b3566a3 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -158,6 +158,7 @@ void RNA_def_camera(BlenderRNA *brna) prop= RNA_def_property(srna, "dof_object", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_pointer_sdna(prop, NULL, "dof_ob"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "DOF Object", "Use this object to define the depth of field focal point."); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); } diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 6f3e85e0103..f4b2a8a7e1e 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -61,6 +61,7 @@ EnumPropertyItem constraint_type_items[] ={ #ifdef RNA_RUNTIME #include "BKE_action.h" +#include "BKE_constraint.h" #include "BKE_context.h" #include "BKE_depsgraph.h" @@ -116,17 +117,7 @@ StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr) static char *rna_Constraint_path(PointerRNA *ptr) { - return BLI_sprintfN("constraints[%s]", ((bConstraint*)ptr->data)->name); // XXX not unique -} - -void rna_CopyLocationConstraint_target_set(PointerRNA *ptr, PointerRNA value) -{ - bLocateLikeConstraint *data= (bLocateLikeConstraint*)(((bConstraint*)ptr->data)->data); - - if(value.data != data->tar) { - data->tar= value.data; - data->subtarget[0]= '\0'; - } + return BLI_sprintfN("constraints[%s]", ((bConstraint*)ptr->data)->name); } static void rna_Constraint_update(bContext *C, PointerRNA *ptr) @@ -162,6 +153,53 @@ static void rna_Constraint_influence_update(bContext *C, PointerRNA *ptr) rna_Constraint_update(C, ptr); } +static EnumPropertyItem space_pchan_items[] = { + {0, "WORLD", "World Space", ""}, + {2, "POSE", "Pose Space", ""}, + {3, "LOCAL_WITH_PARENT", "Local With Parent", ""}, + {1, "LOCAL", "Local Space", ""}, + {0, NULL, NULL, NULL}}; + +static EnumPropertyItem space_object_items[] = { + {0, "WORLD", "World Space", ""}, + {1, "LOCAL", "Local (Without Parent) Space", ""}, + {0, NULL, NULL, NULL}}; + +static EnumPropertyItem *rna_Constraint_owner_space_itemf(PointerRNA *ptr) +{ + Object *ob= (Object*)ptr->id.data; + bConstraint *con= (bConstraint*)ptr->data; + + if(BLI_findindex(&ob->constraints, con) == -1) + return space_pchan_items; + else /* object */ + return space_object_items; +} + +static EnumPropertyItem *rna_Constraint_target_space_itemf(PointerRNA *ptr) +{ + bConstraint *con= (bConstraint*)ptr->data; + bConstraintTypeInfo *cti= constraint_get_typeinfo(con); + ListBase targets = {NULL, NULL}; + bConstraintTarget *ct; + + if(cti && cti->get_constraint_targets) { + cti->get_constraint_targets(con, &targets); + + for(ct=targets.first; ct; ct= ct->next) + if(ct->tar && ct->tar->type == OB_ARMATURE) + break; + + if(cti->flush_constraint_targets) + cti->flush_constraint_targets(con, &targets, 1); + + if(ct) + return space_pchan_items; + } + + return space_object_items; +} + #else static void rna_def_constrainttarget(BlenderRNA *brna) @@ -176,6 +214,7 @@ static void rna_def_constrainttarget(BlenderRNA *brna) prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); @@ -198,6 +237,7 @@ static void rna_def_constraint_childof(BlenderRNA *brna) prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); @@ -272,6 +312,7 @@ static void rna_def_constraint_python(BlenderRNA *brna) prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Script", "The text object that contains the Python script."); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_targets", PROP_BOOLEAN, PROP_NONE); @@ -297,6 +338,7 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna) prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); @@ -312,6 +354,7 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna) prop= RNA_def_property(srna, "pole_target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "poletar"); RNA_def_property_ui_text(prop, "Pole Target", "Object for pole rotation."); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "pole_subtarget", PROP_STRING, PROP_NONE); @@ -389,6 +432,7 @@ static void rna_def_constraint_track_to(BlenderRNA *brna) prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); @@ -426,6 +470,7 @@ static void rna_def_constraint_rotate_like(BlenderRNA *brna) prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); @@ -481,8 +526,8 @@ static void rna_def_constraint_locate_like(BlenderRNA *brna) prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_pointer_funcs(prop, NULL, "rna_CopyLocationConstraint_target_set"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); @@ -554,6 +599,7 @@ static void rna_def_constraint_minmax(BlenderRNA *brna) prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); @@ -596,6 +642,7 @@ static void rna_def_constraint_size_like(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); @@ -648,6 +695,7 @@ static void rna_def_constraint_action(BlenderRNA *brna) prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); @@ -659,10 +707,13 @@ static void rna_def_constraint_action(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, transform_channel_items); RNA_def_property_ui_text(prop, "Transform Channel", "Transfromation channel from the target that is used to key the Action."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "act"); RNA_def_property_ui_text(prop, "Action", ""); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "start_frame", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "start"); @@ -716,6 +767,7 @@ static void rna_def_constraint_locked_track(BlenderRNA *brna) prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); @@ -763,6 +815,7 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna) prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "offset", PROP_INT, PROP_NONE); @@ -812,6 +865,7 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna) prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "volume", PROP_ENUM, PROP_NONE); @@ -857,10 +911,12 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target Object."); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "child", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Child Object", "Child object."); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "pivot_type", PROP_ENUM, PROP_NONE); @@ -939,6 +995,7 @@ static void rna_def_constraint_clamp_to(BlenderRNA *brna) prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "main_axis", PROP_ENUM, PROP_NONE); @@ -964,11 +1021,11 @@ static void rna_def_constraint_transform(BlenderRNA *brna) {2, "SCALE", "Scale", ""}, {0, NULL, NULL, NULL}}; - /*static EnumPropertyItem axis_map_items[] = { + static EnumPropertyItem axis_map_items[] = { {0, "X", "X", ""}, {1, "Y", "Y", ""}, {2, "Z", "Z", ""}, - {0, NULL, NULL, NULL}};*/ + {0, NULL, NULL, NULL}}; srna= RNA_def_struct(brna, "TransformConstraint", "Constraint"); RNA_def_struct_ui_text(srna, "Transformation Constraint", "Maps transformations of the target to the object."); @@ -977,6 +1034,7 @@ static void rna_def_constraint_transform(BlenderRNA *brna) prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); @@ -996,22 +1054,20 @@ static void rna_def_constraint_transform(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Map To", "The transformation type to affect of the constrained object."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); -/* it would be cool to have a method for rna to directly address specific elements of arrays in dna */ - -/* prop= RNA_def_property(srna, "map_to_x_from", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, 0, "map"); + prop= RNA_def_property(srna, "map_to_x_from", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "map[0]"); RNA_def_property_enum_items(prop, axis_map_items); RNA_def_property_ui_text(prop, "Map To X From", "The source axis constrained object's X axis uses."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "map_to_y_from", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, 1, "map"); + RNA_def_property_enum_sdna(prop, NULL, "map[1]"); RNA_def_property_enum_items(prop, axis_map_items); RNA_def_property_ui_text(prop, "Map To Y From", "The source axis constrained object's Y axis uses."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "map_to_z_from", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, 2, "map"); + RNA_def_property_enum_sdna(prop, NULL, "map[2]"); RNA_def_property_enum_items(prop, axis_map_items); RNA_def_property_ui_text(prop, "Map To Z From", "The source axis constrained object's Z axis uses."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); @@ -1022,77 +1078,76 @@ static void rna_def_constraint_transform(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, 0, "from_min"); + RNA_def_property_float_sdna(prop, NULL, "from_min[0]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, 1, "from_min"); + RNA_def_property_float_sdna(prop, NULL, "from_min[1]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, 2, "from_min"); + RNA_def_property_float_sdna(prop, NULL, "from_min[2]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, 0, "from_max"); + RNA_def_property_float_sdna(prop, NULL, "from_max[0]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, 1, "from_max"); + RNA_def_property_float_sdna(prop, NULL, "from_max[1]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, 2, "from_max"); + RNA_def_property_float_sdna(prop, NULL, "from_max[2]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, 0, "to_min"); + RNA_def_property_float_sdna(prop, NULL, "to_min[0]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, 1, "to_min"); + RNA_def_property_float_sdna(prop, NULL, "to_min[1]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, 2, "to_min"); + RNA_def_property_float_sdna(prop, NULL, "to_min[2]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, 0, "to_max"); + RNA_def_property_float_sdna(prop, NULL, "to_max[0]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, 1, "to_max"); + RNA_def_property_float_sdna(prop, NULL, "to_max[1]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, 2, "to_max"); + RNA_def_property_float_sdna(prop, NULL, "to_max[2]"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); -*/ } static void rna_def_constraint_location_limit(BlenderRNA *brna) @@ -1356,6 +1411,7 @@ static void rna_def_constraint_distance_limit(BlenderRNA *brna) prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); @@ -1400,7 +1456,17 @@ void RNA_def_constraint(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, constraint_type_items); RNA_def_property_ui_text(prop, "Type", ""); - + + prop= RNA_def_property(srna, "owner_space", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "ownspace"); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_owner_space_itemf"); + RNA_def_property_ui_text(prop, "Owner Space", "Space that owner is evaluated in."); + + prop= RNA_def_property(srna, "target_space", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "tarspace"); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_target_space_itemf"); + RNA_def_property_ui_text(prop, "Target Space", "Space that target is evaluated in."); + /* flags */ // XXX do we want to wrap this? prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE); @@ -1423,7 +1489,7 @@ void RNA_def_constraint(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Proxy Local", "Constraint was added in this proxy instance (i.e. did not belong to source Armature)."); /* values */ - prop= RNA_def_property(srna, "influence", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "influence", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "enforce"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Influence", "Amount of influence constraint will have on the final solution."); diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c index 1c2e5ecee02..df603e7920f 100644 --- a/source/blender/makesrna/intern/rna_controller.c +++ b/source/blender/makesrna/intern/rna_controller.c @@ -109,6 +109,7 @@ void RNA_def_controller(BlenderRNA *brna) prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "ID"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Text", "Text datablock with the python script."); /* Other Controllers */ diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 3c3aae87f39..bdc33715145 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -370,6 +370,7 @@ static void rna_def_font(BlenderRNA *brna, StructRNA *srna) /* pointers */ prop= RNA_def_property(srna, "text_on_curve", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "textoncurve"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Text on Curve", "Curve deforming text object."); prop= RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE); @@ -520,10 +521,12 @@ void rna_def_curve(BlenderRNA *brna) /* pointers */ prop= RNA_def_property(srna, "bevel_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "bevobj"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Bevel Object", "Curve object name that defines the bevel shape."); prop= RNA_def_property(srna, "taper_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "taperobj"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Taper Object", "Curve object name that defines the taper (width)."); /* Flags */ diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index f216d8b3da6..924a1c9158e 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1678,7 +1678,7 @@ 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) +void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item) { StructRNA *srna= DefRNA.laststruct; @@ -1693,6 +1693,7 @@ void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char if(get) eprop->get= (PropEnumGetFunc)get; if(set) eprop->set= (PropEnumSetFunc)set; + if(item) eprop->itemf= (PropEnumItemFunc)item; break; } default: diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index f7292bdce48..bd1c82fc049 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -67,6 +67,7 @@ typedef int (*PropStringLengthFunc)(struct PointerRNA *ptr); typedef void (*PropStringSetFunc)(struct PointerRNA *ptr, const char *value); typedef int (*PropEnumGetFunc)(struct PointerRNA *ptr); typedef void (*PropEnumSetFunc)(struct PointerRNA *ptr, int value); +typedef EnumPropertyItem *(*PropEnumItemFunc)(struct PointerRNA *ptr); typedef PointerRNA (*PropPointerGetFunc)(struct PointerRNA *ptr); typedef void (*PropPointerSetFunc)(struct PointerRNA *ptr, const PointerRNA value); typedef void (*PropCollectionBeginFunc)(struct CollectionPropertyIterator *iter, struct PointerRNA *ptr); @@ -213,6 +214,7 @@ typedef struct EnumPropertyRNA { PropEnumGetFunc get; PropEnumSetFunc set; + PropEnumItemFunc itemf; const EnumPropertyItem *item; int totitem; diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index 4289376d3e2..1c4aa7b4eee 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -108,6 +108,7 @@ static void rna_def_lamp_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "object"); RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates."); prop= RNA_def_property(srna, "map_to_color", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 101cd2a801f..15cca0f3dfa 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -160,6 +160,7 @@ static void rna_def_material_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "object"); RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates."); prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE); @@ -735,7 +736,7 @@ void RNA_def_material(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "material_type"); RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_ui_text(prop, "Type", "Material type defining how the object is rendered."); - RNA_def_property_enum_funcs(prop, NULL, "rna_Material_type_set"); + RNA_def_property_enum_funcs(prop, NULL, "rna_Material_type_set", NULL); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL); prop= RNA_def_property(srna, "ambient", PROP_FLOAT, PROP_NONE); @@ -777,6 +778,7 @@ void RNA_def_material(BlenderRNA *brna) prop= RNA_def_property(srna, "light_group", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "group"); RNA_def_property_struct_type(prop, "Group"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Light Group", "Limit lighting to lamps in this Group."); /* flags */ diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 3f862199ea0..c1fa0a415ee 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1093,6 +1093,7 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "texco_mesh", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "texcomesh"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Texture Space Mesh", "Derive texture coordinates from another mesh"); prop= RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 35892cefc8a..bc3da3b5a9e 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -293,18 +293,6 @@ static void modifier_object_set(Object **ob_p, int type, PointerRNA value) *ob_p= ob; } -static void modifier_ID_set(ID **id_p, PointerRNA value) -{ - ID *id= value.data; - - if(*id_p) - id_us_min(*id_p); - if(id) - id_us_plus(id); - - *id_p = id; -} - static void rna_LatticeModifier_object_set(PointerRNA *ptr, PointerRNA value) { modifier_object_set(&((LatticeModifierData*)ptr->data)->object, OB_LATTICE, value); @@ -360,21 +348,6 @@ static void rna_ArrayModifier_curve_set(PointerRNA *ptr, PointerRNA value) modifier_object_set(&((ArrayModifierData*)ptr->data)->curve_ob, OB_CURVE, value); } -static void rna_WaveModifier_texture_set(PointerRNA *ptr, PointerRNA value) -{ - modifier_ID_set((ID**)&((WaveModifierData*)ptr->data)->texture, value); -} - -static void rna_DisplaceModifier_texture_set(PointerRNA *ptr, PointerRNA value) -{ - modifier_ID_set((ID**)&((DisplaceModifierData*)ptr->data)->texture, value); -} - -static void rna_UVProjectModifier_image_set(PointerRNA *ptr, PointerRNA value) -{ - modifier_ID_set((ID**)&((UVProjectModifierData*)ptr->data)->image, value); -} - #else static void rna_def_property_subdivision_common(StructRNA *srna, const char type[]) @@ -714,7 +687,6 @@ static void rna_def_modifier_wave(BlenderRNA *brna) prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Texture", "Texture for modulating the wave."); - RNA_def_property_pointer_funcs(prop, NULL, "rna_WaveModifier_texture_set"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); @@ -1045,7 +1017,6 @@ static void rna_def_modifier_displace(BlenderRNA *brna) prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Texture", ""); - RNA_def_property_pointer_funcs(prop, NULL, "rna_DisplaceModifier_texture_set"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); @@ -1107,7 +1078,6 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna) prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Image", ""); - RNA_def_property_pointer_funcs(prop, NULL, "rna_UVProjectModifier_image_set"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index be3e429c1a2..76baed46666 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -333,6 +333,7 @@ static void def_sh_texture(BlenderRNA *brna, int id) prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "id"); RNA_def_property_struct_type(prop, "Texture"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Texture", ""); prop= RNA_def_property(srna, "node_output", PROP_INT, PROP_NONE); @@ -350,6 +351,7 @@ static void def_sh_material(BlenderRNA *brna, int id) prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "id"); RNA_def_property_struct_type(prop, "Material"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Material", ""); prop= RNA_def_property(srna, "diffuse", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 47a243b9697..360b6e1a53b 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -556,6 +556,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation."); prop= RNA_def_property(srna, "track", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Track", "Object being tracked to define the rotation (Old Track)."); prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE); @@ -584,7 +585,6 @@ static StructRNA *rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Materials", ""); prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "Material"); RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", NULL); RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed."); @@ -596,7 +596,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "active_material_link", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, material_link_items); - RNA_def_property_enum_funcs(prop, "rna_Object_active_material_link_get", "rna_Object_active_material_link_set"); + RNA_def_property_enum_funcs(prop, "rna_Object_active_material_link_get", "rna_Object_active_material_link_set", NULL); RNA_def_property_ui_text(prop, "Active Material Link", "Use material from object or data for the active material."); /* transform */ @@ -765,6 +765,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "dupli_frames_no_speed", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED); RNA_def_property_ui_text(prop, "Dupli Frames No Speed", "Set dupliframes to still, regardless of frame."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); prop= RNA_def_property(srna, "dupli_verts_rotation", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT); @@ -774,6 +775,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "dupli_faces_inherit_scale", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT); RNA_def_property_ui_text(prop, "Dupli Faces Inherit Scale", "Scale dupli based on face size."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); prop= RNA_def_property(srna, "dupli_faces_scale", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dupfacesca"); @@ -783,27 +785,33 @@ static StructRNA *rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "dup_group"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Dupli Group", "Instance an existing group."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update"); prop= RNA_def_property(srna, "dupli_frames_start", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dupsta"); RNA_def_property_range(prop, 1, 32767); RNA_def_property_ui_text(prop, "Dupli Frames Start", "Start frame for DupliFrames."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); prop= RNA_def_property(srna, "dupli_frames_end", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dupend"); RNA_def_property_range(prop, 1, 32767); RNA_def_property_ui_text(prop, "Dupli Frames End", "End frame for DupliFrames."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); prop= RNA_def_property(srna, "dupli_frames_on", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dupon"); RNA_def_property_range(prop, 1, 1500); RNA_def_property_ui_text(prop, "Dupli Frames On", "Number of frames to use between DupOff frames."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); prop= RNA_def_property(srna, "dupli_frames_off", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dupoff"); RNA_def_property_range(prop, 0, 1500); RNA_def_property_ui_text(prop, "Dupli Frames Off", "Recurring frames to exclude from the Dupliframes."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); /* time offset */ @@ -836,7 +844,6 @@ static StructRNA *rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "script_link", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "scriptlink"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Script Link", "Scripts linked to this object."); /* drawing */ diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 2b65f890bd2..95c5c90b304 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -173,6 +173,7 @@ static void rna_def_particle(BlenderRNA *brna) prop= RNA_def_property(srna, "stick_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "stick_ob"); RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Stick Object", "Object that particle sticks to when dead"); // ParticleKey state; /* normally current global coordinates or */ @@ -1134,21 +1135,25 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "dup_group"); RNA_def_property_struct_type(prop, "Group"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Dupli Group", "Show Objects in this Group in place of particles"); prop= RNA_def_property(srna, "effector_group", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "eff_group"); RNA_def_property_struct_type(prop, "Group"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Effector Group", "Limit effectors to this Group."); prop= RNA_def_property(srna, "dupli_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "dup_ob"); RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Dupli Object", "Show this Object in place of particles."); prop= RNA_def_property(srna, "billboard_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "bb_ob"); RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Billboard Object", "Billboards face this object (default is active camera)"); #if 0 @@ -1205,6 +1210,7 @@ static void rna_def_particle_system(BlenderRNA *brna) /* reactor */ prop= RNA_def_property(srna, "reactor_target_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "target_ob"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Reactor Target Object", "For reactor systems, the object that has the target particle system (empty if same object)."); prop= RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED); @@ -1215,11 +1221,13 @@ static void rna_def_particle_system(BlenderRNA *brna) /* boids */ prop= RNA_def_property(srna, "boids_surface_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "keyed_ob"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Boids Surface Object", "For boids physics systems, constrain boids to this object's surface."); /* keyed */ prop= RNA_def_property(srna, "keyed_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "keyed_ob"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Keyed Object", "For keyed physics systems, the object that has the target particle system."); prop= RNA_def_property(srna, "keyed_particle_system", PROP_INT, PROP_UNSIGNED); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 55a0f67390e..05aa10ec2eb 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -667,13 +667,13 @@ static void rna_def_property(BlenderRNA *brna) prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_enum_items(prop, type_items); - RNA_def_property_enum_funcs(prop, "rna_Property_type_get", NULL); + RNA_def_property_enum_funcs(prop, "rna_Property_type_get", NULL, NULL); RNA_def_property_ui_text(prop, "Type", "Data type of the property."); prop= RNA_def_property(srna, "subtype", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_enum_items(prop, subtype_items); - RNA_def_property_enum_funcs(prop, "rna_Property_subtype_get", NULL); + 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, "editable", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 6bee1367a86..790c2b6d595 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -566,7 +566,7 @@ void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Stamp Sequence Strip", "Include the name of the foreground sequence strip in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - prop= RNA_def_property(srna, "stamp_note_text", PROP_STRING, PROP_DIRPATH); + prop= RNA_def_property(srna, "stamp_note_text", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "stamp_udata"); RNA_def_property_ui_text(prop, "Stamp Note Text", "Custom text to appear in the stamp note"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index 90a0972fa03..265b59c97ae 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -197,6 +197,7 @@ void rna_def_touch_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "ma"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Material", "Only look for floors with this material."); } diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 4cc98ce5f8a..b0fa4458f22 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -187,6 +187,7 @@ static void rna_def_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tex"); RNA_def_property_struct_type(prop, "Texture"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Texture", "Texture datablock used by this texture slot."); /* mapping */ @@ -671,7 +672,7 @@ static void rna_def_texture_image(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Calculate Alpha", "Calculates an alpha channel based on RGB values in the image"); prop= RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_NEGALPHA); + RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_NEGALPHA); RNA_def_property_ui_text(prop, "Invert Alpha", "Inverts all the alpha values in the image"); rna_def_filter_size_common(srna); @@ -760,6 +761,7 @@ static void rna_def_texture_image(BlenderRNA *brna) prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "ima"); RNA_def_property_struct_type(prop, "Image"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Image", ""); } diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 43e67fdfa57..e90979b8321 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1649,7 +1649,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna) prop= RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, auto_key_modes); - RNA_def_property_enum_funcs(prop, "rna_userdef_autokeymode_get", "rna_userdef_autokeymode_set"); + RNA_def_property_enum_funcs(prop, "rna_userdef_autokeymode_get", "rna_userdef_autokeymode_set", NULL); RNA_def_property_ui_text(prop, "Auto Keying Mode", "Mode of automatic keyframe insertion for Objects and Bones."); prop= RNA_def_property(srna, "auto_keyframe_insert_available", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index eb764e4bc2d..7fb7fe656f5 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -114,6 +114,7 @@ static void rna_def_world_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "object"); RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates."); } |