diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-11-01 10:49:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-01 10:49:38 +0100 |
commit | 9000b1a75dee10caf191a326ec47a91ce8c92cfd (patch) | |
tree | 8b90a7fd5f9793adb4b45daa386135c5cf3d835e | |
parent | 48a8ac506e65171463b84b58acbb30cb3b4cd4bc (diff) | |
parent | 2b71f528312f0f89b03d81d4c0de6644c613a083 (diff) |
Merge pull request #22938 from groud/open_spriteframes_on_animatedsprites_edit
Opens the SpriteFrames editor when editing an AnimatedSprite
-rw-r--r-- | editor/plugins/sprite_frames_editor_plugin.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 30246147c2..40781908fd 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -548,7 +548,6 @@ void SpriteFramesEditor::edit(SpriteFrames *p_frames) { } else { hide(); - //set_physics_process(false); } } @@ -816,16 +815,26 @@ SpriteFramesEditor::SpriteFramesEditor() { void SpriteFramesEditorPlugin::edit(Object *p_object) { frames_editor->set_undo_redo(&get_undo_redo()); - SpriteFrames *s = Object::cast_to<SpriteFrames>(p_object); - if (!s) - return; + + SpriteFrames *s; + 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); } bool SpriteFramesEditorPlugin::handles(Object *p_object) const { - return p_object->is_class("SpriteFrames"); + 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"); + } } void SpriteFramesEditorPlugin::make_visible(bool p_visible) { @@ -833,14 +842,11 @@ void SpriteFramesEditorPlugin::make_visible(bool p_visible) { if (p_visible) { button->show(); editor->make_bottom_panel_item_visible(frames_editor); - //frames_editor->set_process(true); } else { button->hide(); if (frames_editor->is_visible_in_tree()) editor->hide_bottom_panel(); - - //frames_editor->set_process(false); } } |