Skip to content

Commit

Permalink
Fix Camera2D is enabled when dragging scene files to the CanvasItemEd…
Browse files Browse the repository at this point in the history
…itor
  • Loading branch information
WhalesState committed Jan 30, 2024
1 parent c7408ef commit ee46573
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5964,6 +5964,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(CanvasItemEditor *p_canvas_it
target_node = nullptr;
canvas_item_editor = p_canvas_item_editor;
preview_node = memnew(Control);
preview_node->set_process_mode(Node::PROCESS_MODE_DISABLED);

accept = memnew(AcceptDialog);
EditorNode::get_singleton()->get_gui_base()->add_child(accept);
Expand Down
8 changes: 4 additions & 4 deletions scene/2d/camera_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
#include "scene/main/window.h"

bool Camera2D::_is_editing_in_editor() const {
#ifdef TOOLS_ENABLED
return is_part_of_edited_scene();
#else
if (Engine::get_singleton()->is_editor_hint() && is_inside_tree() && get_tree()->get_edited_scene_root()) {
return get_tree()->get_edited_scene_root()->get_viewport() == get_viewport() ||
get_tree()->get_edited_scene_root() == this || get_tree()->get_edited_scene_root()->is_ancestor_of(this);
}
return false;
#endif // TOOLS_ENABLED
}

void Camera2D::_update_scroll() {
Expand Down

0 comments on commit ee46573

Please sign in to comment.