[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35216] trunk/blender: BGE patch: [#26223] Some RigidBody joints fixes (ui angles, conetwist/hinge limits etc) by Juha M?\195?\164ki-Kanto + ui changes pour moi
Dalai Felinto
dfelinto at gmail.com
Sun Feb 27 10:21:13 CET 2011
Revision: 35216
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35216
Author: dfelinto
Date: 2011-02-27 09:21:13 +0000 (Sun, 27 Feb 2011)
Log Message:
-----------
BGE patch: [#26223] Some RigidBody joints fixes (ui angles, conetwist/hinge limits etc) by Juha M?\195?\164ki-Kanto + ui changes pour moi
>From the tracker:::
Issues fixed:
- ConeTwist-constraint's params weren't making it to the CcdPhysicsEnvironment, also added Hinge's params.
- UI wasn't using angles where applicable.
- btHingeConstraint's constructor can create frame-matrices which don't align so the hinge doesn's start at 0 degree tilt.
This is an issue when setting limits.
Changes:
- UI: Hinge limits can be set (and disabled).
- UI: ConeTwist only has max-limits and only the twistX can be disabled
- PyApi via rna_constraint.c: added the functions limit_xyz_min, limit_xyz_max (for 6dof), limit_angle_xyz_min,
limit_angle_xyz_max (for 6dof), limit_angle_x_min, limit_angle_x_max (for hinge).
- PyApi: dropped python-function limit_cone_min.
.:. Extra:
UI Changes:
- renamed "RigidBody Joint" to "Rigid Boidy Joint"
- reorganized UI to conform with other parameters (e.g. Limit Rot)
- added dis/active all over the place :)
Modified Paths:
--------------
trunk/blender/release/scripts/ui/properties_object_constraint.py
trunk/blender/source/blender/blenkernel/intern/constraint.c
trunk/blender/source/blender/makesrna/intern/rna_constraint.c
trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
Modified: trunk/blender/release/scripts/ui/properties_object_constraint.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_object_constraint.py 2011-02-27 08:31:10 UTC (rev 35215)
+++ trunk/blender/release/scripts/ui/properties_object_constraint.py 2011-02-27 09:21:13 UTC (rev 35216)
@@ -535,33 +535,87 @@
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, "use_angular_limit_x", text="Angle X")
+ subcol = col.column()
+ subcol.active =con.use_angular_limit_x
+ subcol.prop(con, "limit_angle_max_x", text="")
col = split.column()
- col.prop(con, "limit_cone_min", text="")
+ col.prop(con, "use_angular_limit_y", text="Angle Y")
+ subcol = col.column()
+ subcol.active =con.use_angular_limit_y
+ subcol.prop(con, "limit_angle_max_y", text="")
+
col = split.column()
- col.prop(con, "limit_cone_max", text="")
+ col.prop(con, "use_angular_limit_z", text="Angle Z")
+ subcol = col.column()
+ subcol.active =con.use_angular_limit_z
+ subcol.prop(con, "limit_angle_max_z", 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")
+ sub = col.column()
+ sub.active = con.use_limit_x
+ sub.prop(con, "limit_min_x", text="Min")
+ sub.prop(con, "limit_max_x", text="Max")
+
+ col = split.column(align=True)
col.prop(con, "use_limit_y", text="Y")
+ sub = col.column()
+ sub.active = con.use_limit_y
+ sub.prop(con, "limit_min_y", text="Min")
+ sub.prop(con, "limit_max_y", text="Max")
+
+ col = split.column(align=True)
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")
+ sub = col.column()
+ sub.active = con.use_limit_z
+ sub.prop(con, "limit_min_z", text="Min")
+ sub.prop(con, "limit_max_z", text="Max")
+
+ split = layout.split()
+
+ col = split.column(align=True)
+ col.prop(con, "use_angular_limit_x", text="Angle X")
+ sub = col.column()
+ sub.active = con.use_angular_limit_x
+ sub.prop(con, "limit_angle_min_x", text="Min")
+ sub.prop(con, "limit_angle_max_x", text="Max")
+
+ col = split.column(align=True)
+ col.prop(con, "use_angular_limit_y", text="Angle Y")
+ sub = col.column()
+ sub.active = con.use_angular_limit_y
+ sub.prop(con, "limit_angle_min_y", text="Min")
+ sub.prop(con, "limit_angle_max_y", text="Max")
+
+ col = split.column(align=True)
+ col.prop(con, "use_angular_limit_z", text="Angle Z")
+ sub = col.column()
+ sub.active = con.use_angular_limit_z
+ sub.prop(con, "limit_angle_min_z", text="Min")
+ sub.prop(con, "limit_angle_max_z", text="Max")
- col = split.column()
- col.prop(con, "limit_generic_min", text="")
- col = split.column()
- col.prop(con, "limit_generic_max", text="")
+ elif con.pivot_type == 'HINGE':
+ layout.label(text="Limits:")
+ split = layout.split()
+ row = split.row(align=True)
+ col = row.column()
+ col.prop(con, "use_angular_limit_x", text="Angle X")
+
+ col = row.column()
+ col.active = con.use_angular_limit_x
+ col.prop(con, "limit_angle_min_x", text="Min")
+ col = row.column()
+ col.active = con.use_angular_limit_x
+ col.prop(con, "limit_angle_max_x", text="Max")
+
def CLAMP_TO(self, context, layout, con):
self.target_template(layout, con)
@@ -736,4 +790,4 @@
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":
- register()
+ register()
\ No newline at end of file
Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/constraint.c 2011-02-27 08:31:10 UTC (rev 35215)
+++ trunk/blender/source/blender/blenkernel/intern/constraint.c 2011-02-27 09:21:13 UTC (rev 35216)
@@ -3069,7 +3069,7 @@
static bConstraintTypeInfo CTI_RIGIDBODYJOINT = {
CONSTRAINT_TYPE_RIGIDBODYJOINT, /* type */
sizeof(bRigidBodyJointConstraint), /* size */
- "RigidBody Joint", /* name */
+ "Rigid Body Joint", /* name */
"bRigidBodyJointConstraint", /* struct name */
NULL, /* free data */
NULL, /* relink data */
Modified: trunk/blender/source/blender/makesrna/intern/rna_constraint.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_constraint.c 2011-02-27 08:31:10 UTC (rev 35215)
+++ trunk/blender/source/blender/makesrna/intern/rna_constraint.c 2011-02-27 09:21:13 UTC (rev 35216)
@@ -322,47 +322,6 @@
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 @@
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", "");
+ /* 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_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_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_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", "");
+ 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", "");
-
- /* Limit Booleans */
+ 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", "");
+
+ 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]");
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list