Files
Nexus/2023/scripts/rigging_tools/ngskintools2/ui/ui_lock.py
2025-11-24 08:27:50 +08:00

24 lines
508 B
Python

import functools
from ngSkinTools2.api.python_compatibility import Object
class UiLock(Object):
def __init__(self):
self.updating = False
def __enter__(self):
self.updating = True
def skip_if_updating(self, fn):
@functools.wraps(fn)
def wrapper(*args, **kwargs):
if self.updating:
return
return fn(*args, **kwargs)
return wrapper
def __exit__(self, _type, value, traceback):
self.updating = False