Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2010-12-29 14:51:53 +0300
committerJoshua Leung <aligorith@gmail.com>2010-12-29 14:51:53 +0300
commit92172b779e28fdd9321dd298bd14a3c93371bcbe (patch)
tree293da69f1cffcd75af683c0510a2d4ce704e04d3 /source/blender/blenkernel/intern/node.c
parentc802e21dbb150ea7022b329e11e41335e13e5550 (diff)
Bugfix [#24163] Unable to animate INSIDE a group node in the
compositor This commit fixes the original bug reported here by adding some methods to move the relevant F-Curves (and drivers) over to the new Node-Tree's (i.e. group-node) AnimData. Animated nodes which subsequently get grouped will still be able to animate as a result of this commit. TODO's: - Ungrouping now will not yet merge the animation back (or at least copy it) - Buttons for nodes freshly grouped do not correctly show animated status indicators for some reason, yet normal animation does
Diffstat (limited to 'source/blender/blenkernel/intern/node.c')
-rw-r--r--source/blender/blenkernel/intern/node.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 0513593a0e0..f85def22566 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -36,11 +36,13 @@
#include <string.h>
#include "DNA_anim_types.h"
+#include "DNA_action_types.h"
#include "RNA_access.h"
+#include "BKE_animsys.h"
+#include "BKE_action.h"
#include "BKE_fcurve.h"
-#include "BKE_animsys.h" /* BKE_free_animdata only */
#include "PIL_time.h"
@@ -460,6 +462,7 @@ bNode *nodeMakeGroupFromSelected(bNodeTree *ntree)
bNode *node, *gnode, *nextn;
bNodeSocket *sock;
bNodeTree *ngroup;
+ ListBase anim_basepaths = {NULL, NULL};
float min[2], max[2];
int totnode=0;
@@ -502,11 +505,27 @@ bNode *nodeMakeGroupFromSelected(bNodeTree *ntree)
for(node= ntree->nodes.first; node; node= nextn) {
nextn= node->next;
if(node->flag & NODE_SELECT) {
+ /* 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 (ntree->adt) {
+ PointerRNA ptr;
+ char *path;
+
+ RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr);
+ path = RNA_path_from_ID_to_struct(&ptr);
+
+ if (path)
+ BLI_addtail(&anim_basepaths, BLI_genericNodeN(path));
+ }
+
+ /* change node-collection membership */
BLI_remlink(&ntree->nodes, node);
BLI_addtail(&ngroup->nodes, node);
+
node->locx-= 0.5f*(min[0]+max[0]);
node->locy-= 0.5f*(min[1]+max[1]);
-
+
/* set socket own_index to zero since it can still have a value
* from being in a group before, otherwise it doesn't get a unique
* index in group_verify_own_indices */
@@ -526,6 +545,21 @@ bNode *nodeMakeGroupFromSelected(bNodeTree *ntree)
}
}
+ /* move animation data over */
+ if (ntree->adt) {
+ LinkData *ld, *ldn=NULL;
+
+ BKE_animdata_separate_by_basepath(&ntree->id, &ngroup->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);
+ }
+ }
+
/* now we can make own group typeinfo */
ntreeMakeOwnType(ngroup);