[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23361] trunk/blender: 2. 5 - More animation/rigging bugfixes

Joshua Leung aligorith at gmail.com
Sun Sep 20 13:21:44 CEST 2009


Revision: 23361
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23361
Author:   aligorith
Date:     2009-09-20 13:21:44 +0200 (Sun, 20 Sep 2009)

Log Message:
-----------
2.5 - More animation/rigging bugfixes

* #19419: PoseLib rename/remove tools could crash when an invalid 
(However, now care is needed when touching that index field, since the warnings can keep piling up)

* Added Browse Poses for PoseLib to the toolbar

* Removing constraints from bones now properly updates. A DAG rebuild is now forced, and the constraint flags are cleared.

* Attempting to improve the situation with Copy Rotation constraint and rotation orders other than xyz. Unforunately, it looks like a different method is required...

Modified Paths:
--------------
    trunk/blender/release/ui/space_view3d_toolbar.py
    trunk/blender/source/blender/blenkernel/intern/constraint.c
    trunk/blender/source/blender/editors/armature/poselib.c
    trunk/blender/source/blender/editors/object/object_constraint.c

Modified: trunk/blender/release/ui/space_view3d_toolbar.py
===================================================================
--- trunk/blender/release/ui/space_view3d_toolbar.py	2009-09-20 11:13:57 UTC (rev 23360)
+++ trunk/blender/release/ui/space_view3d_toolbar.py	2009-09-20 11:21:44 UTC (rev 23361)
@@ -277,8 +277,6 @@
 	def draw(self, context):
 		layout = self.layout
 		
-		
-
 		col = layout.column(align=True)
 		col.itemL(text="Transform:")
 		col.itemO("tfm.translate")
@@ -299,7 +297,8 @@
 		col.itemL(text="Pose:")
 		col.itemO("pose.copy", text="Copy")
 		col.itemO("pose.paste", text="Paste")
-		col.itemO("poselib.pose_add", text="Add To library")
+		col.itemO("poselib.pose_add", text="Add To Library")
+		col.itemO("poselib.browse_interactive", text="Browse Library")
 		
 		col = layout.column(align=True)
 		col.itemL(text="In-Between:")

Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/constraint.c	2009-09-20 11:13:57 UTC (rev 23360)
+++ trunk/blender/source/blender/blenkernel/intern/constraint.c	2009-09-20 11:21:44 UTC (rev 23361)
@@ -685,9 +685,17 @@
 		ct->flag= CONSTRAINT_TAR_TEMP; \
 		 \
 		if (ct->tar) { \
-			if ((ct->tar->type==OB_ARMATURE) && (ct->subtarget[0])) ct->type = CONSTRAINT_OBTYPE_BONE; \
-			else if (ELEM(ct->tar->type, OB_MESH, OB_LATTICE) && (ct->subtarget[0])) ct->type = CONSTRAINT_OBTYPE_VERT; \
-			else ct->type = CONSTRAINT_OBTYPE_OBJECT; \
+			if ((ct->tar->type==OB_ARMATURE) && (ct->subtarget[0])) { \
+				bPoseChannel *pchan= get_pose_channel(ct->tar->pose, ct->subtarget); \
+				ct->type = CONSTRAINT_OBTYPE_BONE; \
+				ct->rotOrder= pchan->rotmode; \
+			}\
+			else if (ELEM(ct->tar->type, OB_MESH, OB_LATTICE) && (ct->subtarget[0])) { \
+				ct->type = CONSTRAINT_OBTYPE_VERT; \
+			} \
+			else {\
+				ct->type = CONSTRAINT_OBTYPE_OBJECT; \
+			} \
 		} \
 		 \
 		BLI_addtail(list, ct); \

Modified: trunk/blender/source/blender/editors/armature/poselib.c
===================================================================
--- trunk/blender/source/blender/editors/armature/poselib.c	2009-09-20 11:13:57 UTC (rev 23360)
+++ trunk/blender/source/blender/editors/armature/poselib.c	2009-09-20 11:21:44 UTC (rev 23361)
@@ -467,6 +467,7 @@
 	marker= BLI_findlink(&act->markers, RNA_int_get(op->ptr, "index"));
 	if (marker == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Invalid index for Pose");
+		return OPERATOR_CANCELLED;
 	}
 	
 	/* remove relevant keyframes */
@@ -533,6 +534,7 @@
 	marker= BLI_findlink(&act->markers, RNA_int_get(op->ptr, "index"));
 	if (marker == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Invalid index for Pose");
+		return OPERATOR_CANCELLED;
 	}
 	
 	/* get new name */

Modified: trunk/blender/source/blender/editors/object/object_constraint.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_constraint.c	2009-09-20 11:13:57 UTC (rev 23360)
+++ trunk/blender/source/blender/editors/object/object_constraint.c	2009-09-20 11:21:44 UTC (rev 23361)
@@ -823,17 +823,22 @@
 static int pose_constraints_clear_exec(bContext *C, wmOperator *op)
 {
 	Object *ob= CTX_data_active_object(C);
+	Scene *scene= CTX_data_scene(C);
 	
 	/* free constraints for all selected bones */
 	CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pchans)
 	{
 		free_constraints(&pchan->constraints);
+		pchan->constflag &= ~(PCHAN_HAS_IK|PCHAN_HAS_CONST);
 	}
 	CTX_DATA_END;
 	
+	/* force depsgraph to get recalculated since relationships removed */
+	DAG_scene_sort(scene);		/* sort order of objects */	
+	
 	/* do updates */
-	DAG_id_flush_update(&ob->id, OB_RECALC_OB);
-	WM_event_add_notifier(C, NC_OBJECT|ND_POSE|ND_CONSTRAINT|NA_REMOVED, ob);
+	DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+	WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
 	
 	return OPERATOR_FINISHED;
 }
@@ -854,14 +859,18 @@
 static int object_constraints_clear_exec(bContext *C, wmOperator *op)
 {
 	Object *ob= CTX_data_active_object(C);
+	Scene *scene= CTX_data_scene(C);
 	
 	/* do freeing */
 	// TODO: we should free constraints for all selected objects instead (to be more consistent with bones)
 	free_constraints(&ob->constraints);
 	
+	/* force depsgraph to get recalculated since relationships removed */
+	DAG_scene_sort(scene);		/* sort order of objects */	
+	
 	/* do updates */
 	DAG_id_flush_update(&ob->id, OB_RECALC_OB);
-	WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_REMOVED, ob);
+	WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
 	
 	return OPERATOR_FINISHED;
 }





More information about the Bf-blender-cvs mailing list