Skip to content

Make rotation gizmo white outline a 4th handle that rotates around the camera's view-axis #108608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ryevdokimov
Copy link
Contributor

@ryevdokimov ryevdokimov commented Jul 14, 2025

Requires and includes: #108576

Common functionality in other 3D software that increases the usability of the rotation gizmo.

Made the white outline slightly larger so it's more distinct and easier to select.

Everything else should work as expected or at least how #108576 works.

2025-07-15.15-36-41.mp4

@ryevdokimov ryevdokimov requested a review from a team as a code owner July 14, 2025 16:57
@ryevdokimov ryevdokimov force-pushed the camera-view-axis-rotation branch from d76bc2e to 2bf683f Compare July 14, 2025 17:03
@BlueCube3310 BlueCube3310 added this to the 4.x milestone Jul 14, 2025
@ryevdokimov ryevdokimov force-pushed the camera-view-axis-rotation branch 2 times, most recently from db6f08a to 9e6438c Compare July 15, 2025 11:35
@fire fire requested a review from a team July 15, 2025 20:41
@ryevdokimov ryevdokimov force-pushed the camera-view-axis-rotation branch from 9e6438c to c6bae67 Compare July 24, 2025 16:06
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, it works as expected.

Code looks good to me.

surftool->commit(axis_gizmo[i]);
// Lines to visualize transforms locked to an axis/plane
{
Ref<SurfaceTool> surftool = memnew(SurfaceTool);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ref<SurfaceTool> surftool = memnew(SurfaceTool);
Ref<SurfaceTool> surftool;
surftool.instantiate();

Preferred syntax

surftool->add_vertex(points[2]);
surftool->add_vertex(points[3]);

Ref<StandardMaterial3D> plane_mat = memnew(StandardMaterial3D);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ref<StandardMaterial3D> plane_mat = memnew(StandardMaterial3D);
Ref<StandardMaterial3D> plane_mat;
plane_mat.instantiate();

vec[i] = 1;
// Plane Scale
{
Ref<SurfaceTool> surftool = memnew(SurfaceTool);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ref<SurfaceTool> surftool = memnew(SurfaceTool);
Ref<SurfaceTool> surftool;
surftool.instantiate();

if (i < 3) {
// Scale
{
Ref<SurfaceTool> surftool = memnew(SurfaceTool);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ref<SurfaceTool> surftool = memnew(SurfaceTool);
Ref<SurfaceTool> surftool;
surftool.instantiate();

{
Ref<SurfaceTool> surftool = memnew(SurfaceTool);
surftool->begin(Mesh::PRIMITIVE_TRIANGLES);
Ref<ShaderMaterial> rotate_mat = memnew(ShaderMaterial);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ref<ShaderMaterial> rotate_mat = memnew(ShaderMaterial);
Ref<ShaderMaterial> rotate_mat;
rotate_mat.instantiate();

surftool->add_vertex(points[2]);
surftool->add_vertex(points[3]);

Ref<StandardMaterial3D> plane_mat = memnew(StandardMaterial3D);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ref<StandardMaterial3D> plane_mat = memnew(StandardMaterial3D);
Ref<StandardMaterial3D> plane_mat;
plane_mat.instantiate();

surftool->commit(move_gizmo[i]);
// Plane Translation
{
Ref<SurfaceTool> surftool = memnew(SurfaceTool);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ref<SurfaceTool> surftool = memnew(SurfaceTool);
Ref<SurfaceTool> surftool;
surftool.instantiate();

if (i < 3) {
//translate
{
Ref<SurfaceTool> surftool = memnew(SurfaceTool);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ref<SurfaceTool> surftool = memnew(SurfaceTool);
Ref<SurfaceTool> surftool;
surftool.instantiate();


if (i < 3) {
// Only create standard materials for X, Y, Z axes (move/scale gizmos)
mat = memnew(StandardMaterial3D);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
mat = memnew(StandardMaterial3D);
mat.instantiate();

@ryevdokimov ryevdokimov force-pushed the camera-view-axis-rotation branch from c6bae67 to cc1389a Compare July 29, 2025 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants