diff options
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_asset_defaults.h | 7 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_asset_types.h | 55 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_screen_types.h | 10 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 20 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_workspace_types.h | 5 | ||||
-rw-r--r-- | source/blender/makesdna/intern/dna_defaults.c | 2 |
6 files changed, 81 insertions, 18 deletions
diff --git a/source/blender/makesdna/DNA_asset_defaults.h b/source/blender/makesdna/DNA_asset_defaults.h index ff00ba79cf0..ce01563f619 100644 --- a/source/blender/makesdna/DNA_asset_defaults.h +++ b/source/blender/makesdna/DNA_asset_defaults.h @@ -32,6 +32,13 @@ 0 \ } +#define _DNA_DEFAULT_AssetLibraryReference \ + { \ + .type = ASSET_LIBRARY_LOCAL, \ + /* Not needed really (should be ignored for #ASSET_LIBRARY_LOCAL), but helps debugging. */ \ + .custom_library_index = -1, \ + } + /** \} */ /* clang-format on */ diff --git a/source/blender/makesdna/DNA_asset_types.h b/source/blender/makesdna/DNA_asset_types.h index 697d25653f8..bd677f838a0 100644 --- a/source/blender/makesdna/DNA_asset_types.h +++ b/source/blender/makesdna/DNA_asset_types.h @@ -20,6 +20,7 @@ #pragma once +#include "DNA_defs.h" #include "DNA_listBase.h" #ifdef __cplusplus @@ -36,6 +37,14 @@ typedef struct AssetTag { char name[64]; /* MAX_NAME */ } AssetTag; +typedef struct AssetFilterSettings { + /** Tags to match against. These are newly allocated, and compared against the + * #AssetMetaData.tags. + * TODO not used and doesn't do anything yet. */ + ListBase tags; /* AssetTag */ + uint64_t id_types; /* rna_enum_id_type_filter_items */ +} AssetFilterSettings; + /** * \brief The meta-data of an asset. * By creating and giving this for a data-block (#ID.asset_data), the data-block becomes an asset. @@ -62,6 +71,52 @@ typedef struct AssetMetaData { char _pad[4]; } AssetMetaData; +typedef enum eAssetLibraryType { + /* For the future. Display assets bundled with Blender by default. */ + // ASSET_LIBRARY_BUNDLED = 0, + /** Display assets from the current session (current "Main"). */ + ASSET_LIBRARY_LOCAL = 1, + /* For the future. Display assets for the current project. */ + // ASSET_LIBRARY_PROJECT = 2, + + /** Display assets from custom asset libraries, as defined in the preferences + * (#bUserAssetLibrary). The name will be taken from #FileSelectParams.asset_library.idname + * then. + * In RNA, we add the index of the custom library to this to identify it by index. So keep + * this last! */ + ASSET_LIBRARY_CUSTOM = 100, +} eAssetLibraryType; + +/* TODO copy of FileSelectAssetLibraryUID */ +/** + * Information to identify a asset library. May be either one of the predefined types (current + * 'Main', builtin library, project library), or a custom type as defined in the Preferences. + * + * If the type is set to #ASSET_LIBRARY_CUSTOM, `custom_library_index` must be set to identify the + * custom library. Otherwise it is not used. + */ +typedef struct AssetLibraryReference { + short type; /* eAssetLibraryType */ + char _pad1[2]; + /** + * If showing a custom asset library (#ASSET_LIBRARY_CUSTOM), this is the index of the + * #bUserAssetLibrary within #UserDef.asset_libraries. + * Should be ignored otherwise (but better set to -1 then, for sanity and debugging). + */ + int custom_library_index; +} AssetLibraryReference; + +/** + * Not part of the core design, we should try to get rid of it. Only needed to wrap FileDirEntry + * into a type with PropertyGroup as base, so we can have an RNA collection of #AssetHandle's to + * pass to the UI. + */ +# +# +typedef struct AssetHandle { + struct FileDirEntry *file_data; +} AssetHandle; + #ifdef __cplusplus } #endif diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 8d3ac3a7814..f98b30f906c 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -269,6 +269,9 @@ typedef struct uiListDyn { int resize; int resize_prev; + /* Allocated custom data. Free'ed together with the uiList (and when re-assigning). */ + void *customdata; + /* Filtering data. */ /** Items_len length. */ int *items_filter_flags; @@ -300,6 +303,12 @@ typedef struct uiList { /* some list UI data need to be saved in file */ int filter_flag; int filter_sort_flag; + /** Operator executed when activating an item. */ + const char *custom_activate_opname; + /** Operator executed when dragging an item (item gets activated too, without running + * custom_activate_opname above). */ + const char *custom_drag_opname; + /* Custom sub-classes properties. */ IDProperty *properties; @@ -583,6 +592,7 @@ enum { UILST_LAYOUT_DEFAULT = 0, UILST_LAYOUT_COMPACT = 1, UILST_LAYOUT_GRID = 2, + UILST_LAYOUT_BIG_PREVIEW_GRID = 3, }; /** #uiList.flag */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index c170e711756..1cb8bf2a9ea 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -696,14 +696,14 @@ typedef enum eSpaceSeq_OverlayType { * Information to identify a asset library. May be either one of the predefined types (current * 'Main', builtin library, project library), or a custom type as defined in the Preferences. * - * If the type is set to #FILE_ASSET_LIBRARY_CUSTOM, idname must have the name to identify the + * If the type is set to #ASSET_LIBRARY_CUSTOM, idname must have the name to identify the * custom library. Otherwise idname is not used. */ typedef struct FileSelectAssetLibraryUID { short type; /* eFileAssetLibrary_Type */ char _pad[2]; /** - * If showing a custom asset library (#FILE_ASSET_LIBRARY_CUSTOM), this is the index of the + * If showing a custom asset library (#ASSET_LIBRARY_CUSTOM), this is the index of the * #bUserAssetLibrary within #UserDef.asset_libraries. * Should be ignored otherwise (but better set to -1 then, for sanity and debugging). */ @@ -868,22 +868,6 @@ typedef enum eFileBrowse_Mode { FILE_BROWSE_MODE_ASSETS = 1, } eFileBrowse_Mode; -typedef enum eFileAssetLibrary_Type { - /* For the future. Display assets bundled with Blender by default. */ - // FILE_ASSET_LIBRARY_BUNDLED = 0, - /** Display assets from the current session (current "Main"). */ - FILE_ASSET_LIBRARY_LOCAL = 1, - /* For the future. Display assets for the current project. */ - // FILE_ASSET_LIBRARY_PROJECT = 2, - - /** Display assets from custom asset libraries, as defined in the preferences - * (#bUserAssetLibrary). The name will be taken from #FileSelectParams.asset_library.idname - * then. - * In RNA, we add the index of the custom library to this to identify it by index. So keep - * this last! */ - FILE_ASSET_LIBRARY_CUSTOM = 100, -} eFileAssetLibrary_Type; - /* FileSelectParams.display */ enum eFileDisplayType { /** Internal (not exposed to users): Keep whatever display type was used during the last File diff --git a/source/blender/makesdna/DNA_workspace_types.h b/source/blender/makesdna/DNA_workspace_types.h index c5c2351c718..e49146ad429 100644 --- a/source/blender/makesdna/DNA_workspace_types.h +++ b/source/blender/makesdna/DNA_workspace_types.h @@ -23,6 +23,7 @@ #pragma once #include "DNA_ID.h" +#include "DNA_asset_types.h" #ifdef __cplusplus extern "C" { @@ -135,6 +136,10 @@ typedef struct WorkSpace { /** Info text from modal operators (runtime). */ char *status_text; + + /** Workspace-wide active asset library, for asset UIs to use (e.g. asset view UI template). The + * Asset Browser has its own and doesn't use this. */ + AssetLibraryReference active_asset_library; } WorkSpace; /** diff --git a/source/blender/makesdna/intern/dna_defaults.c b/source/blender/makesdna/intern/dna_defaults.c index 95272fb7804..94d23ee15c5 100644 --- a/source/blender/makesdna/intern/dna_defaults.c +++ b/source/blender/makesdna/intern/dna_defaults.c @@ -152,6 +152,7 @@ /* DNA_asset_defaults.h */ SDNA_DEFAULT_DECL_STRUCT(AssetMetaData); +SDNA_DEFAULT_DECL_STRUCT(AssetLibraryReference); /* DNA_armature_defaults.h */ SDNA_DEFAULT_DECL_STRUCT(bArmature); @@ -346,6 +347,7 @@ const void *DNA_default_table[SDNA_TYPE_MAX] = { /* DNA_asset_defaults.h */ SDNA_DEFAULT_DECL(AssetMetaData), + SDNA_DEFAULT_DECL(AssetLibraryReference), /* DNA_armature_defaults.h */ SDNA_DEFAULT_DECL(bArmature), |