[Bf-blender-cvs] [889c4ca9c26] asset-engine--archived: Merge branch 'asset-uuid--archived' into asset-engine--archived
Julian Eisel
noreply at git.blender.org
Wed Jul 1 17:25:16 CEST 2020
Commit: 889c4ca9c26d770af02cedef972d65eb173bdb5e
Author: Julian Eisel
Date: Wed Jul 1 17:25:04 2020 +0200
Branches: asset-engine--archived
https://developer.blender.org/rB889c4ca9c26d770af02cedef972d65eb173bdb5e
Merge branch 'asset-uuid--archived' into asset-engine--archived
===================================================================
===================================================================
diff --cc source/blender/blenkernel/intern/library.c
index adb672b579e,48c98be626d..4624818586a
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@@ -79,24 -79,19 +79,24 @@@ IDTypeInfo IDType_ID_LI =
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) {
- BLI_strncpy(lib->name, filepath, sizeof(lib->name));
+ if (lib->filepath != filepath) {
+ BLI_strncpy(lib->filepath, filepath, sizeof(lib->filepath));
}
- BLI_strncpy(lib->filepath, filepath, sizeof(lib->filepath));
+ BLI_strncpy(lib->filepath_abs, filepath, sizeof(lib->filepath_abs));
- /* not essential but set filepath is an absolute copy of value which
- * is more useful if its kept in sync */
- if (BLI_path_is_rel(lib->filepath)) {
+ /* Not essential but set `filepath_abs` is an absolute copy of value which
+ * is more useful if its kept in sync. */
+ if (BLI_path_is_rel(lib->filepath_abs)) {
/* note that the file may be unsaved, in this case, setting the
- * filepath on an indirectly linked path is not allowed from the
+ * `filepath_abs` on an indirectly linked path is not allowed from the
* outliner, and its not really supported but allow from here for now
* since making local could cause this to be directly linked - campbell
*/
diff --cc source/blender/blenkernel/intern/node.c
index c0b908ff9d2,b73f957535c..c21b0b1b2d6
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@@ -3214,9 -3214,9 +3214,9 @@@ void BKE_node_clipboard_add_node(bNode
node_info->id = node->id;
if (node->id) {
BLI_strncpy(node_info->id_name, node->id->name, sizeof(node_info->id_name));
- if (ID_IS_LINKED(node->id)) {
+ if (ID_IS_LINKED_DATABLOCK(node->id)) { /* Don't want virtual libraries here... */
BLI_strncpy(
- node_info->library_name, node->id->lib->filepath, sizeof(node_info->library_name));
+ node_info->library_name, node->id->lib->filepath_abs, sizeof(node_info->library_name));
}
else {
node_info->library_name[0] = '\0';
diff --cc source/blender/blenloader/intern/versioning_280.c
index 79d14f28f9c,111ac728cc3..c13331b9346
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -5076,35 -5093,23 +5094,52 @@@ void blo_do_versions_280(FileData *fd,
* \note Keep this message at the bottom of the function.
*/
{
+ /* Set the cloth wind factor to 1 for old forces. */
+ if (!DNA_struct_elem_find(fd->filesdna, "PartDeflect", "float", "f_wind_factor")) {
+ LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
+ if (ob->pd) {
+ ob->pd->f_wind_factor = 1.0f;
+ }
+ }
+ LISTBASE_FOREACH (ParticleSettings *, part, &bmain->particles) {
+ if (part->pd) {
+ part->pd->f_wind_factor = 1.0f;
+ }
+ if (part->pd2) {
+ part->pd2->f_wind_factor = 1.0f;
+ }
+ }
+ }
+
/* Keep this block, even when empty. */
}
+
+ 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;
+ }
+ }
+ }
+ }
+ }
+ }
}
diff --cc source/blender/blenloader/intern/writefile.c
index 3677f6c4130,d8576b4c6de..68206ed47e2
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@@ -4005,54 -3910,30 +3919,54 @@@ static void write_libraries(WriteData *
writestruct(wd, DATA, PackedFile, 1, pf);
writedata(wd, DATA, pf->size, pf->data);
if (wd->use_memfile == false) {
- printf("write packed .blend: %s\n", main->curlib->name);
+ printf("write packed .blend: %s\n", main->curlib->filepath);
}
}
-
- /* 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_idtype_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_abs);
- BLI_assert(0);
+ if (main->curlib->asset_repository) {
+ writestruct(wd, DATA, AssetRepositoryRef, 1, main->curlib->asset_repository);
+ }
+
+ if (main->curlib->flag & LIBRARY_FLAG_VIRTUAL) {
+ /* 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_idtype_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);
++ main->curlib->filepath_abs);
+ BLI_assert(0);
+ }
+ }
+ }
+ }
+ }
+ else {
+ 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_idtype_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);
++ main->curlib->filepath_abs);
+ BLI_assert(0);
+ }
+ writestruct(wd, ID_LINK_PLACEHOLDER, ID, 1, id);
+ /* It is mandatory to write id's asset uuid reference for placeholders too, otherwise
+ * the whole asset info would be completely lost when reloading the linked
+ * data-block, especially in case it is not immediately found and needs to go through
+ * the whole 'asset engine update' process after main .blend read process is
+ * finished. */
+ write_iddata(&writer, id);
}
- writestruct(wd, ID_LINK_PLACEHOLDER, ID, 1, id);
- /* It is mandatory to write id's asset uuid reference for placeholders too, otherwise
- * the whole asset info would be completely lost when reloading the linked data-block,
- * especially in case it is not immediately found and needs to go through the whole
- * 'asset engine update' process after main .blend read process is finished. */
- write_iddata(&writer, id);
}
}
}
diff --cc source/blender/makesdna/DNA_ID.h
index 2c9888ec06e,660f0121699..76af761ff27
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@@ -565,16 -515,13 +566,16 @@@ typedef enum ID_Type
((GS((id)->name) != ID_SCR) && (GS((id)->name) != ID_WM) && (GS((id)->name) != ID_WS))
#define ID_BLEND_PATH(_bmain, _id) \
- ((_id)->lib ? (_id)->lib->filepath : BKE_main_blendfile_path((_bmain)))
+ ((_id)->lib ? (_id)->lib->filepath_abs : BKE_main_blendfile_path((_bmain)))
#define ID_BLEND_PATH_FROM_GLOBAL(_id) \
- ((_id)->lib ? (_id)->lib->filepath : BKE_main_blendfile_path_from_global())
+ ((_id)->lib ? (_id)->lib->filepath_abs : BKE_main_blendfile_path_from_global())
- #define ID_MISSING(_id) ((((ID *)(_id))->tag & LIB_TAG_MISSING) != 0)
+ #define ID_MISSING(_id) ((((const ID *)(_id))->tag & LIB_TAG_MISSING) != 0)
- #define ID_IS_LINKED(_id) (((ID *)(_id))->lib != NULL)
+ #define ID_IS_LINKED(_id) (((const ID *)(_id))->lib != NULL)
+#define LIB_IS_VIRTUAL(_lib) (((_lib)->flag & LIBRARY_FLAG_VIRTUAL) != 0)
+#define ID_IS_LINKED_DATABLOCK(_id)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list