Skip to content
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

Add Gizmo to display 3D custom AABB #89538

Merged

Conversation

CrayolaEater
Copy link
Contributor

This PR adds the ability to preview the custom AABB of a MeshInstance3D inside the editor.

image

@CrayolaEater CrayolaEater requested a review from a team as a code owner March 15, 2024 20:11
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 (rebased on top of master a7b8602), there are issues with the gizmo shape not being updated when you change the Custom AABB property in the editor:

simplescreenrecorder-2024-04-09_18.38.56.mp4

The gizmo only updates if the mesh resource is changed or if you deselect and reselect the node.

The error message spam when changing Custom AABB if no mesh is assigned also applies to master, so it's not specific to this PR: #86369 (comment)

@CrayolaEater
Copy link
Contributor Author

Tested locally (rebased on top of master a7b8602), there are issues with the gizmo shape not being updated when you change the Custom AABB property in the editor:

simplescreenrecorder-2024-04-09_18.38.56.mp4

The gizmo only updates if the mesh resource is changed or if you deselect and reselect the node.

Yes but I think this is the limitation of the gizmo. I don't really know how to make it update automatically.

@Calinou
Copy link
Member

Calinou commented Apr 9, 2024

Yes but I think this is the limitation of the gizmo. I don't really know how to make it update automatically.

You can force a gizmo update when the property is changed by calling update_gizmos() at the end of GeometryInstance3D::set_custom_aabb():

void GeometryInstance3D::set_custom_aabb(AABB p_aabb) {
if (p_aabb == custom_aabb) {
return;
}
custom_aabb = p_aabb;
RS::get_singleton()->instance_set_custom_aabb(get_instance(), custom_aabb);
}

@clayjohn clayjohn modified the milestones: 4.x, 4.3 Apr 9, 2024
@CrayolaEater CrayolaEater requested a review from a team as a code owner April 10, 2024 04:10
@CrayolaEater
Copy link
Contributor Author

CrayolaEater commented Apr 10, 2024

Yes but I think this is the limitation of the gizmo. I don't really know how to make it update automatically.

You can force a gizmo update when the property is changed by calling update_gizmos() at the end of GeometryInstance3D::set_custom_aabb()

Thanks for the tip!

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 (rebased on top of master 3b18061), it works as expected.

Note to others: The gizmo is only displayed when the node is selected, so it won't be too intrusive in complex 3D scenes.

@CrayolaEater CrayolaEater force-pushed the feature/custom-aabb-gizmos branch 2 times, most recently from c6ab16d to fff8ed6 Compare April 18, 2024 16:18
@CrayolaEater CrayolaEater requested a review from a team as a code owner April 18, 2024 16:18
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

Looks great to me! I just left a suggestion to fill in the docs. We like to have documentation whenever we add a new feature.

The final step before merging is to squash all the commits together so that the whole PR only contains 1 big commit with all your changes. We like to merge one commit at a time to keep the git history clean and navigable.

If you don't know how to do that, we have a helpful tutorial in the official documentation https://docs.godotengine.org/en/latest/community/contributing/pr_workflow.html#the-interactive-rebase

doc/classes/EditorSettings.xml Outdated Show resolved Hide resolved
@CrayolaEater CrayolaEater force-pushed the feature/custom-aabb-gizmos branch 3 times, most recently from 75a8d05 to a454c87 Compare April 18, 2024 23:29
@CrayolaEater CrayolaEater force-pushed the feature/custom-aabb-gizmos branch from a454c87 to 8caa1b8 Compare April 18, 2024 23:32
@akien-mga akien-mga merged commit 1bd6fe8 into godotengine:master Apr 19, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

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.

5 participants