initial assets
This commit is contained in:
parent
873003975b
commit
807e85976a
|
@ -259,6 +259,12 @@ StringRefNull AssetLibrary::root_path() const
|
|||
Vector<AssetLibraryReference> all_valid_asset_library_refs()
|
||||
{
|
||||
Vector<AssetLibraryReference> result;
|
||||
{
|
||||
AssetLibraryReference library_ref{};
|
||||
library_ref.custom_library_index = -1;
|
||||
library_ref.type = ASSET_LIBRARY_BUNDLED;
|
||||
result.append(library_ref);
|
||||
}
|
||||
int i;
|
||||
LISTBASE_FOREACH_INDEX (const bUserAssetLibrary *, asset_library, &U.asset_libraries, i) {
|
||||
if (!BLI_is_dir(asset_library->path)) {
|
||||
|
|
|
@ -60,6 +60,11 @@ AssetLibrary *AssetLibraryService::get_asset_library(
|
|||
const eAssetLibraryType type = eAssetLibraryType(library_reference.type);
|
||||
|
||||
switch (type) {
|
||||
case ASSET_LIBRARY_BUNDLED: {
|
||||
const std::string root_path =
|
||||
"/home/jacques/blender/build_release/bin/3.5/datafiles/assets/base_meshes";
|
||||
return get_asset_library_on_disk(root_path);
|
||||
}
|
||||
case ASSET_LIBRARY_LOCAL: {
|
||||
/* For the "Current File" library we get the asset library root path based on main. */
|
||||
std::string root_path = bmain ? AS_asset_library_find_suitable_root_path_from_main(bmain) :
|
||||
|
|
|
@ -47,7 +47,7 @@ AssetLibraryReference ED_asset_library_reference_from_enum_value(int value)
|
|||
if (value < ASSET_LIBRARY_CUSTOM) {
|
||||
library.type = value;
|
||||
library.custom_library_index = -1;
|
||||
BLI_assert(ELEM(value, ASSET_LIBRARY_ALL, ASSET_LIBRARY_LOCAL));
|
||||
BLI_assert(ELEM(value, ASSET_LIBRARY_ALL, ASSET_LIBRARY_LOCAL, ASSET_LIBRARY_BUNDLED));
|
||||
return library;
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,18 @@ const EnumPropertyItem *ED_asset_library_reference_to_rna_enum_itemf(const bool
|
|||
RNA_enum_item_add_separator(&item, &totitem);
|
||||
}
|
||||
|
||||
{
|
||||
AssetLibraryReference library_reference;
|
||||
library_reference.type = ASSET_LIBRARY_BUNDLED;
|
||||
library_reference.custom_library_index = -1;
|
||||
const int enum_value = ED_asset_library_reference_to_enum_value(&library_reference);
|
||||
EnumPropertyItem tmp = {
|
||||
enum_value, "BUNDLED", ICON_NONE, "Bundled", "Show assets that came bundled with Blender"};
|
||||
RNA_enum_item_add(&item, &totitem, &tmp);
|
||||
}
|
||||
|
||||
RNA_enum_item_add_separator(&item, &totitem);
|
||||
|
||||
int i;
|
||||
LISTBASE_FOREACH_INDEX (bUserAssetLibrary *, user_library, &U.asset_libraries, i) {
|
||||
/* Note that the path itself isn't checked for validity here. If an invalid library path is
|
||||
|
|
|
@ -372,6 +372,7 @@ std::optional<eFileSelectType> AssetListStorage::asset_library_reference_to_file
|
|||
switch (eAssetLibraryType(library_reference.type)) {
|
||||
case ASSET_LIBRARY_ALL:
|
||||
return FILE_ASSET_LIBRARY_ALL;
|
||||
case ASSET_LIBRARY_BUNDLED:
|
||||
case ASSET_LIBRARY_CUSTOM:
|
||||
return FILE_ASSET_LIBRARY;
|
||||
case ASSET_LIBRARY_LOCAL:
|
||||
|
|
|
@ -424,7 +424,13 @@ static void fileselect_refresh_asset_params(FileAssetSelectParams *asset_params)
|
|||
}
|
||||
}
|
||||
|
||||
switch (library->type) {
|
||||
switch (eAssetLibraryType(library->type)) {
|
||||
case ASSET_LIBRARY_BUNDLED:
|
||||
BLI_strncpy(base_params->dir,
|
||||
"/home/jacques/blender/build_release/bin/3.5/datafiles/assets/base_meshes",
|
||||
sizeof(base_params->dir));
|
||||
base_params->type = FILE_ASSET_LIBRARY;
|
||||
break;
|
||||
case ASSET_LIBRARY_ALL:
|
||||
base_params->dir[0] = '\0';
|
||||
base_params->type = FILE_ASSET_LIBRARY_ALL;
|
||||
|
|
|
@ -86,7 +86,7 @@ typedef struct AssetMetaData {
|
|||
|
||||
typedef enum eAssetLibraryType {
|
||||
/* For the future. Display assets bundled with Blender by default. */
|
||||
// ASSET_LIBRARY_BUNDLED = 0,
|
||||
ASSET_LIBRARY_BUNDLED = 0,
|
||||
/** Display assets from the current session (current "Main"). */
|
||||
ASSET_LIBRARY_LOCAL = 1,
|
||||
ASSET_LIBRARY_ALL = 2,
|
||||
|
|
Loading…
Reference in New Issue