diff --git a/scripts/event_recorder/event_recorder.gml b/scripts/event_recorder/event_recorder.gml index f3b3a8037..9e2439dee 100644 --- a/scripts/event_recorder/event_recorder.gml +++ b/scripts/event_recorder/event_recorder.gml @@ -43,7 +43,7 @@ function Action(_type, _object, _data, _trigger = 0) constructor { clear_action = noone; - static undo = function() { #region + static undo = function() { var _n; switch(type) { @@ -85,8 +85,10 @@ function Action(_type, _object, _data, _trigger = 0) constructor { break; case ACTION_TYPE.junction_connect : + if(obj.is_dummy) { data[0].setFrom(noone); + if(obj.dummy_undo != -1) obj.dummy_undo(data[0]); } else { var _d = obj.value_from; obj.setFrom(data); @@ -154,9 +156,9 @@ function Action(_type, _object, _data, _trigger = 0) constructor { } if(trigger) trigger(); - } #endregion + } - static redo = function() { #region + static redo = function() { var _n; switch(type) { case ACTION_TYPE.var_modify : @@ -199,6 +201,7 @@ function Action(_type, _object, _data, _trigger = 0) constructor { if(obj.is_dummy) { obj.setFrom(data[1]); data[0] = obj.dummy_target; + if(obj.dummy_redo != -1) obj.dummy_redo(data[0]); } else { var _d = obj.value_from; obj.setFrom(data); @@ -244,9 +247,9 @@ function Action(_type, _object, _data, _trigger = 0) constructor { } if(trigger) trigger(); - } #endregion + } - static toString = function() { #region + static toString = function() { var ss = ""; switch(type) { case ACTION_TYPE.var_modify : @@ -316,15 +319,15 @@ function Action(_type, _object, _data, _trigger = 0) constructor { break; } return ss; - } #endregion + } - static destroy = function() { #region + static destroy = function() { if(clear_action == noone) return; clear_action(data); - } #endregion + } } -function recordAction(_type, _object, _data = -1, _trigger = 0) { #region +function recordAction(_type, _object, _data = -1, _trigger = 0) { if(IS_UNDOING) return noone; if(LOADING) return noone; if(UNDO_HOLDING) return noone; @@ -340,7 +343,7 @@ function recordAction(_type, _object, _data = -1, _trigger = 0) { #region PANEL_MENU.undoUpdate(); return act; -} #endregion +} function recordAction_variable_change(object, variable_name, variable_old_value, undo_label = "", _trigger = 0) { INLINE @@ -349,7 +352,7 @@ function recordAction_variable_change(object, variable_name, variable_old_value, ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function mergeAction(act) { #region +function mergeAction(act) { if(ds_stack_empty(UNDO_STACK)) { ds_stack_push(UNDO_STACK, [ act ]); PANEL_MENU.undoUpdate(); @@ -359,9 +362,9 @@ function mergeAction(act) { #region var _top = ds_stack_pop(UNDO_STACK); array_push(_top, act); ds_stack_push(UNDO_STACK, _top); -} #endregion +} -function UNDO() { #region +function UNDO() { CALL("undo"); if(ds_stack_empty(UNDO_STACK)) return; @@ -376,9 +379,9 @@ function UNDO() { #region ds_stack_push(REDO_STACK, actions); PANEL_MENU.undoUpdate(); -} #endregion +} -function REDO() { #region +function REDO() { CALL("redo"); if(ds_stack_empty(REDO_STACK)) return; @@ -393,4 +396,4 @@ function REDO() { #region ds_stack_push(UNDO_STACK, actions); PANEL_MENU.undoUpdate(); -} #endregion \ No newline at end of file +} \ No newline at end of file diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index da9365db9..afd61fa1d 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -198,7 +198,11 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc draw_dummy = false; input_dummy = nodeValue("Add to group", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0); - input_dummy.is_dummy = true; + + input_dummy.setDummy(function() /*=>*/ { var input = nodeBuild("Node_Group_Input", 0, 0, self); return input.inParent; }, + function(_junc) /*=>*/ { _junc.from.destroy() } + ); + input_dummy.onSetFrom = function(juncFrom) { array_remove(juncFrom.value_to, input_dummy); input_dummy.value_from = noone; diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 159361da5..f0c1803c9 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -388,7 +388,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { if(auto_input) { dummy_input = nodeValue("Add value", self, JUNCTION_CONNECT.input, dummy_type, 0) - .setDummy(function() { return createNewInput(); }) + .setDummy(function() /*=>*/ {return createNewInput()}) .setVisible(false, true); } diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 2b4d25baf..884ea271d 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -59,8 +59,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru tags = VALUE_TAG.none; - is_dummy = false; - dummy_get = noone; + is_dummy = false; + dummy_get = noone; + dummy_undo = -1; + dummy_redo = -1; #endregion #region ---- connection ---- @@ -235,10 +237,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru /////============= META ============= - static setDummy = function(get_node) { #region + static setDummy = function(get_node, _dummy_undo = -1, _dummy_redo = -1) { #region is_dummy = true; dummy_get = get_node; + dummy_undo = _dummy_undo; + dummy_redo = _dummy_redo; + return self; } #endregion