Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r--source/blender/blenloader/intern/readfile.c12
-rw-r--r--source/blender/blenloader/intern/undofile.c2
-rw-r--r--source/blender/blenloader/intern/versioning_250.c2
-rw-r--r--source/blender/blenloader/intern/versioning_260.c6
-rw-r--r--source/blender/blenloader/intern/versioning_280.c4
-rw-r--r--source/blender/blenloader/intern/versioning_300.c91
-rw-r--r--source/blender/blenloader/intern/versioning_legacy.c6
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c1
-rw-r--r--source/blender/blenloader/intern/writefile.c11
9 files changed, 114 insertions, 21 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 5b668bf12eb..03fb4149d7b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2311,7 +2311,7 @@ static void lib_link_id_embedded_id(BlendLibReader *reader, ID *id)
static void lib_link_id(BlendLibReader *reader, ID *id)
{
- /* Note: WM IDProperties are never written to file, hence they should always be NULL here. */
+ /* NOTE: WM IDProperties are never written to file, hence they should always be NULL here. */
BLI_assert((GS(id->name) != ID_WM) || id->properties == NULL);
IDP_BlendReadLib(reader, id->properties);
@@ -2728,7 +2728,7 @@ static int lib_link_main_data_restore_cb(LibraryIDLinkCallbackData *cb_data)
struct IDNameLib_Map *id_map = cb_data->user_data;
- /* Note: Handling of usercount here is really bad, defining its own system...
+ /* NOTE: Handling of usercount here is really bad, defining its own system...
* Will have to be refactored at some point, but that is not top priority task for now.
* And all user-counts are properly recomputed at the end of the undo management code anyway. */
*id_pointer = restore_pointer_by_name(
@@ -3067,7 +3067,7 @@ void blo_lib_link_restore(Main *oldmain,
/* keep cursor location through undo */
memcpy(&win->scene->cursor, &oldscene->cursor, sizeof(win->scene->cursor));
- /* Note: even though that function seems to redo part of what is done by
+ /* NOTE: even though that function seems to redo part of what is done by
* `lib_link_workspace_layout_restore()` above, it seems to have a slightly different scope:
* while the former updates the whole UI pointers from Main db (going over all layouts of
* all workspaces), that one only focuses one current active screen, takes care of
@@ -3780,7 +3780,7 @@ BHead *blo_read_asset_data_block(FileData *fd, BHead *bhead, AssetMetaData **r_a
/** \name Read Global Data
* \{ */
-/* note, this has to be kept for reading older files... */
+/* NOTE: this has to be kept for reading older files... */
/* also version info is written here */
static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead)
{
@@ -3828,7 +3828,7 @@ static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead)
return blo_bhead_next(fd, bhead);
}
-/* note, this has to be kept for reading older files... */
+/* NOTE: this has to be kept for reading older files... */
static void link_global(FileData *fd, BlendFileData *bfd)
{
bfd->cur_view_layer = blo_read_get_new_globaldata_address(fd, bfd->cur_view_layer);
@@ -5611,7 +5611,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
lib_link_all(mainptr->curlib->filedata, mainptr);
}
- /* Note: No need to call #do_versions_after_linking() or #BKE_main_id_refcount_recompute()
+ /* NOTE: No need to call #do_versions_after_linking() or #BKE_main_id_refcount_recompute()
* here, as this function is only called for library 'subset' data handling, as part of
* either full blendfile reading (#blo_read_file_internal()), or library-data linking
* (#library_link_end()). */
diff --git a/source/blender/blenloader/intern/undofile.c b/source/blender/blenloader/intern/undofile.c
index d1f69d35fe5..2eeeac2e8d7 100644
--- a/source/blender/blenloader/intern/undofile.c
+++ b/source/blender/blenloader/intern/undofile.c
@@ -225,7 +225,7 @@ bool BLO_memfile_write_file(struct MemFile *memfile, const char *filename)
MemFileChunk *chunk;
int file, oflags;
- /* note: This is currently used for autosave and 'quit.blend',
+ /* NOTE: This is currently used for autosave and 'quit.blend',
* where _not_ following symlinks is OK,
* however if this is ever executed explicitly by the user,
* we may want to allow writing to symlinks.
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index 9399af5eb11..8a7bc375ea9 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -1274,7 +1274,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
*/
if (ob->pose && ob->data) {
bArmature *arm = blo_do_versions_newlibadr(fd, lib, ob->data);
- if (arm) { /* XXX - why does this fail in some cases? */
+ if (arm) { /* XXX: why does this fail in some cases? */
bAnimVizSettings *avs = &ob->pose->avs;
/* path settings --------------------- */
diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c
index 070dd181509..5bf4d3b68b5 100644
--- a/source/blender/blenloader/intern/versioning_260.c
+++ b/source/blender/blenloader/intern/versioning_260.c
@@ -169,7 +169,7 @@ static void do_versions_image_settings_2_60(Scene *sce)
R_JPEG2K_CINE_48FPS = (1 << 9),
};
- /* note: rd->subimtype is moved into individual settings now and no longer
+ /* NOTE: rd->subimtype is moved into individual settings now and no longer
* exists */
RenderData *rd = &sce->r;
ImageFormatData *imf = &sce->r.im_format;
@@ -2594,11 +2594,11 @@ void do_versions_after_linking_260(Main *bmain)
*
* This assumes valid typeinfo pointers, as set in lib_link_ntree.
*
- * Note: theoretically only needed in node groups (main->nodetree),
+ * NOTE: theoretically only needed in node groups (main->nodetree),
* but due to a temporary bug such links could have been added in all trees,
* so have to clean up all of them ...
*
- * Note: this always runs, without it links with NULL fromnode and tonode remain
+ * NOTE: this always runs, without it links with NULL fromnode and tonode remain
* which causes problems.
*/
if (!MAIN_VERSION_ATLEAST(bmain, 266, 3)) {
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 399761ead8d..0645380c4cb 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -670,7 +670,7 @@ static ARegion *do_versions_find_region(ListBase *regionbase, int regiontype)
{
ARegion *region = do_versions_find_region_or_null(regionbase, regiontype);
if (region == NULL) {
- BLI_assert(!"Did not find expected region in versioning");
+ BLI_assert_msg(0, "Did not find expected region in versioning");
}
return region;
}
@@ -1268,7 +1268,7 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports))
/* We need to assign lib pointer to generated hidden collections *after* all have been
* created, otherwise we'll end up with several data-blocks sharing same name/library,
- * which is FORBIDDEN! Note: we need this to be recursive, since a child collection may be
+ * which is FORBIDDEN! NOTE: we need this to be recursive, since a child collection may be
* sorted before its parent in bmain. */
for (Collection *collection = bmain->collections.first; collection != NULL;
collection = collection->id.next) {
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index ecee14d3d58..313ce734bbc 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -28,12 +28,18 @@
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_brush_types.h"
+#include "DNA_collection_types.h"
#include "DNA_genfile.h"
#include "DNA_listBase.h"
#include "DNA_modifier_types.h"
#include "DNA_text_types.h"
+#include "DNA_workspace_types.h"
+#include "BKE_action.h"
#include "BKE_animsys.h"
+#include "BKE_asset.h"
+#include "BKE_collection.h"
+#include "BKE_deform.h"
#include "BKE_fcurve_driver.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
@@ -87,6 +93,19 @@ static void assert_sorted_ids(Main *bmain)
#endif
}
+static void move_vertex_group_names_to_object_data(Main *bmain)
+{
+ LISTBASE_FOREACH (Object *, object, &bmain->objects) {
+ if (ELEM(object->type, OB_MESH, OB_LATTICE, OB_GPENCIL)) {
+ ListBase *new_defbase = BKE_object_defgroup_list_mutable(object);
+
+ /* Clear the list in case the it was already assigned from another object. */
+ BLI_freelistN(new_defbase);
+ *new_defbase = object->defbase;
+ }
+ }
+}
+
void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports))
{
if (MAIN_VERSION_ATLEAST(bmain, 300, 0) && !MAIN_VERSION_ATLEAST(bmain, 300, 1)) {
@@ -131,6 +150,10 @@ void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports))
assert_sorted_ids(bmain);
}
+ if (!MAIN_VERSION_ATLEAST(bmain, 300, 11)) {
+ move_vertex_group_names_to_object_data(bmain);
+ }
+
/**
* Versioning code until next subversion bump goes here.
*
@@ -468,6 +491,55 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
+ if (!MAIN_VERSION_ATLEAST(bmain, 300, 8)) {
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+ if (scene->master_collection != NULL) {
+ BLI_strncpy(scene->master_collection->id.name + 2,
+ BKE_SCENE_COLLECTION_NAME,
+ sizeof(scene->master_collection->id.name) - 2);
+ }
+ }
+ }
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 300, 9)) {
+ /* Fix a bug where reordering FCurves and bActionGroups could cause some corruption. Just
+ * reconstruct all the action groups & ensure that the FCurves of a group are continuously
+ * stored (i.e. not mixed with other groups) to be sure. See T89435. */
+ LISTBASE_FOREACH (bAction *, act, &bmain->actions) {
+ BKE_action_groups_reconstruct(act);
+ }
+
+ FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
+ if (ntree->type == NTREE_GEOMETRY) {
+ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
+ if (node->type == GEO_NODE_MESH_SUBDIVIDE) {
+ strcpy(node->idname, "GeometryNodeMeshSubdivide");
+ }
+ }
+ }
+ }
+ FOREACH_NODETREE_END;
+
+ {
+ if (!DNA_struct_elem_find(
+ fd->filesdna, "WorkSpace", "AssetLibraryReference", "active_asset_library")) {
+ LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
+ BKE_asset_library_reference_init_default(&workspace->active_asset_library);
+ }
+ }
+ }
+ }
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 300, 10)) {
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+ ToolSettings *tool_settings = scene->toolsettings;
+ if (tool_settings->snap_uv_mode & (1 << 4)) {
+ tool_settings->snap_uv_mode |= (1 << 6); /* SCE_SNAP_MODE_INCREMENT */
+ tool_settings->snap_uv_mode &= ~(1 << 4);
+ }
+ }
+ }
+
/**
* Versioning code until next subversion bump goes here.
*
@@ -479,5 +551,24 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
*/
{
/* Keep this block, even when empty. */
+
+ /* Convert Surface Deform to sparse-capable bind structure. */
+ if (!DNA_struct_elem_find(
+ fd->filesdna, "SurfaceDeformModifierData", "int", "num_mesh_verts")) {
+ LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
+ LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
+ if (md->type == eModifierType_SurfaceDeform) {
+ SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md;
+ if (smd->num_bind_verts && smd->verts) {
+ smd->num_mesh_verts = smd->num_bind_verts;
+
+ for (unsigned int i = 0; i < smd->num_bind_verts; i++) {
+ smd->verts[i].vertex_idx = i;
+ }
+ }
+ }
+ }
+ }
+ }
}
}
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index 46e25251fd4..95cfc9975d7 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -1311,7 +1311,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
}
- /* Note: #BKE_pose_rebuild is further only called on leave edit-mode. */
+ /* NOTE: #BKE_pose_rebuild is further only called on leave edit-mode. */
if (ob->type == OB_ARMATURE) {
if (ob->pose) {
BKE_pose_tag_recalc(bmain, ob->pose);
@@ -1436,7 +1436,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bPoseChannel *pchan;
bConstraint *con;
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
- /* note, pchan->bone is also lib-link stuff */
+ /* NOTE: pchan->bone is also lib-link stuff. */
if (pchan->limitmin[0] == 0.0f && pchan->limitmax[0] == 0.0f) {
pchan->limitmin[0] = pchan->limitmin[1] = pchan->limitmin[2] = -180.0f;
pchan->limitmax[0] = pchan->limitmax[1] = pchan->limitmax[2] = 180.0f;
@@ -2501,7 +2501,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 248, 2)) {
Scene *sce;
- /* Note, these will need to be added for painting */
+ /* NOTE: these will need to be added for painting. */
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
sce->toolsettings->imapaint.seam_bleed = 2;
sce->toolsettings->imapaint.normal_angle = 80;
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 42b27f57e2c..30587418f84 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -894,6 +894,7 @@ void blo_do_versions_userdef(UserDef *userdef)
*/
{
/* Keep this block, even when empty. */
+ BKE_addon_ensure(&userdef->addons, "pose_library");
}
LISTBASE_FOREACH (bTheme *, btheme, &userdef->themes) {
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 930ce0ba06f..fc29b1d8915 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -304,7 +304,7 @@ static void writedata_do_write(WriteData *wd, const void *mem, size_t memlen)
}
if (memlen > INT_MAX) {
- BLI_assert(!"Cannot write chunks bigger than INT_MAX.");
+ BLI_assert_msg(0, "Cannot write chunks bigger than INT_MAX.");
return;
}
@@ -538,7 +538,7 @@ static void writedata(WriteData *wd, int filecode, size_t len, const void *adr)
}
if (len > INT_MAX) {
- BLI_assert(!"Cannot write chunks bigger than INT_MAX.");
+ BLI_assert_msg(0, "Cannot write chunks bigger than INT_MAX.");
return;
}
@@ -896,9 +896,10 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
writestruct(wd, GLOB, FileGlobal, 1, &fg);
}
-/* preview image, first 2 values are width and height
- * second are an RGBA image (uchar)
- * note, this uses 'TEST' since new types will segfault on file load for older blender versions.
+/**
+ * Preview image, first 2 values are width and height
+ * second are an RGBA image (uchar).
+ * \note this uses 'TEST' since new types will segfault on file load for older blender versions.
*/
static void write_thumb(WriteData *wd, const BlendThumbnail *thumb)
{