[Bf-blender-cvs] [7246c387435] asset-browser-grid-view: Merge branch 'master' into asset-browser-grid-view
Julian Eisel
noreply at git.blender.org
Thu Nov 10 13:18:00 CET 2022
Commit: 7246c387435769a169ac24c91434c615df6434b4
Author: Julian Eisel
Date: Thu Nov 10 13:17:42 2022 +0100
Branches: asset-browser-grid-view
https://developer.blender.org/rB7246c387435769a169ac24c91434c615df6434b4
Merge branch 'master' into asset-browser-grid-view
===================================================================
===================================================================
diff --cc source/blender/blenkernel/intern/screen.c
index c8bdf91b45e,2c896788b20..ab7a1bcaa35
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@@ -1208,151 -1152,10 +1152,14 @@@ static void write_area(BlendWriter *wri
write_region(writer, region, sl->spacetype);
}
- if (sl->spacetype == SPACE_VIEW3D) {
- View3D *v3d = (View3D *)sl;
- BLO_write_struct(writer, View3D, v3d);
-
- if (v3d->localvd) {
- BLO_write_struct(writer, View3D, v3d->localvd);
- }
-
- BKE_screen_view3d_shading_blend_write(writer, &v3d->shading);
- }
- else if (sl->spacetype == SPACE_GRAPH) {
- SpaceGraph *sipo = (SpaceGraph *)sl;
- ListBase tmpGhosts = sipo->runtime.ghost_curves;
-
- /* temporarily disable ghost curves when saving */
- BLI_listbase_clear(&sipo->runtime.ghost_curves);
-
- BLO_write_struct(writer, SpaceGraph, sl);
- if (sipo->ads) {
- BLO_write_struct(writer, bDopeSheet, sipo->ads);
- }
-
- /* reenable ghost curves */
- sipo->runtime.ghost_curves = tmpGhosts;
- }
- else if (sl->spacetype == SPACE_PROPERTIES) {
- BLO_write_struct(writer, SpaceProperties, sl);
- }
- else if (sl->spacetype == SPACE_FILE) {
- SpaceFile *sfile = (SpaceFile *)sl;
-
- BLO_write_struct(writer, SpaceFile, sl);
- if (sfile->params) {
- BLO_write_struct(writer, FileSelectParams, sfile->params);
- }
- if (sfile->asset_params) {
- BLO_write_struct(writer, FileAssetSelectParams, sfile->asset_params);
- }
- }
- else if (sl->spacetype == SPACE_SEQ) {
- BLO_write_struct(writer, SpaceSeq, sl);
- }
- else if (sl->spacetype == SPACE_OUTLINER) {
- SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
- write_space_outliner(writer, space_outliner);
- }
- else if (sl->spacetype == SPACE_IMAGE) {
- BLO_write_struct(writer, SpaceImage, sl);
- }
- else if (sl->spacetype == SPACE_TEXT) {
- BLO_write_struct(writer, SpaceText, sl);
- }
- else if (sl->spacetype == SPACE_SCRIPT) {
- SpaceScript *scr = (SpaceScript *)sl;
- scr->but_refs = NULL;
- BLO_write_struct(writer, SpaceScript, sl);
- }
- else if (sl->spacetype == SPACE_ACTION) {
- BLO_write_struct(writer, SpaceAction, sl);
- }
- else if (sl->spacetype == SPACE_NLA) {
- SpaceNla *snla = (SpaceNla *)sl;
-
- BLO_write_struct(writer, SpaceNla, snla);
- if (snla->ads) {
- BLO_write_struct(writer, bDopeSheet, snla->ads);
- }
- }
- else if (sl->spacetype == SPACE_NODE) {
- SpaceNode *snode = (SpaceNode *)sl;
- BLO_write_struct(writer, SpaceNode, snode);
-
- LISTBASE_FOREACH (bNodeTreePath *, path, &snode->treepath) {
- BLO_write_struct(writer, bNodeTreePath, path);
- }
- }
- else if (sl->spacetype == SPACE_CONSOLE) {
- SpaceConsole *con = (SpaceConsole *)sl;
-
- LISTBASE_FOREACH (ConsoleLine *, cl, &con->history) {
- /* 'len_alloc' is invalid on write, set from 'len' on read */
- BLO_write_struct(writer, ConsoleLine, cl);
- BLO_write_raw(writer, (size_t)cl->len + 1, cl->line);
- }
- BLO_write_struct(writer, SpaceConsole, sl);
- }
- else if (sl->spacetype == SPACE_TOPBAR) {
- BLO_write_struct(writer, SpaceTopBar, sl);
- }
- else if (sl->spacetype == SPACE_STATUSBAR) {
- BLO_write_struct(writer, SpaceStatusBar, sl);
- }
- else if (sl->spacetype == SPACE_USERPREF) {
- BLO_write_struct(writer, SpaceUserPref, sl);
- }
- else if (sl->spacetype == SPACE_CLIP) {
- BLO_write_struct(writer, SpaceClip, sl);
- }
- else if (sl->spacetype == SPACE_INFO) {
- BLO_write_struct(writer, SpaceInfo, sl);
- }
- else if (sl->spacetype == SPACE_SPREADSHEET) {
- BLO_write_struct(writer, SpaceSpreadsheet, sl);
- SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)sl;
-
- LISTBASE_FOREACH (SpreadsheetRowFilter *, row_filter, &sspreadsheet->row_filters) {
- BLO_write_struct(writer, SpreadsheetRowFilter, row_filter);
- BLO_write_string(writer, row_filter->value_string);
- }
-
- LISTBASE_FOREACH (SpreadsheetColumn *, column, &sspreadsheet->columns) {
- BLO_write_struct(writer, SpreadsheetColumn, column);
- BLO_write_struct(writer, SpreadsheetColumnID, column->id);
- BLO_write_string(writer, column->id->name);
- /* While the display name is technically runtime data, we write it here, otherwise the row
- * filters might not now their type if their region draws before the main region.
- * This would ideally be cleared here. */
- BLO_write_string(writer, column->display_name);
- }
- LISTBASE_FOREACH (SpreadsheetContext *, context, &sspreadsheet->context_path) {
- switch (context->type) {
- case SPREADSHEET_CONTEXT_OBJECT: {
- SpreadsheetContextObject *object_context = (SpreadsheetContextObject *)context;
- BLO_write_struct(writer, SpreadsheetContextObject, object_context);
- break;
- }
- case SPREADSHEET_CONTEXT_MODIFIER: {
- SpreadsheetContextModifier *modifier_context = (SpreadsheetContextModifier *)context;
- BLO_write_struct(writer, SpreadsheetContextModifier, modifier_context);
- BLO_write_string(writer, modifier_context->modifier_name);
- break;
- }
- case SPREADSHEET_CONTEXT_NODE: {
- SpreadsheetContextNode *node_context = (SpreadsheetContextNode *)context;
- BLO_write_struct(writer, SpreadsheetContextNode, node_context);
- BLO_write_string(writer, node_context->node_name);
- break;
- }
- }
- }
+ SpaceType *space_type = BKE_spacetype_from_id(sl->spacetype);
+ if (space_type && space_type->blend_write) {
+ space_type->blend_write(writer, sl);
}
+ else if (sl->spacetype == SPACE_ASSETS) {
+ BLO_write_struct(writer, SpaceAssets, sl);
+ // SpaceAssets *space_assets = (SpaceAssets *)sl;
+ }
}
}
diff --cc source/blender/editors/asset/ED_asset_list.h
index 607d3e96ada,3d2aaa3bda1..72f7b670efa
--- a/source/blender/editors/asset/ED_asset_list.h
+++ b/source/blender/editors/asset/ED_asset_list.h
@@@ -25,11 -23,11 +25,12 @@@ struct wmNotifier
*/
void ED_assetlist_storage_fetch(const struct AssetLibraryReference *library_reference,
const struct bContext *C);
+void ED_assetlist_catalog_filter_set(const struct AssetLibraryReference *,
+ const struct AssetCatalogFilterSettings *catalog_filter);
+ bool ED_assetlist_is_loaded(const struct AssetLibraryReference *library_reference);
-void ED_assetlist_ensure_previews_job(const struct AssetLibraryReference *library_reference,
- const struct bContext *C);
void ED_assetlist_clear(const struct AssetLibraryReference *library_reference, struct bContext *C);
bool ED_assetlist_storage_has_list_for_library(const AssetLibraryReference *library_reference);
+
/**
* Tag all asset lists in the storage that show main data as needing an update (re-fetch).
*
diff --cc source/blender/editors/asset/intern/asset_handle.cc
index 6ff0dfe394b,0b2cd352d77..43d69a50f91
--- a/source/blender/editors/asset/intern/asset_handle.cc
+++ b/source/blender/editors/asset/intern/asset_handle.cc
@@@ -13,19 -16,16 +16,21 @@@
#include "ED_asset_handle.h"
#include "ED_asset_list.hh"
+ #include "WM_api.h"
+
const char *ED_asset_handle_get_name(const AssetHandle *asset)
{
- return asset->file_data->name;
+ return BKE_asset_representation_name_get(asset->file_data->asset);
}
+const char *ED_asset_handle_get_identifier(const AssetHandle *asset)
+{
+ return asset->file_data->relpath;
+}
+
- AssetMetaData *ED_asset_handle_get_metadata(const AssetHandle *asset)
+ AssetMetaData *ED_asset_handle_get_metadata(const AssetHandle *asset_handle)
{
- return asset->file_data->asset_data;
+ return BKE_asset_representation_metadata_get(asset_handle->file_data->asset);
}
ID *ED_asset_handle_get_local_id(const AssetHandle *asset)
diff --cc source/blender/editors/asset/intern/asset_list.cc
index 697ee16f6fd,bb72c5cc1bb..fa03f943e69
--- a/source/blender/editors/asset/intern/asset_list.cc
+++ b/source/blender/editors/asset/intern/asset_list.cc
@@@ -408,12 -422,25 +408,24 @@@ void ED_assetlist_storage_fetch(const A
AssetListStorage::fetch_library(*library_reference, *C);
}
+ bool ED_assetlist_is_loaded(const AssetLibraryReference *library_reference)
+ {
+ AssetList *list = AssetListStorage::lookup_list(*library_reference);
+ if (!list) {
+ return false;
+ }
+ if (list->needsRefetch()) {
+ return false;
+ }
+ return true;
+ }
+
-void ED_assetlist_ensure_previews_job(const AssetLibraryReference *library_reference,
- const bContext *C)
+void ED_assetlist_catalog_filter_set(const struct AssetLibraryReference *library_reference,
+ const struct AssetCatalogFilterSettings *settings)
{
-
AssetList *list = AssetListStorage::lookup_list(*library_reference);
if (list) {
- list->ensurePreviewsJob(C);
+ list->setCatalogFilterSettings(*settings);
}
}
diff --cc source/blender/editors/interface/interface_template_asset_view.cc
index d3ed462b85d,9a3f7800c64..2673c5aa168
--- a/source/blender/editors/interface/interface_template_asset_view.cc
+++ b/source/blender/editors/interface/interface_template_asset_view.cc
@@@ -54,15 -54,13 +54,14 @@@ static void asset_view_item_but_drag_se
if (blend_path[0]) {
ImBuf *imbuf = ED_assetlist_asset_image_get(asset_handle);
- UI_but_drag_set_asset(but,
- asset_handle,
- BLI_strdup(blend_path),
- FILE_ASSET_IMPORT_APPEND,
- ED_asset_handle_get_pre
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list