summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scene/2d/animated_sprite.cpp2
-rw-r--r--scene/2d/sprite.cpp11
-rw-r--r--scene/2d/sprite.h2
-rw-r--r--scene/3d/sprite_3d.cpp11
-rw-r--r--scene/3d/sprite_3d.h2
-rw-r--r--tools/editor/editor_resource_preview.cpp2
-rw-r--r--tools/editor/editor_resource_preview.h2
-rw-r--r--tools/editor/property_editor.cpp4
8 files changed, 30 insertions, 6 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);
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 8c86c4bf35..74cab30b17 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -585,6 +585,17 @@ Rect2 Sprite3D::get_item_rect() const {
return Rect2(ofs,s);
}
+
+void Sprite3D::_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 Sprite3D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_texture","texture:Texture"),&Sprite3D::set_texture);
diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h
index 41e6ba804a..31f8ec020f 100644
--- a/scene/3d/sprite_3d.h
+++ b/scene/3d/sprite_3d.h
@@ -158,6 +158,8 @@ class Sprite3D : public SpriteBase3D {
protected:
virtual void _draw();
static void _bind_methods();
+
+ virtual void _validate_property(PropertyInfo& property) const;
public:
diff --git a/tools/editor/editor_resource_preview.cpp b/tools/editor/editor_resource_preview.cpp
index 18ce2bd7f4..6e38d6460b 100644
--- a/tools/editor/editor_resource_preview.cpp
+++ b/tools/editor/editor_resource_preview.cpp
@@ -336,7 +336,7 @@ void EditorResourcePreview::_bind_methods() {
ADD_SIGNAL(MethodInfo("preview_invalidated",PropertyInfo(Variant::STRING,"path")));
}
-bool EditorResourcePreview::check_for_invalidation(const String& p_path) {
+void EditorResourcePreview::check_for_invalidation(const String& p_path) {
preview_mutex->lock();
diff --git a/tools/editor/editor_resource_preview.h b/tools/editor/editor_resource_preview.h
index fed8f129ed..51a00965eb 100644
--- a/tools/editor/editor_resource_preview.h
+++ b/tools/editor/editor_resource_preview.h
@@ -121,7 +121,7 @@ public:
void queue_edited_resource_preview(const Ref<Resource>& p_path, Object* p_receiver, const StringName& p_receiver_func, const Variant& p_userdata);
void add_preview_generator(const Ref<EditorResourcePreviewGenerator>& p_generator);
- bool check_for_invalidation(const String& p_path);
+ void check_for_invalidation(const String& p_path);
EditorResourcePreview();
~EditorResourcePreview();
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index e0dc76e733..4b3f245e44 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -2981,10 +2981,8 @@ void PropertyEditor::update_tree() {
else
item->set_cell_mode( 1, TreeItem::CELL_MODE_RANGE_EXPRESSION );
- if (p.hint==PROPERTY_HINT_SPRITE_FRAME) {
- item->set_range_config(1,0,99999,1);
- } else if (p.hint==PROPERTY_HINT_RANGE || p.hint==PROPERTY_HINT_EXP_RANGE) {
+ if (p.hint==PROPERTY_HINT_SPRITE_FRAME || p.hint==PROPERTY_HINT_RANGE || p.hint==PROPERTY_HINT_EXP_RANGE) {
int c = p.hint_string.get_slice_count(",");
float min=0,max=100,step=1;