diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-08-02 12:29:37 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-08-02 12:30:01 -0300 |
commit | 59961c99144523d7cc2881a4abe6d0a319a975df (patch) | |
tree | 556cd9053433a27bbbc34dfe0a3e9fe693957299 /core/undo_redo.cpp | |
parent | 922356b903061cda7591090bf19e8346c3a78cf5 (diff) | |
download | redot-engine-59961c99144523d7cc2881a4abe6d0a319a975df.tar.gz |
Live edit WORK IN PROGRESS
1) press the heart while the game is running
2) select a scene to live edit from the opened scenes
3) edit/add/remove nodes or resources, change their properties, etc.
4) watch changes reflected in running game, in all places this scene is
edited
5) It's not perfect obviously, but the aim of it is to try to reflect
your changes as best as possible in the running game.
Diffstat (limited to 'core/undo_redo.cpp')
-rw-r--r-- | core/undo_redo.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp index f565070216..85cc2bbc7f 100644 --- a/core/undo_redo.cpp +++ b/core/undo_redo.cpp @@ -244,7 +244,12 @@ void UndoRedo::_process_operation_list(List<Operation>::Element *E) { Resource* res = obj->cast_to<Resource>(); if (res) res->set_edited(true); + #endif + + if (method_callback) { + method_callback(method_callbck_ud,obj,op.name,VARIANT_ARGS_FROM_ARRAY(op.args)); + } } break; case Operation::TYPE_PROPERTY: { @@ -254,6 +259,9 @@ void UndoRedo::_process_operation_list(List<Operation>::Element *E) { if (res) res->set_edited(true); #endif + if (property_callback) { + property_callback(prop_callback_ud,obj,op.name,op.args[0]); + } } break; case Operation::TYPE_REFERENCE: { //do nothing @@ -325,6 +333,19 @@ void UndoRedo::set_commit_notify_callback(CommitNotifyCallback p_callback,void* callback_ud=p_ud; } +void UndoRedo::set_method_notify_callback(MethodNotifyCallback p_method_callback,void* p_ud) { + + method_callback=p_method_callback; + method_callbck_ud=p_ud; +} + +void UndoRedo::set_property_notify_callback(PropertyNotifyCallback p_property_callback,void* p_ud){ + + property_callback=p_property_callback; + prop_callback_ud=p_ud; +} + + UndoRedo::UndoRedo() { version=1; @@ -334,6 +355,12 @@ UndoRedo::UndoRedo() { merging=true; callback=NULL; callback_ud=NULL; + + method_callbck_ud=NULL; + prop_callback_ud=NULL; + method_callback=NULL; + property_callback=NULL; + } UndoRedo::~UndoRedo() { |