You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Fix zero scaling and material mappings being mapped to wrong fields
- fixes scale values of 0.0013 (det == 0.00004) not rendering, they should render even at small values, but not at zero like the editor grid plugin supplies zero exactly. - fixes node_3d_editor_plugin visibility bug when scale is zero - fix culling with small scaling values - which are still valid to be rendered like 0.00004 note: grid is still not fixed, it has det == 0 issues but this fixes one of them.
This commit is contained in:
@@ -3321,6 +3321,21 @@ void Node3DEditorViewport::update_transform_gizmo_view() {
|
||||
|
||||
xform.basis.scale(scale);
|
||||
|
||||
// if the determinant is zero, we should disable the gizmo from being rendered
|
||||
// this prevents supplying bad values to the renderer and then having to filter it out again
|
||||
if (xform.basis.determinant() == 0) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
RenderingServer::get_singleton()->instance_set_visible(move_gizmo_instance[i], false);
|
||||
RenderingServer::get_singleton()->instance_set_visible(move_plane_gizmo_instance[i], false);
|
||||
RenderingServer::get_singleton()->instance_set_visible(rotate_gizmo_instance[i], false);
|
||||
RenderingServer::get_singleton()->instance_set_visible(scale_gizmo_instance[i], false);
|
||||
RenderingServer::get_singleton()->instance_set_visible(scale_plane_gizmo_instance[i], false);
|
||||
}
|
||||
// Rotation white outline
|
||||
RenderingServer::get_singleton()->instance_set_visible(rotate_gizmo_instance[3], false);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
RenderingServer::get_singleton()->instance_set_transform(move_gizmo_instance[i], xform);
|
||||
RenderingServer::get_singleton()->instance_set_visible(move_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_MOVE));
|
||||
|
||||
Reference in New Issue
Block a user