WIP: Brush assets project #106303

Draft
Julian Eisel wants to merge 381 commits from brush-assets-project into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 7 additions and 8 deletions
Showing only changes of commit 6d9f313ba1 - Show all commits

View File

@ -275,7 +275,8 @@ int BKE_preferences_extension_repo_get_index(const UserDef *userdef,
/** \name #bUserAssetShelfSettings /** \name #bUserAssetShelfSettings
* \{ */ * \{ */
bUserAssetShelfSettings *asset_shelf_settings_new(UserDef *userdef, const char *shelf_idname) static bUserAssetShelfSettings *asset_shelf_settings_new(UserDef *userdef,
const char *shelf_idname)
{ {
bUserAssetShelfSettings *settings = DNA_struct_default_alloc(bUserAssetShelfSettings); bUserAssetShelfSettings *settings = DNA_struct_default_alloc(bUserAssetShelfSettings);
BLI_addtail(&userdef->asset_shelves_settings, settings); BLI_addtail(&userdef->asset_shelves_settings, settings);
@ -284,15 +285,14 @@ bUserAssetShelfSettings *asset_shelf_settings_new(UserDef *userdef, const char *
return settings; return settings;
} }
bUserAssetShelfSettings *BKE_preferences_asset_shelf_settings_ensure(UserDef *userdef, static bUserAssetShelfSettings *asset_shelf_settings_ensure(UserDef *userdef,
const char *shelf_idname) const char *shelf_idname)
{ {
if (bUserAssetShelfSettings *settings = BKE_preferences_asset_shelf_settings_get(userdef, if (bUserAssetShelfSettings *settings = BKE_preferences_asset_shelf_settings_get(userdef,
shelf_idname)) shelf_idname))
{ {
return settings; return settings;
} }
return asset_shelf_settings_new(userdef, shelf_idname); return asset_shelf_settings_new(userdef, shelf_idname);
} }
@ -305,8 +305,8 @@ bUserAssetShelfSettings *BKE_preferences_asset_shelf_settings_get(const UserDef
offsetof(bUserAssetShelfSettings, shelf_idname))); offsetof(bUserAssetShelfSettings, shelf_idname)));
} }
bool asset_shelf_settings_is_catalog_path_enabled(const bUserAssetShelfSettings *settings, static bool asset_shelf_settings_is_catalog_path_enabled(const bUserAssetShelfSettings *settings,
const char *catalog_path) const char *catalog_path)
{ {
return BLI_findstring_ptr( return BLI_findstring_ptr(
&settings->enabled_catalog_paths, catalog_path, offsetof(LinkData, data)) != nullptr; &settings->enabled_catalog_paths, catalog_path, offsetof(LinkData, data)) != nullptr;
@ -334,8 +334,7 @@ bool BKE_preferences_asset_shelf_settings_ensure_catalog_path_enabled(UserDef *u
return false; return false;
} }
bUserAssetShelfSettings *settings = BKE_preferences_asset_shelf_settings_ensure(userdef, bUserAssetShelfSettings *settings = asset_shelf_settings_ensure(userdef, shelf_idname);
shelf_idname);
char *path_copy = BLI_strdup(catalog_path); char *path_copy = BLI_strdup(catalog_path);
BLI_addtail(&settings->enabled_catalog_paths, BLI_genericNodeN(path_copy)); BLI_addtail(&settings->enabled_catalog_paths, BLI_genericNodeN(path_copy));