summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-07-16 11:35:16 +0200
committerGitHub <noreply@github.com>2019-07-16 11:35:16 +0200
commit22c843b0c451a0c3d79a3b3e6af900b841c51c12 (patch)
tree53ac289555dd2642345a82eb8ef41008de9d721b /editor/plugins
parentdf62bfdd49d344ece54e922f376280e781809398 (diff)
parent600c153076f192e467472895fe77bcc726595c86 (diff)
Merge pull request #30602 from n-k-chilagani/first_time
Fixed Make 3D viewport locked nodes unselectable as in 2D viewport
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp11
-rw-r--r--editor/plugins/spatial_editor_plugin.h2
2 files changed, 9 insertions, 4 deletions
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 9fd694ee0d..a593a92b97 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -283,7 +283,8 @@ void SpatialEditorViewport::_select_clicked(bool p_append, bool p_single) {
node = node->get_parent();
}
- _select(selected, clicked_wants_append, true);
+ if (!_is_node_locked(selected))
+ _select(selected, clicked_wants_append, true);
}
void SpatialEditorViewport::_select(Node *p_node, bool p_append, bool p_single) {
@@ -513,7 +514,7 @@ void SpatialEditorViewport::_select_region() {
for (int i = 0; i < instances.size(); i++) {
Spatial *sp = Object::cast_to<Spatial>(ObjectDB::get_instance(instances[i]));
- if (!sp)
+ if (!sp && _is_node_locked(sp))
continue;
Node *item = Object::cast_to<Node>(sp);
@@ -536,6 +537,8 @@ void SpatialEditorViewport::_select_region() {
if (selected.find(item) != -1) continue;
+ if (_is_node_locked(Object::cast_to<Spatial>(item))) continue;
+
Ref<EditorSpatialGizmo> seg = sp->get_gizmo();
if (!seg.is_valid())
@@ -833,7 +836,9 @@ void SpatialEditorViewport::_surface_focus_exit() {
view_menu->set_disable_shortcuts(true);
}
-
+bool SpatialEditorViewport ::_is_node_locked(const Node *p_node) {
+ return p_node->has_meta("_edit_lock_") && p_node->get_meta("_edit_lock_");
+}
void SpatialEditorViewport::_list_select(Ref<InputEventMouseButton> b) {
_find_items_at_pos(b->get_position(), clicked_includes_current, selection_results, b->get_shift());
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index b4e2f028d2..1a32d6e047 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -364,7 +364,7 @@ private:
Camera *preview;
bool previewing_cinema;
-
+ bool _is_node_locked(const Node *p_node);
void _preview_exited_scene();
void _toggle_camera_preview(bool);
void _toggle_cinema_preview(bool);