UI: Asset Shelf (Experimental Feature) #104831

Closed
Julian Eisel wants to merge 399 commits from asset-shelf into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
14 changed files with 15 additions and 23 deletions
Showing only changes of commit 81ee8de0b1 - Show all commits

View File

@ -287,6 +287,7 @@ class TEXT_MT_templates_py(Menu):
"text.open",
props_default={"internal": True},
filter_ext=lambda ext: (ext.lower() == ".py"),
# Filter out asset shelf template depending on experimental "Asset Shelf" option.
filter_path=lambda path, use_asset_shelf=use_asset_shelf:
(use_asset_shelf or not path.endswith("ui_asset_shelf.py")),
)

View File

@ -1165,8 +1165,7 @@ class PreferenceThemeSpacePanel:
@classmethod
def poll(cls, context):
# Special exception for expeimental asset shelf: Hide theme settings if
# experimental option is disabled.
# Special exception: Hide asset shelf theme settings depending on experimental "Asset Shelf" option.
if cls.datapath.endswith(".asset_shelf"):
prefs = context.preferences
return prefs.experimental.use_asset_shelf

View File

@ -187,7 +187,6 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
}
}
{
/* TODO for old files saved with the branch only. */
ARegion *new_asset_shelf = do_versions_add_region_if_not_found(
regionbase,
RGN_TYPE_ASSET_SHELF,

View File

@ -1,4 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/* SPDX-License-Identifier: GPL-2.0-or-later */
JulianEisel marked this conversation as resolved Outdated

Use updated copyright format

/* SPDX-FileCopyrightText: 2023 Blender Foundation
 *
 * SPDX-License-Identifier: GPL-2.0-or-later */
Use updated copyright format ``` /* SPDX-FileCopyrightText: 2023 Blender Foundation * * SPDX-License-Identifier: GPL-2.0-or-later */ ```
/** \file
* \ingroup edasset

View File

@ -272,7 +272,7 @@ void *AssetDragController::create_drag_data() const
const eAssetImportMethod import_method = ED_asset_handle_get_import_method(&asset_).value_or(
ASSET_IMPORT_APPEND_REUSE);
AssetView &asset_view = get_view<AssetView>();
const AssetView &asset_view = get_view<AssetView>();
return static_cast<void *>(WM_drag_create_asset_data(
&asset_, BLI_strdup(asset_blend_path), import_method, &asset_view.evil_C_));
}

View File

@ -701,6 +701,8 @@ ARegion *ED_area_find_region_xy_visual(const ScrArea *area, int regiontype, cons
struct ARegionType *ED_area_type_hud(int space_type);
void ED_area_type_hud_clear(struct wmWindowManager *wm, ScrArea *area_keep);
void ED_area_type_hud_ensure(struct bContext *C, struct ScrArea *area);
/** Lookup the region the operation was executed in, and which should be used to redo the
* operation. */
ARegion *ED_area_type_hud_redo_region_find(const struct ScrArea *area,
const struct ARegion *hud_region);

View File

@ -169,7 +169,6 @@ enum {
UI_BLOCK_SEARCH_ONLY = 1 << 25,
/** Hack for quick setup (splash screen) to draw text centered. */
UI_BLOCK_QUICK_SETUP = 1 << 26,
UI_BLOCK_POPUP_CAN_REFRESH = 1 << 27,
};
/** #uiPopupBlockHandle.menuretval */
@ -2180,7 +2179,6 @@ int uiLayoutGetAlignment(uiLayout *layout);
bool uiLayoutGetFixedSize(uiLayout *layout);
bool uiLayoutGetKeepAspect(uiLayout *layout);
int uiLayoutGetWidth(uiLayout *layout);
int uiLayoutGetRootHeight(uiLayout *layout);
float uiLayoutGetScaleX(uiLayout *layout);
float uiLayoutGetScaleY(uiLayout *layout);
float uiLayoutGetUnitsX(uiLayout *layout);
@ -2618,9 +2616,6 @@ void uiTemplateAssetView(struct uiLayout *layout,
struct PointerRNA *r_activate_op_properties,
const char *drag_opname,
struct PointerRNA *r_drag_op_properties);
void uiTemplateAssetShelf(uiLayout *layout,
const struct bContext *C,
const struct AssetFilterSettings *filter_settings);
void uiTemplateLightLinkingCollection(struct uiLayout *layout,
struct PointerRNA *ptr,

View File

@ -832,6 +832,7 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
else {
after->func = but->func;
}
after->func_arg1 = but->func_arg1;
after->func_arg2 = but->func_arg2;

View File

@ -4102,7 +4102,7 @@ static void ui_litem_layout_box(uiLayout *litem)
const uiStyle *style = litem->root->style;
int boxspace = style->boxspace;
if (litem->root->type == UI_LAYOUT_HEADER && false) {
if (litem->root->type == UI_LAYOUT_HEADER) {
boxspace = 0;
}
@ -5131,11 +5131,6 @@ int uiLayoutGetWidth(uiLayout *layout)
return layout->w;
}
int uiLayoutGetRootHeight(uiLayout *layout)
{
return layout->root->layout->h;
}
float uiLayoutGetScaleX(uiLayout *layout)
{
return layout->scale[0];

View File

@ -612,11 +612,6 @@ uiBlock *ui_popup_block_refresh(bContext *C,
block->flag |= UI_BLOCK_LOOP;
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
/* TODO does this flag need to be checked in more cases? */
if (block->flag & UI_BLOCK_POPUP_CAN_REFRESH) {
handle->can_refresh = true;
}
/* defer this until blocks are translated (below) */
block->oldblock = nullptr;

View File

@ -3467,6 +3467,7 @@ void ED_region_header_init(ARegion *region)
{
UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_HEADER, region->winx, region->winy);
}
int ED_area_headersize(void)
{
/* Accommodate widget and padding. */

View File

@ -872,7 +872,6 @@ static bool is_filtered_lib_type(FileListInternEntry *file,
if (file->typeflag & FILE_TYPE_BLENDERLIB) {
return is_filtered_id_file_type(file, file->blentype, file->name, filter);
}
return is_filtered_file_type(file, filter);
}

View File

@ -22,7 +22,7 @@
#define _DNA_DEFAULT_AssetLibraryReference \
{ \
.type = ASSET_LIBRARY_ALL, \
.type = ASSET_LIBRARY_LOCAL, \
/* Not needed really (should be ignored for anything but #ASSET_LIBRARY_CUSTOM), but helps debugging. */ \
.custom_library_index = -1, \
}

View File

@ -579,6 +579,11 @@ wmDragAsset *WM_drag_create_asset_data(const AssetHandle *asset,
asset_drag->id_type = ED_asset_handle_get_id_type(asset);
asset_drag->import_method = import_type;
asset_drag->use_relative_path = ED_asset_handle_get_use_relative_path(asset);
/* FIXME: This is temporary evil solution to get scene/view-layer/etc in the copy callback of the
* #wmDropBox.
* TODO: Handle link/append in operator called at the end of the drop process, and NOT in its
* copy callback.
* */
asset_drag->evil_C = static_cast<bContext *>(evil_C);
return asset_drag;