[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50551] trunk/blender/source/blender/ editors: fix [#31019] [Minor] Freshly added nodes aren't getting undo push
Campbell Barton
ideasman42 at gmail.com
Wed Sep 12 13:09:28 CEST 2012
Revision: 50551
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50551
Author: campbellbarton
Date: 2012-09-12 11:09:27 +0000 (Wed, 12 Sep 2012)
Log Message:
-----------
fix [#31019] [Minor] Freshly added nodes aren't getting undo push
also noticed ED_undo_push was checking USER_GLOBALUNDO unnecessarily
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_node/node_header.c
trunk/blender/source/blender/editors/util/undo.c
Modified: trunk/blender/source/blender/editors/space_node/node_header.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_header.c 2012-09-12 10:54:25 UTC (rev 50550)
+++ trunk/blender/source/blender/editors/space_node/node_header.c 2012-09-12 11:09:27 UTC (rev 50551)
@@ -41,6 +41,7 @@
#include "BLF_translation.h"
+#include "BKE_blender.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -64,7 +65,7 @@
SpaceNode *snode = CTX_wm_space_node(C);
ScrArea *sa = CTX_wm_area(C);
ARegion *ar;
- bNode *node;
+ bNode *node, *node_new;
/* get location to add node at mouse */
for (ar = sa->regionbase.first; ar; ar = ar->next) {
@@ -84,7 +85,7 @@
else node->flag &= ~NODE_TEST;
}
- /* node= */ node_add_node(snode, bmain, scene, ntemp, snode->cursor[0], snode->cursor[1]);
+ node_new = node_add_node(snode, bmain, scene, ntemp, snode->cursor[0], snode->cursor[1]);
/* select previous selection before autoconnect */
for (node = snode->edittree->nodes.first; node; node = node->next) {
@@ -95,7 +96,14 @@
for (node = snode->edittree->nodes.first; node; node = node->next) {
if (node->flag & NODE_TEST) node->flag &= ~NODE_SELECT;
}
-
+
+ /* once this is called from an operator, this should be removed */
+ if (node_new) {
+ char undostr[BKE_UNDO_STR_MAX];
+ BLI_snprintf(undostr, sizeof(BKE_UNDO_STR_MAX), "Add Node %s", nodeLabel(node_new));
+ BKE_write_undo(C, undostr);
+ }
+
snode_notify(C, snode);
snode_dag_update(C, snode);
}
Modified: trunk/blender/source/blender/editors/util/undo.c
===================================================================
--- trunk/blender/source/blender/editors/util/undo.c 2012-09-12 10:54:25 UTC (rev 50550)
+++ trunk/blender/source/blender/editors/util/undo.c 2012-09-12 11:09:27 UTC (rev 50551)
@@ -107,8 +107,7 @@
PE_undo_push(CTX_data_scene(C), str);
}
else {
- if (U.uiflag & USER_GLOBALUNDO)
- BKE_write_undo(C, str);
+ BKE_write_undo(C, str);
}
if (wm->file_saved) {
More information about the Bf-blender-cvs
mailing list