mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
The previous "Online Assets" filter option was useful but some found the name a bit awkward. Additionally, there is use in being able to show only online assets. So solve both by changing the "Online Assets" filter option into an "Access" menu with the three items: - Online and Offline - Online Only - Offline Only When either "Online Only" or "Offline Only" is selected and no assets are shown, the Asset Browser will show an info message hinting at the filter options. Pull Request: https://projects.blender.org/blender/blender/pulls/158274
62 lines
1.6 KiB
Python
62 lines
1.6 KiB
Python
# SPDX-FileCopyrightText: 2023 Blender Authors
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
from bpy.types import (
|
|
Panel,
|
|
)
|
|
|
|
|
|
class ASSETSHELF_PT_display(Panel):
|
|
bl_label = "Display Settings"
|
|
# Doesn't actually matter. Panel is instanced through popover only.
|
|
bl_space_type = 'VIEW_3D'
|
|
bl_region_type = 'HEADER'
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
|
layout.use_property_decorate = False # No animation.
|
|
|
|
shelf = context.asset_shelf
|
|
|
|
layout.prop(shelf, "preview_size", text="Size")
|
|
layout.prop(shelf, "show_names", text="Names")
|
|
|
|
@classmethod
|
|
def poll(cls, context):
|
|
return context.asset_shelf is not None
|
|
|
|
|
|
class ASSETSHELF_PT_filter(Panel):
|
|
bl_label = "Filter"
|
|
# Doesn't actually matter. Panel is instanced through popover only.
|
|
bl_space_type = 'VIEW_3D'
|
|
bl_region_type = 'HEADER'
|
|
bl_parent_id = "ASSETSHELF_PT_display"
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
prefs = context.preferences
|
|
use_remote_asset_libraries = prefs.experimental.use_remote_asset_libraries
|
|
|
|
# Filter option stored in the Preferences.
|
|
if use_remote_asset_libraries:
|
|
col = layout.column()
|
|
col.use_property_split = True
|
|
col.use_property_decorate = False
|
|
col.prop(prefs.view, "asset_access", text="Access")
|
|
|
|
|
|
classes = (
|
|
ASSETSHELF_PT_display,
|
|
ASSETSHELF_PT_filter,
|
|
)
|
|
|
|
|
|
if __name__ == "__main__": # only for live edit.
|
|
from bpy.utils import register_class
|
|
|
|
for cls in classes:
|
|
register_class(cls)
|