[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46719] trunk/blender/source/blender: Disable setting non-object actions as the action used by the Action Constraint

Joshua Leung aligorith at gmail.com
Thu May 17 12:28:30 CEST 2012


Revision: 46719
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46719
Author:   aligorith
Date:     2012-05-17 10:28:30 +0000 (Thu, 17 May 2012)
Log Message:
-----------
Disable setting non-object actions as the action used by the Action Constraint

(... I could've sworn there used to be some dynamic enums for filtering actions
by root type)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/object/object_constraint.c
    trunk/blender/source/blender/makesrna/intern/rna_constraint.c

Modified: trunk/blender/source/blender/editors/object/object_constraint.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_constraint.c	2012-05-17 10:10:11 UTC (rev 46718)
+++ trunk/blender/source/blender/editors/object/object_constraint.c	2012-05-17 10:28:30 UTC (rev 46719)
@@ -356,8 +356,15 @@
 				bActionConstraint *data = curcon->data;
 				
 				/* validate action */
-				if (data->act == NULL) 
+				if (data->act == NULL) {
+					/* must have action */
 					curcon->flag |= CONSTRAINT_DISABLE;
+				}
+				else if (data->act->idroot != ID_OB) {
+					/* only object-rooted actions can be used */
+					data->act = NULL;
+					curcon->flag |= CONSTRAINT_DISABLE;
+				}
 			}
 			else if (curcon->type == CONSTRAINT_TYPE_FOLLOWPATH) {
 				bFollowPathConstraint *data = curcon->data;
@@ -409,12 +416,12 @@
 					if (data->clip != NULL && data->track[0]) {
 						MovieTracking *tracking = &data->clip->tracking;
 						MovieTrackingObject *tracking_object;
-
+						
 						if (data->object[0])
 							tracking_object = BKE_tracking_named_object(tracking, data->object);
 						else
 							tracking_object = BKE_tracking_get_camera_object(tracking);
-
+						
 						if (!tracking_object) {
 							curcon->flag |= CONSTRAINT_DISABLE;
 						}
@@ -428,14 +435,14 @@
 			}
 			else if (curcon->type == CONSTRAINT_TYPE_CAMERASOLVER) {
 				bCameraSolverConstraint *data = curcon->data;
-
-				if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && data->clip == NULL)
+				
+				if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && (data->clip == NULL))
 					curcon->flag |= CONSTRAINT_DISABLE;
 			}
 			else if (curcon->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
 				bObjectSolverConstraint *data = curcon->data;
-
-				if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && data->clip == NULL)
+				
+				if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && (data->clip == NULL))
 					curcon->flag |= CONSTRAINT_DISABLE;
 			}
 			

Modified: trunk/blender/source/blender/makesrna/intern/rna_constraint.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_constraint.c	2012-05-17 10:10:11 UTC (rev 46718)
+++ trunk/blender/source/blender/makesrna/intern/rna_constraint.c	2012-05-17 10:28:30 UTC (rev 46719)
@@ -1105,6 +1105,7 @@
 
 	prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "act");
+	RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Action_id_poll");
 	RNA_def_property_ui_text(prop, "Action", "The constraining action");
 	RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
 	RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");




More information about the Bf-blender-cvs mailing list