[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48149] trunk/blender/source/blender: Fix for properly converting 2.4x IPO Actuators to 2.6x Action Actuators.

Mitchell Stokes mogurijin at gmail.com
Thu Jun 21 08:28:01 CEST 2012


Revision: 48149
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48149
Author:   moguri
Date:     2012-06-21 06:27:51 +0000 (Thu, 21 Jun 2012)
Log Message:
-----------
Fix for properly converting 2.4x IPO Actuators to 2.6x Action Actuators. Previously the converted Action Actuators would not have an action assigned. This fix is based on code provided by Maxim Aleynikov in his report: [#30410] not full conversion IPO Actuator in Action Actuator.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/ipo.c
    trunk/blender/source/blender/blenloader/intern/versioning_250.c

Modified: trunk/blender/source/blender/blenkernel/intern/ipo.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/ipo.c	2012-06-21 06:10:51 UTC (rev 48148)
+++ trunk/blender/source/blender/blenkernel/intern/ipo.c	2012-06-21 06:27:51 UTC (rev 48149)
@@ -46,6 +46,7 @@
 /* since we have versioning code here */
 #define DNA_DEPRECATED_ALLOW
 
+#include "DNA_actuator_types.h"
 #include "DNA_anim_types.h"
 #include "DNA_constraint_types.h"
 #include "DNA_camera_types.h"
@@ -1753,6 +1754,24 @@
 				ipo_to_animdata(id, ob->ipo, NULL, NULL, NULL);
 				ob->ipo->id.us--;
 				ob->ipo = NULL;
+
+				{
+					/* If we have any empty action actuators, assume they were
+					   converted IPO Actuators using the object IPO */
+					bActuator *act;
+					bActionActuator *aa;
+
+					for (act = ob->actuators.first; act; act = act->next) {
+						/* Any actuators set to ACT_IPO at this point are actually Action Actuators that
+						   need this converted IPO to finish converting the actuator. */
+						if (act->type == ACT_IPO)
+						{
+							aa = (bActionActuator*)act->data;
+							aa->act = ob->adt->action;
+							act->type = ACT_ACTION;
+						}
+					}
+				}
 			}
 		}
 		

Modified: trunk/blender/source/blender/blenloader/intern/versioning_250.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/versioning_250.c	2012-06-21 06:10:51 UTC (rev 48148)
+++ trunk/blender/source/blender/blenloader/intern/versioning_250.c	2012-06-21 06:27:51 UTC (rev 48149)
@@ -2558,11 +2558,11 @@
 			for (ob = main->object.first; ob; ob = ob->id.next) {
 				for (act = ob->actuators.first; act; act = act->next) {
 					if (act->type == ACT_IPO) {
-						// Create the new actuator
+						/* Create the new actuator */
 						ia = act->data;
 						aa = MEM_callocN(sizeof(bActionActuator), "fcurve -> action actuator do_version");
 
-						// Copy values
+						/* Copy values */
 						aa->type = ia->type;
 						aa->flag = ia->flag;
 						aa->sta = ia->sta;
@@ -2572,12 +2572,18 @@
 						if (ob->adt)
 							aa->act = ob->adt->action;
 
-						// Get rid of the old actuator
+						/* Get rid of the old actuator */
 						MEM_freeN(ia);
 
-						// Assign the new actuator
+						/* Assign the new actuator */
 						act->data = aa;
 						act->type = act->otype = ACT_ACTION;
+
+						/* Fix for converting 2.4x files: if we don't have an action, but we have an
+						   object IPO, then leave the actuator as an IPO actuator for now and let the
+						   IPO conversion code handle it */
+						if (ob->ipo && !aa->act)
+							act->type = ACT_IPO;
 					}
 					else if (act->type == ACT_SHAPEACTION) {
 						act->type = act->otype = ACT_ACTION;




More information about the Bf-blender-cvs mailing list