Skip to content

Commit

Permalink
Fixed edge selector synthesis crash
Browse files Browse the repository at this point in the history
  • Loading branch information
jmwright committed Aug 9, 2022
1 parent 93f7fea commit ecd6312
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
8 changes: 4 additions & 4 deletions GUI.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -1470,10 +1470,10 @@ margin_right = 315.0
margin_bottom = 517.0

[node name="ColorPicker" type="ColorPicker" parent="ColorPickerDialog/PanelContainer/VBoxContainer"]
margin_left = 136.0
margin_top = 136.0
margin_right = 444.0
margin_bottom = 598.0
margin_left = 148.0
margin_top = 148.0
margin_right = 456.0
margin_bottom = 610.0

[node name="OkButton" type="Button" parent="ColorPickerDialog/PanelContainer/VBoxContainer"]
margin_top = 466.0
Expand Down
5 changes: 4 additions & 1 deletion lib/cqgi_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,10 @@ def tess(self, shape, cq_shape):
min = shape.BoundingBox().zlen

# Use factors of 10 of the ratio of the min and max to set the edge line thickness
ratio = min / max
if min > 0 and max > 0:
ratio = min / max
else:
ratio = -1
if ratio > 0 and ratio <= 10:
diag = max * 0.005
elif ratio > 10 and ratio <= 100:
Expand Down
8 changes: 7 additions & 1 deletion lib/synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def synthesize_edge_sel(self, selector_type, selected_edges, selected_edge_types
for see in selected_edge_ends:
sel_edge_ends.append((see.x, see.y, see.z))
for sen in selected_normals:
sel_normals.append((sen.x, sen.y, sen.z))
if sen != None:
sel_normals.append((sen.x, sen.y, sen.z))
for os in other_edge_starts:
other_starts.append((os.x, os.y, os.z))
for oe in other_edge_ends:
Expand All @@ -76,6 +77,11 @@ def synthesize_edge_sel(self, selector_type, selected_edges, selected_edge_types
other_meta_temp[str(om_inner)] = bool(om[om_inner])
other_meta.append(other_meta_temp)

# Workaround for mismatch in size between start and normal arrays
if len(other_edge_starts) != len(other_norms):
for i in range(len(other_norms), len(other_edge_starts)):
other_norms.append((0, 0, 0))

# Synthesize the selector
res = vector_based_synth.synthesize(str(selector_type), selected_edges=sel_edges, selected_edge_types=sel_edge_types, selected_edge_starts=sel_edge_starts, selected_edge_ends=sel_edge_ends, selected_edge_normals=sel_normals, other_edge_starts=other_starts, other_edge_ends=other_ends, other_edge_meta=other_meta, other_normals=other_norms)

Expand Down

0 comments on commit ecd6312

Please sign in to comment.