diff options
author | Vilém Duha <vilda.novak@gmail.com> | 2020-01-04 20:32:48 +0300 |
---|---|---|
committer | Vilém Duha <vilda.novak@gmail.com> | 2020-01-07 13:43:43 +0300 |
commit | bca0c536b69f9f86a7258be88d2af0a781f7c7bb (patch) | |
tree | 3ed24c480ad7edd65b879a490cecb1b192102a33 /blenderkit/autothumb.py | |
parent | f272cf57a5ce7538ea01a16b88d7a0ec297e311d (diff) |
BlenderKit: move process flags creation to utils
Diffstat (limited to 'blenderkit/autothumb.py')
-rw-r--r-- | blenderkit/autothumb.py | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/blenderkit/autothumb.py b/blenderkit/autothumb.py index 4be82f29..32dbb17b 100644 --- a/blenderkit/autothumb.py +++ b/blenderkit/autothumb.py @@ -32,13 +32,6 @@ import bpy BLENDERKIT_EXPORT_DATA_FILE = "data.json" -ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000 -BELOW_NORMAL_PRIORITY_CLASS = 0x00004000 -HIGH_PRIORITY_CLASS = 0x00000080 -IDLE_PRIORITY_CLASS = 0x00000040 -NORMAL_PRIORITY_CLASS = 0x00000020 -REALTIME_PRIORITY_CLASS = 0x00000100 - def check_thumbnail(props, imgpath): img = utils.get_hidden_image(imgpath, 'upload_preview', force_reload=True) @@ -147,10 +140,7 @@ def start_thumbnailer(self, context): "thumbnail_denoising": bkit.thumbnail_denoising, }, s) - flags = BELOW_NORMAL_PRIORITY_CLASS - if sys.platform != 'win32': # TODO test this on windows and find out how to change process priority on linux - # without psutil - we don't want any more libs in the addon - flags = 0 + proc = subprocess.Popen([ binary_path, @@ -159,7 +149,7 @@ def start_thumbnailer(self, context): tfpath, "--python", os.path.join(script_path, "autothumb_model_bg.py"), "--", datafile, filepath, thumb_path, tempdir - ], bufsize=1, stdout=subprocess.PIPE, stdin=subprocess.PIPE, creationflags=flags) + ], bufsize=1, stdout=subprocess.PIPE, stdin=subprocess.PIPE, creationflags=utils.get_process_flags()) eval_path_computing = "bpy.data.objects['%s'].blenderkit.is_generating_thumbnail" % mainmodel.name eval_path_state = "bpy.data.objects['%s'].blenderkit.thumbnail_generating_state" % mainmodel.name @@ -225,9 +215,6 @@ def start_material_thumbnailer(self, context): "texture_size_meters": bkit.texture_size_meters, }, s) - flags = BELOW_NORMAL_PRIORITY_CLASS - if sys.platform != 'win32': # TODO test this on windows - flags = 0 proc = subprocess.Popen([ binary_path, @@ -236,7 +223,7 @@ def start_material_thumbnailer(self, context): tfpath, "--python", os.path.join(script_path, "autothumb_material_bg.py"), "--", datafile, filepath, thumb_path, tempdir - ], bufsize=1, stdout=subprocess.PIPE, stdin=subprocess.PIPE, creationflags=flags) + ], bufsize=1, stdout=subprocess.PIPE, stdin=subprocess.PIPE, creationflags=utils.get_process_flags()) eval_path_computing = "bpy.data.materials['%s'].blenderkit.is_generating_thumbnail" % mat.name eval_path_state = "bpy.data.materials['%s'].blenderkit.thumbnail_generating_state" % mat.name |