summaryrefslogtreecommitdiff
path: root/modules/csg
diff options
context:
space:
mode:
Diffstat (limited to 'modules/csg')
-rw-r--r--modules/csg/csg_gizmos.cpp45
-rw-r--r--modules/csg/csg_shape.cpp20
2 files changed, 48 insertions, 17 deletions
diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/csg_gizmos.cpp
index fa176cb94e..a859ef80a6 100644
--- a/modules/csg/csg_gizmos.cpp
+++ b/modules/csg/csg_gizmos.cpp
@@ -90,9 +90,12 @@ Variant CSGShape3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int
CSGBox3D *s = Object::cast_to<CSGBox3D>(cs);
switch (p_idx) {
- case 0: return s->get_width();
- case 1: return s->get_height();
- case 2: return s->get_depth();
+ case 0:
+ return s->get_width();
+ case 1:
+ return s->get_height();
+ case 2:
+ return s->get_depth();
}
}
@@ -157,9 +160,15 @@ void CSGShape3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Ca
d = 0.001;
switch (p_idx) {
- case 0: s->set_width(d * 2); break;
- case 1: s->set_height(d * 2); break;
- case 2: s->set_depth(d * 2); break;
+ case 0:
+ s->set_width(d * 2);
+ break;
+ case 1:
+ s->set_height(d * 2);
+ break;
+ case 2:
+ s->set_depth(d * 2);
+ break;
}
}
@@ -229,9 +238,15 @@ void CSGShape3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx,
CSGBox3D *s = Object::cast_to<CSGBox3D>(cs);
if (p_cancel) {
switch (p_idx) {
- case 0: s->set_width(p_restore); break;
- case 1: s->set_height(p_restore); break;
- case 2: s->set_depth(p_restore); break;
+ case 0:
+ s->set_width(p_restore);
+ break;
+ case 1:
+ s->set_height(p_restore);
+ break;
+ case 2:
+ s->set_depth(p_restore);
+ break;
}
return;
}
@@ -241,9 +256,15 @@ void CSGShape3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx,
static const char *method[3] = { "set_width", "set_height", "set_depth" };
float current = 0;
switch (p_idx) {
- case 0: current = s->get_width(); break;
- case 1: current = s->get_height(); break;
- case 2: current = s->get_depth(); break;
+ case 0:
+ current = s->get_width();
+ break;
+ case 1:
+ current = s->get_height();
+ break;
+ case 2:
+ current = s->get_depth();
+ break;
}
ur->add_do_method(s, method[p_idx], current);
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index 96f82ab21b..701c45a5d7 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -185,9 +185,15 @@ CSGBrush *CSGShape3D::_get_brush() {
CSGBrushOperation bop;
switch (child->get_operation()) {
- case CSGShape3D::OPERATION_UNION: bop.merge_brushes(CSGBrushOperation::OPERATION_UNION, *n, *nn2, *nn, snap); break;
- case CSGShape3D::OPERATION_INTERSECTION: bop.merge_brushes(CSGBrushOperation::OPERATION_INTERSECTION, *n, *nn2, *nn, snap); break;
- case CSGShape3D::OPERATION_SUBTRACTION: bop.merge_brushes(CSGBrushOperation::OPERATION_SUBSTRACTION, *n, *nn2, *nn, snap); break;
+ case CSGShape3D::OPERATION_UNION:
+ bop.merge_brushes(CSGBrushOperation::OPERATION_UNION, *n, *nn2, *nn, snap);
+ break;
+ case CSGShape3D::OPERATION_INTERSECTION:
+ bop.merge_brushes(CSGBrushOperation::OPERATION_INTERSECTION, *n, *nn2, *nn, snap);
+ break;
+ case CSGShape3D::OPERATION_SUBTRACTION:
+ bop.merge_brushes(CSGBrushOperation::OPERATION_SUBSTRACTION, *n, *nn2, *nn, snap);
+ break;
}
memdelete(n);
memdelete(nn2);
@@ -1830,8 +1836,12 @@ CSGBrush *CSGPolygon3D::_build_brush() {
int face_count = 0;
switch (mode) {
- case MODE_DEPTH: face_count = triangles.size() * 2 / 3 + (final_polygon.size()) * 2; break;
- case MODE_SPIN: face_count = (spin_degrees < 360 ? triangles.size() * 2 / 3 : 0) + (final_polygon.size()) * 2 * spin_sides; break;
+ case MODE_DEPTH:
+ face_count = triangles.size() * 2 / 3 + (final_polygon.size()) * 2;
+ break;
+ case MODE_SPIN:
+ face_count = (spin_degrees < 360 ? triangles.size() * 2 / 3 : 0) + (final_polygon.size()) * 2 * spin_sides;
+ break;
case MODE_PATH: {
float bl = curve->get_baked_length();
int splits = MAX(2, Math::ceil(bl / path_interval));