You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-23 15:16:17 +00:00
Opens the SpriteFrames editor when editing an AnimatedSprite
This commit is contained in:
@@ -548,7 +548,6 @@ void SpriteFramesEditor::edit(SpriteFrames *p_frames) {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
hide();
|
hide();
|
||||||
//set_physics_process(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -816,31 +815,38 @@ SpriteFramesEditor::SpriteFramesEditor() {
|
|||||||
void SpriteFramesEditorPlugin::edit(Object *p_object) {
|
void SpriteFramesEditorPlugin::edit(Object *p_object) {
|
||||||
|
|
||||||
frames_editor->set_undo_redo(&get_undo_redo());
|
frames_editor->set_undo_redo(&get_undo_redo());
|
||||||
SpriteFrames *s = Object::cast_to<SpriteFrames>(p_object);
|
|
||||||
if (!s)
|
SpriteFrames *s;
|
||||||
return;
|
AnimatedSprite *animated_sprite = Object::cast_to<AnimatedSprite>(p_object);
|
||||||
|
if (animated_sprite) {
|
||||||
|
s = *animated_sprite->get_sprite_frames();
|
||||||
|
} else {
|
||||||
|
s = Object::cast_to<SpriteFrames>(p_object);
|
||||||
|
}
|
||||||
|
|
||||||
frames_editor->edit(s);
|
frames_editor->edit(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpriteFramesEditorPlugin::handles(Object *p_object) const {
|
bool SpriteFramesEditorPlugin::handles(Object *p_object) const {
|
||||||
|
|
||||||
|
AnimatedSprite *animated_sprite = Object::cast_to<AnimatedSprite>(p_object);
|
||||||
|
if (animated_sprite && *animated_sprite->get_sprite_frames()) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
return p_object->is_class("SpriteFrames");
|
return p_object->is_class("SpriteFrames");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SpriteFramesEditorPlugin::make_visible(bool p_visible) {
|
void SpriteFramesEditorPlugin::make_visible(bool p_visible) {
|
||||||
|
|
||||||
if (p_visible) {
|
if (p_visible) {
|
||||||
button->show();
|
button->show();
|
||||||
editor->make_bottom_panel_item_visible(frames_editor);
|
editor->make_bottom_panel_item_visible(frames_editor);
|
||||||
//frames_editor->set_process(true);
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
button->hide();
|
button->hide();
|
||||||
if (frames_editor->is_visible_in_tree())
|
if (frames_editor->is_visible_in_tree())
|
||||||
editor->hide_bottom_panel();
|
editor->hide_bottom_panel();
|
||||||
|
|
||||||
//frames_editor->set_process(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user