diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-03-22 06:09:00 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-03-22 06:09:00 +0300 |
commit | bf087a92dd8f51d8f7b470c1d98a60ef8124f064 (patch) | |
tree | cd5df2286be37a8557938b3e71d599344f5bdce1 /source/blender/blenloader | |
parent | 8f2c7b10cb464ada4251f9f7aff671736e6c5f43 (diff) | |
parent | 127baac44d5c198c8d5159f70cf17167cd2f7e1f (diff) |
Merge branch 'master' into temp-sculpt-colors
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/BLO_read_write.h | 4 | ||||
-rw-r--r-- | source/blender/blenloader/CMakeLists.txt | 5 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 16 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_260.c | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 8 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 110 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_300.c | 288 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_cycles.c | 12 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_legacy.c | 7 |
9 files changed, 112 insertions, 340 deletions
diff --git a/source/blender/blenloader/BLO_read_write.h b/source/blender/blenloader/BLO_read_write.h index 8f0f9fae97f..536c3989aff 100644 --- a/source/blender/blenloader/BLO_read_write.h +++ b/source/blender/blenloader/BLO_read_write.h @@ -286,8 +286,8 @@ void BLO_expand_id(BlendExpander *expander, struct ID *id); * This function ensures that reports are printed, * in the case of library linking errors this is important! * - * bit kludge but better than doubling up on prints, - * we could alternatively have a versions of a report function which forces printing - campbell + * NOTE(@campbellbarton) a kludge but better than doubling up on prints, + * we could alternatively have a versions of a report function which forces printing. */ void BLO_reportf_wrap(struct BlendFileReadReport *reports, eReportType type, diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index 81ac25c637f..5ca026ae9a3 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -22,7 +22,8 @@ set(INC # for writefile.c: dna_type_offsets.h ${CMAKE_BINARY_DIR}/source/blender/makesdna/intern - + # RNA_prototypes.h + ${CMAKE_BINARY_DIR}/source/blender/makesrna ) set(INC_SYS @@ -84,6 +85,8 @@ blender_add_lib(bf_blenloader "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") # needed so writefile.c can use dna_type_offsets.h add_dependencies(bf_blenloader bf_dna) +# RNA_prototypes.h +add_dependencies(bf_blenloader bf_rna) if(WITH_GTESTS) set(TEST_SRC diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 9539436cf69..4ea6287399c 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -161,14 +161,14 @@ * which keeps large arrays in memory from data-blocks we may not even use. * * \note This is disabled when using compression, - * while zlib supports seek it's unusably slow, see: T61880. + * while ZLIB supports seek it's unusably slow, see: T61880. */ #define USE_BHEAD_READ_ON_DEMAND -/* use GHash for BHead name-based lookups (speeds up linking) */ +/** Use #GHash for #BHead name-based lookups (speeds up linking). */ #define USE_GHASH_BHEAD -/* Use GHash for restoring pointers by name */ +/** Use #GHash for restoring pointers by name. */ #define USE_GHASH_RESTORE_POINTER static CLG_LogRef LOG = {"blo.readfile"}; @@ -194,8 +194,10 @@ typedef struct BHeadN { #define BHEADN_FROM_BHEAD(bh) ((BHeadN *)POINTER_OFFSET(bh, -(int)offsetof(BHeadN, bhead))) -/* We could change this in the future, for now it's simplest if only data is delayed - * because ID names are used in lookup tables. */ +/** + * We could change this in the future, for now it's simplest if only data is delayed + * because ID names are used in lookup tables. + */ #define BHEAD_USE_READ_ON_DEMAND(bhead) ((bhead)->code == DATA) void BLO_reportf_wrap(BlendFileReadReport *reports, eReportType type, const char *format, ...) @@ -4711,9 +4713,9 @@ static void read_library_linked_ids(FileData *basefd, read_library_linked_id(basefd, fd, mainvar, id, realid); } - /* realid shall never be NULL - unless some source file/lib is broken + /* `realid` shall never be NULL - unless some source file/lib is broken * (known case: some directly linked shapekey from a missing lib...). */ - /* BLI_assert(*realid != NULL); */ + // BLI_assert(*realid != NULL); /* Now that we have a real ID, replace all pointers to placeholders in * fd->libmap with pointers to the real data-blocks. We do this for all diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 28b934843af..655dc297c35 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -1838,7 +1838,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) Image *image = blo_do_versions_newlibadr(fd, tex->id.lib, tex->ima); if (image && (image->flag & IMA_DO_PREMUL) == 0) { - const int IMA_IGNORE_ALPHA = (1 << 12); + enum { IMA_IGNORE_ALPHA = (1 << 12) }; image->flag |= IMA_IGNORE_ALPHA; } } diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 32dbabf2643..b1c982649d2 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -1550,7 +1550,7 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports)) if (!MAIN_VERSION_ATLEAST(bmain, 280, 69)) { /* Unify DOF settings (EEVEE part only) */ - const int SCE_EEVEE_DOF_ENABLED = (1 << 7); + enum { SCE_EEVEE_DOF_ENABLED = (1 << 7) }; LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (STREQ(scene->r.engine, RE_engine_id_BLENDER_EEVEE)) { if (scene->eevee.flag & SCE_EEVEE_DOF_ENABLED) { @@ -2312,7 +2312,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } \ } \ ((void)0) - const int SCE_EEVEE_DOF_ENABLED = (1 << 7); + enum { SCE_EEVEE_DOF_ENABLED = (1 << 7) }; IDProperty *props = IDP_GetPropertyFromGroup(scene->layer_properties, RE_engine_id_BLENDER_EEVEE); // EEVEE_GET_BOOL(props, volumetric_enable, SCE_EEVEE_VOLUMETRIC_ENABLED); @@ -4032,7 +4032,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) if (!MAIN_VERSION_ATLEAST(bmain, 280, 70)) { /* New image alpha modes. */ LISTBASE_FOREACH (Image *, image, &bmain->images) { - const int IMA_IGNORE_ALPHA = (1 << 12); + enum { IMA_IGNORE_ALPHA = (1 << 12) }; if (image->flag & IMA_IGNORE_ALPHA) { image->alpha_mode = IMA_ALPHA_IGNORE; image->flag &= ~IMA_IGNORE_ALPHA; @@ -4497,7 +4497,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) clmd->sim_parms->max_internal_tension = 15.0f; clmd->sim_parms->internal_compression = 15.0f; clmd->sim_parms->max_internal_compression = 15.0f; - clmd->sim_parms->internal_spring_max_diversion = M_PI / 4.0f; + clmd->sim_parms->internal_spring_max_diversion = M_PI_4; } } } diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index ada011f191d..2f6f0d5c9fa 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -701,8 +701,10 @@ static void panels_remove_x_closed_flag_recursive(Panel *panel) static void do_versions_point_attributes(CustomData *pdata) { /* Change to generic named float/float3 attributes. */ - const int CD_LOCATION = 43; - const int CD_RADIUS = 44; + enum { + CD_LOCATION = 43, + CD_RADIUS = 44, + }; for (int i = 0; i < pdata->totlayer; i++) { CustomDataLayer *layer = &pdata->layers[i]; @@ -1508,27 +1510,6 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } if (!MAIN_VERSION_ATLEAST(bmain, 292, 9)) { - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type == NTREE_GEOMETRY) { - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (node->type == GEO_NODE_LEGACY_ATTRIBUTE_MATH && node->storage == NULL) { - const int old_use_attibute_a = (1 << 0); - const int old_use_attibute_b = (1 << 1); - NodeAttributeMath *data = MEM_callocN(sizeof(NodeAttributeMath), "NodeAttributeMath"); - data->operation = NODE_MATH_ADD; - data->input_type_a = (node->custom2 & old_use_attibute_a) ? - GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE : - GEO_NODE_ATTRIBUTE_INPUT_FLOAT; - data->input_type_b = (node->custom2 & old_use_attibute_b) ? - GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE : - GEO_NODE_ATTRIBUTE_INPUT_FLOAT; - node->storage = data; - } - } - } - } - FOREACH_NODETREE_END; - /* Default properties editors to auto outliner sync. */ LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { @@ -1666,39 +1647,6 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - if (!MAIN_VERSION_ATLEAST(bmain, 293, 3)) { - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type != NTREE_GEOMETRY) { - continue; - } - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (node->type == GEO_NODE_LEGACY_POINT_INSTANCE && node->storage == NULL) { - NodeGeometryPointInstance *data = (NodeGeometryPointInstance *)MEM_callocN( - sizeof(NodeGeometryPointInstance), __func__); - data->instance_type = node->custom1; - data->flag = (node->custom2 ? 0 : GEO_NODE_POINT_INSTANCE_WHOLE_COLLECTION); - node->storage = data; - } - } - } - FOREACH_NODETREE_END; - } - - if (!MAIN_VERSION_ATLEAST(bmain, 293, 4)) { - /* Add support for all operations to the "Attribute Math" node. */ - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type == NTREE_GEOMETRY) { - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (node->type == GEO_NODE_LEGACY_ATTRIBUTE_MATH) { - NodeAttributeMath *data = (NodeAttributeMath *)node->storage; - data->input_type_c = GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE; - } - } - } - } - FOREACH_NODETREE_END; - } - if (!MAIN_VERSION_ATLEAST(bmain, 293, 5)) { /* Change Nishita sky model Altitude unit. */ FOREACH_NODETREE_BEGIN (bmain, ntree, id) { @@ -1742,24 +1690,6 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) FOREACH_NODETREE_END; } - if (!MAIN_VERSION_ATLEAST(bmain, 293, 8)) { - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type != NTREE_GEOMETRY) { - continue; - } - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (node->type == GEO_NODE_LEGACY_ATTRIBUTE_RANDOMIZE && node->storage == NULL) { - NodeAttributeRandomize *data = (NodeAttributeRandomize *)MEM_callocN( - sizeof(NodeAttributeRandomize), __func__); - data->data_type = node->custom1; - data->operation = GEO_NODE_ATTRIBUTE_RANDOMIZE_REPLACE_CREATE; - node->storage = data; - } - } - } - FOREACH_NODETREE_END; - } - if (!MAIN_VERSION_ATLEAST(bmain, 293, 9)) { if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "bokeh_overblur")) { LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { @@ -1781,24 +1711,9 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } - - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type == NTREE_GEOMETRY) { - version_node_socket_name(ntree, GEO_NODE_LEGACY_ATTRIBUTE_PROXIMITY, "Result", "Distance"); - } - } - FOREACH_NODETREE_END; } if (!MAIN_VERSION_ATLEAST(bmain, 293, 10)) { - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type == NTREE_GEOMETRY) { - version_node_socket_name( - ntree, GEO_NODE_LEGACY_ATTRIBUTE_PROXIMITY, "Location", "Position"); - } - } - FOREACH_NODETREE_END; - LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { /* Fix old scene with too many samples that were not being used. * Now they are properly used and might produce a huge slowdown. @@ -1884,16 +1799,6 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) light->volume_fac = 1.0f; } } - - LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) { - if (ntree->type == NTREE_GEOMETRY) { - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (node->type == GEO_NODE_LEGACY_ATTRIBUTE_FILL) { - node->custom2 = ATTR_DOMAIN_AUTO; - } - } - } - } } if (!MAIN_VERSION_ATLEAST(bmain, 293, 15)) { @@ -1938,13 +1843,6 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } if (!MAIN_VERSION_ATLEAST(bmain, 293, 18)) { - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type == NTREE_GEOMETRY) { - version_node_socket_name(ntree, GEO_NODE_LEGACY_VOLUME_TO_MESH, "Grid", "Density"); - } - } - FOREACH_NODETREE_END; - if (!DNA_struct_elem_find(fd->filesdna, "bArmature", "float", "axes_position")) { /* Convert the axes draw position to its old default (tip of bone). */ LISTBASE_FOREACH (struct bArmature *, arm, &bmain->armatures) { diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index bb2396701ed..d71bfd27a7f 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -44,6 +44,7 @@ #include "BKE_asset.h" #include "BKE_attribute.h" #include "BKE_collection.h" +#include "BKE_curve.h" #include "BKE_deform.h" #include "BKE_fcurve.h" #include "BKE_fcurve_driver.h" @@ -57,6 +58,7 @@ #include "RNA_access.h" #include "RNA_enum_types.h" +#include "RNA_prototypes.h" #include "BLO_readfile.h" #include "MEM_guardedalloc.h" @@ -527,7 +529,6 @@ static void version_geometry_nodes_add_realize_instance_nodes(bNodeTree *ntree) GEO_NODE_TRIM_CURVE, GEO_NODE_REPLACE_MATERIAL, GEO_NODE_SUBDIVIDE_MESH, - GEO_NODE_ATTRIBUTE_REMOVE, GEO_NODE_TRIANGULATE)) { bNodeSocket *geometry_socket = node->inputs.first; add_realize_instances_before_socket(ntree, node, geometry_socket); @@ -600,30 +601,6 @@ void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports)) } if (!MAIN_VERSION_ATLEAST(bmain, 300, 3)) { - /* Use new texture socket in Attribute Sample Texture node. */ - LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) { - if (ntree->type != NTREE_GEOMETRY) { - continue; - } - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (node->type != GEO_NODE_LEGACY_ATTRIBUTE_SAMPLE_TEXTURE) { - continue; - } - if (node->id == NULL) { - continue; - } - LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) { - if (socket->type == SOCK_TEXTURE) { - bNodeSocketValueTexture *socket_value = (bNodeSocketValueTexture *) - socket->default_value; - socket_value->value = (Tex *)node->id; - break; - } - } - node->id = NULL; - } - } - sort_linked_ids(bmain); assert_sorted_ids(bmain); } @@ -951,141 +928,6 @@ static bNodeSocket *do_version_replace_float_size_with_vector(bNodeTree *ntree, return new_socket; } -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_TRANSFORM: - case GEO_NODE_MESH_BOOLEAN: - case GEO_NODE_IS_VIEWPORT: - case GEO_NODE_SUBDIVIDE_MESH: - case GEO_NODE_MESH_PRIMITIVE_CUBE: - case GEO_NODE_MESH_PRIMITIVE_CIRCLE: - case GEO_NODE_MESH_PRIMITIVE_UV_SPHERE: - case GEO_NODE_MESH_PRIMITIVE_CYLINDER: - case GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE: - case GEO_NODE_MESH_PRIMITIVE_CONE: - case GEO_NODE_MESH_PRIMITIVE_LINE: - case GEO_NODE_MESH_PRIMITIVE_GRID: - case GEO_NODE_BOUNDING_BOX: - case GEO_NODE_RESAMPLE_CURVE: - case GEO_NODE_INPUT_MATERIAL: - case GEO_NODE_REPLACE_MATERIAL: - case GEO_NODE_CURVE_LENGTH: - case GEO_NODE_CONVEX_HULL: - case GEO_NODE_SEPARATE_COMPONENTS: - case GEO_NODE_CURVE_PRIMITIVE_STAR: - case GEO_NODE_CURVE_PRIMITIVE_SPIRAL: - case GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER: - case GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT: - case GEO_NODE_CURVE_PRIMITIVE_CIRCLE: - case GEO_NODE_VIEWER: - case GEO_NODE_CURVE_PRIMITIVE_LINE: - case GEO_NODE_CURVE_PRIMITIVE_QUADRILATERAL: - case GEO_NODE_FILL_CURVE: - case GEO_NODE_TRIM_CURVE: - case GEO_NODE_CURVE_TO_MESH: - return false; - - /* Not legacy: Newly added with fields patch. */ - case GEO_NODE_INPUT_POSITION: - case GEO_NODE_SET_POSITION: - case GEO_NODE_INPUT_INDEX: - case GEO_NODE_INPUT_NORMAL: - case GEO_NODE_CAPTURE_ATTRIBUTE: - return false; - - /* Maybe legacy: Might need special attribute handling, depending on design. */ - case GEO_NODE_SWITCH: - case GEO_NODE_JOIN_GEOMETRY: - case GEO_NODE_ATTRIBUTE_REMOVE: - case GEO_NODE_OBJECT_INFO: - case GEO_NODE_COLLECTION_INFO: - 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. */ - case GEO_NODE_LEGACY_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: - case GEO_NODE_LEGACY_ATTRIBUTE_FILL: - case GEO_NODE_LEGACY_ATTRIBUTE_MIX: - case GEO_NODE_LEGACY_ATTRIBUTE_COLOR_RAMP: - case GEO_NODE_LEGACY_ATTRIBUTE_COMPARE: - case GEO_NODE_LEGACY_POINT_ROTATE: - case GEO_NODE_LEGACY_ALIGN_ROTATION_TO_VECTOR: - case GEO_NODE_LEGACY_POINT_SCALE: - case GEO_NODE_LEGACY_ATTRIBUTE_SAMPLE_TEXTURE: - case GEO_NODE_LEGACY_ATTRIBUTE_VECTOR_ROTATE: - case GEO_NODE_LEGACY_ATTRIBUTE_CURVE_MAP: - case GEO_NODE_LEGACY_ATTRIBUTE_MAP_RANGE: - 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: - return true; - - /* Legacy: Replaced by field node depending on another geometry. */ - case GEO_NODE_LEGACY_RAYCAST: - case GEO_NODE_LEGACY_ATTRIBUTE_TRANSFER: - case GEO_NODE_LEGACY_ATTRIBUTE_PROXIMITY: - return true; - - /* Legacy: Simple selection attribute input. */ - case GEO_NODE_LEGACY_MESH_TO_CURVE: - case GEO_NODE_LEGACY_POINT_SEPARATE: - case GEO_NODE_LEGACY_CURVE_SELECT_HANDLES: - case GEO_NODE_LEGACY_CURVE_SPLINE_TYPE: - case GEO_NODE_LEGACY_CURVE_REVERSE: - case GEO_NODE_LEGACY_MATERIAL_ASSIGN: - case GEO_NODE_LEGACY_CURVE_SET_HANDLES: - return true; - - /* 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; -} - -static void version_geometry_nodes_change_legacy_names(bNodeTree *ntree) -{ - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (geometry_node_is_293_legacy(node->type)) { - if (strstr(node->idname, "Legacy")) { - /* Make sure we haven't changed this idname already, better safe than sorry. */ - continue; - } - - char temp_idname[sizeof(node->idname)]; - BLI_strncpy(temp_idname, node->idname, sizeof(node->idname)); - - BLI_snprintf(node->idname, - sizeof(node->idname), - "GeometryNodeLegacy%s", - temp_idname + strlen("GeometryNode")); - } - } -} - static bool seq_transform_origin_set(Sequence *seq, void *UNUSED(user_data)) { StripTransform *transform = seq->strip->transform; @@ -1483,6 +1325,10 @@ static void version_liboverride_rnacollections_insertion_animdata(ID *id) /* NOLINTNEXTLINE: readability-function-size */ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) { + /* The #SCE_SNAP_SEQ flag has been removed in favor of the #SCE_SNAP which can be used for each + * snap_flag member individually. */ + enum { SCE_SNAP_SEQ = (1 << 7) }; + if (!MAIN_VERSION_ATLEAST(bmain, 300, 1)) { /* Set default value for the new bisect_threshold parameter in the mirror modifier. */ if (!DNA_struct_elem_find(fd->filesdna, "MirrorModifierData", "float", "bisect_threshold")) { @@ -1869,24 +1715,6 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } if (!MAIN_VERSION_ATLEAST(bmain, 300, 19)) { - /* Add node storage for subdivision surface node. */ - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type == NTREE_GEOMETRY) { - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (node->type == GEO_NODE_LEGACY_SUBDIVISION_SURFACE) { - if (node->storage == NULL) { - NodeGeometrySubdivisionSurface *data = MEM_callocN( - sizeof(NodeGeometrySubdivisionSurface), __func__); - data->uv_smooth = SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES; - data->boundary_smooth = SUBSURF_BOUNDARY_SMOOTH_ALL; - node->storage = data; - } - } - } - } - } - FOREACH_NODETREE_END; - /* Disable Fade Inactive Overlay by default as it is redundant after introducing flash on * mode transfer. */ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { @@ -2087,30 +1915,6 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } - - /* 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)) { @@ -2137,12 +1941,6 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } - - 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)) { @@ -2300,7 +2098,6 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } version_node_id(ntree, FN_NODE_SLICE_STRING, "FunctionNodeSliceString"); version_geometry_nodes_set_position_node_offset(ntree); - version_node_id(ntree, GEO_NODE_LEGACY_VOLUME_TO_MESH, "GeometryNodeLegacyVolumeToMesh"); } /* Add storage to viewer node. */ @@ -2569,8 +2366,61 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } + if (!MAIN_VERSION_ATLEAST(bmain, 302, 6)) { + LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { + ToolSettings *ts = scene->toolsettings; + if (ts->uv_relax_method == 0) { + ts->uv_relax_method = UV_SCULPT_TOOL_RELAX_LAPLACIAN; + } + } + LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { + ToolSettings *tool_settings = scene->toolsettings; + tool_settings->snap_flag_seq = tool_settings->snap_flag & ~(SCE_SNAP | SCE_SNAP_SEQ); + if (tool_settings->snap_flag & SCE_SNAP_SEQ) { + tool_settings->snap_flag_seq |= SCE_SNAP; + tool_settings->snap_flag &= ~SCE_SNAP_SEQ; + } + + tool_settings->snap_flag_node = tool_settings->snap_flag; + tool_settings->snap_uv_flag |= tool_settings->snap_flag & SCE_SNAP; + } + + /* Alter NURBS knot mode flags to fit new modes. */ + LISTBASE_FOREACH (Curve *, curve, &bmain->curves) { + LISTBASE_FOREACH (Nurb *, nurb, &curve->nurb) { + /* Previously other flags were ignored if CU_NURB_CYCLIC is set. */ + if (nurb->flagu & CU_NURB_CYCLIC) { + nurb->flagu = CU_NURB_CYCLIC; + } + /* CU_NURB_BEZIER and CU_NURB_ENDPOINT were ignored if combined. */ + else if (nurb->flagu & CU_NURB_BEZIER && nurb->flagu & CU_NURB_ENDPOINT) { + nurb->flagu &= ~(CU_NURB_BEZIER | CU_NURB_ENDPOINT); + BKE_nurb_knot_calc_u(nurb); + } + /* Bezier NURBS of order 3 were clamped to first control point. */ + else if (nurb->orderu == 3 && (nurb->flagu & CU_NURB_BEZIER)) { + nurb->flagu |= CU_NURB_ENDPOINT; + } + + /* Previously other flags were ignored if CU_NURB_CYCLIC is set. */ + if (nurb->flagv & CU_NURB_CYCLIC) { + nurb->flagv = CU_NURB_CYCLIC; + } + /* CU_NURB_BEZIER and CU_NURB_ENDPOINT were ignored if used together. */ + else if (nurb->flagv & CU_NURB_BEZIER && nurb->flagv & CU_NURB_ENDPOINT) { + nurb->flagv &= ~(CU_NURB_BEZIER | CU_NURB_ENDPOINT); + BKE_nurb_knot_calc_v(nurb); + } + /* Bezier NURBS of order 3 were clamped to first control point. */ + else if (nurb->orderv == 3 && (nurb->flagv & CU_NURB_BEZIER)) { + nurb->flagv |= CU_NURB_ENDPOINT; + } + } + } + } + /* rebuild active/render color attribute references*/ - if (!MAIN_VERSION_ATLEAST(bmain, 302, 4)) { + if (!MAIN_VERSION_ATLEAST(bmain, 302, 6)) { LISTBASE_FOREACH (Brush *, br, &bmain->brushes) { /* buggy code in wm_toolsystem broke smear in old files, reset to defaults */ @@ -2628,5 +2478,23 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) */ { /* Keep this block, even when empty. */ + + /* Initialize brush curves sculpt settings. */ + LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) { + if (brush->ob_mode != OB_MODE_SCULPT_CURVES) { + continue; + } + if (brush->curves_sculpt_settings != NULL) { + continue; + } + brush->curves_sculpt_settings = MEM_callocN(sizeof(BrushCurvesSculptSettings), __func__); + brush->curves_sculpt_settings->add_amount = 1; + } + LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { + if (scene->toolsettings && scene->toolsettings->curves_sculpt && + scene->toolsettings->curves_sculpt->curve_length == 0.0f) { + scene->toolsettings->curves_sculpt->curve_length = 0.3f; + } + } } } diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c index c654972730f..e1ceed82ba7 100644 --- a/source/blender/blenloader/intern/versioning_cycles.c +++ b/source/blender/blenloader/intern/versioning_cycles.c @@ -330,7 +330,7 @@ static void image_node_colorspace(bNode *node) return; } - const int SHD_COLORSPACE_NONE = 0; + enum { SHD_COLORSPACE_NONE = 0 }; Image *image = (Image *)node->id; if (color_space == SHD_COLORSPACE_NONE) { STRNCPY(image->colorspace_settings.name, @@ -1362,10 +1362,12 @@ void blo_do_versions_cycles(FileData *UNUSED(fd), Library *UNUSED(lib), Main *bm void do_versions_after_linking_cycles(Main *bmain) { - const int DENOISER_AUTO = 0; - const int DENOISER_NLM = 1; - const int DENOISER_OPTIX = 2; - const int DENOISER_OPENIMAGEDENOISE = 4; + enum { + DENOISER_AUTO = 0, + DENOISER_NLM = 1, + DENOISER_OPTIX = 2, + DENOISER_OPENIMAGEDENOISE = 4, + }; if (!MAIN_VERSION_ATLEAST(bmain, 280, 66)) { /* Shader node tree changes. After lib linking so we have all the typeinfo diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index 2908b2b151b..5b026c1cca0 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -1075,11 +1075,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) } } - /* ton: made this 230 instead of 229, - * to be sure (tuho files) and this is a reliable check anyway + /* NOTE(@ton): made this 230 instead of 229, + * to be sure (files from the `tuhopuu` branch) and this is a reliable check anyway * nevertheless, we might need to think over a fitness (initialize) - * check apart from the do_versions() - */ + * check apart from the do_versions(). */ if (bmain->versionfile <= 230) { bScreen *screen; |