[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27013] trunk/blender/source/blender/ editors: constraints were being checked twice ( once from rna property update function and once from the constraint panel callback )

Campbell Barton ideasman42 at gmail.com
Thu Feb 18 17:05:01 CET 2010


Revision: 27013
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27013
Author:   campbellbarton
Date:     2010-02-18 17:05:01 +0100 (Thu, 18 Feb 2010)

Log Message:
-----------
constraints were being checked twice (once from rna property update function and once from the constraint panel callback)
comment the update call in the panel function.
also avoid one bone lookup which was taking a fair bit of CPU when profiling.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_templates.c
    trunk/blender/source/blender/editors/object/object_constraint.c

Modified: trunk/blender/source/blender/editors/interface/interface_templates.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_templates.c	2010-02-18 15:59:20 UTC (rev 27012)
+++ trunk/blender/source/blender/editors/interface/interface_templates.c	2010-02-18 16:05:01 UTC (rev 27013)
@@ -886,7 +886,6 @@
 #define REDRAWACTION				4
 #define B_CONSTRAINT_TEST			5
 #define B_CONSTRAINT_CHANGETARGET	6
-#define B_CONSTRAINT_INF			7
 #define REMAKEIPO					8
 #define B_DIFF						9
 
@@ -901,11 +900,6 @@
 		// XXX allqueue(REDRAWBUTSOBJECT, 0);
 		// XXX allqueue(REDRAWBUTSEDIT, 0);
 		break;  // no handling
-	case B_CONSTRAINT_INF:
-		/* influence; do not execute actions for 1 dag_flush */
-		if (ob->pose)
-			ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
-		break;
 	case B_CONSTRAINT_CHANGETARGET:
 		if (ob->pose) ob->pose->flag |= POSE_RECALC;	// checks & sorts pose channels
 		DAG_scene_sort(scene);
@@ -914,10 +908,12 @@
 		break;
 	}
 
-	object_test_constraints(ob);
+	// note: RNA updates now call this, commenting else it gets called twice.
+	// if there are problems because of this, then rna needs changed update functions.
+	// 
+	// object_test_constraints(ob);
+	// if(ob->pose) update_pose_constraint_flags(ob->pose);
 	
-	if(ob->pose) update_pose_constraint_flags(ob->pose);
-	
 	if(ob->type==OB_ARMATURE) DAG_id_flush_update(&ob->id, OB_RECALC_DATA|OB_RECALC_OB);
 	else DAG_id_flush_update(&ob->id, OB_RECALC_OB);
 

Modified: trunk/blender/source/blender/editors/object/object_constraint.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_constraint.c	2010-02-18 15:59:20 UTC (rev 27012)
+++ trunk/blender/source/blender/editors/object/object_constraint.c	2010-02-18 16:05:01 UTC (rev 27013)
@@ -250,9 +250,10 @@
 /* ------------- Constraint Sanity Testing ------------------- */
 
 /* checks validity of object pointers, and NULLs,
- * if Bone doesnt exist it sets the CONSTRAINT_DISABLE flag 
+ * if Bone doesnt exist it sets the CONSTRAINT_DISABLE flag.
+ * 'data' saves a bone name lookup.
  */
-static void test_constraints (Object *owner, const char substring[])
+static void test_constraints (Object *owner, const char substring[], void *data)
 {
 	bConstraint *curcon;
 	ListBase *conlist= NULL;
@@ -284,7 +285,7 @@
 				Bone *bone;
 				bPoseChannel *chan;
 				
-				bone = get_named_bone( ((bArmature *)owner->data), substring );
+				bone = data ? data : get_named_bone( ((bArmature *)owner->data), substring );
 				chan = get_pose_channel(owner->pose, substring);
 				if (bone && chan) {
 					conlist = &chan->constraints;
@@ -436,14 +437,14 @@
 	Bone *bone;
 
 	for (bone = list->first; bone; bone = bone->next) {
-		test_constraints(owner, bone->name);
+		test_constraints(owner, bone->name, (void *)bone);
 		test_bonelist_constraints(owner, &bone->childbase);
 	}
 }
 
 void object_test_constraints (Object *owner)
 {
-	test_constraints(owner, "");
+	test_constraints(owner, "", NULL);
 
 	if (owner->type==OB_ARMATURE) {
 		bArmature *arm= get_armature(owner);





More information about the Bf-blender-cvs mailing list