[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18581] branches/blender2.5/blender/source /blender/makesrna/intern: Wrapped constraint dna.

Roland Hess me at harkyman.com
Tue Jan 20 04:55:39 CET 2009


Revision: 18581
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18581
Author:   harkyman
Date:     2009-01-20 04:55:30 +0100 (Tue, 20 Jan 2009)

Log Message:
-----------
Wrapped constraint dna. There are a couple of things left to look at, all noted, but 99.5% of constraint uses are taken care of.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_constraint.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_constraint.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_constraint.c	2009-01-20 03:41:23 UTC (rev 18580)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_constraint.c	2009-01-20 03:55:30 UTC (rev 18581)
@@ -17,7 +17,7 @@
  * 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), Joshua Leung
+ * Contributor(s): Blender Foundation (2008), Joshua Leung, Roland Hess
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -27,27 +27,1126 @@
 #include "RNA_define.h"
 #include "RNA_types.h"
 
-#include "rna_internal.h"
-
 #include "DNA_constraint_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
 
 #ifdef RNA_RUNTIME
 
-static StructRNA* rna_Constraint_refine(struct PointerRNA *ptr)
+StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
 {
 	bConstraint *con= (bConstraint*)ptr->data;
 
 	switch(con->type) {
-		// FIXME: add constraint types
+		case CONSTRAINT_TYPE_CHILDOF:
+			return &RNA_ChildOfConstraint;
+		case CONSTRAINT_TYPE_TRACKTO:
+			return &RNA_TrackToConstraint;
+		case CONSTRAINT_TYPE_KINEMATIC:
+			return &RNA_KinematicConstraint;
+		case CONSTRAINT_TYPE_FOLLOWPATH:
+			return &RNA_FollowPathConstraint;
+		case CONSTRAINT_TYPE_ROTLIKE:
+			return &RNA_RotateLikeConstraint;
+		case CONSTRAINT_TYPE_LOCLIKE:
+			return &RNA_LocateLikeConstraint;
+		case CONSTRAINT_TYPE_SIZELIKE:
+			return &RNA_SizeLikeConstraint;
+		case CONSTRAINT_TYPE_PYTHON:
+			return &RNA_PythonConstraint;
+		case CONSTRAINT_TYPE_ACTION:
+			return &RNA_ActionConstraint;
+		case CONSTRAINT_TYPE_LOCKTRACK:
+			return &RNA_LockTrackConstraint;
+		case CONSTRAINT_TYPE_STRETCHTO:
+			return &RNA_StretchToConstraint;
+		case CONSTRAINT_TYPE_MINMAX:
+			return &RNA_MinMaxConstraint;
+		case CONSTRAINT_TYPE_RIGIDBODYJOINT:
+			return &RNA_RigidBodyJointConstraint;
+		case CONSTRAINT_TYPE_CLAMPTO:
+			return &RNA_ClampToConstraint;			
+		case CONSTRAINT_TYPE_TRANSFORM:
+			return &RNA_TransformConstraint;
+		case CONSTRAINT_TYPE_ROTLIMIT:
+			return &RNA_RotationLimitConstraint;
+		case CONSTRAINT_TYPE_LOCLIMIT:
+			return &RNA_LocationLimitConstraint;
+		case CONSTRAINT_TYPE_SIZELIMIT:
+			return &RNA_SizeLimitConstraint;
+		case CONSTRAINT_TYPE_DISTLIMIT:
+			return &RNA_DistLimitConstraint;
 		default:
-			return &RNA_Constraint;
+			return &RNA_UnknownType;
 	}
 }
 
 #else
 
+static void rna_def_constrainttarget(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	srna= RNA_def_struct(brna, "ConstraintTarget", NULL);
+	RNA_def_struct_ui_text(srna, "Constraint Target", "Target object for multi-target constraints.");
+	RNA_def_struct_sdna(srna, "bConstraintTarget");
+
+	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");
+
+	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", "");
+
+	// space, flag and type still to do 
+}
+
+static void rna_def_constraint_childof(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	srna= RNA_def_struct(brna, "ChildOfConstraint", "Constraint"); 
+	RNA_def_struct_ui_text(srna, "Child Of Constraint", "Creates constraint-based parent-child relationship."); 
+	RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "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");
+
+	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", "");
+
+	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.");
+
+	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.");
+
+	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.");
+
+	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.");
+
+	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.");
+
+	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.");
+
+	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.");
+
+	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.");
+
+	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.");
+}
+
+static void rna_def_constraint_python(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	srna= RNA_def_struct(brna, "PythonConstraint", "Constraint");
+	RNA_def_struct_ui_text(srna, "Python Constraint", "Uses Python script for constraint evaluation.");
+	RNA_def_struct_sdna_from(srna, "bPythonConstraint", "data");
+
+	prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_sdna(prop, NULL, "targets", NULL);
+	RNA_def_property_struct_type(prop, "ConstraintTarget");
+	RNA_def_property_ui_text(prop, "Targets", "Target Objects.");
+
+	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.");
+
+	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.");
+
+	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.");
+
+	prop= RNA_def_property(srna, "script_error", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", PYCON_SCRIPTERROR);
+	RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+	RNA_def_property_ui_text(prop, "Script Error", "The linked Python script has thrown an error.");
+}
+
+static void rna_def_constraint_kinematic(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	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");
+
+	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");
+
+	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", "");
+
+	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.");
+
+	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.");
+
+	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", "");
+
+	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.");
+
+	prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.01, 1.f);
+	RNA_def_property_ui_text(prop, "Weight", "For Tree-IK: Weight of position control for this target.");
+
+	prop= RNA_def_property(srna, "orient_weight", PROP_FLOAT, PROP_NONE);
+	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.");
+
+	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.");
+
+	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.");
+
+	prop= RNA_def_property(srna, "rotation", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_ROT);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list