Fix empty CSGShape error
This commit is contained in:
parent
5942a70596
commit
decdf4fcbc
1 changed files with 20 additions and 16 deletions
|
@ -317,27 +317,16 @@ bool CSGShapeSpatialGizmoPlugin::is_selectable_when_hidden() const {
|
||||||
|
|
||||||
void CSGShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
void CSGShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
||||||
|
|
||||||
CSGShape *cs = Object::cast_to<CSGShape>(p_gizmo->get_spatial_node());
|
|
||||||
|
|
||||||
p_gizmo->clear();
|
p_gizmo->clear();
|
||||||
|
|
||||||
Ref<Material> material;
|
CSGShape *cs = Object::cast_to<CSGShape>(p_gizmo->get_spatial_node());
|
||||||
switch (cs->get_operation()) {
|
|
||||||
case CSGShape::OPERATION_UNION:
|
|
||||||
material = get_material("shape_union_material", p_gizmo);
|
|
||||||
break;
|
|
||||||
case CSGShape::OPERATION_INTERSECTION:
|
|
||||||
material = get_material("shape_intersection_material", p_gizmo);
|
|
||||||
break;
|
|
||||||
case CSGShape::OPERATION_SUBTRACTION:
|
|
||||||
material = get_material("shape_subtraction_material", p_gizmo);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ref<Material> handles_material = get_material("handles");
|
|
||||||
|
|
||||||
PoolVector<Vector3> faces = cs->get_brush_faces();
|
PoolVector<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);
|
||||||
{
|
{
|
||||||
|
@ -353,6 +342,21 @@ void CSGShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ref<Material> material;
|
||||||
|
switch (cs->get_operation()) {
|
||||||
|
case CSGShape::OPERATION_UNION:
|
||||||
|
material = get_material("shape_union_material", p_gizmo);
|
||||||
|
break;
|
||||||
|
case CSGShape::OPERATION_INTERSECTION:
|
||||||
|
material = get_material("shape_intersection_material", p_gizmo);
|
||||||
|
break;
|
||||||
|
case CSGShape::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…
Add table
Reference in a new issue