diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2021-06-08 15:43:01 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2021-06-08 15:43:01 +0300 |
commit | 676f154013b789cd573fd16eb5f007c0a77bd0d3 (patch) | |
tree | 2e1f2d719b2a772229b6d8cf6d69e5d6a759d90e | |
parent | 440208bbb3c3cdd842295a1a41ce272d4893ac53 (diff) |
Move `Workspace` and `WindowManager` properties to poselib add-on
Move `WorkSpace.active_pose_asset_index` and `WindowManager.pose_assets`
from Blender to the Pose Library add-on. Since that add-on is the only
code using them, they belong there.
-rw-r--r-- | pose_library/gui.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pose_library/gui.py b/pose_library/gui.py index e7bf99e2..7bdeac42 100644 --- a/pose_library/gui.py +++ b/pose_library/gui.py @@ -22,9 +22,12 @@ Pose Library mockup GUI definition. import bpy from bpy.types import ( + AssetHandle, Context, Panel, UIList, + WindowManager, + WorkSpace, ) from bpy_extras import asset_utils @@ -185,6 +188,15 @@ _register, _unregister = bpy.utils.register_classes_factory(classes) def register() -> None: _register() + WorkSpace.active_pose_asset_index = bpy.props.IntProperty( + name="Active Pose Asset", + # TODO explain which list the index belongs to, or how it can be used to get the pose. + description="Per workspace index of the active pose asset" + ) + # Register for window-manager. This is a global property that shouldn't be + # written to files. + WindowManager.pose_assets = bpy.props.CollectionProperty(type=AssetHandle) + bpy.types.UI_MT_list_item_context_menu.prepend(pose_library_list_item_context_menu) bpy.types.FILEBROWSER_MT_context_menu.prepend(pose_library_list_item_context_menu) @@ -192,5 +204,8 @@ def register() -> None: def unregister() -> None: _unregister() + del WorkSpace.active_pose_asset_index + del WindowManager.pose_assets + bpy.types.UI_MT_list_item_context_menu.remove(pose_library_list_item_context_menu) bpy.types.FILEBROWSER_MT_context_menu.remove(pose_library_list_item_context_menu) |