diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_constraint.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_constraint.c | 137 |
1 files changed, 63 insertions, 74 deletions
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 3d516440731..92637e1577c 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -322,47 +322,6 @@ static void rna_SplineIKConstraint_joint_bindings_set(PointerRNA *ptr, const flo memcpy(ikData->points, values, ikData->numpoints * sizeof(float)); } -/* Array Get/Set Functions for RigidBodyJointConstraint Min/Max Cone Limits */ -void rna_RigidBodyJointConstraint_limit_cone_min_get(PointerRNA *ptr, float values[3]) -{ - bRigidBodyJointConstraint *data= (bRigidBodyJointConstraint*)(((bConstraint*)ptr->data)->data); - float *limit = data->minLimit; - - values[0]= limit[3]; - values[1]= limit[4]; - values[2]= limit[5]; -} - -static void rna_RigidBodyJointConstraint_limit_cone_min_set(PointerRNA *ptr, const float values[3]) -{ - bRigidBodyJointConstraint *data= (bRigidBodyJointConstraint*)(((bConstraint*)ptr->data)->data); - float *limit = data->minLimit; - - limit[3]= values[0]; - limit[4]= values[1]; - limit[5]= values[2]; -} - -void rna_RigidBodyJointConstraint_limit_cone_max_get(PointerRNA *ptr, float values[3]) -{ - bRigidBodyJointConstraint *data= (bRigidBodyJointConstraint*)(((bConstraint*)ptr->data)->data); - float *limit = data->maxLimit; - - values[0]= limit[3]; - values[1]= limit[4]; - values[2]= limit[5]; -} - -static void rna_RigidBodyJointConstraint_limit_cone_max_set(PointerRNA *ptr, const float values[3]) -{ - bRigidBodyJointConstraint *data= (bRigidBodyJointConstraint*)(((bConstraint*)ptr->data)->data); - float *limit = data->maxLimit; - - limit[3]= values[0]; - limit[4]= values[1]; - limit[5]= values[2]; -} - #else EnumPropertyItem constraint_distance_items[] = { @@ -1293,62 +1252,92 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) 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_float_funcs(prop, "rna_RigidBodyJointConstraint_limit_cone_min_get", "rna_RigidBodyJointConstraint_limit_cone_min_set", NULL); - 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_float_funcs(prop, "rna_RigidBodyJointConstraint_limit_cone_max_get", "rna_RigidBodyJointConstraint_limit_cone_max_set", NULL); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Maximum Limit", ""); + /* Limits */ + /* Limit Min/Max */ + prop= RNA_def_property(srna, "limit_min_x", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "minLimit[0]"); + RNA_def_property_ui_text(prop, "Minimum Limit X", ""); + + prop= RNA_def_property(srna, "limit_min_y", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "minLimit[1]"); + RNA_def_property_ui_text(prop, "Minimum Limit Y", ""); + + prop= RNA_def_property(srna, "limit_min_z", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "minLimit[2]"); + RNA_def_property_ui_text(prop, "Minimum Limit Z", ""); + + prop= RNA_def_property(srna, "limit_max_x", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit[0]"); + RNA_def_property_ui_text(prop, "Maximum Limit X", ""); + + prop= RNA_def_property(srna, "limit_max_y", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit[1]"); + RNA_def_property_ui_text(prop, "Maximum Limit Y", ""); + + prop= RNA_def_property(srna, "limit_max_z", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit[2]"); + RNA_def_property_ui_text(prop, "Maximum Limit Z", ""); + + /* Limit Min/Max for angle */ + prop= RNA_def_property(srna, "limit_angle_min_x", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "minLimit[3]"); + RNA_def_property_range(prop, -M_PI*2, M_PI*2); + RNA_def_property_ui_text(prop, "Minimum Angular Limit X", ""); - - /* Limit Booleans */ + prop= RNA_def_property(srna, "limit_angle_min_y", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "minLimit[4]"); + RNA_def_property_range(prop, -M_PI*2, M_PI*2); + RNA_def_property_ui_text(prop, "Minimum Angular Limit Y", ""); + + prop= RNA_def_property(srna, "limit_angle_min_z", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "minLimit[5]"); + RNA_def_property_range(prop, -M_PI*2, M_PI*2); + RNA_def_property_ui_text(prop, "Minimum Angular Limit Z", ""); + + prop= RNA_def_property(srna, "limit_angle_max_x", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit[3]"); + RNA_def_property_range(prop, -M_PI*2, M_PI*2); + RNA_def_property_ui_text(prop, "Maximum Angular Limit X", ""); + + prop= RNA_def_property(srna, "limit_angle_max_y", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit[4]"); + RNA_def_property_range(prop, -M_PI*2, M_PI*2); + RNA_def_property_ui_text(prop, "Maximum Angular Limit Y", ""); + + prop= RNA_def_property(srna, "limit_angle_max_z", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit[5]"); + RNA_def_property_range(prop, -M_PI*2, M_PI*2); + RNA_def_property_ui_text(prop, "Maximum Angular Limit Z", ""); + + /* 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_ui_text(prop, "Limit X", "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_ui_text(prop, "Limit Y", "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_ui_text(prop, "Limit Z", "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_ui_text(prop, "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_ui_text(prop, "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_ui_text(prop, "Angular Z Limit", "Use minimum/maximum z angular limit"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } |