[Bf-blender-cvs] [e1380ed958b] asset-engine: Merge branch 'blender2.8' into asset-engine
Bastien Montagne
noreply at git.blender.org
Mon Jun 18 12:59:47 CEST 2018
Commit: e1380ed958b11910410314e3591bd502d2030470
Author: Bastien Montagne
Date: Mon Jun 18 12:59:27 2018 +0200
Branches: asset-engine
https://developer.blender.org/rBe1380ed958b11910410314e3591bd502d2030470
Merge branch 'blender2.8' into asset-engine
Conflicts:
source/blender/blenkernel/intern/library.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/space_file/file_draw.c
source/blender/editors/space_file/file_intern.h
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/makesrna/intern/rna_ID.c
source/blender/makesrna/intern/rna_space.c
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_files_link.c
source/blender/windowmanager/intern/wm_init_exit.c
===================================================================
===================================================================
diff --cc source/blender/blenkernel/intern/library.c
index ef52b02bc74,c45903aa1fa..2cd50e43d1d
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@@ -155,11 -155,7 +155,11 @@@
* also note that the id _must_ have a library - campbell */
void BKE_id_lib_local_paths(Main *bmain, Library *lib, ID *id)
{
+ if (lib->flag & LIBRARY_FLAG_VIRTUAL) {
+ return;
+ }
+
- const char *bpath_user_data[2] = {bmain->name, lib->filepath};
+ const char *bpath_user_data[2] = {BKE_main_blendfile_path(bmain), lib->filepath};
BKE_bpath_traverse_id(bmain, id,
BKE_bpath_relocate_visitor,
@@@ -1787,12 -1795,10 +1801,12 @@@ void id_sort_by_name(ListBase *lb, ID *
static ID *is_dupid(ListBase *lb, ID *id, const char *name)
{
ID *idtest = NULL;
-
+
for (idtest = lb->first; idtest; idtest = idtest->next) {
/* if idtest is not a lib */
- if (id != idtest && !ID_IS_LINKED(idtest)) {
+ /* Virtual lib IDs are considered as local ones here, since we bulk-add them to virtual library datablocks,
+ * we need to ensure ourselves there is no name collision there. */
+ if (id != idtest && !ID_IS_LINKED_DATABLOCK(idtest)) {
/* do not test alphabetic! */
/* optimized */
if (idtest->name[2] == name[0]) {
@@@ -2519,13 -2524,8 +2533,13 @@@ void BKE_id_ui_prefix(char name[MAX_ID_
strcpy(name + 3, id->name + 2);
}
- void BKE_library_filepath_set(Library *lib, const char *filepath)
+ void BKE_library_filepath_set(Main *bmain, Library *lib, const char *filepath)
{
+ if (lib->flag & LIBRARY_FLAG_VIRTUAL) {
+ BLI_assert(!"Setting path for virtual libraries makes no sense.");
+ return;
+ }
+
/* in some cases this is used to update the absolute path from the
* relative */
if (lib->name != filepath) {
diff --cc source/blender/blenloader/intern/readfile.c
index 3f2faf17010,eb9b3f61c08..d570df766d7
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -7499,11 -7506,7 +7515,11 @@@ static bool direct_link_screen(FileDat
static void direct_link_library(FileData *fd, Library *lib, Main *main)
{
Main *newmain;
-
+
+#ifdef DEBUG_LIBRARY
+ printf("adding lib %s (%s)\n", lib->id.name, lib->name);
+#endif
+
/* check if the library was already read */
for (newmain = fd->mainlist->first; newmain; newmain = newmain->next) {
if (newmain->curlib) {
@@@ -7534,17 -7537,12 +7550,18 @@@
/* make sure we have full path in lib->filepath */
BLI_strncpy(lib->filepath, lib->name, sizeof(lib->name));
BLI_cleanup_path(fd->relabase, lib->filepath);
-
+
// printf("direct_link_library: name %s\n", lib->name);
// printf("direct_link_library: filepath %s\n", lib->filepath);
-
+
lib->packedfile = direct_link_packedfile(fd, lib->packedfile);
+
+ lib->asset_repository = newdataadr(fd, lib->asset_repository);
+ if (lib->asset_repository) {
+ /* Do not clear lib->asset_repository itself! */
+ BLI_listbase_clear(&lib->asset_repository->assets);
+ }
+
/* new main */
newmain = BKE_main_new();
BLI_addtail(fd->mainlist, newmain);
@@@ -8341,34 -8335,15 +8358,34 @@@ static BHead *read_libblock(FileData *f
/* That way, we know which datablock needs do_versions (required currently for linking). */
id->tag = tag | LIB_TAG_NEED_LINK | LIB_TAG_NEW;
+ 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_nextbhead(fd, bhead);
}
-
+
+ /* If we have a real ID from a virtual library, tag ID as extern. */
+ if (id->lib && (id->lib->flag & LIBRARY_FLAG_VIRTUAL)) {
+ BLI_assert(ID_VIRTUAL_LIBRARY_VALID(id));
+ id->tag |= LIB_TAG_EXTERN;
+ }
+
/* need a name for the mallocN, just for debugging and sane prints on leaks */
allocname = dataname(GS(id->name));
-
+
/* read all data into fd->datamap */
bhead = read_data_into_oldnewmap(fd, bhead, allocname);
-
+
/* init pointers direct data */
direct_link_id(fd, id);
@@@ -8868,11 -8844,9 +8886,11 @@@ BlendFileData *blo_read_file_internal(F
lib_verify_nodetree(bfd->main, true);
fix_relpaths_library(fd->relabase, bfd->main); /* make all relative paths, relative to the open blend file */
-
+
+ BKE_libraries_asset_repositories_rebuild(bfd->main);
+
link_global(fd, bfd); /* as last */
-
+
fd->mainlist = NULL; /* Safety, this is local variable, shall not be used afterward. */
return bfd;
diff --cc source/blender/blenloader/intern/versioning_280.c
index ecc74b08e33,0324161f6e1..201ac63e4fb
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -1464,52 -1461,143 +1461,169 @@@ void blo_do_versions_280(FileData *fd,
}
}
}
+
+ for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ switch (scene->toolsettings->snap_mode) {
+ case 0: scene->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT; break;
+ case 1: scene->toolsettings->snap_mode = SCE_SNAP_MODE_VERTEX ; break;
+ case 2: scene->toolsettings->snap_mode = SCE_SNAP_MODE_EDGE ; break;
+ case 3: scene->toolsettings->snap_mode = SCE_SNAP_MODE_FACE ; break;
+ case 4: scene->toolsettings->snap_mode = SCE_SNAP_MODE_VOLUME ; break;
+ }
+ switch (scene->toolsettings->snap_node_mode) {
+ case 5: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X; break;
+ case 6: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_Y; break;
+ case 7: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y; break;
+ case 8: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID ; break;
+ }
+ switch (scene->toolsettings->snap_uv_mode) {
+ case 0: scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_INCREMENT; break;
+ case 1: scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_VERTEX ; break;
+ }
+ }
+
+ ParticleSettings *part;
+ for (part = bmain->particle.first; part; part = part->id.next) {
+ part->shape_flag = PART_SHAPE_CLOSE_TIP;
+ part->shape = 0.0f;
+ part->rad_root = 1.0f;
+ part->rad_tip = 0.0f;
+ part->rad_scale = 0.01f;
+ }
}
- for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
- switch (scene->toolsettings->snap_mode) {
- case 0: scene->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT; break;
- case 1: scene->toolsettings->snap_mode = SCE_SNAP_MODE_VERTEX ; break;
- case 2: scene->toolsettings->snap_mode = SCE_SNAP_MODE_EDGE ; break;
- case 3: scene->toolsettings->snap_mode = SCE_SNAP_MODE_FACE ; break;
- case 4: scene->toolsettings->snap_mode = SCE_SNAP_MODE_VOLUME ; break;
+ }
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 280, 18)) {
+ if (!DNA_struct_elem_find(fd->filesdna, "Material", "float", "roughness")) {
+ for (Material *mat = bmain->mat.first; mat; mat = mat->id.next) {
+ if (mat->use_nodes) {
+ if (MAIN_VERSION_ATLEAST(bmain, 280, 0)) {
+ mat->roughness = mat->gloss_mir;
+ }
+ else {
+ mat->roughness = 0.25f;
+ }
+ }
+ else {
+ mat->roughness = 1.0f - mat->gloss_mir;
+ }
+ mat->metallic = mat->ray_mirror;
+ }
+
+ for (bScreen *screen = bmain->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_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ v3d->shading.flag |= V3D_SHADING_SPECULAR_HIGHLIGHT;
+ }
+ }
+ }
}
- switch (scene->toolsettings->snap_node_mode) {
- case 5: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X; break;
- case 6: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_Y; break;
- case 7: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y; break;
- case 8: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID ; break;
+ }
+
+ if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "xray_alpha")) {
+ for (bScreen *screen = bmain->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_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ v3d->shading.xray_alpha = 0.5f;
+ }
+ }
+ }
}
- switch (scene->toolsettings->snap_uv_mode) {
- case 0: scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_INCREMENT; break;
- case 1: scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_VERTEX ; break;
+ }
+ if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "char", "matcap[256]")) {
+ StudioLight *default_matcap = BKE_studiolight_find_first(STUDIOLIGHT_ORIENTATION_VIEWNORMAL);
+ /* when loading the internal file is loaded before the matcaps */
+ if (default_matcap) {
+ for (bScreen *screen = bmain->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_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ BLI_strncpy(v3d->shading.matcap, default_matcap->name, FILE_MAXFILE);
+ }
+ }
+ }
+ }
+ }
+ }
+ if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "wireframe_threshold")) {
+ for (bScreen *screen = bmain->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_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ v3d->overlay.
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list