[Bf-blender-cvs] [42a2d2bdee9] asset-engine: Merge 'master' into 'asset-engine'
Bastien Montagne
noreply at git.blender.org
Wed Apr 17 12:42:08 CEST 2019
Commit: 42a2d2bdee9c274fef011e62e5785ca6dc3a1fa2
Author: Bastien Montagne
Date: Wed Apr 17 12:30:42 2019 +0200
Branches: asset-engine
https://developer.blender.org/rB42a2d2bdee9c274fef011e62e5785ca6dc3a1fa2
Merge 'master' into 'asset-engine'
===================================================================
===================================================================
diff --cc release/datafiles/locale
index 199b3a7c2f0,199b3a7c2f0..2b81e2acc01
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@@ -1,1 -1,1 +1,1 @@@
--Subproject commit 199b3a7c2f03a3af6f612e092d3359f7b6f288cc
++Subproject commit 2b81e2acc011a8b79232a18dad3c00b8e654ceee
diff --cc release/scripts/addons
index 3683429de05,3683429de05..72a85d74000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@@ -1,1 -1,1 +1,1 @@@
--Subproject commit 3683429de050b8026835d17ae7288a436c31cdb6
++Subproject commit 72a85d74000d6f5e568dc4fb73381cc3d1ae7af8
diff --cc source/blender/blenkernel/BKE_asset_engine.h
index 65cafafa03c,00000000000..4738d3225af
mode 100644,000000..100644
--- a/source/blender/blenkernel/BKE_asset_engine.h
+++ b/source/blender/blenkernel/BKE_asset_engine.h
@@@ -1,285 -1,0 +1,294 @@@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2015 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file BKE_asset_engine.h
+ * \ingroup bke
+ */
+
+#ifndef __BKE_ASSET_ENGINE_H__
+#define __BKE_ASSET_ENGINE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "DNA_space_types.h"
+
+struct AssetEngine;
+struct AssetEngineType;
+struct AssetUUIDList;
+struct bContext;
+struct FileDirEntryArr;
+struct FileDirEntry;
+struct FileDirEntryVariant;
+struct FileDirEntryRevision;
+struct FileDirEntryView;
+struct ExtensionRNA;
+struct ID;
+struct IDProperty;
+struct ListBase;
+struct Main;
+struct ReportList;
+struct uiLayout;
+
+enum {
- AE_STATUS_VALID = 1 << 0, /* Asset engine is "OK" (if unset engine won't be used). */
- AE_STATUS_RUNNING = 1 << 1, /* Asset engine is performing some background tasks... */
++ AE_STATUS_VALID = 1 << 0, /* Asset engine is "OK" (if unset engine won't be used). */
++ AE_STATUS_RUNNING = 1 << 1, /* Asset engine is performing some background tasks... */
+};
+
+#define AE_FAKE_ENGINE_ID "NONE"
+
+extern ListBase asset_engines;
+
-
-
+/**************************************************************************************/
+/* ***** Those callbacks help manage engine and its jobs. ***** */
+/**************************************************************************************/
+
+/* AE instance/job is valid, is running, is idle, etc. */
+typedef int (*ae_status)(struct AssetEngine *engine, const int job_id);
+
+/* Report progress ([0.0, 1.0] range) of given job. */
+typedef float (*ae_progress)(struct AssetEngine *engine, const int job_id);
+
+/* To force end of given job (e.g. because it was cancelled by user...). */
+typedef void (*ae_kill)(struct AssetEngine *engine, const int job_id);
+
-
-
+/**************************************************************************************/
+/* ***** All callbacks below shall be non-blocking (i.e. return immediately). ***** */
+/**************************************************************************************/
+
+/* Those callbacks will be called from a 'fake-job' start *and* update functions (i.e. main thread, working one will
+ * just sleep).
+ *
+ * If given id is not AE_JOB_ID_UNSET, engine should update from a running job if available, otherwise it should
+ * start a new one.
+ * It is the responsability of the engine to start/stop background processes to actually perform tasks as/if needed.
+ *
+ * If the engine returns AE_JOB_ID_INVALID as job id, then code assumes whole execution was done in that single first
+ * call (i.e. allows engine that do not need it to not bother with whole async crap - they should then process
+ * the whole request in a very short amount of time (typically below 100ms).
+ *
+ * Most of those callbacks shall not return actual entries, but only (mainly) total number of available entries.
+ * The only callback returning actual entries should be ae_entries_block_get() (which returns a limited subset
+ * of all available ones, the visible ones usually), and ae_entries_uuid_get().
+ */
+#define AE_JOB_ID_UNSET 0
+#define AE_JOB_ID_INVALID -1
+
+/* FILEBROWSER - List everything available at given root path - only returns numbers of entries!
+ * Note that asset engine may change root_path here too. */
- typedef int (*ae_list_dir)(struct AssetEngine *engine, const int job_id, struct FileDirEntryArr *entries_r);
++typedef int (*ae_list_dir)(struct AssetEngine *engine,
++ const int job_id,
++ struct FileDirEntryArr *entries_r);
+
+/* FILEBROWSER - Get previews of given entries.
+ * XXX WARNING! Currently, only asset part of uuids is valid here (because fileentries only store this one)...
+ * Think this makes more sense anyway, or do we want different previews per variants or revisions too? */
- typedef int (*ae_previews_get)(struct AssetEngine *engine, const int job_id, struct AssetUUIDList *uuids);
++typedef int (*ae_previews_get)(struct AssetEngine *engine,
++ const int job_id,
++ struct AssetUUIDList *uuids);
+
+/* 'update' hook, called to prepare updating of given entries (typically after a file (re)load).
+ * Engine should check whether given assets are still valid, if they should be updated, etc.
+ * uuids tagged as needing reload will then be reloaded as new ones
+ * (ae_load_pre, then actual lib loading, then ae_load_post).
+ * \warning This callback is expected to handle **real** UUIDS (not 'users' filebrowser ones),
+ * i.e. calling ae_load_pre with those shall **not** alter them in returned direntries
+ * (else 'link' between old IDs and reloaded ones would be broken). */
- typedef int (*ae_update_check)(struct AssetEngine *engine, const int job_id, struct AssetUUIDList *uuids);
++typedef int (*ae_update_check)(struct AssetEngine *engine,
++ const int job_id,
++ struct AssetUUIDList *uuids);
+
+/* Ensure given assets (uuids) are really available for append/link (some kind of 'anticipated loading'...).
+ * Note: Engine should expect any kind of UUIDs it produced here
+ * (i.e. real ones as well as 'virtual' filebrowsing ones). */
- typedef int (*ae_ensure_uuids)(struct AssetEngine *engine, const int job_id, struct AssetUUIDList *uuids);
-
-
++typedef int (*ae_ensure_uuids)(struct AssetEngine *engine,
++ const int job_id,
++ struct AssetUUIDList *uuids);
+
+/**************************************************************************************/
+/* ***** All callbacks below are blocking. They shall be completed upon return. ***** */
+/**************************************************************************************/
+
+/* FILEBROWSER - Perform sorting and/or filtering on engines' side.
+ * Note that engine is assumed to feature its own sorting/filtering settings!
+ * Number of available filtered entries is to be set in entries_r.
+ */
- typedef bool (*ae_sort_filter)(struct AssetEngine *engine, const bool sort, const bool filter,
- struct FileSelectParams *params, struct FileDirEntryArr *entries_r);
++typedef bool (*ae_sort_filter)(struct AssetEngine *engine,
++ const bool sort,
++ const bool filter,
++ struct FileSelectParams *params,
++ struct FileDirEntryArr *entries_r);
+
+/* FILEBROWSER - Return specified block of entries in entries_r. */
- typedef bool (*ae_entries_block_get)(struct AssetEngine *engine, const int start_index, const int end_index,
++typedef bool (*ae_entries_block_get)(struct AssetEngine *engine,
++ const int start_index,
++ const int end_index,
+ struct FileDirEntryArr *entries_r);
+
+/* FILEBROWSER - Return specified entries from their uuids, in entries_r. */
- typedef bool (*ae_entries_uuid_get)(struct AssetEngine *engine, struct AssetUUIDList *uuids,
++typedef bool (*ae_entries_uuid_get)(struct AssetEngine *engine,
++ struct AssetUUIDList *uuids,
+ struct FileDirEntryArr *entries_r);
+
+/* 'pre-loading' hook, called before opening/appending/linking/updating given entries.
+ * Note first given uuid is the one of 'active' entry, and first entry in returned list will be considered as such too.
+ * E.g. allows the engine to ensure entries' paths are actually valid by downloading requested data, etc.
+ * If is_virtual is True, then there is no requirement that returned paths actually exist.
+ * Note that the generated list shall be simpler than the one generated by ae_list_dir, since only the path from
+ * active revision is used, no need to bother with variants, previews, etc.
+ * This allows to present 'fake' entries to user, and then import actual data.
+ */
- typedef bool (*ae_load_pre)(struct AssetEngine *engine, struct AssetUUIDList *uuids,
++typedef bool (*ae_load_pre)(struct AssetEngine *engine,
++ struct AssetUUIDList *uuids,
+ struct FileDirEntryArr *entries_r);
+
+/* 'post-loading' hook, c
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list