summaryrefslogtreecommitdiff
path: root/editor/plugins/node_3d_editor_plugin.h
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-02-09 09:39:28 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-02-09 09:39:28 +0100
commitd6deada47caa9368a8a45ac3ae11473316d2cc50 (patch)
treef99020530cf352fbe3bc5e5cc37c39e5d8324f1a /editor/plugins/node_3d_editor_plugin.h
parent196801fc64026ab7daee44994ee92bc6eb9faae4 (diff)
Revert "Show the 3D transform gizmo in the center when otherwise offscreen"
This reverts commit 4234a72b256a95cc345dfa2289fe0a3b588631b6. There are some errors which are problematic to have in 4.0 alpha 2. The PR can be redone with fixes and merged again after the dev release. Fixes #57839.
Diffstat (limited to 'editor/plugins/node_3d_editor_plugin.h')
-rw-r--r--editor/plugins/node_3d_editor_plugin.h79
1 files changed, 30 insertions, 49 deletions
diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index f14f8b90b9..bbe5615570 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -87,19 +87,6 @@ public:
void set_viewport(Node3DEditorViewport *p_viewport);
};
-class GizmoOffScreenLine : public Control {
- GDCLASS(GizmoOffScreenLine, Control);
-
-public:
- Vector2 point1;
- Vector2 point2;
- void _notification(int p_what) {
- if (p_what == NOTIFICATION_DRAW && is_visible()) {
- draw_line(point1, point2, Color(0.0f, 0.75f, 0.75f), 2);
- }
- }
-};
-
class Node3DEditorViewport : public Control {
GDCLASS(Node3DEditorViewport, Control);
friend class Node3DEditor;
@@ -214,7 +201,6 @@ private:
CheckBox *preview_camera;
SubViewportContainer *subviewport_container;
- GizmoOffScreenLine *gizmo_offscreen_line;
MenuButton *view_menu;
PopupMenu *display_submenu;
@@ -251,7 +237,7 @@ private:
};
void _update_name();
- void _compute_edit(const Point2 &p_point, const bool p_auto_center = true);
+ void _compute_edit(const Point2 &p_point);
void _clear_selected();
void _select_clicked(bool p_allow_locked);
ObjectID _select_ray(const Point2 &p_pos);
@@ -521,35 +507,6 @@ class Node3DEditor : public VBoxContainer {
public:
static const unsigned int VIEWPORTS_COUNT = 4;
- enum MenuOption {
- MENU_GROUP_SELECTED,
- MENU_KEEP_GIZMO_ONSCREEN,
- MENU_LOCK_SELECTED,
- MENU_SNAP_TO_FLOOR,
- MENU_TOOL_LIST_SELECT,
- MENU_TOOL_LOCAL_COORDS,
- MENU_TOOL_MOVE,
- MENU_TOOL_OVERRIDE_CAMERA,
- MENU_TOOL_ROTATE,
- MENU_TOOL_SCALE,
- MENU_TOOL_SELECT,
- MENU_TOOL_USE_SNAP,
- MENU_TRANSFORM_CONFIGURE_SNAP,
- MENU_TRANSFORM_DIALOG,
- MENU_UNGROUP_SELECTED,
- MENU_UNLOCK_SELECTED,
- MENU_VIEW_CAMERA_SETTINGS,
- MENU_VIEW_GIZMOS_3D_ICONS,
- MENU_VIEW_GRID,
- MENU_VIEW_ORIGIN,
- MENU_VIEW_USE_1_VIEWPORT,
- MENU_VIEW_USE_2_VIEWPORTS,
- MENU_VIEW_USE_2_VIEWPORTS_ALT,
- MENU_VIEW_USE_3_VIEWPORTS,
- MENU_VIEW_USE_3_VIEWPORTS_ALT,
- MENU_VIEW_USE_4_VIEWPORTS,
- };
-
enum ToolMode {
TOOL_MODE_SELECT,
TOOL_MODE_MOVE,
@@ -568,6 +525,7 @@ public:
TOOL_OPT_USE_SNAP,
TOOL_OPT_OVERRIDE_CAMERA,
TOOL_OPT_MAX
+
};
private:
@@ -596,7 +554,6 @@ private:
Camera3D::Projection grid_camera_last_update_perspective = Camera3D::PROJECTION_PERSPECTIVE;
Vector3 grid_camera_last_update_position = Vector3();
- bool keep_gizmo_onscreen = true;
Ref<ArrayMesh> move_gizmo[3], move_plane_gizmo[3], rotate_gizmo[4], scale_gizmo[3], scale_plane_gizmo[3], axis_gizmo[3];
Ref<StandardMaterial3D> gizmo_color[3];
Ref<StandardMaterial3D> plane_gizmo_color[3];
@@ -630,10 +587,37 @@ private:
struct Gizmo {
bool visible = false;
real_t scale = 0;
- Vector3 target_center;
Transform3D transform;
} gizmo;
+ enum MenuOption {
+ MENU_TOOL_SELECT,
+ MENU_TOOL_MOVE,
+ MENU_TOOL_ROTATE,
+ MENU_TOOL_SCALE,
+ MENU_TOOL_LIST_SELECT,
+ MENU_TOOL_LOCAL_COORDS,
+ MENU_TOOL_USE_SNAP,
+ MENU_TOOL_OVERRIDE_CAMERA,
+ MENU_TRANSFORM_CONFIGURE_SNAP,
+ MENU_TRANSFORM_DIALOG,
+ MENU_VIEW_USE_1_VIEWPORT,
+ MENU_VIEW_USE_2_VIEWPORTS,
+ MENU_VIEW_USE_2_VIEWPORTS_ALT,
+ MENU_VIEW_USE_3_VIEWPORTS,
+ MENU_VIEW_USE_3_VIEWPORTS_ALT,
+ MENU_VIEW_USE_4_VIEWPORTS,
+ MENU_VIEW_ORIGIN,
+ MENU_VIEW_GRID,
+ MENU_VIEW_GIZMOS_3D_ICONS,
+ MENU_VIEW_CAMERA_SETTINGS,
+ MENU_LOCK_SELECTED,
+ MENU_UNLOCK_SELECTED,
+ MENU_GROUP_SELECTED,
+ MENU_UNGROUP_SELECTED,
+ MENU_SNAP_TO_FLOOR
+ };
+
Button *tool_button[TOOL_MAX];
Button *tool_option_button[TOOL_OPT_MAX];
@@ -792,10 +776,7 @@ public:
float get_zfar() const { return settings_zfar->get_value(); }
float get_fov() const { return settings_fov->get_value(); }
- Vector3 get_gizmo_target_center() const { return gizmo.target_center; }
Transform3D get_gizmo_transform() const { return gizmo.transform; }
- void set_gizmo_transform(const Transform3D &p_transform) { gizmo.transform = p_transform; }
- bool is_keep_gizmo_onscreen_enabled() const { return keep_gizmo_onscreen; }
bool is_gizmo_visible() const;
ToolMode get_tool_mode() const { return tool_mode; }