[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54354] trunk/blender/source/blender/ editors/space_node/node_group.c: Fix #34115, Group Node corrupted by frames .
Lukas Toenne
lukas.toenne at googlemail.com
Wed Feb 6 14:59:54 CET 2013
Revision: 54354
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54354
Author: lukastoenne
Date: 2013-02-06 13:59:54 +0000 (Wed, 06 Feb 2013)
Log Message:
-----------
Fix #34115, Group Node corrupted by frames.
The group node operators offset nodes when moving them between node trees, but this should only be done for "free", un-parented nodes not attached to a frame, otherwise the node loc is relative to the parent node.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_node/node_group.c
Modified: trunk/blender/source/blender/editors/space_node/node_group.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_group.c 2013-02-06 13:14:11 UTC (rev 54353)
+++ trunk/blender/source/blender/editors/space_node/node_group.c 2013-02-06 13:59:54 UTC (rev 54354)
@@ -457,8 +457,10 @@
/* ensure unique node name in the nodee tree */
nodeUniqueName(ntree, node);
- node->locx += gnode->locx;
- node->locy += gnode->locy;
+ if (!node->parent) {
+ node->locx += gnode->locx;
+ node->locy += gnode->locy;
+ }
node->flag |= NODE_SELECT;
}
@@ -673,8 +675,10 @@
/* ensure unique node name in the node tree */
nodeUniqueName(ntree, newnode);
- newnode->locx += gnode->locx;
- newnode->locy += gnode->locy;
+ if (!newnode->parent) {
+ newnode->locx += gnode->locx;
+ newnode->locy += gnode->locy;
+ }
}
else {
/* ensure valid parent pointers, detach if child stays inside the group */
@@ -865,12 +869,14 @@
static void node_get_selected_minmax(bNodeTree *ntree, bNode *gnode, float *min, float *max)
{
bNode *node;
+ float loc[2];
INIT_MINMAX2(min, max);
for (node = ntree->nodes.first; node; node = node->next) {
if (node == gnode)
continue;
if (node->flag & NODE_SELECT) {
- minmax_v2v2_v2(min, max, &node->locx);
+ nodeToView(node, 0.0f, 0.0f, &loc[0], &loc[1]);
+ minmax_v2v2_v2(min, max, loc);
}
}
}
@@ -921,8 +927,10 @@
/* ensure unique node name in the ngroup */
nodeUniqueName(ngroup, node);
- node->locx -= 0.5f * (min[0] + max[0]);
- node->locy -= 0.5f * (min[1] + max[1]);
+ if (!node->parent) {
+ node->locx -= 0.5f * (min[0] + max[0]);
+ node->locy -= 0.5f * (min[1] + max[1]);
+ }
}
else {
/* if the parent is to be inserted but not the child, detach properly */
More information about the Bf-blender-cvs
mailing list