From 1b1667018e3e960d21ec0c802290a5e49ffe2a90 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 27 May 2009 00:03:49 +0000 Subject: UI: * Added Constraints template and Add Constraint operator. * Added toggle=True/False parameter to uiItemR, to get a toggle button (actual button) rather than an "option" button (checkbox) * Added OPTION/OPTIONN button type, to distinguish with TOG/TOGN. RNA: * Make all modifier pointers editable, including correct updates. * Added notifiers and updates to constraints. * Fix a stack corruption, pointed out by Andrea, and potentially causing crashes. --- source/blender/makesrna/intern/rna_constraint.c | 346 +++++++++++++++++++----- source/blender/makesrna/intern/rna_modifier.c | 217 +++++++++++---- source/blender/makesrna/intern/rna_object.c | 4 +- source/blender/makesrna/intern/rna_pose.c | 1 - source/blender/makesrna/intern/rna_sound.c | 16 +- source/blender/makesrna/intern/rna_ui.c | 2 +- 6 files changed, 452 insertions(+), 134 deletions(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 774f2f9c0ef..6f3e85e0103 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -27,12 +27,45 @@ #include "RNA_define.h" #include "RNA_types.h" +#include "DNA_action_types.h" #include "DNA_constraint_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "WM_types.h" + +EnumPropertyItem constraint_type_items[] ={ + {CONSTRAINT_TYPE_NULL, "NULL", "Null", ""}, + {CONSTRAINT_TYPE_CHILDOF, "CHILD_OF", "Child Of", ""}, + {CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", "Track To", ""}, + {CONSTRAINT_TYPE_KINEMATIC, "IK", "IK", ""}, + {CONSTRAINT_TYPE_FOLLOWPATH, "FOLLOW_PATH", "Follow Path", ""}, + {CONSTRAINT_TYPE_ROTLIMIT, "LIMIT_ROTATION", "Limit Rotation", ""}, + {CONSTRAINT_TYPE_LOCLIMIT, "LIMIT_LOCATION", "Limit Location", ""}, + {CONSTRAINT_TYPE_SIZELIMIT, "LIMIT_SCALE", "Limit Scale", ""}, + {CONSTRAINT_TYPE_ROTLIKE, "COPY_ROTATION", "Copy Rotation", ""}, + {CONSTRAINT_TYPE_LOCLIKE, "COPY_LOCATION", "Copy Location", ""}, + {CONSTRAINT_TYPE_SIZELIKE, "COPY_SCALE", "Copy Scale", ""}, + {CONSTRAINT_TYPE_PYTHON, "SCRIPT", "Script", ""}, + {CONSTRAINT_TYPE_ACTION, "ACTION", "Action", ""}, + {CONSTRAINT_TYPE_LOCKTRACK, "LOCKED_TRACK", "Locked Track", ""}, + {CONSTRAINT_TYPE_DISTLIMIT, "LIMIT_DISTANCE", "Limit Distance", ""}, + {CONSTRAINT_TYPE_STRETCHTO, "STRETCH_TO", "Stretch To", ""}, + {CONSTRAINT_TYPE_MINMAX, "FLOOR", "Floor", ""}, + {CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", "Rigid Body Joint", ""}, + {CONSTRAINT_TYPE_CLAMPTO, "CLAMP_TO", "Clamp To", ""}, + {CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", "Transformation", ""}, + {0, NULL, NULL, NULL}}; + + #ifdef RNA_RUNTIME +#include "BKE_action.h" +#include "BKE_context.h" +#include "BKE_depsgraph.h" + +#include "ED_object.h" + StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr) { bConstraint *con= (bConstraint*)ptr->data; @@ -47,21 +80,21 @@ StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr) case CONSTRAINT_TYPE_FOLLOWPATH: return &RNA_FollowPathConstraint; case CONSTRAINT_TYPE_ROTLIKE: - return &RNA_RotateLikeConstraint; + return &RNA_CopyRotationConstraint; case CONSTRAINT_TYPE_LOCLIKE: - return &RNA_LocateLikeConstraint; + return &RNA_CopyLocationConstraint; case CONSTRAINT_TYPE_SIZELIKE: - return &RNA_SizeLikeConstraint; + return &RNA_CopyScaleConstraint; case CONSTRAINT_TYPE_PYTHON: return &RNA_PythonConstraint; case CONSTRAINT_TYPE_ACTION: return &RNA_ActionConstraint; case CONSTRAINT_TYPE_LOCKTRACK: - return &RNA_LockTrackConstraint; + return &RNA_LockedTrackConstraint; case CONSTRAINT_TYPE_STRETCHTO: return &RNA_StretchToConstraint; case CONSTRAINT_TYPE_MINMAX: - return &RNA_MinMaxConstraint; + return &RNA_FloorConstraint; case CONSTRAINT_TYPE_RIGIDBODYJOINT: return &RNA_RigidBodyJointConstraint; case CONSTRAINT_TYPE_CLAMPTO: @@ -69,18 +102,66 @@ StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr) case CONSTRAINT_TYPE_TRANSFORM: return &RNA_TransformConstraint; case CONSTRAINT_TYPE_ROTLIMIT: - return &RNA_RotationLimitConstraint; + return &RNA_LimitRotationConstraint; case CONSTRAINT_TYPE_LOCLIMIT: - return &RNA_LocationLimitConstraint; + return &RNA_LimitLocationConstraint; case CONSTRAINT_TYPE_SIZELIMIT: - return &RNA_SizeLimitConstraint; + return &RNA_LimitScaleConstraint; case CONSTRAINT_TYPE_DISTLIMIT: - return &RNA_DistLimitConstraint; + return &RNA_LimitDistanceConstraint; default: return &RNA_UnknownType; } } +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'; + } +} + +static void rna_Constraint_update(bContext *C, PointerRNA *ptr) +{ + Scene *scene= CTX_data_scene(C); + Object *ob= ptr->id.data; + + if(ob->pose) update_pose_constraint_flags(ob->pose); + + object_test_constraints(ob); + + if(ob->type==OB_ARMATURE) DAG_object_flush_update(scene, ob, OB_RECALC_DATA|OB_RECALC_OB); + else DAG_object_flush_update(scene, ob, OB_RECALC_OB); +} + +static void rna_Constraint_dependency_update(bContext *C, PointerRNA *ptr) +{ + Object *ob= ptr->id.data; + + rna_Constraint_update(C, ptr); + + if(ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels + DAG_scene_sort(CTX_data_scene(C)); +} + +static void rna_Constraint_influence_update(bContext *C, PointerRNA *ptr) +{ + Object *ob= ptr->id.data; + + if(ob->pose) + ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); + + rna_Constraint_update(C, ptr); +} + #else static void rna_def_constrainttarget(BlenderRNA *brna) @@ -94,12 +175,13 @@ 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_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "subtarget"); RNA_def_property_ui_text(prop, "Sub-Target", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); // space, flag and type still to do } @@ -115,48 +197,58 @@ 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_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "subtarget"); RNA_def_property_ui_text(prop, "Sub-Target", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "locationx", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCX); RNA_def_property_ui_text(prop, "Location X", "Use X Location of Parent."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "locationy", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCY); RNA_def_property_ui_text(prop, "Location Y", "Use Y Location of Parent."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "locationz", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCZ); RNA_def_property_ui_text(prop, "Location Z", "Use Z Location of Parent."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "rotationx", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTX); RNA_def_property_ui_text(prop, "Rotation X", "Use X Rotation of Parent."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "rotationy", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTY); RNA_def_property_ui_text(prop, "Rotation Y", "Use Y Rotation of Parent."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "rotationz", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTZ); RNA_def_property_ui_text(prop, "Rotation Z", "Use Z Rotation of Parent."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "sizex", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEX); RNA_def_property_ui_text(prop, "Size X", "Use X Scale of Parent."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "sizey", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEY); RNA_def_property_ui_text(prop, "Size Y", "Use Y Scale of Parent."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "sizez", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEZ); RNA_def_property_ui_text(prop, "Size Z", "Use Z Scale of Parent."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_python(BlenderRNA *brna) @@ -176,14 +268,16 @@ static void rna_def_constraint_python(BlenderRNA *brna) prop= RNA_def_property(srna, "number_of_targets", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "tarnum"); RNA_def_property_ui_text(prop, "Number of Targets", "Usually only 1-3 are needed."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Text"); RNA_def_property_ui_text(prop, "Script", "The text object that contains the Python script."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_targets", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PYCON_USETARGETS); RNA_def_property_ui_text(prop, "Use Targets", "Use the targets indicated in the constraint panel."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "script_error", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PYCON_SCRIPTERROR); @@ -202,30 +296,34 @@ 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_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "subtarget"); RNA_def_property_ui_text(prop, "Sub-Target", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 1, 10000); RNA_def_property_ui_text(prop, "Iterations", "Maximum number of solving iterations."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "pole_target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "poletar"); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Pole Target", "Object for pole rotation."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "pole_subtarget", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "polesubtarget"); RNA_def_property_ui_text(prop, "Pole Sub-Target", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "poleangle"); RNA_def_property_range(prop, 0.0, 180.f); RNA_def_property_ui_text(prop, "Pole Angle", "Pole rotation offset."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.01, 1.f); @@ -235,27 +333,33 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "orientweight"); RNA_def_property_range(prop, 0.01, 1.f); RNA_def_property_ui_text(prop, "Orientation Weight", "For Tree-IK: Weight of orientation control for this target."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "chain_length", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "rootbone"); RNA_def_property_range(prop, 0, 255); RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the IK effect - 0 uses all bones."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "tail", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_TIP); RNA_def_property_ui_text(prop, "Use Tail", "Include bone's tail as last element in chain."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "rotation", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_ROT); RNA_def_property_ui_text(prop, "Rotation", "Chain follows rotation of target."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "targetless", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_AUTO); RNA_def_property_ui_text(prop, "Targetless", "Use targetless IK."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "stretch", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_STRETCH); RNA_def_property_ui_text(prop, "Stretch", "Enable IK Stretching."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_track_to(BlenderRNA *brna) @@ -284,26 +388,30 @@ 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_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "subtarget"); RNA_def_property_ui_text(prop, "Sub-Target", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "track", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "reserved1"); RNA_def_property_enum_items(prop, track_items); RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "up", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "reserved2"); RNA_def_property_enum_items(prop, up_items); RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "target_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", TARGET_Z_UP); RNA_def_property_ui_text(prop, "Target Z", "Target's Z axis, not World Z axis, will constraint the Up direction."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_rotate_like(BlenderRNA *brna) @@ -311,46 +419,54 @@ static void rna_def_constraint_rotate_like(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "RotateLikeConstraint", "Constraint"); + srna= RNA_def_struct(brna, "CopyRotationConstraint", "Constraint"); RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copies the rotation of the target."); RNA_def_struct_sdna_from(srna, "bRotateLikeConstraint", "data"); prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "subtarget"); RNA_def_property_ui_text(prop, "Sub-Target", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "rotate_like_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_X); RNA_def_property_ui_text(prop, "Like X", "Copy the target's X rotation."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "rotate_like_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Y); RNA_def_property_ui_text(prop, "Like Y", "Copy the target's Y rotation."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "rotate_like_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Z); RNA_def_property_ui_text(prop, "Like Z", "Copy the target's Z rotation."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_X); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_X_INVERT); RNA_def_property_ui_text(prop, "Invert X", "Invert the X rotation."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Y_INVERT); RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y rotation."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Z_INVERT); RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z rotation."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "offset", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_OFFSET); RNA_def_property_ui_text(prop, "Offset", "Add original rotation into copied rotation."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_locate_like(BlenderRNA *brna) @@ -358,46 +474,63 @@ static void rna_def_constraint_locate_like(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "LocateLikeConstraint", "Constraint"); + srna= RNA_def_struct(brna, "CopyLocationConstraint", "Constraint"); RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copies the location of the target."); RNA_def_struct_sdna_from(srna, "bLocateLikeConstraint", "data"); prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); - RNA_def_property_struct_type(prop, "Object"); + 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_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "subtarget"); RNA_def_property_ui_text(prop, "Sub-Target", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "locate_like_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X); RNA_def_property_ui_text(prop, "Like X", "Copy the target's X location."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "locate_like_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y); RNA_def_property_ui_text(prop, "Like Y", "Copy the target's Y location."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "locate_like_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z); RNA_def_property_ui_text(prop, "Like Z", "Copy the target's Z location."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X); + RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X_INVERT); RNA_def_property_ui_text(prop, "Invert X", "Invert the X location."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y_INVERT); RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y location."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z_INVERT); RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z location."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "offset", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_OFFSET); RNA_def_property_ui_text(prop, "Offset", "Add original location into copied location."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + RNA_def_struct_sdna(srna, "bConstraint"); + + prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_PERCENTAGE); + RNA_def_property_float_sdna(prop, NULL, "headtail"); + RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_minmax(BlenderRNA *brna) @@ -414,35 +547,40 @@ static void rna_def_constraint_minmax(BlenderRNA *brna) {LOCLIKE_Z_INVERT, "FLOOR_NEGATIVE_Z", "Floor Negative Z", ""}, {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "MinMaxConstraint", "Constraint"); + srna= RNA_def_struct(brna, "FloorConstraint", "Constraint"); RNA_def_struct_ui_text(srna, "Floor Constraint", "Uses the target object for location limitation."); RNA_def_struct_sdna_from(srna, "bMinMaxConstraint","data"); prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "subtarget"); RNA_def_property_ui_text(prop, "Sub-Target", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "floor_location", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "minmaxflag"); RNA_def_property_enum_items(prop, minmax_items); RNA_def_property_ui_text(prop, "Floor Location", "Location of target that object will not pass through."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "sticky", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MINMAX_STICKY); RNA_def_property_ui_text(prop, "Sticky", "Immobilize object while constrained."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MINMAX_USEROT); RNA_def_property_ui_text(prop, "Use Rotation", "Use the target's rotation to determine floor."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0, 100.f); RNA_def_property_ui_text(prop, "Offset", "Offset of floor from object center."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_size_like(BlenderRNA *brna) @@ -450,34 +588,40 @@ static void rna_def_constraint_size_like(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "SizeLikeConstraint", "Constraint"); + srna= RNA_def_struct(brna, "CopyScaleConstraint", "Constraint"); RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copies the scale of the target."); RNA_def_struct_sdna_from(srna, "bSizeLikeConstraint", "data"); prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); - RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "subtarget"); RNA_def_property_ui_text(prop, "Sub-Target", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "size_like_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_X); RNA_def_property_ui_text(prop, "Like X", "Copy the target's X scale."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "size_like_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Y); RNA_def_property_ui_text(prop, "Like Y", "Copy the target's Y scale."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "size_like_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Z); RNA_def_property_ui_text(prop, "Like Z", "Copy the target's Z scale."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "offset", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_OFFSET); RNA_def_property_ui_text(prop, "Offset", "Add original scale into copied scale."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_action(BlenderRNA *brna) @@ -503,12 +647,13 @@ 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_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "subtarget"); RNA_def_property_ui_text(prop, "Sub-Target", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "transform_channel", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); @@ -517,28 +662,31 @@ static void rna_def_constraint_action(BlenderRNA *brna) prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "act"); - RNA_def_property_struct_type(prop, "Action"); RNA_def_property_ui_text(prop, "Action", ""); prop= RNA_def_property(srna, "start_frame", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "start"); RNA_def_property_range(prop, MINFRAME, MAXFRAME); RNA_def_property_ui_text(prop, "Start Frame", "First frame of the Action to use."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "end_frame", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "end"); RNA_def_property_range(prop, MINFRAME, MAXFRAME); RNA_def_property_ui_text(prop, "End Frame", "Last frame of the Action to use."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "maximum", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "max"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum", "Maximum value for target channel range."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "minimum", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "min"); RNA_def_property_range(prop, 0.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum", "Minimum value for target channel range."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_locked_track(BlenderRNA *brna) @@ -561,28 +709,31 @@ static void rna_def_constraint_locked_track(BlenderRNA *brna) {TRACK_Z, "LOCK_Z", "Lock Z", ""}, {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "LockTrackConstraint", "Constraint"); + srna= RNA_def_struct(brna, "LockedTrackConstraint", "Constraint"); RNA_def_struct_ui_text(srna, "Locked Track Constraint", "Points toward the target along the track axis, while locking the other axis."); RNA_def_struct_sdna_from(srna, "bLockTrackConstraint", "data"); prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "subtarget"); RNA_def_property_ui_text(prop, "Sub-Target", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "track", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "trackflag"); RNA_def_property_enum_items(prop, locktrack_items); RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "locked", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "lockflag"); RNA_def_property_enum_items(prop, lock_items); RNA_def_property_ui_text(prop, "Locked Axis", "Axis that points upward."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_follow_path(BlenderRNA *brna) @@ -611,26 +762,30 @@ 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_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "offset", PROP_INT, PROP_NONE); RNA_def_property_range(prop, -300000.0, 300000.f); RNA_def_property_ui_text(prop, "Offset", "Offset from the position corresponding to the time frame."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "forward", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "trackflag"); RNA_def_property_enum_items(prop, forwardpath_items); RNA_def_property_ui_text(prop, "Forward Axis", "Axis that points forward along the path."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "up", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "upflag"); RNA_def_property_enum_items(prop, pathup_items); RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "curve_follow", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "followflag", 1); RNA_def_property_ui_text(prop, "Follow Curve", "Object will follow the heading and banking of the curve."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_stretch_to(BlenderRNA *brna) @@ -656,27 +811,31 @@ 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_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "volume", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "volmode"); RNA_def_property_enum_items(prop, volume_items); RNA_def_property_ui_text(prop, "Maintain Volume", "Maintain the object's volume as it stretches."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "keep_axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "plane"); RNA_def_property_enum_items(prop, plane_items); RNA_def_property_ui_text(prop, "Keep Axis", "Axis to maintain during stretch."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "original_length", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "orglength"); RNA_def_property_range(prop, 0.0, 100.f); RNA_def_property_ui_text(prop, "Original Length", "Length at rest position."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0, 100.f); RNA_def_property_ui_text(prop, "Volume Variation", "Factor between volume variation and stretching."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) @@ -697,47 +856,54 @@ 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_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Target", "Target Object."); + 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_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Child Object", "Child object."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "pivot_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, pivot_items); RNA_def_property_ui_text(prop, "Pivot Type", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pivX"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Pivot X", "Offset pivot on X."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pivY"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Pivot Y", "Offset pivot on Y."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "pivot_z", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pivZ"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Pivot Z", "Offset pivot on Z."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "axX"); RNA_def_property_range(prop, -360.0, 360.f); RNA_def_property_ui_text(prop, "Axis X", "Rotate pivot on X axis in degrees."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "axY"); RNA_def_property_range(prop, -360.0, 360.f); RNA_def_property_ui_text(prop, "Axis Y", "Rotate pivot on Y axis in degrees."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "axZ"); RNA_def_property_range(prop, -360.0, 360.f); RNA_def_property_ui_text(prop, "Axis Z", "Rotate pivot on Z axis in degrees."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); /* XXX not sure how to wrap the two 6 element arrays for the generic joint */ //float minLimit[6]; @@ -746,10 +912,12 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) prop= RNA_def_property(srna, "disable_linked_collision", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_DISABLE_LINKED_COLLISION); RNA_def_property_ui_text(prop, "Disable Linked Collision", "Disable collision between linked bodies."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "draw_pivot", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_DRAW_PIVOT); RNA_def_property_ui_text(prop, "Draw Pivot", "Display the pivot point and rotation in 3D view."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_clamp_to(BlenderRNA *brna) @@ -770,17 +938,19 @@ 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_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "main_axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, clamp_items); RNA_def_property_ui_text(prop, "Main Axis", "Main axis of movement."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "cyclic", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag2", CLAMPTO_CYCLIC); RNA_def_property_ui_text(prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_transform(BlenderRNA *brna) @@ -806,22 +976,25 @@ 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_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "subtarget"); RNA_def_property_ui_text(prop, "Sub-Target", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "map_from", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "from"); RNA_def_property_enum_items(prop, transform_items); RNA_def_property_ui_text(prop, "Map From", "The transformation type to use from the target."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "map_to", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "to"); RNA_def_property_enum_items(prop, transform_items); 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 */ @@ -829,80 +1002,96 @@ static void rna_def_constraint_transform(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, 0, "map"); 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_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_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"); prop= RNA_def_property(srna, "extrapolate_motion", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "expo", CLAMPTO_CYCLIC); RNA_def_property_ui_text(prop, "Extrapolate Motion", "Extrapolate ranges."); + 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_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_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_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_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_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_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_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_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_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_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_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_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"); */ } @@ -911,67 +1100,80 @@ static void rna_def_constraint_location_limit(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "LocationLimitConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Location Limit Constraint", "Limits the location of the constrained object."); + srna= RNA_def_struct(brna, "LimitLocationConstraint", "Constraint"); + RNA_def_struct_ui_text(srna, "Limit Location Constraint", "Limits the location of the constrained object."); RNA_def_struct_sdna_from(srna, "bLocLimitConstraint", "data"); prop= RNA_def_property(srna, "use_minimum_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN); RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_minimum_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN); RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_minimum_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN); RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_maximum_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX); RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_maximum_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX); RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_maximum_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX); RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xmin"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ymin"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "zmin"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xmax"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ymax"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "zmax"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "limit_transform", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM); RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_rotation_limit(BlenderRNA *brna) @@ -979,67 +1181,80 @@ static void rna_def_constraint_rotation_limit(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "RotationLimitConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Rotation Limit Constraint", "Limits the rotation of the constrained object."); + srna= RNA_def_struct(brna, "LimitRotationConstraint", "Constraint"); + RNA_def_struct_ui_text(srna, "Limit Rotation Constraint", "Limits the rotation of the constrained object."); RNA_def_struct_sdna_from(srna, "bRotLimitConstraint", "data"); prop= RNA_def_property(srna, "use_minimum_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN); RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_minimum_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN); RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_minimum_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN); RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_maximum_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX); RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_maximum_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX); RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_maximum_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX); RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xmin"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ymin"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "zmin"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xmax"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ymax"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "zmax"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "limit_transform", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM); RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_size_limit(BlenderRNA *brna) @@ -1047,67 +1262,80 @@ static void rna_def_constraint_size_limit(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "SizeLimitConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Size Limit Constraint", "Limits the scaling of the constrained object."); + srna= RNA_def_struct(brna, "LimitScaleConstraint", "Constraint"); + RNA_def_struct_ui_text(srna, "Limit Size Constraint", "Limits the scaling of the constrained object."); RNA_def_struct_sdna_from(srna, "bSizeLimitConstraint", "data"); prop= RNA_def_property(srna, "use_minimum_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN); RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_minimum_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN); RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_minimum_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN); RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_maximum_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX); RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_maximum_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX); RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_maximum_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX); RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xmin"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ymin"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "zmin"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xmax"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ymax"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "zmax"); RNA_def_property_range(prop, -1000.0, 1000.f); RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "limit_transform", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM); RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } static void rna_def_constraint_distance_limit(BlenderRNA *brna) @@ -1121,28 +1349,31 @@ static void rna_def_constraint_distance_limit(BlenderRNA *brna) {LIMITDIST_ONSURFACE, "LIMITDIST_ONSURFACE", "On Surface", ""}, {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "DistLimitConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Distance Limit Constraint", "Limits the distance from target object."); + srna= RNA_def_struct(brna, "LimitDistanceConstraint", "Constraint"); + RNA_def_struct_ui_text(srna, "Limit Distance Constraint", "Limits the distance from target object."); RNA_def_struct_sdna_from(srna, "bDistLimitConstraint", "data"); prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "subtarget"); RNA_def_property_ui_text(prop, "Sub-Target", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dist"); RNA_def_property_range(prop, 0.0, 100.f); RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mode"); RNA_def_property_enum_items(prop, distance_items); RNA_def_property_ui_text(prop, "Limit Mode", "Distances in relation to sphere of influence to allow."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } /* base struct for constraints */ @@ -1151,33 +1382,11 @@ void RNA_def_constraint(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem type_items[] ={ - {CONSTRAINT_TYPE_NULL, "NULL", "Null", ""}, - {CONSTRAINT_TYPE_CHILDOF, "CHILDOF", "Child Of", ""}, - {CONSTRAINT_TYPE_TRACKTO, "TRACKTO", "Track To", ""}, - {CONSTRAINT_TYPE_KINEMATIC, "IK", "IK", ""}, - {CONSTRAINT_TYPE_FOLLOWPATH, "FOLLOWPATH", "Follow Path", ""}, - {CONSTRAINT_TYPE_ROTLIMIT, "LIMITROT", "Limit Rotation", ""}, - {CONSTRAINT_TYPE_LOCLIMIT, "LIMITLOC", "Limit Location", ""}, - {CONSTRAINT_TYPE_SIZELIMIT, "LIMITSCALE", "Limit Scale", ""}, - {CONSTRAINT_TYPE_ROTLIKE, "COPYROT", "Copy Rotation", ""}, - {CONSTRAINT_TYPE_LOCLIKE, "COPYLOC", "Copy Location", ""}, - {CONSTRAINT_TYPE_SIZELIKE, "COPYSCALE", "Copy Scale", ""}, - {CONSTRAINT_TYPE_PYTHON, "SCRIPT", "Script", ""}, - {CONSTRAINT_TYPE_ACTION, "ACTION", "Action", ""}, - {CONSTRAINT_TYPE_LOCKTRACK, "LOCKTRACK", "Locked Track", ""}, - {CONSTRAINT_TYPE_DISTLIMIT, "LIMITDIST", "Limit Distance", ""}, - {CONSTRAINT_TYPE_STRETCHTO, "STRETCHTO", "Stretch To", ""}, - {CONSTRAINT_TYPE_MINMAX, "FLOOR", "Floor", ""}, - {CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGIDBODYJOINT", "Rigid Body Joint", ""}, - {CONSTRAINT_TYPE_CLAMPTO, "CLAMPTO", "Clamp To", ""}, - {CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", "Transformation", ""}, - {0, NULL, NULL, NULL}}; - /* data */ srna= RNA_def_struct(brna, "Constraint", NULL ); RNA_def_struct_ui_text(srna, "Constraint", "Constraint modifying the transformation of objects and bones."); RNA_def_struct_refine_func(srna, "rna_ConstraintType_refine"); + RNA_def_struct_path_func(srna, "rna_Constraint_path"); RNA_def_struct_sdna(srna, "bConstraint"); /* strings */ @@ -1189,7 +1398,7 @@ void RNA_def_constraint(BlenderRNA *brna) prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, type_items); + RNA_def_property_enum_items(prop, constraint_type_items); RNA_def_property_ui_text(prop, "Type", ""); /* flags */ @@ -1218,6 +1427,7 @@ void RNA_def_constraint(BlenderRNA *brna) 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."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_influence_update"); /* pointers */ rna_def_constrainttarget(brna); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 7fc9f0a689e..35892cefc8a 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -77,6 +77,7 @@ EnumPropertyItem modifier_type_items[] ={ #include "BKE_context.h" #include "BKE_depsgraph.h" +#include "BKE_library.h" static void rna_UVProject_projectors_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { @@ -152,11 +153,22 @@ static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr) } } +static char *rna_Modifier_path(PointerRNA *ptr) +{ + return BLI_sprintfN("modifiers[%s]", ((ModifierData*)ptr->data)->name); // XXX not unique +} + static void rna_Modifier_update(bContext *C, PointerRNA *ptr) { DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_DATA); } +static void rna_Modifier_dependency_update(bContext *C, PointerRNA *ptr) +{ + rna_Modifier_update(C, ptr); + DAG_scene_sort(CTX_data_scene(C)); +} + static void rna_ExplodeModifier_vgroup_get(PointerRNA *ptr, char *value) { ExplodeModifierData *emd= (ExplodeModifierData*)ptr->data; @@ -273,6 +285,96 @@ static void rna_MultiresModifier_level_range(PointerRNA *ptr, int *min, int *max *max = mmd->totlvl; } +static void modifier_object_set(Object **ob_p, int type, PointerRNA value) +{ + Object *ob= value.data; + + if(!ob || ob->type == type) + *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); +} + +static void rna_BooleanModifier_object_set(PointerRNA *ptr, PointerRNA value) +{ + modifier_object_set(&((BooleanModifierData*)ptr->data)->object, OB_MESH, value); +} + +static void rna_CurveModifier_object_set(PointerRNA *ptr, PointerRNA value) +{ + modifier_object_set(&((CurveModifierData*)ptr->data)->object, OB_CURVE, value); +} + +static void rna_ArmatureModifier_object_set(PointerRNA *ptr, PointerRNA value) +{ + modifier_object_set(&((ArmatureModifierData*)ptr->data)->object, OB_ARMATURE, value); +} + +static void rna_MaskModifier_armature_set(PointerRNA *ptr, PointerRNA value) +{ + modifier_object_set(&((MaskModifierData*)ptr->data)->ob_arm, OB_ARMATURE, value); +} + +static void rna_ShrinkwrapModifier_auxiliary_target_set(PointerRNA *ptr, PointerRNA value) +{ + modifier_object_set(&((ShrinkwrapModifierData*)ptr->data)->auxTarget, OB_MESH, value); +} + +static void rna_ShrinkwrapModifier_target_set(PointerRNA *ptr, PointerRNA value) +{ + modifier_object_set(&((ShrinkwrapModifierData*)ptr->data)->target, OB_MESH, value); +} + +static void rna_MeshDeformModifier_object_set(PointerRNA *ptr, PointerRNA value) +{ + modifier_object_set(&((MeshDeformModifierData*)ptr->data)->object, OB_MESH, value); +} + +static void rna_ArrayModifier_end_cap_set(PointerRNA *ptr, PointerRNA value) +{ + modifier_object_set(&((ArrayModifierData*)ptr->data)->end_cap, OB_MESH, value); +} + +static void rna_ArrayModifier_start_cap_set(PointerRNA *ptr, PointerRNA value) +{ + modifier_object_set(&((ArrayModifierData*)ptr->data)->start_cap, OB_MESH, value); +} + +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[]) @@ -351,11 +453,11 @@ static void rna_def_modifier_lattice(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Lattice Modifier", "Lattice deformation modifier."); RNA_def_struct_sdna(srna, "LatticeModifierData"); - prop= RNA_def_property(srna, "lattice", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "object"); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_ui_text(prop, "Lattice", "Lattice object to deform with."); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); + RNA_def_property_ui_text(prop, "Object", "Lattice object to deform with."); + RNA_def_property_pointer_funcs(prop, NULL, "rna_LatticeModifier_object_set"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); @@ -382,11 +484,11 @@ static void rna_def_modifier_curve(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Curve Modifier", "Curve deformation modifier."); RNA_def_struct_sdna(srna, "CurveModifierData"); - prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "object"); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_ui_text(prop, "Curve", "Curve object to deform with."); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); + RNA_def_property_ui_text(prop, "Object", "Curve object to deform with."); + RNA_def_property_pointer_funcs(prop, NULL, "rna_CurveModifier_object_set"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); @@ -483,9 +585,9 @@ static void rna_def_modifier_mirror(BlenderRNA *brna) prop= RNA_def_property(srna, "mirror_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "mirror_ob"); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Mirror Object", "Object to use as mirror."); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); } static void rna_def_modifier_decimate(BlenderRNA *brna) @@ -600,9 +702,9 @@ static void rna_def_modifier_wave(BlenderRNA *brna) prop= RNA_def_property(srna, "start_position_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "objectcenter"); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Start Position Object", ""); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "defgrp_name"); @@ -611,8 +713,9 @@ static void rna_def_modifier_wave(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Texture"); 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"); prop= RNA_def_property(srna, "texture_coordinates", PROP_ENUM, PROP_NONE); @@ -629,9 +732,9 @@ static void rna_def_modifier_wave(BlenderRNA *brna) prop= RNA_def_property(srna, "texture_coordinates_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "map_object"); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Texture Coordinates Object", ""); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); prop= RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, FLT_MIN, FLT_MAX); @@ -669,10 +772,10 @@ static void rna_def_modifier_armature(BlenderRNA *brna) RNA_def_struct_sdna(srna, "ArmatureModifierData"); 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_ui_text(prop, "Object", "Armature object to deform with."); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_pointer_funcs(prop, NULL, "rna_ArmatureModifier_object_set"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "defgrp_name"); @@ -732,9 +835,9 @@ static void rna_def_modifier_hook(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Object", "Parent Object for hook, also recalculates and clears offset"); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); @@ -768,9 +871,10 @@ static void rna_def_modifier_boolean(BlenderRNA *brna) RNA_def_struct_sdna(srna, "BooleanModifierData"); prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Object", "Mesh object to use for boolean operation."); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_pointer_funcs(prop, NULL, "rna_BooleanModifier_object_set"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); prop= RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_operation_items); @@ -813,9 +917,10 @@ static void rna_def_modifier_array(BlenderRNA *brna) prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "curve_ob"); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Curve", "Curve object to fit array length to."); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_curve_set"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); /* Offset parameters */ prop= RNA_def_property(srna, "constant_offset", PROP_BOOLEAN, PROP_NONE); @@ -864,20 +969,22 @@ static void rna_def_modifier_array(BlenderRNA *brna) prop= RNA_def_property(srna, "offset_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "offset_ob"); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Offset Object", ""); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); /* Caps */ prop= RNA_def_property(srna, "start_cap", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Start Cap", "Mesh object to use as a start cap."); + RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_start_cap_set"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); prop= RNA_def_property(srna, "end_cap", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "End Cap", "Mesh object to use as an end cap."); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_end_cap_set"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); } static void rna_def_modifier_edgesplit(BlenderRNA *brna) @@ -937,8 +1044,9 @@ static void rna_def_modifier_displace(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Texture"); 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"); prop= RNA_def_property(srna, "midlevel", PROP_FLOAT, PROP_NONE); @@ -972,9 +1080,9 @@ static void rna_def_modifier_displace(BlenderRNA *brna) prop= RNA_def_property(srna, "texture_coordinate_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "map_object"); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Texture Coordinate Object", ""); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); } static void rna_def_modifier_uvproject(BlenderRNA *brna) @@ -998,8 +1106,9 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Projectors", ""); prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Image"); 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"); prop= RNA_def_property(srna, "horizontal_aspect_ratio", PROP_FLOAT, PROP_NONE); @@ -1136,11 +1245,11 @@ static void rna_def_modifier_meshdeform(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "MeshDeform Modifier", "Mesh deformation modifier to deform with other meshes."); RNA_def_struct_sdna(srna, "MeshDeformModifierData"); - prop= RNA_def_property(srna, "mesh", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "object"); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_ui_text(prop, "Mesh", ""); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); + RNA_def_property_ui_text(prop, "Object", "Mesh object to deform with."); + RNA_def_property_pointer_funcs(prop, NULL, "rna_MeshDeformModifier_object_set"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); prop= RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_INVERT_VGROUP); @@ -1186,9 +1295,9 @@ static void rna_def_modifier_particleinstance(BlenderRNA *brna) prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "ob"); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Object", "Object that has the particle system."); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); prop= RNA_def_property(srna, "particle_system_number", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "psys"); @@ -1277,16 +1386,13 @@ static void rna_def_modifier_cloth(BlenderRNA *brna) prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "sim_parms"); - RNA_def_property_struct_type(prop, "ClothSettings"); RNA_def_property_ui_text(prop, "Cloth Settings", ""); prop= RNA_def_property(srna, "collision_settings", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "coll_parms"); - RNA_def_property_struct_type(prop, "ClothCollisionSettings"); RNA_def_property_ui_text(prop, "Cloth Collision Settings", ""); prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NEVER_NULL); - RNA_def_property_struct_type(prop, "PointCache"); RNA_def_property_ui_text(prop, "Point Cache", ""); } @@ -1373,15 +1479,17 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Target", "Mesh target to shrink to."); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_pointer_funcs(prop, NULL, "rna_ShrinkwrapModifier_target_set"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); prop= RNA_def_property(srna, "auxiliary_target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "auxTarget"); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Auxiliary Target", "Additional mesh target to shrink to."); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_pointer_funcs(prop, NULL, "rna_ShrinkwrapModifier_auxiliary_target_set"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "vgroup_name"); @@ -1455,7 +1563,6 @@ static void rna_def_modifier_fluidsim(BlenderRNA *brna) prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "fss"); - RNA_def_property_struct_type(prop, "FluidSettings"); RNA_def_property_ui_text(prop, "Settings", "Settings for how this object is used in the fluid simulation."); } @@ -1480,9 +1587,10 @@ static void rna_def_modifier_mask(BlenderRNA *brna) prop= RNA_def_property(srna, "armature", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "ob_arm"); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Armature", "Armature to use as source of bones to mask."); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_pointer_funcs(prop, NULL, "rna_MaskModifier_armature_set"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "vgroup"); @@ -1524,9 +1632,9 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); prop= RNA_def_property(srna, "origin", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Origin", "Origin of modifier space coordinates."); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); prop= RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "originOpts", MOD_SIMPLEDEFORM_ORIGIN_LOCAL); @@ -1567,6 +1675,7 @@ void RNA_def_modifier(BlenderRNA *brna) srna= RNA_def_struct(brna, "Modifier", NULL); RNA_def_struct_ui_text(srna , "Modifier", "Modifier affecting the geometry data of an object."); RNA_def_struct_refine_func(srna, "rna_Modifier_refine"); + RNA_def_struct_path_func(srna, "rna_Modifier_path"); RNA_def_struct_sdna(srna, "ModifierData"); /* strings */ diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index cbc80e68b4a..47a243b9697 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -48,7 +48,7 @@ static void rna_Object_update(bContext *C, PointerRNA *ptr) DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB); } -static void rna_Object_scene_update(bContext *C, PointerRNA *ptr) +static void rna_Object_dependency_update(bContext *C, PointerRNA *ptr) { DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB); DAG_scene_sort(CTX_data_scene(C)); @@ -760,7 +760,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna) RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag"); RNA_def_property_enum_items(prop, dupli_items); RNA_def_property_ui_text(prop, "Dupli Type", "If not None, object duplication method to use."); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_scene_update"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update"); prop= RNA_def_property(srna, "dupli_frames_no_speed", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 5aad710c712..8edcc4c72f4 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -82,7 +82,6 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_struct_idproperties_func(srna, "rna_PoseChannel_idproperties"); prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "constraints", NULL); RNA_def_property_struct_type(prop, "Constraint"); RNA_def_property_ui_text(prop, "Constraints", "Constraints that act on this PoseChannel."); diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index 2aeb1b984fb..c6515385757 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -64,30 +64,30 @@ static void rna_def_sample(BlenderRNA *brna) prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_sample_type_items); - RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Types", ""); prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Filename", "Full path filename of the sample"); prop= RNA_def_property(srna, "length", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "len"); RNA_def_property_ui_text(prop, "Length", "The length of sample in seconds"); - RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "rate", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(prop, "Rate", "Sample rate in kHz"); - RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "bits", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(prop, "Bits", "Bit-depth of sample"); - RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "channels", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(prop, "Channels", "Number of channels (mono=1; stereo=2)"); - RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); } static void rna_def_soundlistener(BlenderRNA *brna) @@ -117,12 +117,12 @@ static void rna_def_soundlistener(BlenderRNA *brna) prop= RNA_def_property(srna, "num_sounds_blender", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "numsoundsblender"); RNA_def_property_ui_text(prop, "Total Sounds in Blender", "The total number of sounds currently linked and available."); - RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "num_sounds_gameengine", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "numsoundsgameengine"); RNA_def_property_ui_text(prop, "Total Sounds in Game Engine", "The total number of sounds in the Game Engine."); - RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); } #endif diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index a3e48f629cb..252e8cee27a 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -151,7 +151,7 @@ static StructRNA *rna_Panel_register(const bContext *C, ReportList *reports, voi PanelType *pt, dummypt = {0}; Panel dummypanel= {0}; PointerRNA dummyptr; - int have_function[2]; + int have_function[3]; /* setup dummy panel & panel type to store static properties in */ dummypanel.type= &dummypt; -- cgit v1.2.3 From a804ae7b3f9a6c220bed51b91f7fdb0f3347e3e4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 28 May 2009 02:03:48 +0000 Subject: rna_define.c, RNA_def_struct - set the py_type to NULL when making an rna struct based on another. bpy_util.c, PyObSpit - print refcount with PyObject --- source/blender/makesrna/intern/rna_define.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index a29f6c06b17..f216d8b3da6 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -559,6 +559,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * memcpy(srna, srnafrom, sizeof(StructRNA)); srna->cont.properties.first= srna->cont.properties.last= NULL; srna->functions.first= srna->functions.last= NULL; + srna->py_type= NULL; if(DefRNA.preprocess) { srna->base= srnafrom; @@ -567,7 +568,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * else srna->base= srnafrom; } - + srna->identifier= identifier; srna->name= identifier; /* may be overwritten later RNA_def_struct_ui_text */ srna->description= ""; -- cgit v1.2.3 From 970f9f3ee2d2eb1cf9fa87327a590d7e1fde50f2 Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Thu, 28 May 2009 05:09:25 +0000 Subject: * Wrapped outliner space in RNA, and added a python ui file for the header. Brecht, would you be able to have a look at this if you have time - I can't figure out how to trigger the python file to register the header instead of what's in outliner_header.c. --- source/blender/makesrna/intern/rna_space.c | 38 +++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 2b5c3a621b4..5393352ce93 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -69,9 +69,10 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr) return &RNA_SpaceView3D; case SPACE_IPO: return &RNA_SpaceGraphEditor; + */ case SPACE_OUTLINER: return &RNA_SpaceOutliner; - case SPACE_BUTS: + /* case SPACE_BUTS: return &RNA_SpaceButtonsWindow; case SPACE_FILE: return &RNA_SpaceFileBrowser;*/ @@ -250,6 +251,40 @@ static void rna_def_space_image_uv(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Live Unwrap", "Continuously unwrap the selected UV island while transforming pinned vertices."); } +static void rna_def_space_outliner(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem display_mode_items[] = { + {0, "ALL_SCENES", "All Scenes", ""}, + {1, "CURRENT_SCENE", "Current Scene", ""}, + {2, "VISIBLE_LAYERS", "Visible Layers", ""}, + {3, "SELECTED", "Selected", ""}, + {4, "ACTIVE", "Active", ""}, + {5, "SAME_TYPES", "Same Types", ""}, + {6, "GROUPS", "Groups", ""}, + {7, "LIBRARIES", "Libraries", ""}, + {10, "SEQUENCE", "Sequence", ""}, + {11, "DATABLOCKS", "Datablocks", ""}, + {12, "USER_PREFERENCES", "User Preferences", ""}, + {0, NULL, NULL, NULL}}; + + srna= RNA_def_struct(brna, "SpaceOutliner", "Space"); + RNA_def_struct_sdna(srna, "SpaceOops"); + RNA_def_struct_ui_text(srna, "Space Outliner", "Outliner space data."); + + prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "outlinevis"); + RNA_def_property_enum_items(prop, display_mode_items); + RNA_def_property_ui_text(prop, "Display Mode", "Type of information to display"); + + prop= RNA_def_property(srna, "show_restriction_columns", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_HIDE_RESTRICTCOLS); + RNA_def_property_ui_text(prop, "Show Restriction Columns", "Show colum"); + +} + static void rna_def_space_image(BlenderRNA *brna) { StructRNA *srna; @@ -400,6 +435,7 @@ void RNA_def_space(BlenderRNA *brna) rna_def_space(brna); rna_def_space_image(brna); rna_def_space_text(brna); + rna_def_space_outliner(brna); } #endif -- cgit v1.2.3 From a591a47c4337b62304a1d69b0e7de009bf3742bd Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 28 May 2009 23:23:47 +0000 Subject: RNA: * Automatically do us++ and us-- reference counting in ID pointer set functions. * Added an enum property callback to dynamically vary the list of available items. * Added some functions to do removes on pointers and collections runtime defined for RNA and using ID properties. * Constraints now have owner/target space wrapped, and most pointers made editable. They can be ported to use python layouts. * Also other pointers made editable that I think are see now with the automatic reference counting. --- source/blender/makesrna/intern/makesrna.c | 39 +++++- source/blender/makesrna/intern/rna_access.c | 56 ++++++++- source/blender/makesrna/intern/rna_brush.c | 4 +- source/blender/makesrna/intern/rna_camera.c | 1 + source/blender/makesrna/intern/rna_constraint.c | 136 +++++++++++++++------ source/blender/makesrna/intern/rna_controller.c | 1 + source/blender/makesrna/intern/rna_curve.c | 3 + source/blender/makesrna/intern/rna_define.c | 3 +- .../blender/makesrna/intern/rna_internal_types.h | 2 + source/blender/makesrna/intern/rna_lamp.c | 1 + source/blender/makesrna/intern/rna_material.c | 4 +- source/blender/makesrna/intern/rna_mesh.c | 1 + source/blender/makesrna/intern/rna_modifier.c | 30 ----- source/blender/makesrna/intern/rna_nodetree.c | 2 + source/blender/makesrna/intern/rna_object.c | 13 +- source/blender/makesrna/intern/rna_particle.c | 8 ++ source/blender/makesrna/intern/rna_rna.c | 4 +- source/blender/makesrna/intern/rna_scene.c | 2 +- source/blender/makesrna/intern/rna_sensor.c | 1 + source/blender/makesrna/intern/rna_texture.c | 4 +- source/blender/makesrna/intern/rna_userdef.c | 2 +- source/blender/makesrna/intern/rna_world.c | 1 + 22 files changed, 236 insertions(+), 82 deletions(-) (limited to 'source/blender/makesrna/intern') 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; atotitem; a++) - mask |= eprop->item[a].value; + if(eprop->item) { + for(a=0; atotitem; 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 \n"); fprintf(f, "#include \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."); } -- cgit v1.2.3 From 46b91bf16286104488c98b04208e8715a04f48b7 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 28 May 2009 23:37:55 +0000 Subject: UI: * Added some properties of uiLayout that can be set. I've added some API code for more than the two I've implementeds, so ignore those for now. * layout.active = False will gray out buttons inside a layout. * layout.enabled = False will gray out and completely disable the buttons inside a layout. * Also some function renames. --- source/blender/makesrna/intern/rna_ui.c | 90 ++++++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 2 deletions(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 252e8cee27a..9d3d961c18f 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -30,6 +30,8 @@ #include "rna_internal.h" #include "RNA_enum_types.h" +#include "UI_interface.h" + #ifdef RNA_RUNTIME #include "MEM_guardedalloc.h" @@ -44,8 +46,6 @@ #include "BKE_report.h" #include "BKE_screen.h" -#include "UI_interface.h" - #include "WM_api.h" #include "WM_types.h" @@ -408,16 +408,102 @@ static StructRNA* rna_Menu_refine(struct PointerRNA *mtr) return (hdr->type)? hdr->type->py_srna: &RNA_Menu; } +static int rna_UILayout_active_get(struct PointerRNA *ptr) +{ + return uiLayoutGetActive(ptr->data); +} + +static void rna_UILayout_active_set(struct PointerRNA *ptr, int value) +{ + return uiLayoutSetActive(ptr->data, value); +} + +static int rna_UILayout_enabled_get(struct PointerRNA *ptr) +{ + return uiLayoutGetEnabled(ptr->data); +} + +static void rna_UILayout_enabled_set(struct PointerRNA *ptr, int value) +{ + return uiLayoutSetEnabled(ptr->data, value); +} + +static int rna_UILayout_red_alert_get(struct PointerRNA *ptr) +{ + return uiLayoutGetRedAlert(ptr->data); +} + +static void rna_UILayout_red_alert_set(struct PointerRNA *ptr, int value) +{ + return uiLayoutSetRedAlert(ptr->data, value); +} + +static int rna_UILayout_keep_aspect_get(struct PointerRNA *ptr) +{ + return uiLayoutGetKeepAspect(ptr->data); +} + +static void rna_UILayout_keep_aspect_set(struct PointerRNA *ptr, int value) +{ + return uiLayoutSetKeepAspect(ptr->data, value); +} + +static int rna_UILayout_alignment_get(struct PointerRNA *ptr) +{ + return uiLayoutGetAlignment(ptr->data); +} + +static void rna_UILayout_alignment_set(struct PointerRNA *ptr, int value) +{ + return uiLayoutSetAlignment(ptr->data, value); +} + +static float rna_UILayout_scale_get(struct PointerRNA *ptr) +{ + return uiLayoutGetScale(ptr->data); +} + +static void rna_UILayout_scale_set(struct PointerRNA *ptr, float value) +{ + return uiLayoutSetScale(ptr->data, value); +} + #else static void rna_def_ui_layout(BlenderRNA *brna) { StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem alignment_items[] = { + {UI_LAYOUT_ALIGN_LEFT, "LEFT", "Left", ""}, + {UI_LAYOUT_ALIGN_CENTER, "CENTER", "Center", ""}, + {UI_LAYOUT_ALIGN_RIGHT, "RIGHT", "RIght", ""}, + {0, NULL, NULL, NULL}}; srna= RNA_def_struct(brna, "UILayout", NULL); RNA_def_struct_sdna(srna, "uiLayout"); RNA_def_struct_ui_text(srna, "UI Layout", "User interface layout in a panel or header."); + prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_UILayout_active_get", "rna_UILayout_active_set"); + + prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_UILayout_enabled_get", "rna_UILayout_enabled_set"); + + prop= RNA_def_property(srna, "red_alert", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_UILayout_red_alert_get", "rna_UILayout_red_alert_set"); + + prop= RNA_def_property(srna, "alignment", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, alignment_items); + RNA_def_property_enum_funcs(prop, "rna_UILayout_alignment_get", "rna_UILayout_alignment_set", NULL); + + prop= RNA_def_property(srna, "keep_aspect", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_UILayout_keep_aspect_get", "rna_UILayout_keep_aspect_set"); + + prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_funcs(prop, "rna_UILayout_scale_get", "rna_UILayout_scale_set", NULL); + RNA_api_ui_layout(srna); } -- cgit v1.2.3 From 688b7c73ad42148bfa946a195549c4fc6b38c266 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 29 May 2009 15:12:31 +0000 Subject: RNA: * Added PROP_ID_REFCOUNT flag to control if refcounting should be done on ID pointer properties. All ID pointers are refcounted, by default, with the exception of Object, Scene and Text. * Also made TextureFace image pointer editable, with the special refcounting behavior. --- source/blender/makesrna/intern/makesrna.c | 13 +++++++++---- source/blender/makesrna/intern/rna_ID.c | 2 +- source/blender/makesrna/intern/rna_define.c | 11 ++++++++++- source/blender/makesrna/intern/rna_mesh.c | 23 +++++++++++++++++++++-- source/blender/makesrna/intern/rna_object.c | 1 + source/blender/makesrna/intern/rna_scene.c | 1 + source/blender/makesrna/intern/rna_text.c | 1 + 7 files changed, 44 insertions(+), 8 deletions(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index b6ea00a08e0..438100243e3 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -509,17 +509,15 @@ 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) { + if(prop->flag & PROP_ID_REFCOUNT) { 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); } @@ -1212,9 +1210,16 @@ static void rna_auto_types() if(dp->dnatype) { if(dp->prop->type == PROP_POINTER) { PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop; + StructRNA *type; if(!pprop->type && !pprop->get) pprop->type= (StructRNA*)rna_find_type(dp->dnatype); + + if(pprop->type) { + type= rna_find_struct((char*)pprop->type); + if(type && (type->flag & STRUCT_ID_REFCOUNT)) + pprop->property.flag |= PROP_ID_REFCOUNT; + } } else if(dp->prop->type== PROP_COLLECTION) { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop; diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index ee1a1fedf2c..ad1c7eae95e 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -182,7 +182,7 @@ static void rna_def_ID(BlenderRNA *brna) srna= RNA_def_struct(brna, "ID", NULL); RNA_def_struct_ui_text(srna, "ID", "Base type for datablocks, defining a unique name, linking from other libraries and garbage collection."); - RNA_def_struct_flag(srna, STRUCT_ID); + RNA_def_struct_flag(srna, STRUCT_ID|STRUCT_ID_REFCOUNT); RNA_def_struct_refine_func(srna, "rna_ID_refine"); RNA_def_struct_idproperties_func(srna, "rna_ID_idproperties"); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 924a1c9158e..49c8c69fbcf 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -712,7 +712,12 @@ void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *struct void RNA_def_struct_flag(StructRNA *srna, int flag) { - srna->flag= flag; + srna->flag |= flag; +} + +void RNA_def_struct_clear_flag(StructRNA *srna, int flag) +{ + srna->flag &= ~flag; } void RNA_def_struct_refine_func(StructRNA *srna, const char *refine) @@ -1059,6 +1064,10 @@ void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type) case PROP_POINTER: { PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; pprop->type = type; + + if(type && (type->flag & STRUCT_ID_REFCOUNT)) + prop->flag |= PROP_ID_REFCOUNT; + break; } case PROP_COLLECTION: { diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index c1fa0a415ee..c75558dafe4 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -467,6 +467,23 @@ static int rna_Mesh_string_layers_length(PointerRNA *ptr) return rna_CustomDataLayer_length(ptr, CD_PROP_STR); } +static void rna_TextureFace_image_set(PointerRNA *ptr, PointerRNA value) +{ + MTFace *tf= (MTFace*)ptr->data; + ID *id= value.data; + + if(id) { + /* special exception here, individual faces don't count + * as reference, but we do ensure the refcount is not zero */ + if(id->us == 0) + id_us_plus(id); + else + id_lib_extern(id); + } + + tf->tpage= (struct Image*)id; +} + /* path construction */ static char *rna_VertexGroupElement_path(PointerRNA *ptr) @@ -747,9 +764,11 @@ static void rna_def_mtface(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Mesh Texture Face", "UV mapping, texturing and game engine data for a face."); RNA_def_struct_path_func(srna, "rna_MeshTextureFace_path"); - /* prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); + prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tpage"); - RNA_def_property_ui_text(prop, "Image", ""); */ + RNA_def_property_pointer_funcs(prop, NULL, "rna_TextureFace_image_set"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Image", ""); prop= RNA_def_property(srna, "tex", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_TEX); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 360b6e1a53b..86df2935f79 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -513,6 +513,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna) srna= RNA_def_struct(brna, "Object", "ID"); RNA_def_struct_ui_text(srna, "Object", "Object datablock defining an object in a scene.."); + RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "ID"); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 790c2b6d595..caa6e73903a 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -607,6 +607,7 @@ void RNA_def_scene(BlenderRNA *brna) srna= RNA_def_struct(brna, "Scene", "ID"); RNA_def_struct_ui_text(srna, "Scene", "Scene consisting objects and defining time and render related settings."); + RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index 3dacd4c0898..d3e4a34b9a7 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -172,6 +172,7 @@ static void rna_def_text(BlenderRNA *brna) srna = RNA_def_struct(brna, "Text", "ID"); RNA_def_struct_ui_text(srna, "Text", "Text datablock referencing an external or packed text file."); + RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_NONE); RNA_def_property_string_funcs(prop, "rna_Text_filename_get", "rna_Text_filename_length", "rna_Text_filename_set"); -- cgit v1.2.3 From a67e7bebb9c212b5e40abe6b74e1849dde7d769d Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sat, 30 May 2009 23:31:10 +0000 Subject: 2.5 Constraints: * Wrapped the constraint layout to python and deleted the corresponding C code. ToDo: 4 constraints are still C code (IK, Script, Action and Rigid Body Joint) * Some Constraint RNA fixes. * Wrapped the Shrinkwrap Constraint in RNA. --- source/blender/makesrna/intern/rna_constraint.c | 181 ++++++++++++++---------- 1 file changed, 110 insertions(+), 71 deletions(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index f4b2a8a7e1e..9880e25e9fd 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -29,6 +29,7 @@ #include "DNA_action_types.h" #include "DNA_constraint_types.h" +#include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -55,6 +56,7 @@ EnumPropertyItem constraint_type_items[] ={ {CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", "Rigid Body Joint", ""}, {CONSTRAINT_TYPE_CLAMPTO, "CLAMP_TO", "Clamp To", ""}, {CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", "Transformation", ""}, + {CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", "Shrinkwrap", ""}, {0, NULL, NULL, NULL}}; @@ -110,6 +112,8 @@ StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr) return &RNA_LimitScaleConstraint; case CONSTRAINT_TYPE_DISTLIMIT: return &RNA_LimitDistanceConstraint; + case CONSTRAINT_TYPE_SHRINKWRAP: + return &RNA_ShrinkwrapConstraint; default: return &RNA_UnknownType; } @@ -411,18 +415,18 @@ static void rna_def_constraint_track_to(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem track_items[] = { - {TRACK_X, "TRACK_X", "Track X", ""}, - {TRACK_Y, "TRACK_Y", "Track Y", ""}, - {TRACK_Z, "TRACK_Z", "Track Z", ""}, - {TRACK_nX, "TRACK_NEGATIVE_X", "Track Negative X", ""}, - {TRACK_nY, "TRACK_NEGATIVE_Y", "Track Negative Y", ""}, - {TRACK_nZ, "TRACK_NEGATIVE_Z", "Track Negative Z", ""}, + {TRACK_X, "TRACK_X", "X", ""}, + {TRACK_Y, "TRACK_Y", "Y", ""}, + {TRACK_Z, "TRACK_Z", "Z", ""}, + {TRACK_nX, "TRACK_NEGATIVE_X", "-X", ""}, + {TRACK_nY, "TRACK_NEGATIVE_Y", "-Y", ""}, + {TRACK_nZ, "TRACK_NEGATIVE_Z", "-Z", ""}, {0, NULL, NULL, NULL}}; static EnumPropertyItem up_items[] = { - {TRACK_X, "UP_X", "Up X", ""}, - {TRACK_Y, "UP_Y", "Up Y", ""}, - {TRACK_Z, "UP_Z", "Up Z", ""}, + {TRACK_X, "UP_X", "X", ""}, + {TRACK_Y, "UP_Y", "Y", ""}, + {TRACK_Z, "UP_Z", "Z", ""}, {0, NULL, NULL, NULL}}; srna= RNA_def_struct(brna, "TrackToConstraint", "Constraint"); @@ -584,12 +588,12 @@ static void rna_def_constraint_minmax(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem minmax_items[] = { - {LOCLIKE_X, "FLOOR_X", "Floor X", ""}, - {LOCLIKE_Y, "FLOOR_Y", "Floor Y", ""}, - {LOCLIKE_Z, "FLOOR_Z", "Floor Z", ""}, - {LOCLIKE_X_INVERT, "FLOOR_NEGATIVE_X", "Floor Negative X", ""}, - {LOCLIKE_Y_INVERT, "FLOOR_NEGATIVE_Y", "Floor Negative Y", ""}, - {LOCLIKE_Z_INVERT, "FLOOR_NEGATIVE_Z", "Floor Negative Z", ""}, + {LOCLIKE_X, "FLOOR_X", "X", ""}, + {LOCLIKE_Y, "FLOOR_Y", "Y", ""}, + {LOCLIKE_Z, "FLOOR_Z", "Z", ""}, + {LOCLIKE_X_INVERT, "FLOOR_NEGATIVE_X", "-X", ""}, + {LOCLIKE_Y_INVERT, "FLOOR_NEGATIVE_Y", "-Y", ""}, + {LOCLIKE_Z_INVERT, "FLOOR_NEGATIVE_Z", "-Z", ""}, {0, NULL, NULL, NULL}}; srna= RNA_def_struct(brna, "FloorConstraint", "Constraint"); @@ -706,7 +710,7 @@ static void rna_def_constraint_action(BlenderRNA *brna) prop= RNA_def_property(srna, "transform_channel", PROP_ENUM, PROP_NONE); 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_ui_text(prop, "Transform Channel", "Transformation 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); @@ -746,18 +750,18 @@ static void rna_def_constraint_locked_track(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem locktrack_items[] = { - {TRACK_X, "TRACK_X", "Track X", ""}, - {TRACK_Y, "TRACK_Y", "Track Y", ""}, - {TRACK_Z, "TRACK_Z", "Track Z", ""}, - {TRACK_nX, "TRACK_NEGATIVE_X", "Track Negative X", ""}, - {TRACK_nY, "TRACK_NEGATIVE_Y", "Track Negative Y", ""}, - {TRACK_nZ, "TRACK_NEGATIVE_Z", "Track Negative Z", ""}, + {TRACK_X, "TRACK_X", "X", ""}, + {TRACK_Y, "TRACK_Y", "Y", ""}, + {TRACK_Z, "TRACK_Z", "Z", ""}, + {TRACK_nX, "TRACK_NEGATIVE_X", "-X", ""}, + {TRACK_nY, "TRACK_NEGATIVE_Y", "-Y", ""}, + {TRACK_nZ, "TRACK_NEGATIVE_Z", "-Z", ""}, {0, NULL, NULL, NULL}}; static EnumPropertyItem lock_items[] = { - {TRACK_X, "LOCK_X", "Lock X", ""}, - {TRACK_Y, "LOCK_Y", "Lock Y", ""}, - {TRACK_Z, "LOCK_Z", "Lock Z", ""}, + {TRACK_X, "LOCK_X", "X", ""}, + {TRACK_Y, "LOCK_Y", "Y", ""}, + {TRACK_Z, "LOCK_Z", "Z", ""}, {0, NULL, NULL, NULL}}; srna= RNA_def_struct(brna, "LockedTrackConstraint", "Constraint"); @@ -794,18 +798,18 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem forwardpath_items[] = { - {TRACK_X, "FORWARD_X", "Forward X", ""}, - {TRACK_Y, "FORWARD_Y", "Forward Y", ""}, - {TRACK_Z, "FORWARD_Z", "Forward Z", ""}, - {TRACK_nX, "TRACK_NEGATIVE_X", "Forward Negative X", ""}, - {TRACK_nY, "TRACK_NEGATIVE_Y", "Forward Negative Y", ""}, - {TRACK_nZ, "TRACK_NEGATIVE_Z", "Forward Negative Z", ""}, + {TRACK_X, "FORWARD_X", "X", ""}, + {TRACK_Y, "FORWARD_Y", "Y", ""}, + {TRACK_Z, "FORWARD_Z", "Z", ""}, + {TRACK_nX, "TRACK_NEGATIVE_X", "-X", ""}, + {TRACK_nY, "TRACK_NEGATIVE_Y", "-Y", ""}, + {TRACK_nZ, "TRACK_NEGATIVE_Z", "-Z", ""}, {0, NULL, NULL, NULL}}; static EnumPropertyItem pathup_items[] = { - {TRACK_X, "UP_X", "Up X", ""}, - {TRACK_Y, "UP_Y", "Up Y", ""}, - {TRACK_Z, "UP_Z", "Up Z", ""}, + {TRACK_X, "UP_X", "X", ""}, + {TRACK_Y, "UP_Y", "Y", ""}, + {TRACK_Z, "UP_Z", "Z", ""}, {0, NULL, NULL, NULL}}; srna= RNA_def_struct(brna, "FollowPathConstraint", "Constraint"); @@ -847,15 +851,15 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem volume_items[] = { - {VOLUME_XZ, "VOLUME_XZX", "Volume XZ", ""}, - {VOLUME_XZ, "VOLUME_X", "Volume Y", ""}, - {VOLUME_XZ, "VOLUME_Z", "Volume Z", ""}, - {NO_VOLUME, "NO_VOLUME", "No Volume", ""}, + {VOLUME_XZ, "VOLUME_XZX", "XZ", ""}, + {VOLUME_X, "VOLUME_X", "Y", ""}, + {VOLUME_Z, "VOLUME_Z", "Z", ""}, + {NO_VOLUME, "NO_VOLUME", "None", ""}, {0, NULL, NULL, NULL}}; static EnumPropertyItem plane_items[] = { - {PLANE_X, "PLANE_X", "Keep X Axis", ""}, - {PLANE_Z, "PLANE_Z", "Keep Z Axis", ""}, + {PLANE_X, "PLANE_X", "X", "Keep X Axis"}, + {PLANE_Z, "PLANE_Z", "Z", "Keep Z Axis"}, {0, NULL, NULL, NULL}}; srna= RNA_def_struct(brna, "StretchToConstraint", "Constraint"); @@ -982,10 +986,10 @@ static void rna_def_constraint_clamp_to(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem clamp_items[] = { - {CLAMPTO_AUTO, "CLAMPTO_AUTO", "Clamp Auto", ""}, - {CLAMPTO_X, "CLAMPTO_X", "Clamp X", ""}, - {CLAMPTO_Y, "CLAMPTO_Y", "Clamp Y", ""}, - {CLAMPTO_Z, "CLAMPTO_Z", "Clamp Z", ""}, + {CLAMPTO_AUTO, "CLAMPTO_AUTO", "Auto", ""}, + {CLAMPTO_X, "CLAMPTO_X", "X", ""}, + {CLAMPTO_Y, "CLAMPTO_Y", "Y", ""}, + {CLAMPTO_Z, "CLAMPTO_Z", "Z", ""}, {0, NULL, NULL, NULL}}; srna= RNA_def_struct(brna, "ClampToConstraint", "Constraint"); @@ -1016,8 +1020,8 @@ static void rna_def_constraint_transform(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem transform_items[] = { - {0, "LOCATION", "Location", ""}, - {1, "ROTATION", "Rotation", ""}, + {0, "LOCATION", "Loc", ""}, + {1, "ROTATION", "Rot", ""}, {2, "SCALE", "Scale", ""}, {0, NULL, NULL, NULL}}; @@ -1240,34 +1244,19 @@ static void rna_def_constraint_rotation_limit(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Limit Rotation Constraint", "Limits the rotation of the constrained object."); RNA_def_struct_sdna_from(srna, "bRotLimitConstraint", "data"); - prop= RNA_def_property(srna, "use_minimum_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN); - RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value."); + prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XROT); + RNA_def_property_ui_text(prop, "Limit X", "Use the minimum X value."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "use_minimum_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN); - RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value."); + prop= RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YROT); + RNA_def_property_ui_text(prop, "Limit Y", "Use the minimum Y value."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - prop= RNA_def_property(srna, "use_minimum_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN); - RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value."); - RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - - prop= RNA_def_property(srna, "use_maximum_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX); - RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value."); - RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - - prop= RNA_def_property(srna, "use_maximum_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX); - RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value."); - RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - - prop= RNA_def_property(srna, "use_maximum_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX); - RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value."); + prop= RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZROT); + RNA_def_property_ui_text(prop, "Limit Z", "Use the minimum Z value."); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_NONE); @@ -1432,6 +1421,55 @@ static void rna_def_constraint_distance_limit(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } +static void rna_def_constraint_shrinkwrap(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint"); + RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Creates constraint-based shrinkwrap relationship."); + RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data"); + + static EnumPropertyItem type_items[] = { + {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", "Nearest Surface Point", ""}, + {MOD_SHRINKWRAP_PROJECT, "PROJECT", "Project", ""}, + {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", "Nearest Vertex", ""}, + {0, NULL, NULL, NULL}}; + + prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "target"); + 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, "shrinkwrap_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "shrinkType"); + RNA_def_property_enum_items(prop, type_items); + RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Selects type of shrinkwrap algorithm for target position"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "dist"); + RNA_def_property_range(prop, 0.0, 100.f); + RNA_def_property_ui_text(prop, "Distance", "Distance to Target."); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + prop= RNA_def_property(srna, "axis_x", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS); + RNA_def_property_ui_text(prop, "Axis X", "Projection over X Axis"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + prop= RNA_def_property(srna, "axis_y", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS); + RNA_def_property_ui_text(prop, "Axis Y", "Projection over Y Axis"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + prop= RNA_def_property(srna, "axis_z", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS); + RNA_def_property_ui_text(prop, "Axis Z", "Projection over Z Axis"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); +} + /* base struct for constraints */ void RNA_def_constraint(BlenderRNA *brna) { @@ -1517,6 +1555,7 @@ void RNA_def_constraint(BlenderRNA *brna) rna_def_constraint_rotation_limit(brna); rna_def_constraint_location_limit(brna); rna_def_constraint_transform(brna); + rna_def_constraint_shrinkwrap(brna); } -#endif +#endif \ No newline at end of file -- cgit v1.2.3 From 27fe29b2b79c4d1a1c7c7723afdf23e455bfb0eb Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Sun, 31 May 2009 01:22:34 +0000 Subject: * started wrapping 3d view space in RNA --- source/blender/makesrna/intern/rna_camera.c | 4 +- source/blender/makesrna/intern/rna_space.c | 194 +++++++++++++++++++++++++++- 2 files changed, 193 insertions(+), 5 deletions(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 9877b3566a3..1b2bd4b4aab 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -75,13 +75,13 @@ void RNA_def_camera(BlenderRNA *brna) prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "clipsta"); - RNA_def_property_range(prop, 0.0f, 100.0f); + RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_text(prop, "Clip Start", "Camera near clipping distance."); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "clipend"); - RNA_def_property_range(prop, 1.0f, 5000.0f); + RNA_def_property_range(prop, 1.0f, FLT_MAX); RNA_def_property_ui_text(prop, "Clip End", "Camera far clipping distance."); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 5393352ce93..56967a84903 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -29,7 +29,9 @@ #include "rna_internal.h" +#include "DNA_object_types.h" #include "DNA_space_types.h" +#include "DNA_view3d_types.h" #include "WM_types.h" @@ -65,9 +67,9 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr) SpaceLink *space= (SpaceLink*)ptr->data; switch(space->spacetype) { - /*case SPACE_VIEW3D: - return &RNA_SpaceView3D; - case SPACE_IPO: + case SPACE_VIEW3D: + return &RNA_Space3DView; + /*case SPACE_IPO: return &RNA_SpaceGraphEditor; */ case SPACE_OUTLINER: @@ -278,13 +280,197 @@ static void rna_def_space_outliner(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "outlinevis"); RNA_def_property_enum_items(prop, display_mode_items); RNA_def_property_ui_text(prop, "Display Mode", "Type of information to display"); + RNA_def_property_update(prop, NC_WINDOW, NULL); prop= RNA_def_property(srna, "show_restriction_columns", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_HIDE_RESTRICTCOLS); RNA_def_property_ui_text(prop, "Show Restriction Columns", "Show colum"); + RNA_def_property_update(prop, NC_WINDOW, NULL); } +static void rna_def_background_image(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "BackgroundImage", NULL); + RNA_def_struct_sdna(srna, "BGpic"); + RNA_def_struct_ui_text(srna, "Background Image", "Image and settings for display in the 3d View background."); + + prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "ima"); + RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space."); + + prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "iuser"); + RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed."); + + prop= RNA_def_property(srna, "x_offset", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "xof"); + RNA_def_property_ui_text(prop, "X Offset", "Offsets image horizontally from the view center"); + + prop= RNA_def_property(srna, "y_offset", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "yof"); + RNA_def_property_ui_text(prop, "Y Offset", "Offsets image vertically from the view center"); + + prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "size"); + RNA_def_property_ui_text(prop, "Size", "Scaling factor for the background image."); + RNA_def_property_range(prop, 0.0, FLT_MAX); + + prop= RNA_def_property(srna, "transparency", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "blend"); + RNA_def_property_ui_text(prop, "Transparency", "Amount to blend the image against the background color."); + RNA_def_property_range(prop, 0.0, 1.0); + +} + +static void rna_def_space_3dview(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem viewport_shading_items[] = { + {OB_BOUNDBOX, "BOUNDBOX", "Bounding Box", "Display the object's local bounding boxes only"}, + {OB_WIRE, "WIREFRAME", "Wireframe", "Display the object as wire edges"}, + {OB_SOLID, "SOLID", "Solid", "Display the object solid, lit with default OpenGL lights"}, + {OB_SHADED, "SHADED", "Shaded", "Display the object solid, with preview shading interpolated at vertices"}, + {OB_TEXTURE, "TEXTURED", "Textured", "Display the object solid, with face-assigned textures"}, + {0, NULL, NULL, NULL}}; + + static EnumPropertyItem pivot_items[] = { + {V3D_CENTER, "BOUNDING_BOX_CENTER", "Bounding Box Center", ""}, + {V3D_CURSOR, "CURSOR", "3D Cursor", ""}, + {V3D_LOCAL, "INDIVIDUAL_CENTERS", "Individual Centers", ""}, + {V3D_CENTROID, "MEDIAN_POINT", "Median Point", ""}, + {V3D_ACTIVE, "ACTIVE_ELEMENT", "Active Element", ""}, + {0, NULL, NULL, NULL}}; + + static EnumPropertyItem transform_orientation_items[] = { + {V3D_MANIP_GLOBAL, "ORIENT_GLOBAL", "Global", "Align the transformation axes to world space"}, + {V3D_MANIP_LOCAL, "ORIENT_LOCAL", "Local", "Align the transformation axes to the selected objects' local space"}, + {V3D_MANIP_NORMAL, "ORIENT_NORMAL", "Normal", "Align the transformation axes to average normal of selected elements (bone Y axis for pose mode)"}, + {V3D_MANIP_VIEW, "ORIENT_VIEW", "View", "Align the transformation axes to the window"}, + {V3D_MANIP_CUSTOM, "ORIENT_CUSTOM", "Custom", "Use a custom transform orientation"}, + {0, NULL, NULL, NULL}}; + + srna= RNA_def_struct(brna, "Space3DView", "Space"); + RNA_def_struct_sdna(srna, "View3D"); + RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data"); + + prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "camera"); + RNA_def_property_ui_text(prop, "Camera", "Active camera used in this view (when unlocked from the scene's active camera)."); + + prop= RNA_def_property(srna, "lock_object", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "ob_centre"); + RNA_def_property_ui_text(prop, "Lock Object", "3D View center is locked to this object's position"); + + prop= RNA_def_property(srna, "background_image", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "bgpic"); + RNA_def_property_ui_text(prop, "Background Image", "Image and settings to display in the 3D View background"); + + prop= RNA_def_property(srna, "viewport_shading", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "drawtype"); + RNA_def_property_enum_items(prop, viewport_shading_items); + RNA_def_property_ui_text(prop, "Viewport Shading", "Method to display/shade objects in the 3D View."); + + prop= RNA_def_property(srna, "localview", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "localview", 0); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Local View", "Display an isolated sub-set of objects, apart from the scene visibility."); + + prop= RNA_def_property(srna, "lens", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "lens"); + RNA_def_property_ui_text(prop, "Lens", "Lens angle (mm) in perspective view."); + RNA_def_property_range(prop, 1.0f, 250.0f); + + prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "near"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_text(prop, "Clip Start", "3D View near clipping distance."); + + prop= RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "far"); + RNA_def_property_range(prop, 1.0f, FLT_MAX); + RNA_def_property_ui_text(prop, "Clip End", "3D View far clipping distance."); + + prop= RNA_def_property(srna, "grid_spacing", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "grid"); + RNA_def_property_ui_text(prop, "Grid Spacing", "The distance between 3D View grid lines."); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + + prop= RNA_def_property(srna, "grid_lines", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "gridlines"); + RNA_def_property_ui_text(prop, "Grid Lines", "The number of grid lines to display in perspective view."); + RNA_def_property_range(prop, 0, 1024); + + prop= RNA_def_property(srna, "grid_subdivisions", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "gridsubdiv"); + RNA_def_property_ui_text(prop, "Grid Subdivisions", "The number of subdivisions between grid lines."); + RNA_def_property_range(prop, 1, 1024); + + prop= RNA_def_property(srna, "display_floor", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_FLOOR); + RNA_def_property_ui_text(prop, "Display Grid Floor", "Show the ground plane grid in perspective view."); + + prop= RNA_def_property(srna, "display_x_axis", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_X); + RNA_def_property_ui_text(prop, "Display X Axis", "Show the X axis line in perspective view."); + + prop= RNA_def_property(srna, "display_y_axis", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Y); + RNA_def_property_ui_text(prop, "Display Y Axis", "Show the Y axis line in perspective view."); + + prop= RNA_def_property(srna, "display_z_axis", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Z); + RNA_def_property_ui_text(prop, "Display Z Axis", "Show the Z axis line in perspective view."); + + prop= RNA_def_property(srna, "outline_selected", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SELECT_OUTLINE); + RNA_def_property_ui_text(prop, "Outline Selected", "Show an outline highlight around selected objects in non-wireframe views."); + + prop= RNA_def_property(srna, "all_object_centers", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DRAW_CENTERS); + RNA_def_property_ui_text(prop, "All Object Centers", "Show the object center dot for all (selected and unselected) objects."); + + prop= RNA_def_property(srna, "relationship_lines", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", V3D_HIDE_HELPLINES); + RNA_def_property_ui_text(prop, "Relationship Lines", "Show dashed lines indicating parent or constraint relationships."); + + prop= RNA_def_property(srna, "textured_solid", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SOLID_TEX); + RNA_def_property_ui_text(prop, "Textured Solid", "Display face-assigned textures in solid view"); + + prop= RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "around"); + RNA_def_property_enum_items(prop, pivot_items); + RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling."); + + prop= RNA_def_property(srna, "manipulator", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "twflag", V3D_USE_MANIPULATOR); + RNA_def_property_ui_text(prop, "Manipulator", "Use a 3D manipulator widget for controlling transforms."); + + prop= RNA_def_property(srna, "manipulator_translate", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_TRANSLATE); + RNA_def_property_ui_text(prop, "Manipulator Translate", "Use the manipulator for movement transformations."); + + prop= RNA_def_property(srna, "manipulator_rotate", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_ROTATE); + RNA_def_property_ui_text(prop, "Manipulator Rotate", "Use the manipulator for rotation transformations."); + + prop= RNA_def_property(srna, "manipulator_scale", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_SCALE); + RNA_def_property_ui_text(prop, "Manipulator Scale", "Use the manipulator for scale transformations."); + + prop= RNA_def_property(srna, "transform_orientation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "twmode"); + RNA_def_property_enum_items(prop, transform_orientation_items); + RNA_def_property_ui_text(prop, "Transform Orientation", "The alignment of manipulator handles."); + +} + static void rna_def_space_image(BlenderRNA *brna) { StructRNA *srna; @@ -436,6 +622,8 @@ void RNA_def_space(BlenderRNA *brna) rna_def_space_image(brna); rna_def_space_text(brna); rna_def_space_outliner(brna); + rna_def_background_image(brna); + rna_def_space_3dview(brna); } #endif -- cgit v1.2.3 From acd5281a2166dbcce74312277f9e68ff040e90a8 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 31 May 2009 12:47:36 +0000 Subject: 2.5 RNA didn't compile for msvc, variable declaration on wrong place. --- source/blender/makesrna/intern/rna_constraint.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 9880e25e9fd..02429ffa4bf 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -1425,17 +1425,17 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - - srna= RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Creates constraint-based shrinkwrap relationship."); - RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data"); static EnumPropertyItem type_items[] = { {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", "Nearest Surface Point", ""}, {MOD_SHRINKWRAP_PROJECT, "PROJECT", "Project", ""}, {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", "Nearest Vertex", ""}, {0, NULL, NULL, NULL}}; - + + srna= RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint"); + RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Creates constraint-based shrinkwrap relationship."); + RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data"); + prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "target"); RNA_def_property_ui_text(prop, "Target", "Target Object"); -- cgit v1.2.3 From c4efd3a1af2b286a00e970583a44abef4d92acd1 Mon Sep 17 00:00:00 2001 From: Robin Allen Date: Sun, 31 May 2009 16:45:30 +0000 Subject: RNA: Wrapped texture nodes, made a start on compo nodes. Difficult to test, because outliner no longer shows nodetree? (Just a bullet icon) --- source/blender/makesrna/intern/rna_nodetree.c | 357 +++++++++++++++++---- .../blender/makesrna/intern/rna_nodetree_types.h | 86 ++--- 2 files changed, 345 insertions(+), 98 deletions(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 76baed46666..9594a1a4a05 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -31,13 +31,14 @@ #include "rna_internal.h" #include "DNA_node_types.h" +#include "DNA_scene_types.h" #include "BKE_node.h" #ifdef RNA_RUNTIME StructRNA *rna_Node_refine(struct PointerRNA *ptr) { - bNode *node= (bNode*)ptr->data; + bNode *node = (bNode*)ptr->data; switch(node->type) { @@ -118,7 +119,7 @@ static StructRNA* def_node(BlenderRNA *brna, int node_id) StructRNA *srna; NodeInfo *node = nodes + node_id; - srna= RNA_def_struct(brna, node->struct_name, node->base_name); + srna = RNA_def_struct(brna, node->struct_name, node->base_name); RNA_def_struct_ui_text(srna, node->ui_name, node->ui_desc); RNA_def_struct_sdna(srna, "bNode"); @@ -191,9 +192,9 @@ static void def_math(BlenderRNA *brna, int id) {0, NULL, NULL, NULL} }; - srna= def_node(brna, id); + srna = def_node(brna, id); - prop= RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, items); RNA_def_property_ui_text(prop, "Operation", ""); @@ -215,9 +216,9 @@ static void def_vector_math(BlenderRNA *brna, int id) {0, NULL, NULL, NULL} }; - srna= def_node(brna, id); + srna = def_node(brna, id); - prop= RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, items); RNA_def_property_ui_text(prop, "Operation", ""); @@ -228,9 +229,9 @@ static void def_rgb_curve(BlenderRNA *brna, int id) StructRNA *srna; PropertyRNA *prop; - srna= def_node(brna, id); + srna = def_node(brna, id); - prop= RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE); + prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "storage"); RNA_def_property_struct_type(prop, "CurveMapping"); RNA_def_property_ui_text(prop, "Mapping", ""); @@ -241,23 +242,44 @@ static void def_vector_curve(BlenderRNA *brna, int id) StructRNA *srna; PropertyRNA *prop; - srna= def_node(brna, id); + srna = def_node(brna, id); - prop= RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE); + prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "storage"); RNA_def_property_struct_type(prop, "CurveMapping"); RNA_def_property_ui_text(prop, "Mapping", ""); } +static void def_time(BlenderRNA *brna, int id) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = def_node(brna, id); + + prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "storage"); + RNA_def_property_struct_type(prop, "CurveMapping"); + RNA_def_property_ui_text(prop, "Curve", ""); + + 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", ""); + + 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", ""); +} + static void def_val_to_rgb(BlenderRNA *brna, int id) { StructRNA *srna; // PropertyRNA *prop; - srna= def_node(brna, id); + srna = def_node(brna, id); /* TODO: uncomment when ColorBand is wrapped */ - /*prop= RNA_def_property(srna, "color_band", PROP_POINTER, PROP_NONE); + /*prop = RNA_def_property(srna, "color_band", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "storage"); RNA_def_property_struct_type(prop, "ColorBand"); RNA_def_property_ui_text(prop, "Color Band", "");*/ @@ -288,18 +310,36 @@ static void def_mix_rgb(BlenderRNA *brna, int id) {0, NULL, NULL, NULL} }; - srna= def_node(brna, id); + srna = def_node(brna, id); - prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, blend_type_items); RNA_def_property_ui_text(prop, "Blend Type", ""); - prop= RNA_def_property(srna, "alpha", PROP_BOOLEAN, PROP_NONE); + 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, "Diffuse", "Include alpha of second input in this operation"); } +static void def_texture(BlenderRNA *brna, int id) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = def_node(brna, 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); + 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"); +} + /* -- Shader Node Storage Types --------------------------------------------- */ @@ -308,14 +348,14 @@ static void rna_def_storage_node_geometry(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "NodeGeometry", NULL); + srna = RNA_def_struct(brna, "NodeGeometry", NULL); RNA_def_struct_ui_text(srna, "Node Geometry", ""); - prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE); + 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", ""); - prop= RNA_def_property(srna, "color_layer", PROP_STRING, PROP_NONE); + 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", ""); } @@ -323,46 +363,28 @@ static void rna_def_storage_node_geometry(BlenderRNA *brna) /* -- Shader Nodes ---------------------------------------------------------- */ -static void def_sh_texture(BlenderRNA *brna, int id) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna= def_node(brna, 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); - 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"); -} - static void def_sh_material(BlenderRNA *brna, int id) { StructRNA *srna; PropertyRNA *prop; - srna= def_node(brna, id); + srna = def_node(brna, id); - prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); + 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); + 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"); - prop= RNA_def_property(srna, "specular", PROP_BOOLEAN, PROP_NONE); + 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"); - prop= RNA_def_property(srna, "invert_normal", PROP_BOOLEAN, PROP_NONE); + 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"); } @@ -372,9 +394,9 @@ static void def_sh_mapping(BlenderRNA *brna, int id) StructRNA *srna; PropertyRNA *prop; - srna= def_node(brna, id); + srna = def_node(brna, id); - prop= RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE); + prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "storage"); RNA_def_property_struct_type(prop, "TexMapping"); RNA_def_property_ui_text(prop, "Mapping", ""); @@ -385,18 +407,235 @@ static void def_sh_geometry(BlenderRNA *brna, int id) StructRNA *srna; PropertyRNA *prop; - srna= def_node(brna, id); + srna = def_node(brna, id); - prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE); + prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "storage"); RNA_def_property_struct_type(prop, "NodeGeometry"); RNA_def_property_ui_text(prop, "Settings", ""); } + +/* -- Compositor Node Storage Types ----------------------------------------- */ + +static void rna_def_storage_node_blur_data(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem filter_type_items[] ={ + {R_FILTER_BOX, "FLAT", "Flat", ""}, + {R_FILTER_TENT, "TENT", "Tent", ""}, + {R_FILTER_QUAD, "QUAD", "Quadratic", ""}, + {R_FILTER_CUBIC, "CUBIC", "Cubic", ""}, + {R_FILTER_GAUSS, "GAUSS", "Gaussian", ""}, + {R_FILTER_FAST_GAUSS, "FAST_GAUSS", "Fast Gaussian", ""}, + {R_FILTER_CATROM, "CATROM", "Catrom", ""}, + {R_FILTER_MITCH, "MITCH", "Mitch", ""}, + {0, NULL, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "NodeBlurData", NULL); + RNA_def_struct_ui_text(srna, "Node Blur Data", ""); + + /**/ + + prop = RNA_def_property(srna, "sizex", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "sizex"); + RNA_def_property_ui_text(prop, "Size X", ""); + + prop = RNA_def_property(srna, "sizey", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "sizey"); + RNA_def_property_ui_text(prop, "Size Y", ""); + + /**/ + + 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", ""); + + /**/ + + 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", ""); + + 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", ""); + + /**/ + + 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", ""); + + /**/ + + prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "fac"); + RNA_def_property_ui_text(prop, "Factor", ""); + + /* These aren't percentages */ + prop = RNA_def_property(srna, "factor_x", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "percentx"); + RNA_def_property_ui_text(prop, "Relative Size X", ""); + + prop = RNA_def_property(srna, "factor_y", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "percenty"); + RNA_def_property_ui_text(prop, "Relative Size Y", ""); + + /**/ + + 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", ""); + + /**/ + + 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", ""); + + 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", ""); + + /* + Also: + curved + image_in_width + image_in_height + + Don't know if these need wrapping + */ + +} + + /* -- Compositor Nodes ------------------------------------------------------ */ +static void def_cmp_alpha_over(BlenderRNA *brna, int id) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = def_node(brna, id); + + 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", "TODO: don't know what this is"); + + /* TODO: uses NodeTwoFloats storage */ +} + +static void def_cmp_blur(BlenderRNA *brna, int id) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = def_node(brna, id); + + prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "storage"); + RNA_def_property_struct_type(prop, "NodeBlurData"); + RNA_def_property_ui_text(prop, "Settings", ""); +} + +static void def_cmp_filter(BlenderRNA *brna, int id) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem type_items[] ={ + {0, "SOFTEN", "Soften", ""}, + {1, "SHARPEN", "Sharpen", ""}, + {2, "LAPLACE", "Laplace", ""}, + {3, "SOBEL", "Sobel", ""}, + {4, "PREWITT", "Prewitt", ""}, + {5, "KIRSCH", "Kirsch", ""}, + {6, "SHADOW", "Shadow", ""}, + {0, NULL, NULL, NULL} + }; + + srna = def_node(brna, id); + + prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "custom1"); + RNA_def_property_enum_items(prop, type_items); + RNA_def_property_ui_text(prop, "Type", ""); +} + + +/* -- Texture Node Storage Types --------------------------------------------- */ + +static void rna_def_storage_tex_node_output(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "TexNodeOutput", NULL); + RNA_def_struct_ui_text(srna, "Texture Node Output", ""); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_ui_text(prop, "Name", ""); +} + + /* -- Texture Nodes --------------------------------------------------------- */ +static void def_tex_output(BlenderRNA *brna, int id) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = def_node(brna, id); + + prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "storage"); + RNA_def_property_struct_type(prop, "TexNodeOutput"); + RNA_def_property_ui_text(prop, "Settings", ""); +} + +static void def_tex_image(BlenderRNA *brna, int id) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = def_node(brna, id); + + 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", ""); +} + +static void def_tex_bricks(BlenderRNA *brna, int id) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = def_node(brna, id); + + prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "custom3"); + RNA_def_property_ui_text(prop, "Offset Amount", ""); + + prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "custom1"); + RNA_def_property_ui_text(prop, "Offset Frequency", "Offset every N rows"); + + prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "custom4"); + RNA_def_property_ui_text(prop, "Squash Amount", ""); + + prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "custom2"); + RNA_def_property_ui_text(prop, "Squash Frequency", "Squash every N rows"); +} + /* -------------------------------------------------------------------------- */ static void rna_def_shader_node(BlenderRNA *brna) @@ -407,11 +646,11 @@ static void rna_def_shader_node(BlenderRNA *brna) node_type_items = alloc_node_type_items(Category_ShaderNode); - srna= RNA_def_struct(brna, "ShaderNode", "Node"); + srna = RNA_def_struct(brna, "ShaderNode", "Node"); RNA_def_struct_ui_text(srna, "Shader Node", "Material shader node."); RNA_def_struct_sdna(srna, "bNode"); - prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_enum_items(prop, node_type_items); RNA_def_property_ui_text(prop, "Type", ""); @@ -428,14 +667,17 @@ static void rna_def_compositor_node(BlenderRNA *brna) node_type_items = alloc_node_type_items(Category_CompositorNode); - srna= RNA_def_struct(brna, "CompositorNode", "Node"); + srna = RNA_def_struct(brna, "CompositorNode", "Node"); RNA_def_struct_ui_text(srna, "Compositor Node", ""); RNA_def_struct_sdna(srna, "bNode"); - prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_enum_items(prop, node_type_items); RNA_def_property_ui_text(prop, "Type", ""); + + /* Compositor storage types */ + rna_def_storage_node_blur_data(brna); } static void rna_def_texture_node(BlenderRNA *brna) @@ -446,14 +688,17 @@ static void rna_def_texture_node(BlenderRNA *brna) node_type_items = alloc_node_type_items(Category_TextureNode); - srna= RNA_def_struct(brna, "TextureNode", "Node"); + srna = RNA_def_struct(brna, "TextureNode", "Node"); RNA_def_struct_ui_text(srna, "Texture Node", ""); RNA_def_struct_sdna(srna, "bNode"); - prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_enum_items(prop, node_type_items); RNA_def_property_ui_text(prop, "Type", ""); + + /* Texture storage types */ + rna_def_storage_tex_node_output(brna); } /* -------------------------------------------------------------------------- */ @@ -463,18 +708,18 @@ static void rna_def_node(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "Node", NULL); + 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_refine_func(srna, "rna_Node_refine"); - prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_VECTOR); + prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_VECTOR); RNA_def_property_float_sdna(prop, NULL, "locx"); RNA_def_property_array(prop, 2); RNA_def_property_range(prop, -10000.0f, 10000.0f); RNA_def_property_ui_text(prop, "Location", ""); - prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + 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); } @@ -484,11 +729,11 @@ static void rna_def_nodetree(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "NodeTree", "ID"); + 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"); - prop= RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE); + 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", ""); diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h index 00b7f7e62cb..0c333dfef56 100644 --- a/source/blender/makesrna/intern/rna_nodetree_types.h +++ b/source/blender/makesrna/intern/rna_nodetree_types.h @@ -17,10 +17,12 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Contributor(s): Blender Foundation (2008), Robin Allen + * Contributor(s): Robin Allen * * ***** END GPL LICENSE BLOCK ***** */ + +#define TODO 0 /* Tree type Node ID RNA def function Enum name Struct name UI Name UI Description */ DefNode( ShaderNode, SH_NODE_OUTPUT, 0, "OUTPUT", Output, "Output", "" ) @@ -30,7 +32,7 @@ DefNode( ShaderNode, SH_NODE_VALUE, 0, "VALUE", DefNode( ShaderNode, SH_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "MixRGB", "" ) DefNode( ShaderNode, SH_NODE_VALTORGB, def_val_to_rgb, "VALTORGB", ValToRGB, "Value to RGB", "" ) DefNode( ShaderNode, SH_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" ) -DefNode( ShaderNode, SH_NODE_TEXTURE, def_sh_texture, "TEXTURE", Texture, "Texture", "" ) +DefNode( ShaderNode, SH_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" ) DefNode( ShaderNode, SH_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" ) DefNode( ShaderNode, SH_NODE_GEOMETRY, def_sh_geometry, "GEOMETRY", Geometry, "Geometry", "" ) DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" ) @@ -49,76 +51,76 @@ DefNode( ShaderNode, SH_NODE_HUE_SAT, 0, "HUE_SAT" DefNode( CompositorNode, CMP_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" ) DefNode( CompositorNode, CMP_NODE_RGB, 0, "RGB", RGB, "RGB", "" ) DefNode( CompositorNode, CMP_NODE_VALUE, 0, "VALUE", Value, "Value", "" ) -DefNode( CompositorNode, CMP_NODE_MIX_RGB, 0, "MIX_RGB", MixRGB, "Mix RGB", "" ) -DefNode( CompositorNode, CMP_NODE_VALTORGB, 0, "VALTORGB", ValToRGB, "Val to RGB", "" ) +DefNode( CompositorNode, CMP_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix RGB", "" ) +DefNode( CompositorNode, CMP_NODE_VALTORGB, def_val_to_rgb, "VALTORGB", ValToRGB, "Val to RGB", "" ) DefNode( CompositorNode, CMP_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" ) DefNode( CompositorNode, CMP_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" ) -DefNode( CompositorNode, CMP_NODE_CURVE_VEC, 0, "CURVE_VEC", CurveVec, "Vector Curve", "" ) -DefNode( CompositorNode, CMP_NODE_CURVE_RGB, 0, "CURVE_RGB", CurveRGB, "RGB Curve", "" ) -DefNode( CompositorNode, CMP_NODE_ALPHAOVER, 0, "ALPHAOVER", AlphaOver, "Alpha Over", "" ) -DefNode( CompositorNode, CMP_NODE_BLUR, 0, "BLUR", Blur, "Blur", "" ) -DefNode( CompositorNode, CMP_NODE_FILTER, 0, "FILTER", Filter, "Filter", "" ) -DefNode( CompositorNode, CMP_NODE_MAP_VALUE, 0, "MAP_VALUE", MapValue, "Map Value", "" ) -DefNode( CompositorNode, CMP_NODE_TIME, 0, "TIME", Time, "Time", "" ) -DefNode( CompositorNode, CMP_NODE_VECBLUR, 0, "VECBLUR", VecBlur, "Vector Blur", "" ) +DefNode( CompositorNode, CMP_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", CurveVec, "Vector Curve", "" ) +DefNode( CompositorNode, CMP_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curve", "" ) +DefNode( CompositorNode, CMP_NODE_ALPHAOVER, def_cmp_alpha_over, "ALPHAOVER", AlphaOver, "Alpha Over", "" ) +DefNode( CompositorNode, CMP_NODE_BLUR, def_cmp_blur, "BLUR", Blur, "Blur", "" ) +DefNode( CompositorNode, CMP_NODE_FILTER, def_cmp_filter, "FILTER", Filter, "Filter", "" ) +DefNode( CompositorNode, CMP_NODE_MAP_VALUE, TODO, "MAP_VALUE", MapValue, "Map Value", "" ) +DefNode( CompositorNode, CMP_NODE_TIME, def_time, "TIME", Time, "Time", "" ) +DefNode( CompositorNode, CMP_NODE_VECBLUR, TODO, "VECBLUR", VecBlur, "Vector Blur", "" ) DefNode( CompositorNode, CMP_NODE_SEPRGBA, 0, "SEPRGBA", SepRGBA, "Separate RGBA", "" ) DefNode( CompositorNode, CMP_NODE_SEPHSVA, 0, "SEPHSVA", SepHSVA, "Separate HSVA", "" ) DefNode( CompositorNode, CMP_NODE_SETALPHA, 0, "SETALPHA", SetAlpha, "Set Alpha", "" ) DefNode( CompositorNode, CMP_NODE_HUE_SAT, 0, "HUE_SAT", HueSat, "Hue/Saturation", "" ) -DefNode( CompositorNode, CMP_NODE_IMAGE, 0, "IMAGE", Image, "Image", "" ) -DefNode( CompositorNode, CMP_NODE_R_LAYERS, 0, "R_LAYERS", RLayers, "Render Layers", "" ) +DefNode( CompositorNode, CMP_NODE_IMAGE, TODO, "IMAGE", Image, "Image", "" ) +DefNode( CompositorNode, CMP_NODE_R_LAYERS, TODO, "R_LAYERS", RLayers, "Render Layers", "" ) DefNode( CompositorNode, CMP_NODE_COMPOSITE, 0, "COMPOSITE", Composite, "Composite", "" ) -DefNode( CompositorNode, CMP_NODE_OUTPUT_FILE, 0, "OUTPUT_FILE", OutputFile, "Output File", "" ) -DefNode( CompositorNode, CMP_NODE_TEXTURE, 0, "TEXTURE", Texture, "Texture", "" ) +DefNode( CompositorNode, CMP_NODE_OUTPUT_FILE, TODO, "OUTPUT_FILE", OutputFile, "Output File", "" ) +DefNode( CompositorNode, CMP_NODE_TEXTURE, TODO, "TEXTURE", Texture, "Texture", "" ) DefNode( CompositorNode, CMP_NODE_TRANSLATE, 0, "TRANSLATE", Translate, "Translate", "" ) DefNode( CompositorNode, CMP_NODE_ZCOMBINE, 0, "ZCOMBINE", Zcombine, "Z Combine", "" ) DefNode( CompositorNode, CMP_NODE_COMBRGBA, 0, "COMBRGBA", CombRGBA, "Combine RGBA", "" ) -DefNode( CompositorNode, CMP_NODE_DILATEERODE, 0, "DILATEERODE", DilateErode, "Dilate/Erode", "" ) +DefNode( CompositorNode, CMP_NODE_DILATEERODE, TODO, "DILATEERODE", DilateErode, "Dilate/Erode", "" ) DefNode( CompositorNode, CMP_NODE_ROTATE, 0, "ROTATE", Rotate, "Rotate", "" ) -DefNode( CompositorNode, CMP_NODE_SCALE, 0, "SCALE", Scale, "Scale", "" ) +DefNode( CompositorNode, CMP_NODE_SCALE, TODO, "SCALE", Scale, "Scale", "" ) DefNode( CompositorNode, CMP_NODE_SEPYCCA, 0, "SEPYCCA", SepYCCA, "Separate YCCA", "" ) DefNode( CompositorNode, CMP_NODE_COMBYCCA, 0, "COMBYCCA", CombYCCA, "Combine YCCA", "" ) DefNode( CompositorNode, CMP_NODE_SEPYUVA, 0, "SEPYUVA", SepYUVA, "Separate YUVA", "" ) DefNode( CompositorNode, CMP_NODE_COMBYUVA, 0, "COMBYUVA", CombYUVA, "Combine YUVA", "" ) -DefNode( CompositorNode, CMP_NODE_DIFF_MATTE, 0, "DIFF_MATTE", DiffMatte, "Diff Matte", "" ) -DefNode( CompositorNode, CMP_NODE_COLOR_SPILL, 0, "COLOR_SPILL", ColorSpill, "Color Spill", "" ) -DefNode( CompositorNode, CMP_NODE_CHROMA, 0, "CHROMA", Chroma, "Chroma", "" ) -DefNode( CompositorNode, CMP_NODE_CHANNEL_MATTE, 0, "CHANNEL_MATTE", ChannelMatte, "Channel Matte", "" ) -DefNode( CompositorNode, CMP_NODE_FLIP, 0, "FLIP", Flip, "Flip", "" ) -DefNode( CompositorNode, CMP_NODE_SPLITVIEWER, 0, "SPLITVIEWER", SplitViewer, "Split Viewer", "" ) -DefNode( CompositorNode, CMP_NODE_INDEX_MASK, 0, "INDEX_MASK", IndexMask, "Index Mask", "" ) -DefNode( CompositorNode, CMP_NODE_MAP_UV, 0, "MAP_UV", MapUV, "Map UV", "" ) -DefNode( CompositorNode, CMP_NODE_ID_MASK, 0, "ID_MASK", IDMask, "ID Mask", "" ) -DefNode( CompositorNode, CMP_NODE_DEFOCUS, 0, "DEFOCUS", Defocus, "Defocus", "" ) +DefNode( CompositorNode, CMP_NODE_DIFF_MATTE, TODO, "DIFF_MATTE", DiffMatte, "Diff Matte", "" ) +DefNode( CompositorNode, CMP_NODE_COLOR_SPILL, TODO, "COLOR_SPILL", ColorSpill, "Color Spill", "" ) +DefNode( CompositorNode, CMP_NODE_CHROMA, TODO, "CHROMA", Chroma, "Chroma", "" ) +DefNode( CompositorNode, CMP_NODE_CHANNEL_MATTE, TODO, "CHANNEL_MATTE", ChannelMatte, "Channel Matte", "" ) +DefNode( CompositorNode, CMP_NODE_FLIP, TODO, "FLIP", Flip, "Flip", "" ) +DefNode( CompositorNode, CMP_NODE_SPLITVIEWER, TODO, "SPLITVIEWER", SplitViewer, "Split Viewer", "" ) +DefNode( CompositorNode, CMP_NODE_INDEX_MASK, TODO, "INDEX_MASK", IndexMask, "Index Mask", "" ) +DefNode( CompositorNode, CMP_NODE_MAP_UV, TODO, "MAP_UV", MapUV, "Map UV", "" ) +DefNode( CompositorNode, CMP_NODE_ID_MASK, TODO, "ID_MASK", IDMask, "ID Mask", "" ) +DefNode( CompositorNode, CMP_NODE_DEFOCUS, TODO, "DEFOCUS", Defocus, "Defocus", "" ) DefNode( CompositorNode, CMP_NODE_DISPLACE, 0, "DISPLACE", Displace, "Displace", "" ) DefNode( CompositorNode, CMP_NODE_COMBHSVA, 0, "COMBHSVA", CombHSVA, "Combine HSVA", "" ) DefNode( CompositorNode, CMP_NODE_MATH, def_math, "MATH", Math, "Math", "" ) -DefNode( CompositorNode, CMP_NODE_LUMA_MATTE, 0, "LUMA_MATTE", LumaMatte, "Luma Matte", "" ) +DefNode( CompositorNode, CMP_NODE_LUMA_MATTE, TODO, "LUMA_MATTE", LumaMatte, "Luma Matte", "" ) DefNode( CompositorNode, CMP_NODE_BRIGHTCONTRAST, 0, "BRIGHTCONTRAST", BrightContrast, "Bright Contrast", "" ) DefNode( CompositorNode, CMP_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" ) -DefNode( CompositorNode, CMP_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" ) +DefNode( CompositorNode, CMP_NODE_INVERT, TODO, "INVERT", Invert, "Invert", "" ) DefNode( CompositorNode, CMP_NODE_NORMALIZE, 0, "NORMALIZE", Normalize, "Normalize", "" ) -DefNode( CompositorNode, CMP_NODE_CROP, 0, "CROP", Crop, "Crop", "" ) -DefNode( CompositorNode, CMP_NODE_DBLUR, 0, "DBLUR", DBlur, "DBlur", "" ) -DefNode( CompositorNode, CMP_NODE_BILATERALBLUR, 0, "BILATERALBLUR", Bilateralblur, "Bilateral Blur", "" ) -DefNode( CompositorNode, CMP_NODE_PREMULKEY, 0, "PREMULKEY", PremulKey, "Premul Key", "" ) -DefNode( CompositorNode, CMP_NODE_GLARE, 0, "GLARE", Glare, "Glare", "" ) -DefNode( CompositorNode, CMP_NODE_TONEMAP, 0, "TONEMAP", Tonemap, "Tonemap", "" ) -DefNode( CompositorNode, CMP_NODE_LENSDIST, 0, "LENSDIST", Lensdist, "Lensdist", "" ) +DefNode( CompositorNode, CMP_NODE_CROP, TODO, "CROP", Crop, "Crop", "" ) +DefNode( CompositorNode, CMP_NODE_DBLUR, TODO, "DBLUR", DBlur, "DBlur", "" ) +DefNode( CompositorNode, CMP_NODE_BILATERALBLUR, TODO, "BILATERALBLUR", Bilateralblur, "Bilateral Blur", "" ) +DefNode( CompositorNode, CMP_NODE_PREMULKEY, TODO, "PREMULKEY", PremulKey, "Premul Key", "" ) +DefNode( CompositorNode, CMP_NODE_GLARE, TODO, "GLARE", Glare, "Glare", "" ) +DefNode( CompositorNode, CMP_NODE_TONEMAP, TODO, "TONEMAP", Tonemap, "Tonemap", "" ) +DefNode( CompositorNode, CMP_NODE_LENSDIST, TODO, "LENSDIST", Lensdist, "Lensdist", "" ) -DefNode( TextureNode, TEX_NODE_OUTPUT, 0, "OUTPUT", Output, "Output", "" ) +DefNode( TextureNode, TEX_NODE_OUTPUT, def_tex_output, "OUTPUT", Output, "Output", "" ) DefNode( TextureNode, TEX_NODE_CHECKER, 0, "CHECKER", Checker, "Checker", "" ) -DefNode( TextureNode, TEX_NODE_TEXTURE, 0, "TEXTURE", Texture, "Texture", "" ) -DefNode( TextureNode, TEX_NODE_BRICKS, 0, "BRICKS", Bricks, "Bricks", "" ) +DefNode( TextureNode, TEX_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" ) +DefNode( TextureNode, TEX_NODE_BRICKS, def_tex_bricks, "BRICKS", Bricks, "Bricks", "" ) DefNode( TextureNode, TEX_NODE_MATH, def_math, "MATH", Math, "Math", "" ) DefNode( TextureNode, TEX_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix RGB", "" ) DefNode( TextureNode, TEX_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB To BW", "" ) DefNode( TextureNode, TEX_NODE_VALTORGB, def_val_to_rgb, "VALTORGB", ValToRGB, "Val To RGB", "" ) -DefNode( TextureNode, TEX_NODE_IMAGE, 0, "IMAGE", Image, "Image", "" ) +DefNode( TextureNode, TEX_NODE_IMAGE, def_tex_image, "IMAGE", Image, "Image", "" ) DefNode( TextureNode, TEX_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curve", "" ) DefNode( TextureNode, TEX_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" ) DefNode( TextureNode, TEX_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" ) -DefNode( TextureNode, TEX_NODE_CURVE_TIME, 0, "CURVE_TIME", CurveTime, "Curve Time", "" ) +DefNode( TextureNode, TEX_NODE_CURVE_TIME, def_time, "CURVE_TIME", CurveTime, "Curve Time", "" ) DefNode( TextureNode, TEX_NODE_ROTATE, 0, "ROTATE", Rotate, "Rotate", "" ) DefNode( TextureNode, TEX_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" ) DefNode( TextureNode, TEX_NODE_TRANSLATE, 0, "TRANSLATE", Translate, "Translate", "" ) -- cgit v1.2.3 From 41963d9e4e04e481aad99a9b24ddebd9a198b30d Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 1 Jun 2009 11:31:06 +0000 Subject: 2.5 Added new widget type in drawing and themes: "Box Backdrop", which is in use by modifiers. Allows alpha blend, shade, etc. It was using the general button theme for standard buttons still, to indicate this change I made it a bit darker. Matt/Bill are invited to tweak this default color :) --- source/blender/makesrna/intern/rna_userdef.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index e90979b8321..6376a3029ad 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -291,6 +291,12 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Slider Widget Colors", ""); RNA_def_property_update(prop, NC_WINDOW, NULL); + prop= RNA_def_property(srna, "wcol_box", PROP_POINTER, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "wcol_box"); + RNA_def_property_struct_type(prop, "ThemeWidgetColors"); + RNA_def_property_ui_text(prop, "Box Backdrop Colors", ""); + RNA_def_property_update(prop, NC_WINDOW, NULL); + prop= RNA_def_property(srna, "wcol_menu", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_menu"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); -- cgit v1.2.3 From 0e02fef8b498a7a2905dc8b341f6bebfc3a1e167 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 1 Jun 2009 11:39:11 +0000 Subject: 2.5: Added first particle panel, and an RNA property to retrieve the active particle system. --- source/blender/makesrna/intern/rna_object.c | 13 +++++++++++++ source/blender/makesrna/intern/rna_particle.c | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 86df2935f79..6baf5083d31 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -42,6 +42,7 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_material.h" +#include "BKE_particle.h" static void rna_Object_update(bContext *C, PointerRNA *ptr) { @@ -202,6 +203,13 @@ static void rna_Object_active_material_link_set(PointerRNA *ptr, int value) ob->colbits &= ~(1<<(ob->actcol)); } +static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr) +{ + Object *ob= (Object*)ptr->id.data; + ParticleSystem *psys= psys_get_current(ob); + return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, psys); +} + static PointerRNA rna_Object_game_settings_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_GameObjectSettings, ptr->id.data); @@ -720,6 +728,11 @@ static StructRNA *rna_def_object(BlenderRNA *brna) RNA_def_property_struct_type(prop, "ParticleSystem"); RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object."); + prop= RNA_def_property(srna, "active_particle_system", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "ParticleSystem"); + RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL); + RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed"); + /* restrict */ prop= RNA_def_property(srna, "restrict_view", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 95c5c90b304..36a1992670a 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -838,10 +838,10 @@ static void rna_def_particle_settings(BlenderRNA *brna) //float rt; TODO:find where rt is used - can't find it in UI - prop= RNA_def_property(srna, "total_particles", PROP_INT, PROP_UNSIGNED); + prop= RNA_def_property(srna, "amount", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "totpart"); RNA_def_property_range(prop, 0, 100000); - RNA_def_property_ui_text(prop, "Particle Amount", "The total number of particles."); + RNA_def_property_ui_text(prop, "Amount", "Total number of particles."); prop= RNA_def_property(srna, "userjit", PROP_INT, PROP_UNSIGNED);//TODO: can we get a better name for userjit? RNA_def_property_int_sdna(prop, NULL, "userjit"); -- cgit v1.2.3