Skip to content

Commit

Permalink
Merge pull request #90815 from KoBeWi/2_objects_1_editor
Browse files Browse the repository at this point in the history
Avoid double editing when clicking AnimatedSprite
  • Loading branch information
akien-mga committed Apr 18, 2024
2 parents 2d884ba + e36301e commit f6ba06a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion editor/plugins/sprite_frames_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,10 @@ void SpriteFramesEditor::edit(Ref<SpriteFrames> p_frames) {
_fetch_sprite_node(); // Fetch node after set frames.
}

bool SpriteFramesEditor::is_editing() const {
return frames.is_valid();
}

Variant SpriteFramesEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
if (read_only) {
return false;
Expand Down Expand Up @@ -2325,7 +2329,7 @@ bool SpriteFramesEditorPlugin::handles(Object *p_object) const {
if (animated_sprite_3d && *animated_sprite_3d->get_sprite_frames()) {
return true;
}
return p_object->is_class("SpriteFrames");
return !frames_editor->is_editing() && Object::cast_to<SpriteFrames>(p_object);
}

void SpriteFramesEditorPlugin::make_visible(bool p_visible) {
Expand Down
3 changes: 2 additions & 1 deletion editor/plugins/sprite_frames_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ class SpriteFramesEditor : public HSplitContainer {
void _update_show_settings();

void _edit();
void _regist_scene_undo(EditorUndoRedoManager *undo_redo);
void _fetch_sprite_node();
void _remove_sprite_node();

Expand All @@ -270,6 +269,8 @@ class SpriteFramesEditor : public HSplitContainer {

public:
void edit(Ref<SpriteFrames> p_frames);
bool is_editing() const;

SpriteFramesEditor();
};

Expand Down

0 comments on commit f6ba06a

Please sign in to comment.