Fixed a bunch of connection errors in TextureEditorPlugin
This commit is contained in:
parent
fe7559f751
commit
19afaa0203
11 changed files with 29 additions and 18 deletions
|
@ -39,6 +39,11 @@
|
|||
Emitted when the [member frame] changes.
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="texture_changed">
|
||||
<description>
|
||||
Emitted when the [member texture] changes.
|
||||
</description>
|
||||
</signal>
|
||||
</signals>
|
||||
<constants>
|
||||
</constants>
|
||||
|
|
|
@ -127,13 +127,6 @@
|
|||
The texture to use when drawing this style box.
|
||||
</member>
|
||||
</members>
|
||||
<signals>
|
||||
<signal name="texture_changed">
|
||||
<description>
|
||||
Emitted when the stylebox's texture is changed.
|
||||
</description>
|
||||
</signal>
|
||||
</signals>
|
||||
<constants>
|
||||
<constant name="AXIS_STRETCH_MODE_STRETCH" value="0" enum="AxisStretchMode">
|
||||
Stretch the stylebox's texture. This results in visible distortion unless the texture size matches the stylebox's size perfectly.
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
_edit_region();
|
||||
} else {
|
||||
node_sprite = nullptr;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
/*************************************************************************/
|
||||
|
||||
#include "mesh_instance_2d.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
void MeshInstance2D::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_DRAW) {
|
||||
|
@ -70,7 +71,7 @@ void MeshInstance2D::set_texture(const Ref<Texture2D> &p_texture) {
|
|||
}
|
||||
texture = p_texture;
|
||||
update();
|
||||
emit_signal("texture_changed");
|
||||
emit_signal(SceneStringNames::get_singleton()->texture_changed);
|
||||
}
|
||||
|
||||
void MeshInstance2D::set_normal_map(const Ref<Texture2D> &p_texture) {
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
/*************************************************************************/
|
||||
|
||||
#include "multimesh_instance_2d.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
void MultiMeshInstance2D::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_DRAW) {
|
||||
|
@ -70,7 +71,7 @@ void MultiMeshInstance2D::set_texture(const Ref<Texture2D> &p_texture) {
|
|||
}
|
||||
texture = p_texture;
|
||||
update();
|
||||
emit_signal("texture_changed");
|
||||
emit_signal(SceneStringNames::get_singleton()->texture_changed);
|
||||
}
|
||||
|
||||
Ref<Texture2D> MultiMeshInstance2D::get_texture() const {
|
||||
|
|
|
@ -153,7 +153,7 @@ void Sprite2D::set_texture(const Ref<Texture2D> &p_texture) {
|
|||
}
|
||||
|
||||
update();
|
||||
emit_signal("texture_changed");
|
||||
emit_signal(SceneStringNames::get_singleton()->texture_changed);
|
||||
item_rect_changed();
|
||||
}
|
||||
|
||||
|
|
|
@ -505,6 +505,7 @@ void Sprite3D::set_texture(const Ref<Texture2D> &p_texture) {
|
|||
texture->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Sprite3D::_texture_changed));
|
||||
}
|
||||
_queue_update();
|
||||
emit_signal(SceneStringNames::get_singleton()->texture_changed);
|
||||
}
|
||||
|
||||
Ref<Texture2D> Sprite3D::get_texture() const {
|
||||
|
@ -663,6 +664,7 @@ void Sprite3D::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::RECT2, "region_rect"), "set_region_rect", "get_region_rect");
|
||||
|
||||
ADD_SIGNAL(MethodInfo("frame_changed"));
|
||||
ADD_SIGNAL(MethodInfo("texture_changed"));
|
||||
}
|
||||
|
||||
Sprite3D::Sprite3D() {
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "nine_patch_rect.h"
|
||||
|
||||
#include "scene/scene_string_names.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
void NinePatchRect::_notification(int p_what) {
|
||||
|
@ -97,7 +98,7 @@ void NinePatchRect::set_texture(const Ref<Texture2D> &p_tex) {
|
|||
texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites
|
||||
*/
|
||||
minimum_size_changed();
|
||||
emit_signal("texture_changed");
|
||||
emit_signal(SceneStringNames::get_singleton()->texture_changed);
|
||||
}
|
||||
|
||||
Ref<Texture2D> NinePatchRect::get_texture() const {
|
||||
|
|
|
@ -121,7 +121,6 @@ void StyleBoxTexture::set_texture(Ref<Texture2D> p_texture) {
|
|||
} else {
|
||||
region_rect = Rect2(Point2(), texture->get_size());
|
||||
}
|
||||
emit_signal("texture_changed");
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
|
@ -285,8 +284,6 @@ void StyleBoxTexture::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_v_axis_stretch_mode", "mode"), &StyleBoxTexture::set_v_axis_stretch_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_v_axis_stretch_mode"), &StyleBoxTexture::get_v_axis_stretch_mode);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("texture_changed"));
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::RECT2, "region_rect"), "set_region_rect", "get_region_rect");
|
||||
ADD_GROUP("Margin", "margin_");
|
||||
|
|
|
@ -175,6 +175,7 @@ SceneStringNames::SceneStringNames() {
|
|||
_toggled = StaticCString::create("_toggled");
|
||||
|
||||
frame_changed = StaticCString::create("frame_changed");
|
||||
texture_changed = StaticCString::create("texture_changed");
|
||||
|
||||
playback_speed = StaticCString::create("playback/speed");
|
||||
playback_active = StaticCString::create("playback/active");
|
||||
|
|
|
@ -184,6 +184,7 @@ public:
|
|||
StringName _mouse_exit;
|
||||
|
||||
StringName frame_changed;
|
||||
StringName texture_changed;
|
||||
|
||||
StringName playback_speed;
|
||||
StringName playback_active;
|
||||
|
|
Loading…
Reference in a new issue