Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_constraint.c')
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c176
1 files changed, 85 insertions, 91 deletions
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 9570d817726..fcfbb4eb990 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -22,6 +22,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/makesrna/intern/rna_constraint.c
+ * \ingroup RNA
+ */
+
+
#include <stdlib.h>
#include "RNA_define.h"
@@ -70,32 +75,20 @@ EnumPropertyItem constraint_type_items[] ={
{CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", ICON_CONSTRAINT_DATA, "Shrinkwrap", ""},
{0, NULL, 0, NULL, NULL}};
-EnumPropertyItem space_pchan_items[] = {
+static EnumPropertyItem space_pchan_items[] = {
{0, "WORLD", 0, "World Space", ""},
{2, "POSE", 0, "Pose Space", ""},
{3, "LOCAL_WITH_PARENT", 0, "Local With Parent", ""},
{1, "LOCAL", 0, "Local Space", ""},
{0, NULL, 0, NULL, NULL}};
-EnumPropertyItem space_object_items[] = {
+#ifdef RNA_RUNTIME
+
+static EnumPropertyItem space_object_items[] = {
{0, "WORLD", 0, "World Space", ""},
{1, "LOCAL", 0, "Local Space", ""},
{0, NULL, 0, NULL, NULL}};
-EnumPropertyItem constraint_ik_type_items[] ={
- {CONSTRAINT_IK_COPYPOSE, "COPY_POSE", 0, "Copy Pose", ""},
- {CONSTRAINT_IK_DISTANCE, "DISTANCE", 0, "Distance", ""},
- {0, NULL, 0, NULL, NULL},
-};
-
-EnumPropertyItem constraint_ik_axisref_items[] ={
- {0, "BONE", 0, "Bone", ""},
- {CONSTRAINT_IK_TARGETAXIS, "TARGET", 0, "Target", ""},
- {0, NULL, 0, NULL, NULL},
-};
-
-#ifdef RNA_RUNTIME
-
#include "BKE_animsys.h"
#include "BKE_action.h"
#include "BKE_constraint.h"
@@ -322,47 +315,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[] = {
@@ -502,6 +454,18 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
+ static EnumPropertyItem constraint_ik_axisref_items[] ={
+ {0, "BONE", 0, "Bone", ""},
+ {CONSTRAINT_IK_TARGETAXIS, "TARGET", 0, "Target", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static EnumPropertyItem constraint_ik_type_items[] ={
+ {CONSTRAINT_IK_COPYPOSE, "COPY_POSE", 0, "Copy Pose", ""},
+ {CONSTRAINT_IK_DISTANCE, "DISTANCE", 0, "Distance", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
srna= RNA_def_struct(brna, "KinematicConstraint", "Constraint");
RNA_def_struct_ui_text(srna, "Kinematic Constraint", "Inverse Kinematics");
RNA_def_struct_sdna_from(srna, "bKinematicConstraint", "data");
@@ -1158,7 +1122,7 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna)
static EnumPropertyItem volume_items[] = {
{VOLUME_XZ, "VOLUME_XZX", 0, "XZ", ""},
- {VOLUME_X, "VOLUME_X", 0, "Y", ""},
+ {VOLUME_X, "VOLUME_X", 0, "X", ""},
{VOLUME_Z, "VOLUME_Z", 0, "Z", ""},
{NO_VOLUME, "NO_VOLUME", 0, "None", ""},
{0, NULL, 0, NULL, NULL}};
@@ -1293,62 +1257,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");
}