summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-06-13 14:44:50 +0200
committerGitHub <noreply@github.com>2021-06-13 14:44:50 +0200
commitef7974f3d9d51865aac83bfdd2876f39061b87fa (patch)
treefe701efa270126f1598db6198f3d0f85ee76cf50 /editor
parentaa51911c690141846f0c54c7e6c23d29cd884e8f (diff)
parent19afaa0203fbe5638b9be35f7e43bdba3b8a3641 (diff)
Merge pull request #49526 from Chaosus/fix_textureregion_errors
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 9526160674..686ff0f9ef 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -863,13 +863,13 @@ Sprite2D *TextureRegionEditor::get_sprite() {
void TextureRegionEditor::edit(Object *p_obj) {
if (node_sprite) {
- node_sprite->disconnect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
+ node_sprite->disconnect("texture_changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
}
if (node_sprite_3d) {
- node_sprite_3d->disconnect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
+ node_sprite_3d->disconnect("texture_changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
}
if (node_ninepatch) {
- node_ninepatch->disconnect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
+ node_ninepatch->disconnect("texture_changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
}
if (obj_styleBox.is_valid()) {
obj_styleBox->disconnect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
@@ -881,13 +881,22 @@ void TextureRegionEditor::edit(Object *p_obj) {
node_sprite = Object::cast_to<Sprite2D>(p_obj);
node_sprite_3d = Object::cast_to<Sprite3D>(p_obj);
node_ninepatch = Object::cast_to<NinePatchRect>(p_obj);
+
+ bool is_resource = false;
if (Object::cast_to<StyleBoxTexture>(p_obj)) {
obj_styleBox = Ref<StyleBoxTexture>(Object::cast_to<StyleBoxTexture>(p_obj));
+ is_resource = true;
}
if (Object::cast_to<AtlasTexture>(p_obj)) {
atlas_tex = Ref<AtlasTexture>(Object::cast_to<AtlasTexture>(p_obj));
+ is_resource = true;
+ }
+
+ if (is_resource) {
+ p_obj->connect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
+ } else {
+ p_obj->connect("texture_changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
}
- p_obj->connect("changed", callable_mp(this, &TextureRegionEditor::_texture_changed));
_edit_region();
} else {
node_sprite = nullptr;