diff options
Diffstat (limited to 'scene/2d/sprite.cpp')
-rw-r--r-- | scene/2d/sprite.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index 3e6384ea2c..c5b338bf59 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(); } @@ -287,6 +288,17 @@ Rect2 Sprite::get_item_rect() const { } + +void Sprite::_validate_property(PropertyInfo& property) const { + + if (property.name=="frame") { + + property.hint=PROPERTY_HINT_SPRITE_FRAME; + + property.hint_string="0,"+itos(vframes*hframes-1)+",1"; + } +} + void Sprite::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_texture","texture:Texture"),&Sprite::set_texture); @@ -323,6 +335,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")); |