index-of-nearest-104619 #2

Merged
Iliya Katushenock merged 62 commits from HooglyBoogly/blender:index-of-nearest-104619 into index_of_nearest 2023-04-20 21:19:53 +02:00
Showing only changes of commit 199c7da06d - Show all commits

View File

@ -706,6 +706,15 @@ class ASSETBROWSER_PT_metadata(asset_utils.AssetBrowserPanel, Panel):
bl_label = "Asset Metadata" bl_label = "Asset Metadata"
bl_options = {'HIDE_HEADER'} bl_options = {'HIDE_HEADER'}
@staticmethod
def metadata_prop(layout, asset_data, propname):
"""
Only display properties that are either set or can be modified (i.e. the
asset is in the current file). Empty, non-editable fields are not really useful.
"""
if getattr(asset_data, propname) or not asset_data.is_property_readonly(propname):
layout.prop(asset_data, propname)
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
wm = context.window_manager wm = context.window_manager
@ -745,10 +754,11 @@ class ASSETBROWSER_PT_metadata(asset_utils.AssetBrowserPanel, Panel):
row.prop(wm, "asset_path_dummy", text="Source", icon='CURRENT_FILE' if is_local_asset else 'NONE') row.prop(wm, "asset_path_dummy", text="Source", icon='CURRENT_FILE' if is_local_asset else 'NONE')
row.operator("asset.open_containing_blend_file", text="", icon='TOOL_SETTINGS') row.operator("asset.open_containing_blend_file", text="", icon='TOOL_SETTINGS')
layout.prop(asset_file_handle.asset_data, "description") asset_data = asset_file_handle.asset_data
layout.prop(asset_file_handle.asset_data, "license") self.metadata_prop(layout, asset_data, "description")
layout.prop(asset_file_handle.asset_data, "copyright") self.metadata_prop(layout, asset_data, "license")
layout.prop(asset_file_handle.asset_data, "author") self.metadata_prop(layout, asset_data, "copyright")
self.metadata_prop(layout, asset_data, "author")
class ASSETBROWSER_PT_metadata_preview(asset_utils.AssetMetaDataPanel, Panel): class ASSETBROWSER_PT_metadata_preview(asset_utils.AssetMetaDataPanel, Panel):