diff options
| author | Juan Linietsky <reduzio@gmail.com> | 2020-03-27 13:47:15 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-27 13:47:15 -0300 |
| commit | 307b1b3a5835ecdb477859785c673a07e248f904 (patch) | |
| tree | cc0123bc7111e48775331d500452875c278cc13b /editor/plugins/sprite_frames_editor_plugin.cpp | |
| parent | f48aeeeeefa73d4c6e58ee2934eaf16bc0408df0 (diff) | |
| parent | d1acbbce7f123c2b5fccdefc6417787dc91b6ced (diff) | |
Merge pull request #37340 from reduz/rename-3d-nodes
Make 2D and 3D node names more explicit
Diffstat (limited to 'editor/plugins/sprite_frames_editor_plugin.cpp')
| -rw-r--r-- | editor/plugins/sprite_frames_editor_plugin.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 776b80d73b..76e60bb014 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -485,7 +485,7 @@ static void _find_anim_sprites(Node *p_node, List<Node *> *r_nodes, Ref<SpriteFr return; { - AnimatedSprite *as = Object::cast_to<AnimatedSprite>(p_node); + AnimatedSprite2D *as = Object::cast_to<AnimatedSprite2D>(p_node); if (as && as->get_sprite_frames() == p_sfames) { r_nodes->push_back(p_node); } @@ -1068,11 +1068,17 @@ void SpriteFramesEditorPlugin::edit(Object *p_object) { frames_editor->set_undo_redo(&get_undo_redo()); SpriteFrames *s; - AnimatedSprite *animated_sprite = Object::cast_to<AnimatedSprite>(p_object); + AnimatedSprite2D *animated_sprite = Object::cast_to<AnimatedSprite2D>(p_object); if (animated_sprite) { s = *animated_sprite->get_sprite_frames(); } else { - s = Object::cast_to<SpriteFrames>(p_object); + AnimatedSprite3D *animated_sprite_3d = Object::cast_to<AnimatedSprite3D>(p_object); + if (animated_sprite_3d) { + s = *animated_sprite_3d->get_sprite_frames(); + } else { + + s = Object::cast_to<SpriteFrames>(p_object); + } } frames_editor->edit(s); @@ -1080,9 +1086,12 @@ void SpriteFramesEditorPlugin::edit(Object *p_object) { bool SpriteFramesEditorPlugin::handles(Object *p_object) const { - AnimatedSprite *animated_sprite = Object::cast_to<AnimatedSprite>(p_object); + AnimatedSprite2D *animated_sprite = Object::cast_to<AnimatedSprite2D>(p_object); + AnimatedSprite3D *animated_sprite_3d = Object::cast_to<AnimatedSprite3D>(p_object); if (animated_sprite && *animated_sprite->get_sprite_frames()) { return true; + } else if (animated_sprite_3d && *animated_sprite_3d->get_sprite_frames()) { + return true; } else { return p_object->is_class("SpriteFrames"); } |