[Bf-extensions-cvs] [bca0c536] master: BlenderKit: move process flags creation to utils

Vilém Duha noreply at git.blender.org
Tue Jan 7 11:43:57 CET 2020


Commit: bca0c536b69f9f86a7258be88d2af0a781f7c7bb
Author: Vilém Duha
Date:   Sat Jan 4 18:32:48 2020 +0100
Branches: master
https://developer.blender.org/rBAbca0c536b69f9f86a7258be88d2af0a781f7c7bb

BlenderKit: move process flags creation to utils

===================================================================

M	blenderkit/autothumb.py

===================================================================

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



More information about the Bf-extensions-cvs mailing list