Skip to content

Commit

Permalink
feat: ensure cutter bolts are clearly visible in the viewport, includ…
Browse files Browse the repository at this point in the history
…ing their depth into the target
  • Loading branch information
tristan-hm committed Jan 24, 2022
1 parent bde234c commit d6d08f2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bolt.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def invoke(self, context, event):
self.add_displace_modifier()
self.add_solidify_modifier()
self.align_object_to_3d_cursor(context)
self.set_cutter_visibility(context)

init_overlay(self, event)
register_draw_handler(self, draw_text_callback, "nd_draw_bolt")
Expand Down Expand Up @@ -108,10 +109,16 @@ def add_object(self, context):
bpy.ops.object.shade_smooth()
obj.data.use_auto_smooth = True
obj.data.auto_smooth_angle = radians(30)

self.obj = obj


def set_cutter_visibility(self, context):
if len(context.selected_objects) > 1:
self.obj.show_in_front = True
self.obj.color[3] = 0.2


def add_screw_x_modifier(self):
screwX = self.obj.modifiers.new("ND — Radius", 'SCREW')
screwX.axis = 'X'
Expand Down Expand Up @@ -169,6 +176,9 @@ def align_object_to_3d_cursor(self, context):
def handle_optional_boolean_ops(self, context):
if len(context.selected_objects) > 1:
self.obj.display_type = 'WIRE'
self.obj.show_in_front = False
self.obj.color[3] = 1.0

targets = [o for o in context.selected_objects if not (o == self.obj)]

for target in targets:
Expand Down

0 comments on commit d6d08f2

Please sign in to comment.