forked from bartvdbraak/blender
fix [#31019] [Minor] Freshly added nodes aren't getting undo push
also noticed ED_undo_push was checking USER_GLOBALUNDO unnecessarily
This commit is contained in:
parent
d86f1f67fd
commit
db1191d451
@ -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 @@ static void do_node_add(bContext *C, bNodeTemplate *ntemp)
|
||||
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 @@ static void do_node_add(bContext *C, bNodeTemplate *ntemp)
|
||||
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 @@ static void do_node_add(bContext *C, bNodeTemplate *ntemp)
|
||||
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);
|
||||
}
|
||||
|
@ -107,8 +107,7 @@ void ED_undo_push(bContext *C, const char *str)
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user