aboutsummaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
authorAndreas Haas2016-10-11 11:31:25 +0200
committerRémi Verschelde2016-10-17 20:47:14 +0200
commit4b6809a2b3c66d7b8f5335210ce2ece80c6f2926 (patch)
treee4c59961e56b3341ab2f39989f4225f8f77208f0 /tools/editor
parent280728c0c7ce67280cd308019ad23c9d59b6bd56 (diff)
downloadgodot-4b6809a2b3c66d7b8f5335210ce2ece80c6f2926.tar.gz
godot-4b6809a2b3c66d7b8f5335210ce2ece80c6f2926.tar.zst
godot-4b6809a2b3c66d7b8f5335210ce2ece80c6f2926.zip
Refresh TextureRegionEditor when region has been changed externally.
Now the TextureRegionEditor updates when you change the region_rect either via the inspector or via undo/redo. Fixes #6772 (cherry picked from commit 094073e4b22344c4b969d55850c7927e569bfd43)
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/plugins/texture_region_editor_plugin.cpp7
-rw-r--r--tools/editor/plugins/texture_region_editor_plugin.h2
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 43086fb20..6b918e6e8 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 3658a38f1..f0bb7c9bc 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();