UI: Asset Shelf (Experimental Feature) #104831
|
@ -9,6 +9,7 @@ if "bpy" in locals():
|
|||
del reload
|
||||
|
||||
_modules = [
|
||||
"asset_shelf",
|
||||
"node_add_menu",
|
||||
"node_add_menu_geometry",
|
||||
"properties_animviz",
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
JulianEisel marked this conversation as resolved
Outdated
|
||||
import bpy
|
||||
from bpy.types import (
|
||||
Panel,
|
||||
)
|
||||
|
||||
|
||||
class ASSETSHELF_PT_display(Panel):
|
||||
bl_label = "Display Settings"
|
||||
bl_space_type = 'PREFERENCES'
|
||||
bl_region_type = 'HEADER'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
shelf_settings = context.asset_shelf_settings
|
||||
|
||||
layout.prop(shelf_settings, "show_names")
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.asset_shelf_settings is not None
|
||||
|
||||
|
||||
classes = (
|
||||
ASSETSHELF_PT_display,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
from bpy.utils import register_class
|
||||
|
||||
for cls in classes:
|
||||
register_class(cls)
|
|
@ -396,6 +396,10 @@ static void asset_shelf_footer_draw(const bContext *C, Header *header)
|
|||
if (shelf_settings) {
|
||||
add_catalog_toggle_buttons(*shelf_settings, *layout);
|
||||
}
|
||||
|
||||
uiItemSpacer(layout);
|
||||
|
||||
uiItemPopoverPanel(layout, C, "ASSETSHELF_PT_display", "", ICON_IMGDISPLAY);
|
||||
}
|
||||
|
||||
void ED_asset_shelf_footer_register(ARegionType *region_type,
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "DNA_defs.h"
|
||||
#include "DNA_listBase.h"
|
||||
#include "DNA_vec_types.h"
|
||||
|
@ -765,8 +767,17 @@ typedef struct AssetShelfSettings {
|
|||
ListBase enabled_catalog_paths; /* #LinkData */
|
||||
/** If not set (null or empty string), all assets will be displayed ("All" catalog behavior). */
|
||||
const char *active_catalog_path;
|
||||
|
||||
short display_flag; /* #AssetShelfSettings_DisplayFlag */
|
||||
char _pad1[6];
|
||||
} AssetShelfSettings;
|
||||
|
||||
/* #AssetShelfSettings.display_flag */
|
||||
typedef enum AssetShelfSettings_DisplayFlag {
|
||||
ASSETSHELF_SHOW_NAMES = (1 << 0),
|
||||
} AssetShelfSettings_DisplayFlag;
|
||||
ENUM_OPERATORS(AssetShelfSettings_DisplayFlag, ASSETSHELF_SHOW_NAMES);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2091,6 +2091,16 @@ static void rna_def_asset_shelf_settings(BlenderRNA *brna)
|
|||
{
|
||||
StructRNA *srna = RNA_def_struct(brna, "AssetShelfSettings", NULL);
|
||||
RNA_def_struct_ui_text(srna, "Asset Shelf Settings", "");
|
||||
|
||||
PropertyRNA *prop;
|
||||
|
||||
prop = RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "display_flag", ASSETSHELF_SHOW_NAMES);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Show Names",
|
||||
"Show the asset name together with the preview. Otherwise only the preview will be visible");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_ASSET_SHELF, NULL);
|
||||
}
|
||||
|
||||
void RNA_def_ui(BlenderRNA *brna)
|
||||
|
|
|
@ -485,6 +485,7 @@ typedef struct wmNotifier {
|
|||
#define ND_SPACE_CLIP (20 << 16)
|
||||
#define ND_SPACE_FILE_PREVIEW (21 << 16)
|
||||
#define ND_SPACE_SPREADSHEET (22 << 16)
|
||||
/* Not a space itself, but a part of another space. */
|
||||
#define ND_SPACE_ASSET_SHELF (23 << 16)
|
||||
|
||||
/* NC_ASSET */
|
||||
|
|
Loading…
Reference in New Issue
Use updated copyright convention
SPDX-FileCopyrightText
.