[Bf-blender-cvs] [ef14700] asset-engine: Cleanup: get rid of blocking asset update_check code.
Bastien Montagne
noreply at git.blender.org
Thu Apr 28 21:34:34 CEST 2016
Commit: ef1470008977f2985adb3928b576111824e48a9e
Author: Bastien Montagne
Date: Thu Apr 28 21:32:32 2016 +0200
Branches: asset-engine
https://developer.blender.org/rBef1470008977f2985adb3928b576111824e48a9e
Cleanup: get rid of blocking asset update_check code.
===================================================================
M source/blender/blenkernel/BKE_asset.h
M source/blender/blenkernel/intern/asset.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_asset.h b/source/blender/blenkernel/BKE_asset.h
index b0ed429..bc07eb7 100644
--- a/source/blender/blenkernel/BKE_asset.h
+++ b/source/blender/blenkernel/BKE_asset.h
@@ -206,8 +206,6 @@ void BKE_asset_engine_free(AssetEngine *engine);
AssetUUIDList *BKE_asset_engine_load_pre(AssetEngine *engine, struct FileDirEntryArr *r_entries);
-void BKE_assets_update_check(struct Main *bmain);
-
/* File listing utils... */
typedef enum FileCheckType {
diff --git a/source/blender/blenkernel/intern/asset.c b/source/blender/blenkernel/intern/asset.c
index 7fa422d..8a345d3 100644
--- a/source/blender/blenkernel/intern/asset.c
+++ b/source/blender/blenkernel/intern/asset.c
@@ -235,100 +235,6 @@ AssetUUIDList *BKE_asset_engine_load_pre(AssetEngine *engine, FileDirEntryArr *r
return uuids;
}
-/* Note: this is a blocking version! We probably won't need it in the end. */
-void BKE_assets_update_check(Main *bmain)
-{
- for (Library *lib = bmain->library.first; lib; lib = lib->id.next) {
- if (lib->asset_repository) {
- printf("Handling lib file %s (engine %s, ver. %d)\n", lib->filepath, lib->asset_repository->asset_engine, lib->asset_repository->asset_engine_version);
-
- AssetUUIDList uuids = {0};
- AssetUUID *uuid;
- AssetEngineType *ae_type = BKE_asset_engines_find(lib->asset_repository->asset_engine);
- AssetEngine *ae = NULL;
-
- uuids.asset_engine_version = lib->asset_repository->asset_engine_version;
-
- printf("Handling lib file %s (engine %s, ver. %d)\n", lib->filepath, lib->asset_repository->asset_engine, lib->asset_repository->asset_engine_version);
-
- if (ae_type == NULL) {
- printf("ERROR! Unknown asset engine!\n");
- }
- else {
- ae = BKE_asset_engine_create(ae_type, NULL);
- }
-
- for (AssetRef *aref = lib->asset_repository->assets.first; aref; aref = aref->next) {
- for (LinkData *ld = aref->id_list.first; ld; ld = ld->next) {
- ID *id = ld->data;
-
- if (ae_type == NULL) {
- if (id->uuid) {
- id->uuid->tag = UUID_TAG_ENGINE_MISSING;
- }
- continue;
- }
-
- if (id->uuid) {
- printf("\tWe need to check for updated asset %s...\n", id->name);
- id->uuid->tag = 0;
-
- /* XXX horrible, need to use some mempool, stack or something :) */
- uuids.nbr_uuids++;
- if (uuids.uuids) {
- uuids.uuids = MEM_reallocN_id(uuids.uuids, sizeof(*uuids.uuids) * (size_t)uuids.nbr_uuids, __func__);
- }
- else {
- uuids.uuids = MEM_mallocN(sizeof(*uuids.uuids) * (size_t)uuids.nbr_uuids, __func__);
- }
- uuids.uuids[uuids.nbr_uuids - 1] = *id->uuid;
- }
- else {
- printf("\t\tWe need to check for updated asset sub-data %s...\n", id->name);
- }
- }
- }
-
- if (ae == NULL) {
- continue; /* uuids.uuids has not been allocated either, we can skip to next lib safely. */
- }
-
- const int job_id = ae_type->update_check(ae, AE_JOB_ID_UNSET, &uuids);
- if (job_id != AE_JOB_ID_INVALID) {
- while (ae_type->status(ae, job_id) & AE_STATUS_RUNNING) PIL_sleep_ms(50);
- ae_type->kill(ae, job_id);
- }
-
- /* Note: UUIDs list itself is not editable from py (adding/removing/reordering items), so we can use mere
- * order to map returned uuid data to their IDs. */
-
- uuid = uuids.uuids;
- for (AssetRef *aref = lib->asset_repository->assets.first; aref; aref = aref->next) {
- for (LinkData *ld = aref->id_list.first; ld; ld = ld->next) {
- ID *id = ld->data;
- if (id->uuid) {
- *id->uuid = *uuid;
- uuid++;
-
- if (id->uuid->tag & UUID_TAG_ENGINE_MISSING) {
- printf("\t%s uses a currently unknown asset engine!\n", id->name);
- }
- else if (id->uuid->tag & UUID_TAG_ASSET_MISSING) {
- printf("\t%s is currently unknown by asset engine!\n", id->name);
- }
- else if (id->uuid->tag & UUID_TAG_ASSET_RELOAD) {
- printf("\t%s needs to be reloaded/updated!\n", id->name);
- }
- }
- }
- }
-
- MEM_freeN(uuids.uuids);
- BKE_asset_engine_free(ae);
- }
- }
-}
-
/* FileDirxxx handling. */
void BKE_filedir_revision_free(FileDirEntryRevision *rev)
More information about the Bf-blender-cvs
mailing list