Merge pull request #48172 from madmiraal/fix-empty-csgshape-error
Fix new `CSGMesh` errors
This commit is contained in:
commit
f6e5ea774b
1 changed files with 20 additions and 16 deletions
|
@ -292,27 +292,16 @@ bool CSGShape3DGizmoPlugin::is_selectable_when_hidden() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSGShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
void CSGShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
||||||
CSGShape3D *cs = Object::cast_to<CSGShape3D>(p_gizmo->get_spatial_node());
|
|
||||||
|
|
||||||
p_gizmo->clear();
|
p_gizmo->clear();
|
||||||
|
|
||||||
Ref<Material> material;
|
CSGShape3D *cs = Object::cast_to<CSGShape3D>(p_gizmo->get_spatial_node());
|
||||||
switch (cs->get_operation()) {
|
|
||||||
case CSGShape3D::OPERATION_UNION:
|
|
||||||
material = get_material("shape_union_material", p_gizmo);
|
|
||||||
break;
|
|
||||||
case CSGShape3D::OPERATION_INTERSECTION:
|
|
||||||
material = get_material("shape_intersection_material", p_gizmo);
|
|
||||||
break;
|
|
||||||
case CSGShape3D::OPERATION_SUBTRACTION:
|
|
||||||
material = get_material("shape_subtraction_material", p_gizmo);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ref<Material> handles_material = get_material("handles");
|
|
||||||
|
|
||||||
Vector<Vector3> faces = cs->get_brush_faces();
|
Vector<Vector3> faces = cs->get_brush_faces();
|
||||||
|
|
||||||
|
if (faces.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Vector<Vector3> lines;
|
Vector<Vector3> lines;
|
||||||
lines.resize(faces.size() * 2);
|
lines.resize(faces.size() * 2);
|
||||||
{
|
{
|
||||||
|
@ -328,6 +317,21 @@ void CSGShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ref<Material> material;
|
||||||
|
switch (cs->get_operation()) {
|
||||||
|
case CSGShape3D::OPERATION_UNION:
|
||||||
|
material = get_material("shape_union_material", p_gizmo);
|
||||||
|
break;
|
||||||
|
case CSGShape3D::OPERATION_INTERSECTION:
|
||||||
|
material = get_material("shape_intersection_material", p_gizmo);
|
||||||
|
break;
|
||||||
|
case CSGShape3D::OPERATION_SUBTRACTION:
|
||||||
|
material = get_material("shape_subtraction_material", p_gizmo);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ref<Material> handles_material = get_material("handles");
|
||||||
|
|
||||||
p_gizmo->add_lines(lines, material);
|
p_gizmo->add_lines(lines, material);
|
||||||
p_gizmo->add_collision_segments(lines);
|
p_gizmo->add_collision_segments(lines);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue