From eaed38cbd3372024408bab644c99559be56c8958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 26 Oct 2021 18:53:40 +0200 Subject: 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. --- release/scripts/startup/bl_ui/space_view3d.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'release/scripts/startup/bl_ui/space_view3d.py') 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, -- cgit v1.2.3 From 6871f8482b03f13b94171dcbb1211b00802bb9bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 26 Oct 2021 19:26:57 +0200 Subject: 3D View, Objects menu: Always show Assets sub-menu Now that object assets are no longer considered experimental, the Assets submenu can always be shown (regardless of the Extended Asset Browser experimental feature). --- release/scripts/startup/bl_ui/space_view3d.py | 5 ----- 1 file changed, 5 deletions(-) (limited to 'release/scripts/startup/bl_ui/space_view3d.py') diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 07ca3a27392..0172fa0655f 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2762,11 +2762,6 @@ class VIEW3D_MT_object_cleanup(Menu): 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 -- cgit v1.2.3