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/readblenentry.c33
-rw-r--r--source/blender/blenloader/intern/readfile.c26
-rw-r--r--source/blender/blenloader/intern/versioning_280.c6
-rw-r--r--source/blender/blenloader/intern/versioning_290.c2
-rw-r--r--source/blender/blenloader/intern/versioning_300.c349
-rw-r--r--source/blender/blenloader/intern/versioning_defaults.c3
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c12
7 files changed, 371 insertions, 60 deletions
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index f88b470809c..3306eb9e454 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -170,17 +170,19 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh,
}
/**
- * Gets the names and asset-data (if ID is an asset) of all the data-blocks in a file of a certain
- * type (e.g. all the scene names in a file).
+ * Gets the names and asset-data (if ID is an asset) of data-blocks in a file of a certain type.
+ * The data-blocks can be limited to assets.
*
* \param bh: The blendhandle to access.
* \param ofblocktype: The type of names to get.
+ * \param use_assets_only: Limit the result to assets only.
* \param tot_info_items: The length of the returned list.
* \return A BLI_linklist of BLODataBlockInfo *. The links and #BLODataBlockInfo.asset_data should
* be freed with MEM_freeN.
*/
LinkNode *BLO_blendhandle_get_datablock_info(BlendHandle *bh,
int ofblocktype,
+ const bool use_assets_only,
int *r_tot_info_items)
{
FileData *fd = (FileData *)bh;
@@ -189,27 +191,34 @@ LinkNode *BLO_blendhandle_get_datablock_info(BlendHandle *bh,
int tot = 0;
for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
+ if (bhead->code == ENDB) {
+ break;
+ }
if (bhead->code == ofblocktype) {
- struct BLODataBlockInfo *info = MEM_mallocN(sizeof(*info), __func__);
const char *name = blo_bhead_id_name(fd, bhead) + 2;
+ AssetMetaData *asset_meta_data = blo_bhead_id_asset_data_address(fd, bhead);
- STRNCPY(info->name, name);
+ const bool is_asset = asset_meta_data != NULL;
+ const bool skip_datablock = use_assets_only && !is_asset;
+ if (skip_datablock) {
+ continue;
+ }
+ struct BLODataBlockInfo *info = MEM_mallocN(sizeof(*info), __func__);
/* Lastly, read asset data from the following blocks. */
- info->asset_data = blo_bhead_id_asset_data_address(fd, bhead);
- if (info->asset_data) {
- bhead = blo_read_asset_data_block(fd, bhead, &info->asset_data);
- /* blo_read_asset_data_block() reads all DATA heads and already advances bhead to the next
- * non-DATA one. Go back, so the loop doesn't skip the non-DATA head. */
+ if (asset_meta_data) {
+ bhead = blo_read_asset_data_block(fd, bhead, &asset_meta_data);
+ /* blo_read_asset_data_block() reads all DATA heads and already advances bhead to the
+ * next non-DATA one. Go back, so the loop doesn't skip the non-DATA head. */
bhead = blo_bhead_prev(fd, bhead);
}
+ STRNCPY(info->name, name);
+ info->asset_data = asset_meta_data;
+
BLI_linklist_prepend(&infos, info);
tot++;
}
- else if (bhead->code == ENDB) {
- break;
- }
}
*r_tot_info_items = tot;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 8203f988eed..cb3e81ba6d5 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4500,7 +4500,7 @@ static void add_loose_objects_to_scene(Main *mainvar,
ViewLayer *view_layer,
const View3D *v3d,
Library *lib,
- const short flag)
+ const int flag)
{
Collection *active_collection = NULL;
const bool do_append = (flag & FILE_LINK) == 0;
@@ -4510,7 +4510,10 @@ static void add_loose_objects_to_scene(Main *mainvar,
/* Give all objects which are LIB_TAG_INDIRECT a base,
* or for a collection when *lib has been set. */
LISTBASE_FOREACH (Object *, ob, &mainvar->objects) {
- bool do_it = (ob->id.tag & LIB_TAG_DOIT) != 0;
+ /* NOTE: Even if this is a directly linked object and is tagged for instantiation, it might
+ * have already been instantiated through one of its owner collections, in which case we do not
+ * want to re-instantiate it in the active collection here. */
+ bool do_it = (ob->id.tag & LIB_TAG_DOIT) != 0 && !BKE_scene_object_find(scene, ob);
if (do_it ||
((ob->id.tag & LIB_TAG_INDIRECT) != 0 && (ob->id.tag & LIB_TAG_PRE_EXISTING) == 0)) {
if (do_append) {
@@ -4560,9 +4563,9 @@ static void add_loose_object_data_to_scene(Main *mainvar,
Scene *scene,
ViewLayer *view_layer,
const View3D *v3d,
- const short flag)
+ const int flag)
{
- if ((flag & FILE_OBDATA_INSTANCE) == 0) {
+ if ((flag & BLO_LIBLINK_OBDATA_INSTANCE) == 0) {
return;
}
@@ -4621,7 +4624,7 @@ static void add_collections_to_scene(Main *mainvar,
ViewLayer *view_layer,
const View3D *v3d,
Library *lib,
- const short flag)
+ const int flag)
{
Collection *active_collection = scene->master_collection;
if (flag & FILE_ACTIVE_COLLECTION) {
@@ -4631,7 +4634,7 @@ static void add_collections_to_scene(Main *mainvar,
/* Give all objects which are tagged a base. */
LISTBASE_FOREACH (Collection *, collection, &mainvar->collections) {
- if ((flag & FILE_COLLECTION_INSTANCE) && (collection->id.tag & LIB_TAG_DOIT)) {
+ if ((flag & BLO_LIBLINK_COLLECTION_INSTANCE) && (collection->id.tag & LIB_TAG_DOIT)) {
/* Any indirect collection should not have been tagged. */
BLI_assert((collection->id.tag & LIB_TAG_INDIRECT) == 0);
@@ -4780,7 +4783,7 @@ int BLO_library_link_copypaste(Main *mainl, BlendHandle *bh, const uint64_t id_t
if (blo_bhead_is_id_valid_type(bhead) && BKE_idtype_idcode_is_linkable((short)bhead->code) &&
(id_types_mask == 0 ||
(BKE_idtype_idcode_to_idfilter((short)bhead->code) & id_types_mask) != 0)) {
- read_libblock(fd, mainl, bhead, LIB_TAG_NEED_EXPAND | LIB_TAG_INDIRECT, false, &id);
+ read_libblock(fd, mainl, bhead, LIB_TAG_NEED_EXPAND | LIB_TAG_EXTERN, false, &id);
num_directly_linked++;
}
@@ -4789,6 +4792,13 @@ int BLO_library_link_copypaste(Main *mainl, BlendHandle *bh, const uint64_t id_t
ListBase *lb = which_libbase(mainl, GS(id->name));
id_sort_by_name(lb, id, NULL);
+ /* Tag as loose object (or data associated with objects)
+ * needing to be instantiated (see also #link_named_part and its usage of
+ * #BLO_LIBLINK_NEEDS_ID_TAG_DOIT above). */
+ if (library_link_idcode_needs_tag_check(GS(id->name), BLO_LIBLINK_NEEDS_ID_TAG_DOIT)) {
+ id->tag |= LIB_TAG_DOIT;
+ }
+
if (bhead->code == ID_OB) {
/* Instead of instancing Base's directly, postpone until after collections are loaded
* otherwise the base's flag is set incorrectly when collections are used */
@@ -4834,7 +4844,7 @@ static bool library_link_idcode_needs_tag_check(const short idcode, const int fl
if (ELEM(idcode, ID_OB, ID_GR)) {
return true;
}
- if (flag & FILE_OBDATA_INSTANCE) {
+ if (flag & BLO_LIBLINK_OBDATA_INSTANCE) {
if (OB_DATA_SUPPORT_ID(idcode)) {
return true;
}
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 69b67460a5d..d8f4d01a2e9 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3394,7 +3394,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
SpaceImage *sima = (SpaceImage *)sl;
sima->flag &= ~(SI_FLAG_UNUSED_0 | SI_FLAG_UNUSED_1 | SI_FLAG_UNUSED_3 |
SI_FLAG_UNUSED_6 | SI_FLAG_UNUSED_7 | SI_FLAG_UNUSED_8 |
- SI_FLAG_UNUSED_17 | SI_FLAG_UNUSED_18 | SI_FLAG_UNUSED_23 |
+ SI_FLAG_UNUSED_17 | SI_CUSTOM_GRID | SI_FLAG_UNUSED_23 |
SI_FLAG_UNUSED_24);
break;
}
@@ -3416,8 +3416,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
case SPACE_FILE: {
SpaceFile *sfile = (SpaceFile *)sl;
if (sfile->params) {
- sfile->params->flag &= ~(FILE_APPEND_SET_FAKEUSER | FILE_APPEND_RECURSIVE |
- FILE_OBDATA_INSTANCE);
+ sfile->params->flag &= ~(FILE_PARAMS_FLAG_UNUSED_1 | FILE_PARAMS_FLAG_UNUSED_2 |
+ FILE_PARAMS_FLAG_UNUSED_3);
}
break;
}
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index be8c4b735be..bf5b0bdbf3c 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -1540,7 +1540,7 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if (STREQ(node->idname, "GeometryNodeRandomAttribute")) {
- STRNCPY(node->idname, "GeometryNodeAttributeRandomize");
+ STRNCPY(node->idname, "GeometryLegacyNodeAttributeRandomize");
}
}
}
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 3bb76a4d4b6..323391d9715 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -376,6 +376,7 @@ static void move_vertex_group_names_to_object_data(Main *bmain)
/* Clear the list in case the it was already assigned from another object. */
BLI_freelistN(new_defbase);
*new_defbase = object->defbase;
+ BKE_object_defgroup_active_index_set(object, object->actdef);
}
}
}
@@ -449,6 +450,79 @@ static void do_versions_sequencer_speed_effect_recursive(Scene *scene, const Lis
#undef SEQ_SPEED_COMPRESS_IPO_Y
}
+static bool do_versions_sequencer_color_tags(Sequence *seq, void *UNUSED(user_data))
+{
+ seq->color_tag = SEQUENCE_COLOR_NONE;
+ return true;
+}
+
+static bNodeLink *find_connected_link(bNodeTree *ntree, bNodeSocket *in_socket)
+{
+ LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
+ if (link->tosock == in_socket) {
+ return link;
+ }
+ }
+ return NULL;
+}
+
+static void add_realize_instances_before_socket(bNodeTree *ntree,
+ bNode *node,
+ bNodeSocket *geometry_socket)
+{
+ BLI_assert(geometry_socket->type == SOCK_GEOMETRY);
+ bNodeLink *link = find_connected_link(ntree, geometry_socket);
+ if (link == NULL) {
+ return;
+ }
+
+ /* If the realize instances node is already before this socket, no need to continue. */
+ if (link->fromnode->type == GEO_NODE_REALIZE_INSTANCES) {
+ return;
+ }
+
+ bNode *realize_node = nodeAddStaticNode(NULL, ntree, GEO_NODE_REALIZE_INSTANCES);
+ realize_node->parent = node->parent;
+ realize_node->locx = node->locx - 100;
+ realize_node->locy = node->locy;
+ nodeAddLink(ntree, link->fromnode, link->fromsock, realize_node, realize_node->inputs.first);
+ link->fromnode = realize_node;
+ link->fromsock = realize_node->outputs.first;
+}
+
+/**
+ * If a node used to realize instances implicitly and will no longer do so in 3.0, add a "Realize
+ * Instances" node in front of it to avoid changing behavior. Don't do this if the node will be
+ * replaced anyway though.
+ */
+static void version_geometry_nodes_add_realize_instance_nodes(bNodeTree *ntree)
+{
+ LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree->nodes) {
+ if (ELEM(node->type,
+ GEO_NODE_ATTRIBUTE_CAPTURE,
+ GEO_NODE_SEPARATE_COMPONENTS,
+ GEO_NODE_CONVEX_HULL,
+ GEO_NODE_CURVE_LENGTH,
+ GEO_NODE_BOOLEAN,
+ GEO_NODE_CURVE_FILLET,
+ GEO_NODE_CURVE_RESAMPLE,
+ GEO_NODE_CURVE_TO_MESH,
+ GEO_NODE_CURVE_TRIM,
+ GEO_NODE_MATERIAL_REPLACE,
+ GEO_NODE_MESH_SUBDIVIDE,
+ GEO_NODE_ATTRIBUTE_REMOVE,
+ GEO_NODE_TRIANGULATE)) {
+ bNodeSocket *geometry_socket = node->inputs.first;
+ add_realize_instances_before_socket(ntree, node, geometry_socket);
+ }
+ /* Also realize instances for the profile input of the curve to mesh node. */
+ if (node->type == GEO_NODE_CURVE_TO_MESH) {
+ bNodeSocket *profile_socket = node->inputs.last;
+ add_realize_instances_before_socket(ntree, node, profile_socket);
+ }
+ }
+}
+
void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports))
{
if (MAIN_VERSION_ATLEAST(bmain, 300, 0) && !MAIN_VERSION_ATLEAST(bmain, 300, 1)) {
@@ -505,6 +579,70 @@ void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports))
}
}
+ if (!MAIN_VERSION_ATLEAST(bmain, 300, 26)) {
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+ ToolSettings *tool_settings = scene->toolsettings;
+ ImagePaintSettings *imapaint = &tool_settings->imapaint;
+ if (imapaint->canvas != NULL &&
+ ELEM(imapaint->canvas->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
+ imapaint->canvas = NULL;
+ }
+ if (imapaint->stencil != NULL &&
+ ELEM(imapaint->stencil->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
+ imapaint->stencil = NULL;
+ }
+ if (imapaint->clone != NULL &&
+ ELEM(imapaint->clone->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
+ imapaint->clone = NULL;
+ }
+ }
+
+ LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
+ if (brush->clone.image != NULL &&
+ ELEM(brush->clone.image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
+ brush->clone.image = NULL;
+ }
+ }
+ }
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 300, 28)) {
+ LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
+ if (ntree->type == NTREE_GEOMETRY) {
+ version_geometry_nodes_add_realize_instance_nodes(ntree);
+ }
+ }
+ }
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 300, 30)) {
+ do_versions_idproperty_ui_data(bmain);
+ }
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 300, 32)) {
+ /* Update Switch Node Non-Fields switch input to Switch_001. */
+ LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
+ if (ntree->type != NTREE_GEOMETRY) {
+ continue;
+ }
+
+ LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
+ if (link->tonode->type == GEO_NODE_SWITCH) {
+ if (STREQ(link->tosock->identifier, "Switch")) {
+ bNode *to_node = link->tonode;
+
+ uint8_t mode = ((NodeSwitch *)to_node->storage)->input_type;
+ if (ELEM(mode,
+ SOCK_GEOMETRY,
+ SOCK_OBJECT,
+ SOCK_COLLECTION,
+ SOCK_TEXTURE,
+ SOCK_MATERIAL)) {
+ link->tosock = link->tosock->next;
+ }
+ }
+ }
+ }
+ }
+ }
/**
* Versioning code until next subversion bump goes here.
*
@@ -517,7 +655,16 @@ void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports))
*/
{
/* Keep this block, even when empty. */
- do_versions_idproperty_ui_data(bmain);
+
+ /* This was missing from #move_vertex_group_names_to_object_data. */
+ LISTBASE_FOREACH (Object *, object, &bmain->objects) {
+ if (ELEM(object->type, OB_MESH, OB_LATTICE, OB_GPENCIL)) {
+ /* This uses the fact that the active vertex group index starts counting at 1. */
+ if (BKE_object_defgroup_active_index_get(object) == 0) {
+ BKE_object_defgroup_active_index_set(object, object->actdef);
+ }
+ }
+ }
}
}
@@ -656,10 +803,8 @@ static bool geometry_node_is_293_legacy(const short node_type)
switch (node_type) {
/* Not legacy: No attribute inputs or outputs. */
case GEO_NODE_TRIANGULATE:
- case GEO_NODE_EDGE_SPLIT:
case GEO_NODE_TRANSFORM:
case GEO_NODE_BOOLEAN:
- case GEO_NODE_SUBDIVISION_SURFACE:
case GEO_NODE_IS_VIEWPORT:
case GEO_NODE_MESH_SUBDIVIDE:
case GEO_NODE_MESH_PRIMITIVE_CUBE:
@@ -706,16 +851,16 @@ static bool geometry_node_is_293_legacy(const short node_type)
case GEO_NODE_COLLECTION_INFO:
return false;
- /* Maybe legacy: Transferred *all* attributes before, will not transfer all built-ins now. */
- case GEO_NODE_CURVE_ENDPOINTS:
- case GEO_NODE_CURVE_TO_POINTS:
- return false;
-
- /* Maybe legacy: Special case for grid names? Or finish patch from level set branch to generate
- * a mesh for all grids in the volume. */
+ /* Maybe legacy: Special case for grid names? Or finish patch from level set branch to
+ * generate a mesh for all grids in the volume. */
case GEO_NODE_VOLUME_TO_MESH:
return false;
+ /* Legacy: Transferred *all* attributes before, will not transfer all built-ins now. */
+ case GEO_NODE_LEGACY_CURVE_ENDPOINTS:
+ case GEO_NODE_LEGACY_CURVE_TO_POINTS:
+ return true;
+
/* Legacy: Attribute operation completely replaced by field nodes. */
case GEO_NODE_LEGACY_ATTRIBUTE_RANDOMIZE:
case GEO_NODE_LEGACY_ATTRIBUTE_MATH:
@@ -727,10 +872,10 @@ static bool geometry_node_is_293_legacy(const short node_type)
case GEO_NODE_LEGACY_ALIGN_ROTATION_TO_VECTOR:
case GEO_NODE_LEGACY_POINT_SCALE:
case GEO_NODE_LEGACY_ATTRIBUTE_SAMPLE_TEXTURE:
- case GEO_NODE_ATTRIBUTE_VECTOR_ROTATE:
+ case GEO_NODE_LEGACY_ATTRIBUTE_VECTOR_ROTATE:
case GEO_NODE_LEGACY_ATTRIBUTE_CURVE_MAP:
case GEO_NODE_LEGACY_ATTRIBUTE_MAP_RANGE:
- case GEO_NODE_LECAGY_ATTRIBUTE_CLAMP:
+ case GEO_NODE_LEGACY_ATTRIBUTE_CLAMP:
case GEO_NODE_LEGACY_ATTRIBUTE_VECTOR_MATH:
case GEO_NODE_LEGACY_ATTRIBUTE_COMBINE_XYZ:
case GEO_NODE_LEGACY_ATTRIBUTE_SEPARATE_XYZ:
@@ -752,15 +897,17 @@ static bool geometry_node_is_293_legacy(const short node_type)
case GEO_NODE_LEGACY_CURVE_SET_HANDLES:
return true;
- /* Legacy: More complex attribute inputs or outputs. */
- case GEO_NODE_LEGACY_DELETE_GEOMETRY: /* Needs field input, domain drop-down. */
- case GEO_NODE_LEGACY_CURVE_SUBDIVIDE: /* Needs field count input. */
- case GEO_NODE_LEGACY_POINTS_TO_VOLUME: /* Needs field radius input. */
- case GEO_NODE_LEGACY_SELECT_BY_MATERIAL: /* Output anonymous attribute. */
- case GEO_NODE_LEGACY_POINT_TRANSLATE: /* Needs field inputs. */
- case GEO_NODE_LEGACY_POINT_INSTANCE: /* Needs field inputs. */
- case GEO_NODE_LEGACY_POINT_DISTRIBUTE: /* Needs field input, remove max for random mode. */
- case GEO_NODE_LEGACY_ATTRIBUTE_CONVERT: /* Attribute Capture, Store Attribute. */
+ /* Legacy: More complex attribute inputs or outputs. */
+ case GEO_NODE_LEGACY_SUBDIVISION_SURFACE: /* Used "crease" attribute. */
+ case GEO_NODE_LEGACY_EDGE_SPLIT: /* Needs selection input version. */
+ case GEO_NODE_LEGACY_DELETE_GEOMETRY: /* Needs field input, domain drop-down. */
+ case GEO_NODE_LEGACY_CURVE_SUBDIVIDE: /* Needs field count input. */
+ case GEO_NODE_LEGACY_POINTS_TO_VOLUME: /* Needs field radius input. */
+ case GEO_NODE_LEGACY_SELECT_BY_MATERIAL: /* Output anonymous attribute. */
+ case GEO_NODE_LEGACY_POINT_TRANSLATE: /* Needs field inputs. */
+ case GEO_NODE_LEGACY_POINT_INSTANCE: /* Needs field inputs. */
+ case GEO_NODE_LEGACY_POINT_DISTRIBUTE: /* Needs field input, remove max for random mode. */
+ case GEO_NODE_LEGACY_ATTRIBUTE_CONVERT: /* Attribute Capture, Store Attribute. */
return true;
}
return false;
@@ -785,6 +932,7 @@ static void version_geometry_nodes_change_legacy_names(bNodeTree *ntree)
}
}
}
+
static bool seq_transform_origin_set(Sequence *seq, void *UNUSED(user_data))
{
StripTransform *transform = seq->strip->transform;
@@ -1111,6 +1259,15 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
+ if (ob->type == OB_GPENCIL) {
+ LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
+ if (md->type == eGpencilModifierType_Lineart) {
+ LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
+ lmd->flags |= LRT_GPENCIL_USE_CACHE;
+ lmd->chain_smooth_tolerance = 0.2f;
+ }
+ }
+ }
}
}
@@ -1241,7 +1398,7 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
if (ntree->type == NTREE_GEOMETRY) {
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
- if (node->type == GEO_NODE_SUBDIVISION_SURFACE) {
+ if (node->type == GEO_NODE_LEGACY_SUBDIVISION_SURFACE) {
if (node->storage == NULL) {
NodeGeometrySubdivisionSurface *data = MEM_callocN(
sizeof(NodeGeometrySubdivisionSurface), __func__);
@@ -1312,11 +1469,6 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 300, 22)) {
- LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
- if (ntree->type == NTREE_GEOMETRY) {
- version_geometry_nodes_change_legacy_names(ntree);
- }
- }
if (!DNA_struct_elem_find(
fd->filesdna, "LineartGpencilModifierData", "bool", "use_crease_on_smooth")) {
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
@@ -1428,6 +1580,142 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
+ if (!MAIN_VERSION_ATLEAST(bmain, 300, 26)) {
+ LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
+ LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
+ if (md->type == eModifierType_Nodes) {
+ version_geometry_nodes_add_attribute_input_settings((NodesModifierData *)md);
+ }
+ }
+ }
+
+ LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
+ LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+ LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
+ switch (sl->spacetype) {
+ case SPACE_FILE: {
+ SpaceFile *sfile = (SpaceFile *)sl;
+ if (sfile->params) {
+ sfile->params->flag &= ~(FILE_PARAMS_FLAG_UNUSED_1 | FILE_PARAMS_FLAG_UNUSED_2 |
+ FILE_PARAMS_FLAG_UNUSED_3 | FILE_PARAMS_FLAG_UNUSED_4);
+ }
+
+ /* New default import type: Append with reuse. */
+ if (sfile->asset_params) {
+ sfile->asset_params->import_type = FILE_ASSET_IMPORT_APPEND_REUSE;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ /* Deprecate the random float node in favor of the random value node. */
+ LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
+ if (ntree->type != NTREE_GEOMETRY) {
+ continue;
+ }
+ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
+ if (node->type != FN_NODE_LEGACY_RANDOM_FLOAT) {
+ continue;
+ }
+ if (strstr(node->idname, "Legacy")) {
+ /* Make sure we haven't changed this idname already. */
+ continue;
+ }
+
+ char temp_idname[sizeof(node->idname)];
+ BLI_strncpy(temp_idname, node->idname, sizeof(node->idname));
+
+ BLI_snprintf(node->idname,
+ sizeof(node->idname),
+ "FunctionNodeLegacy%s",
+ temp_idname + strlen("FunctionNode"));
+ }
+ }
+ }
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 300, 29)) {
+ LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
+ LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+ LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
+ switch (sl->spacetype) {
+ case SPACE_SEQ: {
+ ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
+ &sl->regionbase;
+ LISTBASE_FOREACH (ARegion *, region, regionbase) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ region->v2d.max[1] = MAXSEQ;
+ }
+ }
+ break;
+ }
+ case SPACE_IMAGE: {
+ SpaceImage *sima = (SpaceImage *)sl;
+ sima->custom_grid_subdiv = 10;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
+ if (ntree->type == NTREE_GEOMETRY) {
+ version_geometry_nodes_change_legacy_names(ntree);
+ }
+ }
+ }
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 300, 31)) {
+ /* Swap header with the tool header so the regular header is always on the edge. */
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+ LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
+ ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
+ &sl->regionbase;
+ ARegion *region_tool = NULL, *region_head = NULL;
+ int region_tool_index = -1, region_head_index = -1, i;
+ LISTBASE_FOREACH_INDEX (ARegion *, region, regionbase, i) {
+ if (region->regiontype == RGN_TYPE_TOOL_HEADER) {
+ region_tool = region;
+ region_tool_index = i;
+ }
+ else if (region->regiontype == RGN_TYPE_HEADER) {
+ region_head = region;
+ region_head_index = i;
+ }
+ }
+ if ((region_tool && region_head) && (region_head_index > region_tool_index)) {
+ BLI_listbase_swaplinks(regionbase, region_tool, region_head);
+ }
+ }
+ }
+ }
+
+ /* Set strip color tags to SEQUENCE_COLOR_NONE. */
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+ if (scene->ed != NULL) {
+ SEQ_for_each_callback(&scene->ed->seqbase, do_versions_sequencer_color_tags, NULL);
+ }
+ }
+
+ /* Show sequencer color tags by default. */
+ LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
+ LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+ LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
+ if (sl->spacetype == SPACE_SEQ) {
+ SpaceSeq *sseq = (SpaceSeq *)sl;
+ sseq->timeline_overlay.flag |= SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG;
+ }
+ }
+ }
+ }
+ }
+
/**
* Versioning code until next subversion bump goes here.
*
@@ -1439,12 +1727,5 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
*/
{
/* Keep this block, even when empty. */
- LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
- LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
- if (md->type == eModifierType_Nodes) {
- version_geometry_nodes_add_attribute_input_settings((NodesModifierData *)md);
- }
- }
- }
}
}
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 152ef79a38f..c383c1cc4e5 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -160,7 +160,8 @@ static void blo_update_defaults_screen(bScreen *screen,
seq->flag |= SEQ_SHOW_MARKERS | SEQ_ZOOM_TO_FIT | SEQ_USE_PROXIES | SEQ_SHOW_OVERLAY;
seq->render_size = SEQ_RENDER_SIZE_PROXY_100;
seq->timeline_overlay.flag |= SEQ_TIMELINE_SHOW_STRIP_SOURCE | SEQ_TIMELINE_SHOW_STRIP_NAME |
- SEQ_TIMELINE_SHOW_STRIP_DURATION | SEQ_TIMELINE_SHOW_GRID;
+ SEQ_TIMELINE_SHOW_STRIP_DURATION | SEQ_TIMELINE_SHOW_GRID |
+ SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG;
seq->preview_overlay.flag |= SEQ_PREVIEW_SHOW_OUTLINE_SELECTED;
}
else if (area->spacetype == SPACE_TEXT) {
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index f4853ff803f..cd365b6be78 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -291,6 +291,16 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
btheme->space_sequencer.grid[3] = 255;
}
+ if (!USER_VERSION_ATLEAST(300, 30)) {
+ FROM_DEFAULT_V4_UCHAR(space_node.wire);
+ }
+
+ if (!USER_VERSION_ATLEAST(300, 31)) {
+ for (int i = 0; i < SEQUENCE_COLOR_TOT; ++i) {
+ FROM_DEFAULT_V4_UCHAR(strip_color[i].color);
+ }
+ }
+
/**
* Versioning code until next subversion bump goes here.
*
@@ -728,7 +738,7 @@ void blo_do_versions_userdef(UserDef *userdef)
}
}
- /* patch to set Dupli Lightprobes and Grease Pencil */
+ /* Patch to set dupli light-probes and grease-pencil. */
if (!USER_VERSION_ATLEAST(280, 58)) {
userdef->dupflag |= USER_DUP_LIGHTPROBE;
userdef->dupflag |= USER_DUP_GPENCIL;