[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54130] trunk/blender/source/blender/ editors/animation/keyframing.c: Visual Keyframing now works for rigid body objects too

Joshua Leung aligorith at gmail.com
Mon Jan 28 02:02:18 CET 2013


Revision: 54130
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54130
Author:   aligorith
Date:     2013-01-28 01:02:14 +0000 (Mon, 28 Jan 2013)
Log Message:
-----------
Visual Keyframing now works for rigid body objects too

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/keyframing.c

Modified: trunk/blender/source/blender/editors/animation/keyframing.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframing.c	2013-01-27 21:51:25 UTC (rev 54129)
+++ trunk/blender/source/blender/editors/animation/keyframing.c	2013-01-28 01:02:14 UTC (rev 54130)
@@ -52,6 +52,7 @@
 #include "DNA_material_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"
+#include "DNA_rigidbody_types.h"
 
 #include "BKE_animsys.h"
 #include "BKE_action.h"
@@ -554,6 +555,7 @@
 {
 	bConstraint *con = NULL;
 	short searchtype = VISUALKEY_NONE;
+	short has_rigidbody = FALSE;
 	short has_parent = FALSE;
 	const char *identifier = NULL;
 	
@@ -569,10 +571,14 @@
 	if (ptr->type == &RNA_Object) {
 		/* Object */
 		Object *ob = (Object *)ptr->data;
+		RigidBodyOb *rbo = ob->rigidbody_object;
 		
 		con = ob->constraints.first;
 		identifier = RNA_property_identifier(prop);
 		has_parent = (ob->parent != NULL);
+		
+		/* active rigidbody objects only, as only those are affected by sim */
+		has_rigidbody = ((rbo) && (rbo->type == RBO_TYPE_ACTIVE));
 	}
 	else if (ptr->type == &RNA_PoseBone) {
 		/* Pose Channel */
@@ -584,7 +590,7 @@
 	}
 	
 	/* check if any data to search using */
-	if (ELEM(NULL, con, identifier) && (has_parent == FALSE))
+	if (ELEM(NULL, con, identifier) && (has_parent == FALSE) && (has_rigidbody == FALSE))
 		return 0;
 	
 	/* location or rotation identifiers only... */
@@ -609,8 +615,8 @@
 	
 	/* only search if a searchtype and initial constraint are available */
 	if (searchtype) {
-		/* parent is always matching */
-		if (has_parent)
+		/* parent or rigidbody are always matching */
+		if (has_parent || has_rigidbody)
 			return 1;
 		
 		/* constraints */
@@ -696,12 +702,12 @@
 	 */
 	if (ptr->type == &RNA_Object) {
 		Object *ob = (Object *)ptr->data;
-
+		
 		/* Loc code is specific... */
 		if (strstr(identifier, "location")) {
 			return ob->obmat[3][array_index];
 		}
-
+		
 		copy_m4_m4(tmat, ob->obmat);
 		rotmode = ob->rotmode;
 	}




More information about the Bf-blender-cvs mailing list