|
@@ -3329,13 +3329,7 @@ void Node3DEditorViewport::_menu_option(int p_option) {
|
|
|
case VIEW_LOCK_ROTATION: {
|
|
|
int idx = view_menu->get_popup()->get_item_index(VIEW_LOCK_ROTATION);
|
|
|
bool current = view_menu->get_popup()->is_item_checked(idx);
|
|
|
- lock_rotation = !current;
|
|
|
- view_menu->get_popup()->set_item_checked(idx, !current);
|
|
|
- if (lock_rotation) {
|
|
|
- locked_label->show();
|
|
|
- } else {
|
|
|
- locked_label->hide();
|
|
|
- }
|
|
|
+ _set_lock_view_rotation(!current);
|
|
|
|
|
|
} break;
|
|
|
case VIEW_AUDIO_LISTENER: {
|
|
@@ -3809,10 +3803,7 @@ void Node3DEditorViewport::set_state(const Dictionary &p_state) {
|
|
|
}
|
|
|
}
|
|
|
if (p_state.has("lock_rotation")) {
|
|
|
- lock_rotation = p_state["lock_rotation"];
|
|
|
-
|
|
|
- int idx = view_menu->get_popup()->get_item_index(VIEW_LOCK_ROTATION);
|
|
|
- view_menu->get_popup()->set_item_checked(idx, lock_rotation);
|
|
|
+ _set_lock_view_rotation(p_state["lock_rotation"]);
|
|
|
}
|
|
|
if (p_state.has("use_environment")) {
|
|
|
bool env = p_state["use_environment"];
|
|
@@ -3928,9 +3919,7 @@ Dictionary Node3DEditorViewport::get_state() const {
|
|
|
if (previewing) {
|
|
|
d["previewing"] = EditorNode::get_singleton()->get_edited_scene()->get_path_to(previewing);
|
|
|
}
|
|
|
- if (lock_rotation) {
|
|
|
- d["lock_rotation"] = lock_rotation;
|
|
|
- }
|
|
|
+ d["lock_rotation"] = lock_rotation;
|
|
|
|
|
|
return d;
|
|
|
}
|
|
@@ -4935,6 +4924,17 @@ void Node3DEditorViewport::shortcut_changed_callback(const Ref<Shortcut> p_short
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void Node3DEditorViewport::_set_lock_view_rotation(bool p_lock_rotation) {
|
|
|
+ lock_rotation = p_lock_rotation;
|
|
|
+ int idx = view_menu->get_popup()->get_item_index(VIEW_LOCK_ROTATION);
|
|
|
+ view_menu->get_popup()->set_item_checked(idx, p_lock_rotation);
|
|
|
+ if (p_lock_rotation) {
|
|
|
+ locked_label->show();
|
|
|
+ } else {
|
|
|
+ locked_label->hide();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p_index) {
|
|
|
cpu_time_history_index = 0;
|
|
|
gpu_time_history_index = 0;
|