diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2016-10-11 16:29:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-11 16:29:40 +0200 |
commit | 12843167cacf3bacca32c29b7ea8b4426392bad0 (patch) | |
tree | b9c3e968e5c22f0e8dddc78ae8f0baeb89d64227 /tools/editor/plugins | |
parent | 13bf9b6973aa7620e90a3d17f728fcf34094ba9e (diff) | |
parent | 094073e4b22344c4b969d55850c7927e569bfd43 (diff) |
Merge pull request #6788 from Hinsbart/region_refresh
Refresh TextureRegionEditor when region has been changed externally.
Diffstat (limited to 'tools/editor/plugins')
-rw-r--r-- | tools/editor/plugins/texture_region_editor_plugin.cpp | 7 | ||||
-rw-r--r-- | tools/editor/plugins/texture_region_editor_plugin.h | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp index 43086fb208..6b918e6e8f 100644 --- a/tools/editor/plugins/texture_region_editor_plugin.cpp +++ b/tools/editor/plugins/texture_region_editor_plugin.cpp @@ -653,6 +653,7 @@ void TextureRegionEditor::edit(Object *p_obj) } else { p_obj->connect("texture_changed",this,"_edit_region"); } + p_obj->add_change_receptor(this); p_obj->connect("exit_tree",this,"_node_removed",varray(p_obj),CONNECT_ONESHOT); _edit_region(); } else { @@ -673,6 +674,12 @@ void TextureRegionEditor::edit(Object *p_obj) edit_draw->update(); } +void TextureRegionEditor::_changed_callback(Object *p_changed, const char *p_prop) { + if ((String)p_prop == "region_rect") { + _edit_region(); + } +} + void TextureRegionEditor::_edit_region() { Ref<Texture> texture = NULL; diff --git a/tools/editor/plugins/texture_region_editor_plugin.h b/tools/editor/plugins/texture_region_editor_plugin.h index 3658a38f11..f0bb7c9bc2 100644 --- a/tools/editor/plugins/texture_region_editor_plugin.h +++ b/tools/editor/plugins/texture_region_editor_plugin.h @@ -116,6 +116,8 @@ protected: Vector2 snap_point(Vector2 p_target) const; + virtual void _changed_callback(Object *p_changed, const char *p_prop); + public: void _edit_region(); |