[Bf-blender-cvs] [8f8f5a65887] asset-engine: Merge branch 'blender2.8' into asset-engine
Bastien Montagne
noreply at git.blender.org
Sun Jan 21 17:38:17 CET 2018
Commit: 8f8f5a65887f2a38d783307a0fbf9ba8e08bee6a
Author: Bastien Montagne
Date: Sun Jan 21 17:37:33 2018 +0100
Branches: asset-engine
https://developer.blender.org/rB8f8f5a65887f2a38d783307a0fbf9ba8e08bee6a
Merge branch 'blender2.8' into asset-engine
Conflicts:
source/blender/blenloader/intern/versioning_280.c
source/blender/makesdna/DNA_ID.h
===================================================================
===================================================================
diff --cc source/blender/blenloader/intern/versioning_280.c
index b7b2d0f4232,b5530d90330..f7c71350b50
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -885,30 -885,34 +885,60 @@@ void blo_do_versions_280(FileData *fd,
}
{
+ if (DNA_struct_elem_find(fd->filesdna, "SpaceOops", "int", "filter") == false) {
+ bScreen *sc;
+ ScrArea *sa;
+ SpaceLink *sl;
+
+ /* Update files using invalid (outdated) outlinevis Outliner values. */
+ for (sc = main->screen.first; sc; sc = sc->id.next) {
+ for (sa = sc->areabase.first; sa; sa = sa->next) {
+ for (sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_OUTLINER) {
+ SpaceOops *so = (SpaceOops *)sl;
+
+ if (!ELEM(so->outlinevis,
+ SO_SCENES,
+ SO_GROUPS,
+ SO_LIBRARIES,
+ SO_SEQUENCE,
+ SO_DATABLOCKS,
+ SO_ID_ORPHANS,
+ SO_VIEW_LAYER,
+ SO_COLLECTIONS))
+ {
+ so->outlinevis = SO_VIEW_LAYER;
+ }
+ }
+ }
+ }
+ }
+ }
++
+ if (1 || !DNA_struct_find(fd->filesdna, "AssetUUID")) { /* struct_find will have to wait, not working for now... */
+ /* Move non-op filebrowsers to 'library browsing' type/mode. */
+ for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_FILE) {
+ SpaceFile *sfile = (SpaceFile *)sl;
+ if (sfile->params != NULL) {
+ sfile->params->type = FILE_LOADLIB;
+ sfile->params->filter = FILE_TYPE_FOLDER | FILE_TYPE_BLENDERLIB;
+ /* For now, always init filterid to 'all true' */
+ sfile->params->filter_id = FILTER_ID_AC | FILTER_ID_AR | FILTER_ID_BR | FILTER_ID_CA |
+ FILTER_ID_CU | FILTER_ID_GD | FILTER_ID_GR | FILTER_ID_IM |
+ FILTER_ID_LA | FILTER_ID_LS | FILTER_ID_LT | FILTER_ID_MA |
+ FILTER_ID_MB | FILTER_ID_MC | FILTER_ID_ME | FILTER_ID_MSK |
+ FILTER_ID_NT | FILTER_ID_OB | FILTER_ID_PA | FILTER_ID_PAL |
+ FILTER_ID_PC | FILTER_ID_SCE | FILTER_ID_SPK | FILTER_ID_SO |
+ FILTER_ID_TE | FILTER_ID_TXT | FILTER_ID_VF | FILTER_ID_WO |
+ FILTER_ID_CF;
+ }
+ }
+ }
+ }
+ }
+ }
}
}
diff --cc source/blender/makesdna/DNA_ID.h
index fcfab47c32d,fd8cd8b2855..a0d9f7aa6f6
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@@ -265,7 -217,10 +265,13 @@@ typedef struct ID
IDOverrideStatic *override_static; /* Reference linked ID which this one overrides. */
+ AssetUUID *uuid;
++ void *pad_v;
++
+ /* Only set for datablocks which are coming from copy-on-write, points to
+ * the original version of it.
+ */
+ void *orig_id;
void *py_instance;
} ID;
diff --cc source/blender/windowmanager/intern/wm_files_link.c
index 7d610f366f0,cd6a38cb9a8..a2a332623cd
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@@ -234,90 -213,8 +234,90 @@@ static WMLinkAppendDataItem *wm_link_ap
return item;
}
+static int path_to_idcode(const char *path)
+{
+ const int filetype = ED_path_extension_type(path);
+ switch (filetype) {
+ case FILE_TYPE_IMAGE:
+ case FILE_TYPE_MOVIE:
+ return ID_IM;
+ case FILE_TYPE_FTFONT:
+ return ID_VF;
+ case FILE_TYPE_SOUND:
+ return ID_SO;
+ case FILE_TYPE_PYSCRIPT:
+ case FILE_TYPE_TEXT:
+ return ID_TXT;
+ default:
+ return 0;
+ }
+}
+
+static void wm_link_virtual_lib(
+ WMLinkAppendData *lapp_data, Main *bmain, AssetEngineType *aet, const int lib_idx)
+{
+ const bool generate_overrides = (lapp_data->flag & BLO_LIBLINK_GENERATE_OVERRIDE) != 0;
+ LinkNode *itemlink;
+ int item_idx;
+
+ BLI_assert(aet);
+
+ /* Find or add virtual library matching current asset engine. */
+ Library *virtlib = BKE_library_asset_virtual_ensure(bmain, aet);
+
+ for (item_idx = 0, itemlink = lapp_data->items.list; itemlink; item_idx++, itemlink = itemlink->next) {
+ WMLinkAppendDataItem *item = itemlink->link;
+ ID *new_id = NULL;
+ bool id_exists = false;
+
+ if (!BLI_BITMAP_TEST(item->libraries, lib_idx)) {
+ continue;
+ }
+
+ switch (item->idcode) {
+ case ID_IM:
+ new_id = (ID *)BKE_image_load_exists_ex(item->name, &id_exists);
+ if (id_exists) {
+ if (!new_id->uuid || !ASSETUUID_COMPARE(new_id->uuid, item->uuid)) {
+ /* Fake 'same ID' (same path, but different uuid or whatever), force loading into new ID. */
+ BLI_assert(new_id->lib != virtlib);
+ new_id = (ID *)BKE_image_load(bmain, item->name);
+ id_exists = false;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (new_id) {
+ new_id->lib = virtlib;
+ new_id->tag |= LIB_TAG_EXTERN | LIB_ASSET;
+
+ if (!id_exists) {
+ new_id->uuid = MEM_mallocN(sizeof(*new_id->uuid), __func__);
+ *new_id->uuid = *item->uuid;
+ }
+
+ if (generate_overrides) {
+ /* Create local override of virtually linked datablock, since we nearly always want to be able
+ * to edit pretty much everything about it. */
- new_id = BKE_override_static_create_from(bmain, new_id);
++ new_id = BKE_override_static_create_from_id(bmain, new_id);
+ /* TODO: will need to protect some fields on type-by-type case (path field). */
+ }
+
+ /* If the link is sucessful, clear item's libs 'todo' flags.
+ * This avoids trying to link same item with other libraries to come. */
+ BLI_BITMAP_SET_ALL(item->libraries, false, lapp_data->num_libraries);
+ item->new_id = new_id;
+ }
+ }
+ BKE_libraries_asset_repositories_rebuild(bmain);
+}
+
static void wm_link_do(
- WMLinkAppendData *lapp_data, ReportList *reports, Main *bmain, Scene *scene, ViewLayer *view_layer)
+ WMLinkAppendData *lapp_data, ReportList *reports, Main *bmain, AssetEngineType *aet,
+ Scene *scene, ViewLayer *view_layer)
{
Main *mainl;
BlendHandle *bh;
More information about the Bf-blender-cvs
mailing list