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:
-rw-r--r--pose_library/functions.py25
-rw-r--r--pose_library/operators.py4
-rw-r--r--pose_library/pose_creation.py4
3 files changed, 6 insertions, 27 deletions
diff --git a/pose_library/functions.py b/pose_library/functions.py
index bb32e669..d2e210a7 100644
--- a/pose_library/functions.py
+++ b/pose_library/functions.py
@@ -21,34 +21,11 @@ Pose Library - functions.
"""
from pathlib import Path
-from typing import Any, List, Set, cast, Iterable
+from typing import Any, List, Iterable
Datablock = Any
import bpy
-from bpy.types import (
- Context,
-)
-
-
-def asset_mark(context: Context, datablock: Any) -> Set[str]:
- asset_mark_ctx = {
- **context.copy(),
- "id": datablock,
- }
- return cast(Set[str], bpy.ops.asset.mark(asset_mark_ctx))
-
-
-def asset_clear(context: Context, datablock: Any) -> Set[str]:
- asset_clear_ctx = {
- **context.copy(),
- "id": datablock,
- }
- result = bpy.ops.asset.clear(asset_clear_ctx)
- assert isinstance(result, set)
- if "FINISHED" in result:
- datablock.use_fake_user = False
- return result
def load_assets_from(filepath: Path) -> List[Datablock]:
diff --git a/pose_library/operators.py b/pose_library/operators.py
index c8c2c070..008aceda 100644
--- a/pose_library/operators.py
+++ b/pose_library/operators.py
@@ -216,7 +216,9 @@ class POSELIB_OT_copy_as_asset(PoseAssetCreator, Operator):
filepath = self.save_datablock(asset)
- functions.asset_clear(context, asset)
+ # The asset has been saved to disk, so to clean up it has to loose its asset & fake user status.
+ asset.asset_clear()
+ asset.use_fake_user = False
if asset.users > 0:
self.report({"ERROR"}, "Unexpected non-null user count for the asset")
return {"FINISHED"}
diff --git a/pose_library/pose_creation.py b/pose_library/pose_creation.py
index 79efcae4..ac08b776 100644
--- a/pose_library/pose_creation.py
+++ b/pose_library/pose_creation.py
@@ -305,7 +305,7 @@ def create_pose_asset(
) -> Optional[Action]:
"""Create a single-frame Action containing only the pose of the given bones.
- DOES mark as asset, DOES NOT add asset metadata.
+ DOES mark as asset, DOES NOT configure asset metadata.
"""
creator = PoseActionCreator(params)
@@ -313,7 +313,7 @@ def create_pose_asset(
if pose_action is None:
return None
- functions.asset_mark(context, pose_action)
+ pose_action.asset_mark()
return pose_action