summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp9
-rw-r--r--editor/plugins/tile_set_editor_plugin.h1
-rw-r--r--scene/resources/tile_set.cpp3
3 files changed, 12 insertions, 1 deletions
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 08679b781a..612bdb1d2a 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -583,6 +583,14 @@ void AutotileEditor::_notification(int p_what) {
}
}
+void AutotileEditor::_changed_callback(Object *p_changed, const char *p_prop) {
+ if (p_prop == StringName("texture") || p_prop == StringName("is_autotile")) {
+ edit(tile_set.ptr());
+ autotile_list->update();
+ workspace->update();
+ }
+}
+
void AutotileEditor::_on_autotile_selected(int p_index) {
if (get_current_tile() >= 0) {
@@ -1581,6 +1589,7 @@ Vector2 AutotileEditor::snap_point(const Vector2 &point) {
void AutotileEditor::edit(Object *p_node) {
tile_set = Ref<TileSet>(Object::cast_to<TileSet>(p_node));
+ tile_set->add_change_receptor(this);
helper->set_tileset(tile_set);
autotile_list->clear();
diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h
index 9bd3e23181..93d403deea 100644
--- a/editor/plugins/tile_set_editor_plugin.h
+++ b/editor/plugins/tile_set_editor_plugin.h
@@ -124,6 +124,7 @@ class AutotileEditor : public Control {
protected:
static void _bind_methods();
void _notification(int p_what);
+ virtual void _changed_callback(Object *p_changed, const char *p_prop);
private:
void _on_autotile_selected(int p_index);
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 710612d5f4..4d200f5548 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -309,6 +309,7 @@ void TileSet::tile_set_texture(int p_id, const Ref<Texture> &p_texture) {
ERR_FAIL_COND(!tile_map.has(p_id));
tile_map[p_id].texture = p_texture;
emit_changed();
+ _change_notify("texture");
}
Ref<Texture> TileSet::tile_get_texture(int p_id) const {
@@ -386,8 +387,8 @@ void TileSet::tile_set_is_autotile(int p_id, bool p_is_autotile) {
ERR_FAIL_COND(!tile_map.has(p_id));
tile_map[p_id].is_autotile = p_is_autotile;
- _change_notify("");
emit_changed();
+ _change_notify("is_autotile");
}
bool TileSet::tile_get_is_autotile(int p_id) const {