summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-07-06 23:46:04 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-07-06 23:46:04 -0300
commit7c1ab42571d5291952e329554643142a30dee1d1 (patch)
treec496f23203877c6cfe99a809e97da74505fad7fa /scene/2d
parent17e4ead62a949e2a1568574228a157ea4b403d30 (diff)
Fix the +1 button to insert keyframes in Sprite and Sprite3D, closes #5422
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/animated_sprite.cpp2
-rw-r--r--scene/2d/sprite.cpp11
-rw-r--r--scene/2d/sprite.h2
3 files changed, 14 insertions, 1 deletions
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp
index c062a6d1fc..73774e12d9 100644
--- a/scene/2d/animated_sprite.cpp
+++ b/scene/2d/animated_sprite.cpp
@@ -318,7 +318,7 @@ void AnimatedSprite::_validate_property(PropertyInfo& property) const {
if (property.name=="frame") {
- property.hint=PROPERTY_HINT_RANGE;
+ property.hint=PROPERTY_HINT_SPRITE_FRAME;
if (frames->has_animation(animation)) {
property.hint_string="0,"+itos(frames->get_frame_count(animation)-1)+",1";
diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp
index 27aa08ec5b..c5b338bf59 100644
--- a/scene/2d/sprite.cpp
+++ b/scene/2d/sprite.cpp
@@ -288,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);
diff --git a/scene/2d/sprite.h b/scene/2d/sprite.h
index f789538b1d..32d3f476d1 100644
--- a/scene/2d/sprite.h
+++ b/scene/2d/sprite.h
@@ -61,6 +61,8 @@ protected:
static void _bind_methods();;
+ virtual void _validate_property(PropertyInfo& property) const;
+
public:
virtual void edit_set_pivot(const Point2& p_pivot);