[Bf-blender-cvs] [54b60eb1b04] asset-engine: Merge branch 'master' into asset-engine
Bastien Montagne
noreply at git.blender.org
Thu Sep 19 21:55:53 CEST 2019
Commit: 54b60eb1b04e08f5786dc59e1bc05c2abf1694ce
Author: Bastien Montagne
Date: Thu Sep 19 20:51:09 2019 +0200
Branches: asset-engine
https://developer.blender.org/rB54b60eb1b04e08f5786dc59e1bc05c2abf1694ce
Merge branch 'master' into asset-engine
Conflicts:
source/blender/blenloader/intern/writefile.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_files_link.c
===================================================================
===================================================================
diff --cc source/blender/blenkernel/intern/library.c
index ff5c440c847,468d0e97ece..59c58f3f114
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@@ -1771,8 -1778,8 +1786,9 @@@ void id_clear_lib_data_ex(Main *bmain,
id_fake_user_clear(id);
id->lib = NULL;
+ MEM_SAFE_FREE(id->uuid);
id->tag &= ~(LIB_TAG_INDIRECT | LIB_TAG_EXTERN);
+ id->flag &= ~LIB_INDIRECT_WEAK_LINK;
if (id_in_mainlist) {
if (BKE_id_new_name_validate(which_libbase(bmain, GS(id->name)), id, NULL)) {
bmain->is_memfile_undo_written = false;
diff --cc source/blender/blenloader/intern/readfile.c
index ab46967bf8e,87db0ce1ad2..8ec877ee707
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -112,10 -105,7 +107,8 @@@
#include "BKE_action.h"
#include "BKE_armature.h"
+#include "BKE_asset_engine.h"
#include "BKE_brush.h"
- #include "BKE_cachefile.h"
- #include "BKE_cloth.h"
#include "BKE_collection.h"
#include "BKE_colortools.h"
#include "BKE_constraint.h"
@@@ -9225,21 -9199,17 +9222,30 @@@ static BHead *read_libblock(FileData *f
/* this case cannot be direct_linked: it's just the ID part */
if (bhead->code == ID_LINK_PLACEHOLDER) {
/* That way, we know which data-lock needs do_versions (required currently for linking). */
- id->tag = tag | LIB_TAG_NEED_LINK | LIB_TAG_NEW;
+ id->tag = tag | LIB_TAG_ID_LINK_PLACEHOLDER | LIB_TAG_NEED_LINK | LIB_TAG_NEW;
+
+ if (placeholder_set_indirect_extern) {
+ if (id->flag & LIB_INDIRECT_WEAK_LINK) {
+ id->tag |= LIB_TAG_INDIRECT;
+ }
+ else {
+ id->tag |= LIB_TAG_EXTERN;
+ }
+ }
+ if (id->uuid) {
+ /* read all data into fd->datamap */
+ bhead = read_data_into_oldnewmap(fd, bhead, __func__);
+
+ id->uuid = newdataadr(fd, id->uuid);
+ id->uuid->ibuff = NULL; /* Just in case... */
+ id->uuid->width = id->uuid->height = 0;
+
+ oldnewmap_free_unused(fd->datamap);
+ oldnewmap_clear(fd->datamap);
+ return bhead;
+ }
+
return blo_bhead_next(fd, bhead);
}
diff --cc source/blender/blenloader/intern/versioning_280.c
index 31730c74d26,aa54e64cd6b..93f18e66a93
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -3843,36 -3844,54 +3845,83 @@@ void blo_do_versions_280(FileData *fd,
}
}
+ 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 = bmain->screens.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;
+ }
+ }
+ }
+ }
+ }
+ }
+
{
/* Versioning code until next subversion bump goes here. */
+ if (!DNA_struct_elem_find(
+ fd->filesdna, "LayerCollection", "short", "local_collections_bits")) {
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+ LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
+ LISTBASE_FOREACH (LayerCollection *, layer_collection, &view_layer->layer_collections) {
+ do_versions_local_collection_bits_set(layer_collection);
+ }
+ }
+ }
+ }
+
+ /* Fix wrong 3D viewport copying causing corrupt pointers (T69974). */
+ for (bScreen *screen = bmain->screens.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_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+
+ for (ScrArea *sa_other = screen->areabase.first; sa_other; sa_other = sa_other->next) {
+ for (SpaceLink *sl_other = sa_other->spacedata.first; sl_other;
+ sl_other = sl_other->next) {
+ if (sl != sl_other && sl_other->spacetype == SPACE_VIEW3D) {
+ View3D *v3d_other = (View3D *)sl_other;
+
+ if (v3d->shading.prop == v3d_other->shading.prop) {
+ v3d_other->shading.prop = NULL;
+ }
+ }
+ }
+ }
+ }
+ else if (sl->spacetype == SPACE_FILE) {
+ ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
+ ARegion *ar_execute = do_versions_find_region_or_null(regionbase, RGN_TYPE_EXECUTE);
+
+ if (!ar_execute) {
+ ARegion *ar_main = do_versions_find_region(regionbase, RGN_TYPE_WINDOW);
+ ar_execute = MEM_callocN(sizeof(ARegion), "versioning execute region for file");
+ BLI_insertlinkbefore(regionbase, ar_main, ar_execute);
+ ar_execute->regiontype = RGN_TYPE_EXECUTE;
+ ar_execute->alignment = RGN_ALIGN_BOTTOM;
+ ar_execute->flag |= RGN_FLAG_DYNAMIC_SIZE;
+ }
+ }
+ }
+ }
+ }
}
}
diff --cc source/blender/blenloader/intern/writefile.c
index 21eedcb9601,aae5072c8de..a272798a6fb
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@@ -703,14 -702,7 +702,15 @@@ static void write_iddata(void *wd, cons
{
/* ID_WM's id->properties are considered runtime only, and never written in .blend file. */
if (id->properties && !ELEM(GS(id->name), ID_WM)) {
- /* We want to write IDProps from 'virtual' libraries too, but not from 'real' linked datablocks... */
- IDP_WriteProperty(id->properties, wd);
++ /* We want to write IDProps from 'virtual' libraries too, but not from 'real' linked
++ * datablocks... */
+ if (!id->uuid || (id->lib && (id->lib->flag & LIBRARY_FLAG_VIRTUAL))) {
+ IDP_WriteProperty(id->properties, wd);
+ }
+ }
+ if (id->uuid) {
+ BLI_assert(id->lib && id->lib->asset_repository);
+ writestruct(wd, DATA, AssetUUID, 1, id->uuid);
}
if (id->override_library) {
@@@ -3676,80 -3665,21 +3678,82 @@@ static void write_libraries(WriteData *
}
}
- /* Write link placeholders for all direct linked IDs. */
- while (a--) {
- for (id = lbarray[a]->first; id; id = id->next) {
- if (id->us > 0 &&
- ((id->tag & LIB_TAG_EXTERN) ||
- ((id->tag & LIB_TAG_INDIRECT) && (id->flag & LIB_INDIRECT_WEAK_LINK)))) {
- if (!BKE_idcode_is_linkable(GS(id->name))) {
- printf(
- "ERROR: write file: data-block '%s' from lib '%s' is not linkable "
- "but is flagged as directly linked",
- id->name,
- main->curlib->filepath);
- BLI_assert(0);
+ if (main->curlib->asset_repository) {
+ writestruct(wd, DATA, AssetRepositoryRef, 1, main->curlib->asset_repository);
+ }
+
+ if (main->curlib->flag & LIBRARY_FLAG_VIRTUAL) {
+ while (a--) {
+ for (id = lbarray[a]->first; id; id = id->next) {
+ switch ((ID_Type)GS(id->name)) {
+ /* Those should be the only datatypes found in a virtual library (for now)! */
+ case ID_IM:
+ write_image(wd, (Image *)id);
+ break;
+ case ID_VF:
+ write_vfont(wd, (VFont *)id);
+ break;
+ case ID_TXT:
+ write_text(wd, (Text *)id);
+ break;
+ case ID_SO:
+ write_sound(wd, (bSound *)id);
+ break;
+ case ID_WM:
+ case ID_SCR:
+ case ID_MC:
+ case ID_MSK:
+ case ID_SCE:
+ case ID_CU:
+ case ID_MB:
+ case ID_CA:
+ case ID_LA:
+ case ID_LT:
+ case ID_KE:
+ case ID_WO:
+ case ID_SPK:
+ case ID_GR:
+ case ID_AR:
+ case ID_AC:
+ case ID_OB:
+ case ID_MA:
+ case ID_TE:
+ case ID_ME:
+ case ID_PA:
+ case ID_NT:
+ case ID_BR:
+ case ID_PAL:
+ case ID_PC:
+ case ID_GD:
+ case ID_LS:
+ case ID_CF:
+ case ID_LI:
+ case ID_IP:
+ default:
+ /* Should never be reached. */
+ BLI_assert(0);
+ break;
+ }
+ }
+ }
+ }
+ else {
+ while (a--) {
+ for (id = lbarray[a]->first; id; id = id->next) {
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list