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:
authorSybren A. Stüvel <sybren@blender.org>2021-10-05 11:13:02 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-10-05 11:13:02 +0300
commit2fee3336a85ac5d5fb7c7765cd8ae2aa4e7621ac (patch)
tree29370a247279051a5e91b4233584ff594916bafc /pose_library/operators.py
parent1f38515d87fb78443f2ead17b4e95411f43dc1b2 (diff)
Pose Library: avoid breakage due to changes in the asset browser
Asset browser moved from Categories (the big, fixed buttons) to Catalogs (the tree-based, user-creatable organisation system). This required some changes to the Pose Library code, as that was still expecting to be able to use the categories system. The entire workflow has to be looked at better, but at least now it's not broken anymore.
Diffstat (limited to 'pose_library/operators.py')
-rw-r--r--pose_library/operators.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/pose_library/operators.py b/pose_library/operators.py
index c0c8b332..3b038709 100644
--- a/pose_library/operators.py
+++ b/pose_library/operators.py
@@ -106,9 +106,7 @@ class POSELIB_OT_create_pose_asset(PoseAssetCreator, Operator):
This makes it possible to immediately check & edit the created pose asset.
"""
- asset_browse_area: Optional[bpy.types.Area] = asset_browser.area_for_category(
- context.screen, "ANIMATION"
- )
+ asset_browse_area: Optional[bpy.types.Area] = asset_browser.biggest_asset_browser_area(context.screen)
if not asset_browse_area:
return
@@ -277,9 +275,17 @@ class POSELIB_OT_paste_asset(Operator):
self.report({"INFO"}, "Pasted %d assets" % len(assets))
bpy.ops.file.refresh()
- asset_browser_area = asset_browser.area_from_context(context, 'ANIMATIONS')
- if asset_browser_area:
- asset_browser.activate_asset(assets[0], asset_browser_area, deferred=True)
+
+ asset_browser_area = asset_browser.area_from_context(context)
+ if not asset_browser_area:
+ return {"FINISHED"}
+
+ # Assign same catalog as in asset browser.
+ catalog_id = asset_browser.active_catalog_id(asset_browser_area)
+ for asset in assets:
+ print(f"{asset}.asset_data.catalog_id = {catalog_id}")
+ asset.asset_data.catalog_id = catalog_id
+ asset_browser.activate_asset(assets[0], asset_browser_area, deferred=True)
return {"FINISHED"}