diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-10-26 19:53:40 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-10-26 19:56:13 +0300 |
commit | eaed38cbd3372024408bab644c99559be56c8958 (patch) | |
tree | d403d11fb7679e2611cff237f2b53beec7e38ca7 /release/scripts/startup/bl_ui/space_view3d.py | |
parent | 730de2e7fd33cf6d529aab6846d0a0d509806627 (diff) |
Add Assets menu to 3D View's Object menu
In the 3D Viewport, add an "Assets" submenu to the Objects menu, for the
same operators as available in the outliner: Mark as Asset, Clear Asset,
Clear Asset (Set Fake User).
Since object assets are still considered experimental, the menu is only
shown when the Extended Asset Browser experimental feature is enabled.
Diffstat (limited to 'release/scripts/startup/bl_ui/space_view3d.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 1c2190bb7a0..07ca3a27392 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2265,6 +2265,7 @@ class VIEW3D_MT_object(Menu): layout.separator() + layout.menu("VIEW3D_MT_object_asset") layout.menu("VIEW3D_MT_object_parent") layout.menu("VIEW3D_MT_object_collection") layout.menu("VIEW3D_MT_object_relations") @@ -2758,6 +2759,21 @@ class VIEW3D_MT_object_cleanup(Menu): layout.operator("object.material_slot_remove_unused", text="Remove Unused Material Slots") +class VIEW3D_MT_object_asset(Menu): + bl_label = "Asset" + + @classmethod + def poll(cls, context): + # TODO(Sybren): once object assets are no longer considered experimental, remove this poll function. + return context.preferences.experimental.use_extended_asset_browser + + def draw(self, _context): + layout = self.layout + + layout.operator("asset.mark") + layout.operator("asset.clear", text="Clear Asset").set_fake_user = False + layout.operator("asset.clear", text="Clear Asset (Set Fake User)").set_fake_user = True + class VIEW3D_MT_make_single_user(Menu): bl_label = "Make Single User" @@ -7541,6 +7557,7 @@ classes = ( VIEW3D_MT_image_add, VIEW3D_MT_object, VIEW3D_MT_object_animation, + VIEW3D_MT_object_asset, VIEW3D_MT_object_rigid_body, VIEW3D_MT_object_clear, VIEW3D_MT_object_context_menu, |