Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenloader/intern/versioning_300.c
| Show First 20 Lines • Show All 443 Lines • ▼ Show 20 Lines | else if (seq->type == SEQ_TYPE_META) { | ||||
| do_versions_sequencer_speed_effect_recursive(scene, &seq->seqbase); | do_versions_sequencer_speed_effect_recursive(scene, &seq->seqbase); | ||||
| } | } | ||||
| } | } | ||||
| #undef SEQ_SPEED_INTEGRATE | #undef SEQ_SPEED_INTEGRATE | ||||
| #undef SEQ_SPEED_COMPRESS_IPO_Y | #undef SEQ_SPEED_COMPRESS_IPO_Y | ||||
| } | } | ||||
| 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; | |||||
JacquesLucke: Add `realize_node->parent = node->parent;`.
Otherwise the Realize Instances node might end up… | |||||
| 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, | |||||
Not Done Inline ActionsCould also just add the Capture node for completeness here, doesn't matter too much. JacquesLucke: Could also just add the Capture node for completeness here, doesn't matter too much. | |||||
| GEO_NODE_SEPARATE_COMPONENTS, | |||||
| 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)) | void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports)) | ||||
| { | { | ||||
| if (MAIN_VERSION_ATLEAST(bmain, 300, 0) && !MAIN_VERSION_ATLEAST(bmain, 300, 1)) { | if (MAIN_VERSION_ATLEAST(bmain, 300, 0) && !MAIN_VERSION_ATLEAST(bmain, 300, 1)) { | ||||
| /* Set zero user text objects to have a fake user. */ | /* Set zero user text objects to have a fake user. */ | ||||
| LISTBASE_FOREACH (Text *, text, &bmain->texts) { | LISTBASE_FOREACH (Text *, text, &bmain->texts) { | ||||
| if (text->id.us == 0) { | if (text->id.us == 0) { | ||||
| id_fake_user_set(&text->id); | id_fake_user_set(&text->id); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | if (!MAIN_VERSION_ATLEAST(bmain, 300, 26)) { | ||||
| LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) { | LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) { | ||||
| if (brush->clone.image != NULL && | if (brush->clone.image != NULL && | ||||
| ELEM(brush->clone.image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) { | ELEM(brush->clone.image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) { | ||||
| brush->clone.image = NULL; | 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); | |||||
| } | |||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Versioning code until next subversion bump goes here. | * Versioning code until next subversion bump goes here. | ||||
| * | * | ||||
| * \note Be sure to check when bumping the version: | * \note Be sure to check when bumping the version: | ||||
| * - #blo_do_versions_300 in this file. | * - #blo_do_versions_300 in this file. | ||||
| * - "versioning_userdef.c", #blo_do_versions_userdef | * - "versioning_userdef.c", #blo_do_versions_userdef | ||||
| * - "versioning_userdef.c", #do_versions_theme | * - "versioning_userdef.c", #do_versions_theme | ||||
| * | * | ||||
| ▲ Show 20 Lines • Show All 983 Lines • Show Last 20 Lines | |||||
Add realize_node->parent = node->parent;.
Otherwise the Realize Instances node might end up in a very different place when node is in a frame (e.g. in the Still Life demo file).