소스 검색

Moved Local Space Mode and Transform Snap settings to Top Bar ...

...buttons for easier access.
Przemysław Gołąb (n-pigeon) 7 년 전
부모
커밋
b3575b5164
2개의 변경된 파일76개의 추가작업 그리고 48개의 파일을 삭제
  1. 63 31
      editor/plugins/spatial_editor_plugin.cpp
  2. 13 17
      editor/plugins/spatial_editor_plugin.h

+ 63 - 31
editor/plugins/spatial_editor_plugin.cpp

@@ -3884,8 +3884,7 @@ Dictionary SpatialEditor::get_state() const {
 	d["rotate_snap"] = get_rotate_snap();
 	d["rotate_snap"] = get_rotate_snap();
 	d["scale_snap"] = get_scale_snap();
 	d["scale_snap"] = get_scale_snap();
 
 
-	int local_coords_index = transform_menu->get_popup()->get_item_index(MENU_TRANSFORM_LOCAL_COORDS);
-	d["local_coords"] = transform_menu->get_popup()->is_item_checked(local_coords_index);
+	d["local_coords"] = tool_option_button[TOOL_OPT_LOCAL_COORDS]->is_pressed();
 
 
 	int vc = 0;
 	int vc = 0;
 	if (view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT)))
 	if (view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT)))
@@ -3923,8 +3922,7 @@ void SpatialEditor::set_state(const Dictionary &p_state) {
 
 
 	if (d.has("snap_enabled")) {
 	if (d.has("snap_enabled")) {
 		snap_enabled = d["snap_enabled"];
 		snap_enabled = d["snap_enabled"];
-		int snap_enabled_idx = transform_menu->get_popup()->get_item_index(MENU_TRANSFORM_USE_SNAP);
-		transform_menu->get_popup()->set_item_checked(snap_enabled_idx, snap_enabled);
+		tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_pressed(d["snap_enabled"]);
 	}
 	}
 
 
 	if (d.has("translate_snap"))
 	if (d.has("translate_snap"))
@@ -3937,8 +3935,7 @@ void SpatialEditor::set_state(const Dictionary &p_state) {
 		snap_scale->set_text(d["scale_snap"]);
 		snap_scale->set_text(d["scale_snap"]);
 
 
 	if (d.has("local_coords")) {
 	if (d.has("local_coords")) {
-		int local_coords_idx = transform_menu->get_popup()->get_item_index(MENU_TRANSFORM_LOCAL_COORDS);
-		transform_menu->get_popup()->set_item_checked(local_coords_idx, d["local_coords"]);
+		tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_pressed(d["local_coords"]);
 		update_transform_gizmo();
 		update_transform_gizmo();
 	}
 	}
 
 
@@ -4078,6 +4075,22 @@ void SpatialEditor::_xform_dialog_action() {
 	undo_redo->commit_action();
 	undo_redo->commit_action();
 }
 }
 
 
+void SpatialEditor::_menu_item_toggled(bool pressed, int p_option) {
+
+	switch (p_option) {
+		case MENU_TOOL_LOCAL_COORDS: {
+
+			tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_pressed(pressed);
+			update_transform_gizmo();
+		} break;
+
+		case MENU_TOOL_USE_SNAP: {
+			tool_option_button[TOOL_OPT_USE_SNAP]->set_pressed(pressed);
+			snap_enabled = pressed;
+		} break;
+	}
+}
+
 void SpatialEditor::_menu_item_pressed(int p_option) {
 void SpatialEditor::_menu_item_pressed(int p_option) {
 
 
 	switch (p_option) {
 	switch (p_option) {
@@ -4091,29 +4104,13 @@ void SpatialEditor::_menu_item_pressed(int p_option) {
 			for (int i = 0; i < TOOL_MAX; i++)
 			for (int i = 0; i < TOOL_MAX; i++)
 				tool_button[i]->set_pressed(i == p_option);
 				tool_button[i]->set_pressed(i == p_option);
 			tool_mode = (ToolMode)p_option;
 			tool_mode = (ToolMode)p_option;
-
-			//static const char *_mode[]={"Selection Mode.","Translation Mode.","Rotation Mode.","Scale Mode.","List Selection Mode."};
-			//set_message(_mode[p_option],3);
 			update_transform_gizmo();
 			update_transform_gizmo();
 
 
 		} break;
 		} break;
-		case MENU_TRANSFORM_USE_SNAP: {
-
-			bool is_checked = transform_menu->get_popup()->is_item_checked(transform_menu->get_popup()->get_item_index(p_option));
-			snap_enabled = !is_checked;
-			transform_menu->get_popup()->set_item_checked(transform_menu->get_popup()->get_item_index(p_option), snap_enabled);
-		} break;
 		case MENU_TRANSFORM_CONFIGURE_SNAP: {
 		case MENU_TRANSFORM_CONFIGURE_SNAP: {
 
 
 			snap_dialog->popup_centered(Size2(200, 180));
 			snap_dialog->popup_centered(Size2(200, 180));
 		} break;
 		} break;
-		case MENU_TRANSFORM_LOCAL_COORDS: {
-
-			bool is_checked = transform_menu->get_popup()->is_item_checked(transform_menu->get_popup()->get_item_index(p_option));
-			transform_menu->get_popup()->set_item_checked(transform_menu->get_popup()->get_item_index(p_option), !is_checked);
-			update_transform_gizmo();
-
-		} break;
 		case MENU_TRANSFORM_DIALOG: {
 		case MENU_TRANSFORM_DIALOG: {
 
 
 			for (int i = 0; i < 3; i++) {
 			for (int i = 0; i < 3; i++) {
@@ -4718,6 +4715,19 @@ void SpatialEditor::_unhandled_key_input(Ref<InputEvent> p_event) {
 
 
 			else if (ED_IS_SHORTCUT("spatial_editor/tool_scale", p_event))
 			else if (ED_IS_SHORTCUT("spatial_editor/tool_scale", p_event))
 				_menu_item_pressed(MENU_TOOL_SCALE);
 				_menu_item_pressed(MENU_TOOL_SCALE);
+
+			else if (ED_IS_SHORTCUT("spatial_editor/local_coords", p_event))
+				if (are_local_coords_enabled()) {
+					_menu_item_toggled(false, MENU_TOOL_LOCAL_COORDS);
+				} else {
+					_menu_item_toggled(true, MENU_TOOL_LOCAL_COORDS);
+				}
+			else if (ED_IS_SHORTCUT("spatial_editor/snap", p_event))
+				if (is_snap_enabled()) {
+					_menu_item_toggled(false, MENU_TOOL_USE_SNAP);
+				} else {
+					_menu_item_toggled(true, MENU_TOOL_USE_SNAP);
+				}
 		}
 		}
 	}
 	}
 }
 }
@@ -4733,6 +4743,9 @@ void SpatialEditor::_notification(int p_what) {
 		tool_button[SpatialEditor::TOOL_LOCK_SELECTED]->set_icon(get_icon("Lock", "EditorIcons"));
 		tool_button[SpatialEditor::TOOL_LOCK_SELECTED]->set_icon(get_icon("Lock", "EditorIcons"));
 		tool_button[SpatialEditor::TOOL_UNLOCK_SELECTED]->set_icon(get_icon("Unlock", "EditorIcons"));
 		tool_button[SpatialEditor::TOOL_UNLOCK_SELECTED]->set_icon(get_icon("Unlock", "EditorIcons"));
 
 
+		tool_option_button[SpatialEditor::TOOL_OPT_LOCAL_COORDS]->set_icon(get_icon("Object", "EditorIcons"));
+		tool_option_button[SpatialEditor::TOOL_OPT_USE_SNAP]->set_icon(get_icon("Snap", "EditorIcons"));
+
 		view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), get_icon("Panels1", "EditorIcons"));
 		view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), get_icon("Panels1", "EditorIcons"));
 		view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), get_icon("Panels2", "EditorIcons"));
 		view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), get_icon("Panels2", "EditorIcons"));
 		view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), get_icon("Panels2Alt", "EditorIcons"));
 		view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), get_icon("Panels2Alt", "EditorIcons"));
@@ -4768,6 +4781,9 @@ void SpatialEditor::_notification(int p_what) {
 		tool_button[SpatialEditor::TOOL_MODE_SCALE]->set_icon(get_icon("ToolScale", "EditorIcons"));
 		tool_button[SpatialEditor::TOOL_MODE_SCALE]->set_icon(get_icon("ToolScale", "EditorIcons"));
 		tool_button[SpatialEditor::TOOL_MODE_LIST_SELECT]->set_icon(get_icon("ListSelect", "EditorIcons"));
 		tool_button[SpatialEditor::TOOL_MODE_LIST_SELECT]->set_icon(get_icon("ListSelect", "EditorIcons"));
 
 
+		tool_option_button[SpatialEditor::TOOL_OPT_LOCAL_COORDS]->set_icon(get_icon("Object", "EditorIcons"));
+		tool_option_button[SpatialEditor::TOOL_OPT_USE_SNAP]->set_icon(get_icon("Snap", "EditorIcons"));
+
 		view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), get_icon("Panels1", "EditorIcons"));
 		view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), get_icon("Panels1", "EditorIcons"));
 		view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), get_icon("Panels2", "EditorIcons"));
 		view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), get_icon("Panels2", "EditorIcons"));
 		view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), get_icon("Panels2Alt", "EditorIcons"));
 		view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), get_icon("Panels2Alt", "EditorIcons"));
@@ -4886,6 +4902,7 @@ void SpatialEditor::_bind_methods() {
 	ClassDB::bind_method("_unhandled_key_input", &SpatialEditor::_unhandled_key_input);
 	ClassDB::bind_method("_unhandled_key_input", &SpatialEditor::_unhandled_key_input);
 	ClassDB::bind_method("_node_removed", &SpatialEditor::_node_removed);
 	ClassDB::bind_method("_node_removed", &SpatialEditor::_node_removed);
 	ClassDB::bind_method("_menu_item_pressed", &SpatialEditor::_menu_item_pressed);
 	ClassDB::bind_method("_menu_item_pressed", &SpatialEditor::_menu_item_pressed);
+	ClassDB::bind_method("_menu_item_toggled", &SpatialEditor::_menu_item_toggled);
 	ClassDB::bind_method("_xform_dialog_action", &SpatialEditor::_xform_dialog_action);
 	ClassDB::bind_method("_xform_dialog_action", &SpatialEditor::_xform_dialog_action);
 	ClassDB::bind_method("_get_editor_data", &SpatialEditor::_get_editor_data);
 	ClassDB::bind_method("_get_editor_data", &SpatialEditor::_get_editor_data);
 	ClassDB::bind_method("_request_gizmo", &SpatialEditor::_request_gizmo);
 	ClassDB::bind_method("_request_gizmo", &SpatialEditor::_request_gizmo);
@@ -4949,6 +4966,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
 
 
 	Vector<Variant> button_binds;
 	Vector<Variant> button_binds;
 	button_binds.resize(1);
 	button_binds.resize(1);
+	String sct;
 
 
 	tool_button[TOOL_MODE_SELECT] = memnew(ToolButton);
 	tool_button[TOOL_MODE_SELECT] = memnew(ToolButton);
 	hbc_menu->add_child(tool_button[TOOL_MODE_SELECT]);
 	hbc_menu->add_child(tool_button[TOOL_MODE_SELECT]);
@@ -4960,7 +4978,6 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
 	tool_button[TOOL_MODE_SELECT]->set_tooltip(TTR("Select Mode (Q)\n") + keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate\nAlt+Drag: Move\nAlt+RMB: Depth list selection"));
 	tool_button[TOOL_MODE_SELECT]->set_tooltip(TTR("Select Mode (Q)\n") + keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate\nAlt+Drag: Move\nAlt+RMB: Depth list selection"));
 
 
 	tool_button[TOOL_MODE_MOVE] = memnew(ToolButton);
 	tool_button[TOOL_MODE_MOVE] = memnew(ToolButton);
-
 	hbc_menu->add_child(tool_button[TOOL_MODE_MOVE]);
 	hbc_menu->add_child(tool_button[TOOL_MODE_MOVE]);
 	tool_button[TOOL_MODE_MOVE]->set_toggle_mode(true);
 	tool_button[TOOL_MODE_MOVE]->set_toggle_mode(true);
 	tool_button[TOOL_MODE_MOVE]->set_flat(true);
 	tool_button[TOOL_MODE_MOVE]->set_flat(true);
@@ -4984,9 +5001,6 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
 	tool_button[TOOL_MODE_SCALE]->connect("pressed", this, "_menu_item_pressed", button_binds);
 	tool_button[TOOL_MODE_SCALE]->connect("pressed", this, "_menu_item_pressed", button_binds);
 	tool_button[TOOL_MODE_SCALE]->set_tooltip(TTR("Scale Mode (R)"));
 	tool_button[TOOL_MODE_SCALE]->set_tooltip(TTR("Scale Mode (R)"));
 
 
-	VSeparator *vs = memnew(VSeparator);
-	hbc_menu->add_child(vs);
-
 	tool_button[TOOL_MODE_LIST_SELECT] = memnew(ToolButton);
 	tool_button[TOOL_MODE_LIST_SELECT] = memnew(ToolButton);
 	hbc_menu->add_child(tool_button[TOOL_MODE_LIST_SELECT]);
 	hbc_menu->add_child(tool_button[TOOL_MODE_LIST_SELECT]);
 	tool_button[TOOL_MODE_LIST_SELECT]->set_toggle_mode(true);
 	tool_button[TOOL_MODE_LIST_SELECT]->set_toggle_mode(true);
@@ -5007,6 +5021,29 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
 	tool_button[TOOL_UNLOCK_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
 	tool_button[TOOL_UNLOCK_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
 	tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip(TTR("Unlock the selected object (can be moved)."));
 	tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip(TTR("Unlock the selected object (can be moved)."));
 
 
+	VSeparator *vs = memnew(VSeparator);
+	hbc_menu->add_child(vs);
+
+	tool_option_button[TOOL_OPT_LOCAL_COORDS] = memnew(ToolButton);
+	hbc_menu->add_child(tool_option_button[TOOL_OPT_LOCAL_COORDS]);
+	tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_toggle_mode(true);
+	tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_flat(true);
+	button_binds[0] = MENU_TOOL_LOCAL_COORDS;
+	tool_option_button[TOOL_OPT_LOCAL_COORDS]->connect("toggled", this, "_menu_item_toggled", button_binds);
+	ED_SHORTCUT("spatial_editor/local_coords", TTR("Local Coords"), KEY_T);
+	sct = ED_GET_SHORTCUT("spatial_editor/local_coords").ptr()->get_as_text();
+	tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_tooltip(vformat(TTR("Local Space Mode (%s)"), sct));
+
+	tool_option_button[TOOL_OPT_USE_SNAP] = memnew(ToolButton);
+	hbc_menu->add_child(tool_option_button[TOOL_OPT_USE_SNAP]);
+	tool_option_button[TOOL_OPT_USE_SNAP]->set_toggle_mode(true);
+	tool_option_button[TOOL_OPT_USE_SNAP]->set_flat(true);
+	button_binds[0] = MENU_TOOL_USE_SNAP;
+	tool_option_button[TOOL_OPT_USE_SNAP]->connect("toggled", this, "_menu_item_toggled", button_binds);
+	ED_SHORTCUT("spatial_editor/snap", TTR("Snap"), KEY_Y);
+	sct = ED_GET_SHORTCUT("spatial_editor/snap").ptr()->get_as_text();
+	tool_option_button[TOOL_OPT_USE_SNAP]->set_tooltip(vformat(TTR("Snap Mode (%s)"), sct));
+
 	vs = memnew(VSeparator);
 	vs = memnew(VSeparator);
 	hbc_menu->add_child(vs);
 	hbc_menu->add_child(vs);
 
 
@@ -5021,7 +5058,6 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
 	ED_SHORTCUT("spatial_editor/left_view", TTR("Left View"), KEY_MASK_ALT + KEY_KP_3);
 	ED_SHORTCUT("spatial_editor/left_view", TTR("Left View"), KEY_MASK_ALT + KEY_KP_3);
 	ED_SHORTCUT("spatial_editor/right_view", TTR("Right View"), KEY_KP_3);
 	ED_SHORTCUT("spatial_editor/right_view", TTR("Right View"), KEY_KP_3);
 	ED_SHORTCUT("spatial_editor/switch_perspective_orthogonal", TTR("Switch Perspective/Orthogonal view"), KEY_KP_5);
 	ED_SHORTCUT("spatial_editor/switch_perspective_orthogonal", TTR("Switch Perspective/Orthogonal view"), KEY_KP_5);
-	ED_SHORTCUT("spatial_editor/snap", TTR("Snap"), KEY_S);
 	ED_SHORTCUT("spatial_editor/insert_anim_key", TTR("Insert Animation Key"), KEY_K);
 	ED_SHORTCUT("spatial_editor/insert_anim_key", TTR("Insert Animation Key"), KEY_K);
 	ED_SHORTCUT("spatial_editor/focus_origin", TTR("Focus Origin"), KEY_O);
 	ED_SHORTCUT("spatial_editor/focus_origin", TTR("Focus Origin"), KEY_O);
 	ED_SHORTCUT("spatial_editor/focus_selection", TTR("Focus Selection"), KEY_F);
 	ED_SHORTCUT("spatial_editor/focus_selection", TTR("Focus Selection"), KEY_F);
@@ -5043,12 +5079,8 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
 	hbc_menu->add_child(transform_menu);
 	hbc_menu->add_child(transform_menu);
 
 
 	p = transform_menu->get_popup();
 	p = transform_menu->get_popup();
-	p->add_check_shortcut(ED_SHORTCUT("spatial_editor/use_snap", TTR("Use Snap")), MENU_TRANSFORM_USE_SNAP);
 	p->add_shortcut(ED_SHORTCUT("spatial_editor/configure_snap", TTR("Configure Snap..")), MENU_TRANSFORM_CONFIGURE_SNAP);
 	p->add_shortcut(ED_SHORTCUT("spatial_editor/configure_snap", TTR("Configure Snap..")), MENU_TRANSFORM_CONFIGURE_SNAP);
 	p->add_separator();
 	p->add_separator();
-	p->add_check_shortcut(ED_SHORTCUT("spatial_editor/local_coords", TTR("Local Coords")), MENU_TRANSFORM_LOCAL_COORDS);
-	//p->set_item_checked(p->get_item_count()-1,true);
-	p->add_separator();
 	p->add_shortcut(ED_SHORTCUT("spatial_editor/transform_dialog", TTR("Transform Dialog..")), MENU_TRANSFORM_DIALOG);
 	p->add_shortcut(ED_SHORTCUT("spatial_editor/transform_dialog", TTR("Transform Dialog..")), MENU_TRANSFORM_DIALOG);
 
 
 	p->connect("id_pressed", this, "_menu_item_pressed");
 	p->connect("id_pressed", this, "_menu_item_pressed");

+ 13 - 17
editor/plugins/spatial_editor_plugin.h

@@ -405,6 +405,14 @@ public:
 
 
 	};
 	};
 
 
+	enum ToolOptions {
+
+		TOOL_OPT_LOCAL_COORDS,
+		TOOL_OPT_USE_SNAP,
+		TOOL_OPT_MAX
+
+	};
+
 private:
 private:
 	EditorNode *editor;
 	EditorNode *editor;
 	EditorSelection *editor_selection;
 	EditorSelection *editor_selection;
@@ -449,17 +457,6 @@ private:
 	Spatial *preview_node;
 	Spatial *preview_node;
 	AABB preview_bounds;
 	AABB preview_bounds;
 
 
-	/*
-	struct Selected {
-		AABB aabb;
-		Transform original; // original location when moving
-		Transform last_xform; // last transform
-		Spatial *sp;
-		RID poly_instance;
-	};
-
-	Map<uint32_t,Selected> selected;
-*/
 	struct Gizmo {
 	struct Gizmo {
 
 
 		bool visible;
 		bool visible;
@@ -474,9 +471,9 @@ private:
 		MENU_TOOL_ROTATE,
 		MENU_TOOL_ROTATE,
 		MENU_TOOL_SCALE,
 		MENU_TOOL_SCALE,
 		MENU_TOOL_LIST_SELECT,
 		MENU_TOOL_LIST_SELECT,
-		MENU_TRANSFORM_USE_SNAP,
+		MENU_TOOL_LOCAL_COORDS,
+		MENU_TOOL_USE_SNAP,
 		MENU_TRANSFORM_CONFIGURE_SNAP,
 		MENU_TRANSFORM_CONFIGURE_SNAP,
-		MENU_TRANSFORM_LOCAL_COORDS,
 		MENU_TRANSFORM_DIALOG,
 		MENU_TRANSFORM_DIALOG,
 		MENU_VIEW_USE_1_VIEWPORT,
 		MENU_VIEW_USE_1_VIEWPORT,
 		MENU_VIEW_USE_2_VIEWPORTS,
 		MENU_VIEW_USE_2_VIEWPORTS,
@@ -493,6 +490,7 @@ private:
 	};
 	};
 
 
 	Button *tool_button[TOOL_MAX];
 	Button *tool_button[TOOL_MAX];
+	Button *tool_option_button[TOOL_OPT_MAX];
 
 
 	MenuButton *transform_menu;
 	MenuButton *transform_menu;
 	MenuButton *view_menu;
 	MenuButton *view_menu;
@@ -524,11 +522,10 @@ private:
 
 
 	void _xform_dialog_action();
 	void _xform_dialog_action();
 	void _menu_item_pressed(int p_option);
 	void _menu_item_pressed(int p_option);
+	void _menu_item_toggled(bool pressed, int p_option);
 
 
 	HBoxContainer *hbc_menu;
 	HBoxContainer *hbc_menu;
 
 
-	//
-	//
 	void _generate_selection_box();
 	void _generate_selection_box();
 	UndoRedo *undo_redo;
 	UndoRedo *undo_redo;
 
 
@@ -579,13 +576,12 @@ public:
 	bool is_gizmo_visible() const { return gizmo.visible; }
 	bool is_gizmo_visible() const { return gizmo.visible; }
 
 
 	ToolMode get_tool_mode() const { return tool_mode; }
 	ToolMode get_tool_mode() const { return tool_mode; }
+	bool are_local_coords_enabled() const { return tool_option_button[SpatialEditor::TOOL_OPT_LOCAL_COORDS]->is_pressed(); }
 	bool is_snap_enabled() const { return snap_enabled; }
 	bool is_snap_enabled() const { return snap_enabled; }
 	float get_translate_snap() const { return snap_translate->get_text().to_double(); }
 	float get_translate_snap() const { return snap_translate->get_text().to_double(); }
 	float get_rotate_snap() const { return snap_rotate->get_text().to_double(); }
 	float get_rotate_snap() const { return snap_rotate->get_text().to_double(); }
 	float get_scale_snap() const { return snap_scale->get_text().to_double(); }
 	float get_scale_snap() const { return snap_scale->get_text().to_double(); }
 
 
-	bool are_local_coords_enabled() const { return transform_menu->get_popup()->is_item_checked(transform_menu->get_popup()->get_item_index(SpatialEditor::MENU_TRANSFORM_LOCAL_COORDS)); }
-
 	Ref<ArrayMesh> get_move_gizmo(int idx) const { return move_gizmo[idx]; }
 	Ref<ArrayMesh> get_move_gizmo(int idx) const { return move_gizmo[idx]; }
 	Ref<ArrayMesh> get_move_plane_gizmo(int idx) const { return move_plane_gizmo[idx]; }
 	Ref<ArrayMesh> get_move_plane_gizmo(int idx) const { return move_plane_gizmo[idx]; }
 	Ref<ArrayMesh> get_rotate_gizmo(int idx) const { return rotate_gizmo[idx]; }
 	Ref<ArrayMesh> get_rotate_gizmo(int idx) const { return rotate_gizmo[idx]; }