[Bf-blender-cvs] [b0e7c4d] asset-engine: Merge branch 'master' into asset-engine

Bastien Montagne noreply at git.blender.org
Mon Nov 7 15:30:06 CET 2016


Commit: b0e7c4ded99705f182853973c35c443fd3e75f01
Author: Bastien Montagne
Date:   Mon Nov 7 15:29:48 2016 +0100
Branches: asset-engine
https://developer.blender.org/rBb0e7c4ded99705f182853973c35c443fd3e75f01

Merge branch 'master' into asset-engine

===================================================================



===================================================================

diff --cc source/blender/blenkernel/BKE_library.h
index 5a4f331,79373e3..82cecb8
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@@ -38,9 -38,8 +38,10 @@@ extern "C" 
  
  #include "BLI_compiler_attrs.h"
  
 +struct AssetEngineType;
 +struct AssetUUID;
  struct BlendThumbnail;
+ struct GHash;
  struct ListBase;
  struct ID;
  struct ImBuf;
@@@ -127,22 -126,9 +128,23 @@@ void BKE_id_ui_prefix(char name[66 + 1]
  void BKE_library_free(struct Library *lib);
  
  void BKE_library_make_local(
-         struct Main *bmain, const struct Library *lib, const bool untagged_only, const bool set_fake);
+         struct Main *bmain, const struct Library *lib, struct GHash *old_to_new_ids,
+         const bool untagged_only, const bool set_fake);
  
 +void BKE_library_asset_repository_init(struct Library *lib, const struct AssetEngineType *aet, const char *repo_root);
 +void BKE_library_asset_repository_clear(struct Library *lib);
 +void BKE_library_asset_repository_free(struct Library *lib);
 +struct AssetRef *BKE_library_asset_repository_asset_add(struct Library *lib, const void *idv);
 +void BKE_library_asset_repository_asset_remove(struct Library *lib, const void *idv);
 +struct AssetRef *BKE_library_asset_repository_asset_find(struct Library *lib, const void *idv);
 +void BKE_library_asset_repository_subdata_add(struct AssetRef *aref, const void *idv);
 +void BKE_library_asset_repository_subdata_remove(struct AssetRef *aref, const void *idv);
 +
 +void BKE_libraries_asset_subdata_remove(struct Main *bmain, const void *idv);
 +void BKE_libraries_asset_repositories_clear(struct Main *bmain);
 +void BKE_libraries_asset_repositories_rebuild(struct Main *bmain);
 +struct AssetRef *BKE_libraries_asset_repository_uuid_find(struct Main *bmain, const struct AssetUUID *uuid);
 +struct Library *BKE_library_asset_virtual_ensure(struct Main *bmain, const struct AssetEngineType *aet);
  
  /* use when "" is given to new_id() */
  #define ID_FALLBACK_NAME N_("Untitled")
diff --cc source/blender/blenkernel/intern/library.c
index d7deff3,5d28a84..b651e14
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@@ -1762,9 -1796,40 +1802,41 @@@ void BKE_library_make_local
  			}
  		}
  	}
+ 
+ 	/* Fourth step: Try to find circle dependencies between indirectly-linked-only datablocks.
+ 	 * Those are fake 'usages' that prevent their deletion. See T49775 for nice ugly case. */
+ 	BKE_library_tag_unused_linked_data(bmain, false);
+ 	for (LinkNode *it = linked_loop_candidates; it; it = it->next) {
+ 		if (it->link == NULL) {
+ 			continue;
+ 		}
+ 		if ((id = ((LinkNode *)it->link)->link) == NULL) {
+ 			it->link = NULL;
+ 			continue;
+ 		}
+ 
+ 		/* Note: in theory here we are only handling datablocks forming exclusive linked dependency-cycles-based
+ 		 * archipelagos, so no need to check again after we have deleted one, as done in previous step. */
+ 		if (id->tag & LIB_TAG_DOIT) {
+ 			/* Note: *in theory* IDs tagged here are fully *outside* of file scope, totally unused, so we can
+ 			 *       directly wipe them out without caring about clearing their usages.
+ 			 *       However, this is a highly-risky presumption, and nice crasher in case something goes wrong here.
+ 			 *       So for 2.78a will keep the safe option, and switch to more efficient one in master later. */
+ #if 0
+ 			BKE_libblock_free_ex(bmain, id, false);
+ #else
+ 			BKE_libblock_unlink(bmain, id, false, false);
+ 			BKE_libblock_free(bmain, id);
+ #endif
+ 			((LinkNode *)it->link)->link = NULL;  /* Not strictly necessary, but safer (see T49903)... */
+ 			it->link = NULL;
+ 		}
+ 	}
+ 
+ 	BLI_memarena_free(linklist_mem);
  }
  
 +
  /**
   * Use after setting the ID's name
   * When name exists: call 'new_id'




More information about the Bf-blender-cvs mailing list