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>2021-04-05 20:03:10 +0300
committerVilém Duha <vilda.novak@gmail.com>2021-04-05 20:03:10 +0300
commit414f63669ff475d044a1d907326d78cad77fbefd (patch)
tree6ded9c46086fe65fbdea75bfe6f4f1834a7c0278 /blenderkit/upload.py
parent08e9ab150d105ba4de2b977b94ab794efd6fd1f2 (diff)
BlenderKit: fix poll of Fast metadata edit and rating operators
previous fix broke other use cases (in panels and in BGL element)
Diffstat (limited to 'blenderkit/upload.py')
-rw-r--r--blenderkit/upload.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/blenderkit/upload.py b/blenderkit/upload.py
index 284d6359..b2395f68 100644
--- a/blenderkit/upload.py
+++ b/blenderkit/upload.py
@@ -596,6 +596,11 @@ class FastMetadata(bpy.types.Operator):
description="Unique name of the asset (hidden)",
default=""
)
+ asset_type: StringProperty(
+ name="Asset Type",
+ description="Asset Type",
+ default=""
+ )
name: StringProperty(
name="Name",
description="Main name of the asset",
@@ -658,7 +663,7 @@ class FastMetadata(bpy.types.Operator):
def poll(cls, context):
scene = bpy.context.scene
ui_props = scene.blenderkitUI
- return can_edit_asset(active_index=ui_props.active_index)
+ return True
def draw(self, context):
layout = self.layout
@@ -717,9 +722,9 @@ class FastMetadata(bpy.types.Operator):
sr = bpy.context.window_manager['search results']
asset_data = dict(sr[ui_props.active_index])
else:
- for result in bpy.context.window_manager['search results']:
- if result['id'] == self.asset_id:
- asset_data = dict(result)
+
+ active_asset = utils.get_active_asset_by_type(asset_type = self.asset_type)
+ asset_data = active_asset.get('asset_data')
if not can_edit_asset(asset_data=asset_data):
return {'CANCELLED'}