Skip to content

Commit

Permalink
feat: add option to lock overlay pin state and position across all op…
Browse files Browse the repository at this point in the history
…erators
  • Loading branch information
tristan-hm committed Apr 25, 2022
1 parent a1125e7 commit 0ce0dd7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
24 changes: 24 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,26 @@ class NDPreferences(AddonPreferences):
default=True,
)

lock_overlay_pinning: BoolProperty(
name="Lock Overlay Pinning",
default=False,
)

overlay_pinned: BoolProperty(
name="Overlay Pinned",
default=False,
)

overlay_pin_x: IntProperty(
name="Overlay Pin X Coordinate",
default=0,
)

overlay_pin_y: IntProperty(
name="Overlay Pin Y Coordinate",
default=0,
)

axis_base_thickness: FloatProperty(
name="Axis Base Thickness",
default=2,
Expand Down Expand Up @@ -210,6 +230,10 @@ def draw_ui(self, box):
column = box.column(align=True)
row = column.row()
row.prop(self, "enable_quick_favourites")

column = box.column(align=True)
row = column.row()
row.prop(self, "lock_overlay_pinning")

column = box.column(align=True)
row = column.row()
Expand Down
10 changes: 10 additions & 0 deletions lib/overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ def toggle_pin_overlay(cls, event):

cls.pin_overlay = not cls.pin_overlay

if get_preferences().lock_overlay_pinning:
get_preferences().overlay_pinned = cls.pin_overlay
get_preferences().overlay_pin_x = cls.overlay_x
get_preferences().overlay_pin_y = cls.overlay_y


def toggle_operator_passthrough(cls):
cls.operator_passthrough = not cls.operator_passthrough
Expand All @@ -62,6 +67,11 @@ def init_overlay(cls, event):
cls.operator_passthrough = False
cls.mouse_warped = False

if get_preferences().lock_overlay_pinning:
cls.pin_overlay = get_preferences().overlay_pinned
cls.overlay_x = get_preferences().overlay_pin_x
cls.overlay_y = get_preferences().overlay_pin_y


def update_overlay(cls, context, event):
if not cls.pin_overlay:
Expand Down

0 comments on commit 0ce0dd7

Please sign in to comment.