WIP: Brush assets project #106303

Draft
Julian Eisel wants to merge 358 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.
4 changed files with 12 additions and 1 deletions
Showing only changes of commit 4e17d78a9b - Show all commits

View File

@ -8768,6 +8768,7 @@ class VIEW3D_PT_viewport_debug(Panel):
class BrushAssetShelf:
bl_space_type = "VIEW_3D"
bl_options = {'NO_ASSET_DRAG'}
bl_default_preview_size = 40
@classmethod
def poll(cls, context):

View File

@ -525,6 +525,8 @@ struct AssetShelfType {
AssetShelfTypeFlag flag;
short default_preview_size;
/** Determine if asset shelves of this type should be available in current context or not. */
bool (*poll)(const bContext *C, const AssetShelfType *shelf_type);

View File

@ -90,7 +90,8 @@ static AssetShelf *create_shelf_from_type(AssetShelfType &type)
{
AssetShelf *shelf = MEM_new<AssetShelf>(__func__);
*shelf = dna::shallow_zero_initialize();
shelf->settings.preview_size = DEFAULT_TILE_SIZE;
shelf->settings.preview_size = type.default_preview_size ? type.default_preview_size :
DEFAULT_TILE_SIZE;
shelf->settings.asset_library_reference = asset_system::all_library_reference();
shelf->type = &type;
shelf->preferred_row_count = 1;

View File

@ -2321,6 +2321,13 @@ static void rna_def_asset_shelf(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
RNA_def_property_ui_text(prop, "Options", "Options for this asset shelf type");
prop = RNA_def_property(srna, "bl_default_preview_size", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, nullptr, "type->default_preview_size");
RNA_def_property_range(prop, 32, 256);
RNA_def_property_flag(prop, PROP_REGISTER);
RNA_def_property_ui_text(
prop, "Default Preview Size", "Default size of the asset preview thumbnails in pixels");
PropertyRNA *parm;
FunctionRNA *func;