Fix the +1 button to insert keyframes in Sprite and Sprite3D, closes #5422
This commit is contained in:
parent
17e4ead62a
commit
7c1ab42571
8 changed files with 30 additions and 6 deletions
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -158,6 +158,8 @@ class Sprite3D : public SpriteBase3D {
|
|||
protected:
|
||||
virtual void _draw();
|
||||
static void _bind_methods();
|
||||
|
||||
virtual void _validate_property(PropertyInfo& property) const;
|
||||
public:
|
||||
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue