diff --git a/release/scripts/ui/properties_object_constraint.py b/release/scripts/ui/properties_object_constraint.py index a2e886adc11..4db846fc2fe 100644 --- a/release/scripts/ui/properties_object_constraint.py +++ b/release/scripts/ui/properties_object_constraint.py @@ -550,9 +550,39 @@ class ConstraintButtonsPanel(): col.prop(con, "axis_x", text="X") col.prop(con, "axis_y", text="Y") col.prop(con, "axis_z", text="Z") + - #Missing: Limit arrays (not wrapped in RNA yet) + if con.pivot_type == 'CONE_TWIST': + layout.label(text="Limits:") + split = layout.split() + + col = split.column(align=True) + col.prop(con, "use_angular_limit_x", text="Angular X") + col.prop(con, "use_angular_limit_y", text="Angular Y") + col.prop(con, "use_angular_limit_z", text="Angular Z") + + col = split.column() + col.prop(con, "limit_cone_min", text="") + col = split.column() + col.prop(con, "limit_cone_max", text="") + elif con.pivot_type == 'GENERIC_6_DOF': + layout.label(text="Limits:") + split = layout.split() + + col = split.column(align=True) + col.prop(con, "use_limit_x", text="X") + col.prop(con, "use_limit_y", text="Y") + col.prop(con, "use_limit_z", text="Z") + col.prop(con, "use_angular_limit_x", text="Angular X") + col.prop(con, "use_angular_limit_y", text="Angular Y") + col.prop(con, "use_angular_limit_z", text="Angular Z") + + col = split.column() + col.prop(con, "limit_generic_min", text="") + col = split.column() + col.prop(con, "limit_generic_max", text="") + def CLAMP_TO(self, context, layout, con): self.target_template(layout, con) diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index dee12d43144..f46827f95a6 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -1241,16 +1241,6 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) RNA_def_property_range(prop, -M_PI*2, M_PI*2); 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"); - - prop= RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "minLimit"); - RNA_def_property_array(prop, 6); - RNA_def_property_ui_text(prop, "Minimum Limit", ""); - - prop= RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "maxLimit"); - RNA_def_property_array(prop, 6); - RNA_def_property_ui_text(prop, "Maximum Limit", ""); prop= RNA_def_property(srna, "use_linked_collision", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_DISABLE_LINKED_COLLISION); @@ -1261,6 +1251,64 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) 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"); + + + /* Limit */ + + /* Limit Min/Max for genereic 6 DoF */ + prop= RNA_def_property(srna, "limit_generic_min", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "minLimit"); + RNA_def_property_array(prop, 6); + RNA_def_property_ui_text(prop, "Minimum Limit", ""); + + prop= RNA_def_property(srna, "limit_generic_max", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit"); + RNA_def_property_array(prop, 6); + RNA_def_property_ui_text(prop, "Maximum Limit", ""); + + /* Limit Min/Max for Cone Twist */ + prop= RNA_def_property(srna, "limit_cone_min", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "minLimit"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Minimum Limit", ""); + + prop= RNA_def_property(srna, "limit_cone_max", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Maximum Limit", ""); + + + /* Limit Booleans */ + prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", 1); + RNA_def_property_ui_text(prop, "Use X Limit", "Use minimum/maximum x limit"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + prop= RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", 2); + RNA_def_property_ui_text(prop, "Use Y Limit", "Use minimum/maximum y limit"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + prop= RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", 4); + RNA_def_property_ui_text(prop, "Use Z Limit", "Use minimum/maximum z limit"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + prop= RNA_def_property(srna, "use_angular_limit_x", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", 8); + RNA_def_property_ui_text(prop, "Use Angular X Limit", "Use minimum/maximum x angular limit"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + prop= RNA_def_property(srna, "use_angular_limit_y", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", 16); + RNA_def_property_ui_text(prop, "Use Angular Y Limit", "Use minimum/maximum y angular limit"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + + prop= RNA_def_property(srna, "use_angular_limit_z", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", 32); + RNA_def_property_ui_text(prop, "Use Angular Z Limit", "Use minimum/maximum z angular limit"); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); + } static void rna_def_constraint_clamp_to(BlenderRNA *brna)