Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVilém Duha <vilda.novak@gmail.com>2020-01-04 21:42:10 +0300
committerVilém Duha <vilda.novak@gmail.com>2020-01-07 13:43:44 +0300
commit46fb3ac3a1990c6eaea0274c4987bf14de674a2b (patch)
tree2ea69404b372e12741cd2f4432787eed3d0a58bd /blenderkit/upload.py
parent1a1fd78cd18a4e80bb53c1c580c98c8fa73522f1 (diff)
BlenderKit: replace bpy.context.active_object with bpy.context.view_layer.objects.active everywhere. This gives much less issues with context in queue.
Diffstat (limited to 'blenderkit/upload.py')
-rw-r--r--blenderkit/upload.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/blenderkit/upload.py b/blenderkit/upload.py
index 4b02d321..44bbb313 100644
--- a/blenderkit/upload.py
+++ b/blenderkit/upload.py
@@ -486,13 +486,13 @@ def get_upload_location(props):
scene = bpy.context.scene
ui_props = scene.blenderkitUI
if ui_props.asset_type == 'MODEL':
- if bpy.context.active_object is not None:
+ if bpy.context.view_layer.objects.active is not None:
ob = utils.get_active_model()
return ob.location
if ui_props.asset_type == 'SCENE':
return None
elif ui_props.asset_type == 'MATERIAL':
- if bpy.context.active_object is not None and bpy.context.active_object.active_material is not None:
+ if bpy.context.view_layer.objects.active is not None and bpy.context.active_object.active_material is not None:
return bpy.context.active_object.location
elif ui_props.asset_type == 'TEXTURE':
return None
@@ -740,7 +740,7 @@ class UploadOperator(Operator):
@classmethod
def poll(cls, context):
- return bpy.context.active_object is not None
+ return bpy.context.view_layer.objects.active is not None
def execute(self, context):
bpy.ops.object.blenderkit_auto_tags()