diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/sprite.cpp | 2 | ||||
-rw-r--r-- | scene/gui/patch_9_frame.cpp | 5 | ||||
-rw-r--r-- | scene/resources/style_box.cpp | 5 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 5 |
4 files changed, 17 insertions, 0 deletions
diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index 3e6384ea2c..27aa08ec5b 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -120,6 +120,7 @@ void Sprite::set_texture(const Ref<Texture>& p_texture) { } #endif update(); + emit_signal("texture_changed"); item_rect_changed(); } @@ -323,6 +324,7 @@ void Sprite::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_modulate"),&Sprite::get_modulate); ADD_SIGNAL(MethodInfo("frame_changed")); + ADD_SIGNAL(MethodInfo("texture_changed")); ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_texture"),_SCS("get_texture")); ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "centered"), _SCS("set_centered"),_SCS("is_centered")); diff --git a/scene/gui/patch_9_frame.cpp b/scene/gui/patch_9_frame.cpp index a6a3490ad2..9ad6398359 100644 --- a/scene/gui/patch_9_frame.cpp +++ b/scene/gui/patch_9_frame.cpp @@ -79,6 +79,8 @@ void Patch9Frame::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_draw_center","draw_center"), & Patch9Frame::set_draw_center ); ObjectTypeDB::bind_method(_MD("get_draw_center"), & Patch9Frame::get_draw_center ); + ADD_SIGNAL(MethodInfo("texture_changed")); + ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), _SCS("set_texture"),_SCS("get_texture") ); ADD_PROPERTYNO( PropertyInfo( Variant::COLOR, "modulate"), _SCS("set_modulate"),_SCS("get_modulate") ); ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "draw_center"), _SCS("set_draw_center"),_SCS("get_draw_center") ); @@ -93,11 +95,14 @@ void Patch9Frame::_bind_methods() { void Patch9Frame::set_texture(const Ref<Texture>& p_tex) { + if (texture==p_tex) + return; texture=p_tex; update(); //if (texture.is_valid()) // 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"); } Ref<Texture> Patch9Frame::get_texture() const { diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index a61ffe8e97..8580ffdc5a 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -104,7 +104,10 @@ StyleBox::StyleBox() { void StyleBoxTexture::set_texture(RES p_texture) { + if (texture==p_texture) + return; texture=p_texture; + emit_signal("texture_changed"); emit_changed(); } @@ -207,6 +210,8 @@ void StyleBoxTexture::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_draw_center","enable"),&StyleBoxTexture::set_draw_center); ObjectTypeDB::bind_method(_MD("get_draw_center"),&StyleBoxTexture::get_draw_center); + ADD_SIGNAL(MethodInfo("texture_changed")); + ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture" ), _SCS("set_texture"),_SCS("get_texture") ); ADD_PROPERTYNZ( PropertyInfo( Variant::RECT2, "region_rect"), _SCS("set_region_rect"),_SCS("get_region_rect")); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "margin/left", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_margin_size"),_SCS("get_margin_size"), MARGIN_LEFT ); diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 1893bfe524..2fa00c7da7 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -526,8 +526,11 @@ uint32_t AtlasTexture::get_flags() const{ void AtlasTexture::set_atlas(const Ref<Texture>& p_atlas){ + if (atlas==p_atlas) + return; atlas=p_atlas; emit_changed(); + emit_signal("atlas_changed"); } Ref<Texture> AtlasTexture::get_atlas() const{ @@ -569,6 +572,8 @@ void AtlasTexture::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_margin","margin"),&AtlasTexture::set_margin); ObjectTypeDB::bind_method(_MD("get_margin"),&AtlasTexture::get_margin); + ADD_SIGNAL(MethodInfo("atlas_changed")); + ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "atlas", PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_atlas"),_SCS("get_atlas") ); ADD_PROPERTY( PropertyInfo( Variant::RECT2, "region"), _SCS("set_region"),_SCS("get_region") ); ADD_PROPERTY( PropertyInfo( Variant::RECT2, "margin"), _SCS("set_margin"),_SCS("get_margin") ); |