[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33935] trunk/blender/source/blender/ blenkernel/intern/node.c: Bugfix [#24163] (PART 2) Unable to animate INSIDE a group node in the
Joshua Leung
aligorith at gmail.com
Wed Dec 29 13:18:59 CET 2010
Revision: 33935
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33935
Author: aligorith
Date: 2010-12-29 13:18:59 +0100 (Wed, 29 Dec 2010)
Log Message:
-----------
Bugfix [#24163] (PART 2) Unable to animate INSIDE a group node in the
compositor
Now ungrouping grouped-nodes copies the animation back to the main
nodetree. This means that it is now possible to successfully roundtrip
group/un-group nodes and their animation data.
---
This should also be done for the Separate Armature operator... hmm...
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/node.c
Modified: trunk/blender/source/blender/blenkernel/intern/node.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/node.c 2010-12-29 11:51:53 UTC (rev 33934)
+++ trunk/blender/source/blender/blenkernel/intern/node.c 2010-12-29 12:18:59 UTC (rev 33935)
@@ -805,6 +805,7 @@
bNodeLink *link, *linkn;
bNode *node, *nextn;
bNodeTree *ngroup, *wgroup;
+ ListBase anim_basepaths = {NULL, NULL};
int index;
ngroup= (bNodeTree *)gnode->id;
@@ -813,16 +814,38 @@
/* clear new pointers, set in copytree */
for(node= ntree->nodes.first; node; node= node->next)
node->new_node= NULL;
-
+
+ /* wgroup is a temporary copy of the NodeTree we're merging in
+ * - all of wgroup's nodes are transferred across to their new home
+ * - ngroup (i.e. the source NodeTree) is left unscathed
+ */
wgroup= ntreeCopyTree(ngroup, 0);
/* add the nodes into the ntree */
for(node= wgroup->nodes.first; node; node= nextn) {
nextn= node->next;
+
+ /* keep track of this node's RNA "base" path (the part of the pat identifying the node)
+ * if the old nodetree has animation data which potentially covers this node
+ */
+ if (wgroup->adt) {
+ PointerRNA ptr;
+ char *path;
+
+ RNA_pointer_create(&wgroup->id, &RNA_Node, node, &ptr);
+ path = RNA_path_from_ID_to_struct(&ptr);
+
+ if (path)
+ BLI_addtail(&anim_basepaths, BLI_genericNodeN(path));
+ }
+
+ /* migrate node */
BLI_remlink(&wgroup->nodes, node);
BLI_addtail(&ntree->nodes, node);
+
node->locx+= gnode->locx;
node->locy+= gnode->locy;
+
node->flag |= NODE_SELECT;
}
/* and the internal links */
@@ -831,6 +854,29 @@
BLI_remlink(&wgroup->links, link);
BLI_addtail(&ntree->links, link);
}
+
+ /* and copy across the animation */
+ if (wgroup->adt) {
+ LinkData *ld, *ldn=NULL;
+ bAction *waction;
+
+ /* firstly, wgroup needs to temporary dummy action that can be destroyed, as it shares copies */
+ waction = wgroup->adt->action = copy_action(wgroup->adt->action);
+
+ /* now perform the moving */
+ BKE_animdata_separate_by_basepath(&wgroup->id, &ntree->id, &anim_basepaths);
+
+ /* paths + their wrappers need to be freed */
+ for (ld = anim_basepaths.first; ld; ld = ld->next) {
+ ldn = ld->next;
+
+ MEM_freeN(ld->data);
+ BLI_freelinkN(&anim_basepaths, ld);
+ }
+
+ /* free temp action too */
+ free_libblock(&G.main->action, waction);
+ }
/* restore links to and from the gnode */
for(link= ntree->links.first; link; link= link->next) {
More information about the Bf-blender-cvs
mailing list