move execution_queue in butils, cleanup
This commit is contained in:
parent
07c38fcdaf
commit
d7a73116fd
2 changed files with 34 additions and 40 deletions
14
butils.py
14
butils.py
|
@ -1,5 +1,6 @@
|
|||
import bpy
|
||||
import mathutils
|
||||
import queue
|
||||
import importlib
|
||||
|
||||
# then import dependencies for our addon
|
||||
|
@ -13,6 +14,19 @@ if "utils" in locals():
|
|||
else:
|
||||
from .common import utils
|
||||
|
||||
execution_queue = queue.Queue()
|
||||
|
||||
# This function can safely be called in another thread.
|
||||
# The function will be executed when the timer runs the next time.
|
||||
def run_in_main_thread(function):
|
||||
execution_queue.put(function)
|
||||
|
||||
def execute_queued_functions():
|
||||
while not execution_queue.empty():
|
||||
function = execution_queue.get()
|
||||
function()
|
||||
return 1.0
|
||||
|
||||
def apply_all_transforms(obj):
|
||||
mb = obj.matrix_basis
|
||||
if hasattr(obj.data, "transform"):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue