You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Store lock view rotation whether its on or off
This commit is contained in:
@@ -3327,13 +3327,7 @@ void Node3DEditorViewport::_menu_option(int p_option) {
|
|||||||
case VIEW_LOCK_ROTATION: {
|
case VIEW_LOCK_ROTATION: {
|
||||||
int idx = view_menu->get_popup()->get_item_index(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);
|
bool current = view_menu->get_popup()->is_item_checked(idx);
|
||||||
lock_rotation = !current;
|
_set_lock_view_rotation(!current);
|
||||||
view_menu->get_popup()->set_item_checked(idx, !current);
|
|
||||||
if (lock_rotation) {
|
|
||||||
locked_label->show();
|
|
||||||
} else {
|
|
||||||
locked_label->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case VIEW_AUDIO_LISTENER: {
|
case VIEW_AUDIO_LISTENER: {
|
||||||
@@ -3808,10 +3802,7 @@ void Node3DEditorViewport::set_state(const Dictionary &p_state) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p_state.has("lock_rotation")) {
|
if (p_state.has("lock_rotation")) {
|
||||||
lock_rotation = p_state["lock_rotation"];
|
_set_lock_view_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);
|
|
||||||
}
|
}
|
||||||
if (p_state.has("use_environment")) {
|
if (p_state.has("use_environment")) {
|
||||||
bool env = p_state["use_environment"];
|
bool env = p_state["use_environment"];
|
||||||
@@ -3918,9 +3909,7 @@ Dictionary Node3DEditorViewport::get_state() const {
|
|||||||
if (previewing) {
|
if (previewing) {
|
||||||
d["previewing"] = EditorNode::get_singleton()->get_edited_scene()->get_path_to(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;
|
return d;
|
||||||
}
|
}
|
||||||
@@ -4925,6 +4914,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) {
|
Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p_index) {
|
||||||
cpu_time_history_index = 0;
|
cpu_time_history_index = 0;
|
||||||
gpu_time_history_index = 0;
|
gpu_time_history_index = 0;
|
||||||
|
|||||||
@@ -445,6 +445,8 @@ private:
|
|||||||
void register_shortcut_action(const String &p_path, const String &p_name, Key p_keycode, bool p_physical = false);
|
void register_shortcut_action(const String &p_path, const String &p_name, Key p_keycode, bool p_physical = false);
|
||||||
void shortcut_changed_callback(const Ref<Shortcut> p_shortcut, const String &p_shortcut_path);
|
void shortcut_changed_callback(const Ref<Shortcut> p_shortcut, const String &p_shortcut_path);
|
||||||
|
|
||||||
|
void _set_lock_view_rotation(bool p_lock_rotation);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|||||||
Reference in New Issue
Block a user