Skip to content

Commit 30f1274

Browse files
committed
Fix crashing bug on empty transforms within CSG hierarchies
1 parent 042eac3 commit 30f1274

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/flitter/render/window/canvas3d.pyx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ cdef Model get_model(Node node, bint top):
451451
cdef Vector origin, normal, function, minimum, maximum, vertices, faces
452452
cdef double snap_angle, resolution
453453
cdef str mapping, filename
454+
cdef list models
454455
if node.kind is 'box':
455456
model = Model._box(node.get_str('uv_map', 'standard'))
456457
elif node.kind is 'sphere':
@@ -471,7 +472,15 @@ cdef Model get_model(Node node, bint top):
471472
model = model.repair()
472473
elif not top and node.kind is 'transform':
473474
transform_matrix = update_transform_matrix(node, IdentityTransform)
474-
model = Model._boolean('union', [get_model(child, False)._transform(transform_matrix) for child in node._children], 0, 0, 0)
475+
models = []
476+
for child in node._children:
477+
model = get_model(child, False)
478+
if model is not None:
479+
models.append(model._transform(transform_matrix))
480+
if models:
481+
model = Model._boolean('union', models, 0, 0, 0)
482+
else:
483+
model = None
475484
elif node.kind is 'trim' or node.kind is 'slice':
476485
normal = node.get_fvec('normal', 3, null_)
477486
origin = node.get_fvec('origin', 3, Zero3)

0 commit comments

Comments
 (0)