Commit: 349682e5bf97112581de8e116210f94adeaa5dc1 Author: Hans Goudey Date: Thu Jul 7 16:32:02 2022 -0500 Branches: temp-deform-curves-on-surface https://developer.blender.org/rB349682e5bf97112581de8e116210f94adeaa5dc1
Cleanup to naming and other small tweaks =================================================================== M source/blender/blenkernel/BKE_node.h M source/blender/blenkernel/intern/node.cc M source/blender/editors/curves/intern/curves_add.cc M source/blender/makesrna/intern/rna_object.c M source/blender/modifiers/intern/MOD_nodes.cc M source/blender/nodes/NOD_geometry.h M source/blender/nodes/NOD_static_types.h M source/blender/nodes/geometry/nodes/node_geo_deform_curves_with_surface.cc =================================================================== diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 71eb3f6664f..b7962ade312 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -1501,7 +1501,7 @@ struct TexResult; #define GEO_NODE_MESH_TO_VOLUME 1164 #define GEO_NODE_UV_UNWRAP 1165 #define GEO_NODE_UV_PACK_ISLANDS 1166 -#define GEO_NODE_DEFORM_CURVES_WITH_SURFACE 1167 +#define GEO_NODE_DEFORM_CURVES_ON_SURFACE 1167 /** \} */ diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 1c797f29ce1..c6f140b9260 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -4749,7 +4749,7 @@ static void registerGeometryNodes() register_node_type_geo_curve_to_mesh(); register_node_type_geo_curve_to_points(); register_node_type_geo_curve_trim(); - register_node_type_geo_deform_curves_with_surface(); + register_node_type_geo_deform_curves_on_surface(); register_node_type_geo_delete_geometry(); register_node_type_geo_duplicate_elements(); register_node_type_geo_distribute_points_on_faces(); diff --git a/source/blender/editors/curves/intern/curves_add.cc b/source/blender/editors/curves/intern/curves_add.cc index c725ef2edb9..79916253207 100644 --- a/source/blender/editors/curves/intern/curves_add.cc +++ b/source/blender/editors/curves/intern/curves_add.cc @@ -24,7 +24,7 @@ namespace blender::ed::curves { static bool has_surface_deformation_node(const bNodeTree &ntree) { LISTBASE_FOREACH (const bNode *, node, &ntree.nodes) { - if (node->type == GEO_NODE_DEFORM_CURVES_WITH_SURFACE) { + if (node->type == GEO_NODE_DEFORM_CURVES_ON_SURFACE) { return true; } if (node->type == NODE_GROUP) { @@ -65,16 +65,16 @@ void ensure_surface_deformation_node_exists(bContext &C, Object &curves_ob) Scene *scene = CTX_data_scene(&C); ModifierData *md = ED_object_modifier_add( - nullptr, bmain, scene, &curves_ob, "Hair Deform", eModifierType_Nodes); + nullptr, bmain, scene, &curves_ob, "Surface Deform", eModifierType_Nodes); NodesModifierData &nmd = *reinterpret_cast<NodesModifierData *>(md); - nmd.node_group = ntreeAddTree(bmain, "Hair Deform", "GeometryNodeTree"); + nmd.node_group = ntreeAddTree(bmain, "Surface Deform", "GeometryNodeTree"); bNodeTree *ntree = nmd.node_group; ntreeAddSocketInterface(ntree, SOCK_IN, "NodeSocketGeometry", "Geometry"); ntreeAddSocketInterface(ntree, SOCK_OUT, "NodeSocketGeometry", "Geometry"); bNode *group_input = nodeAddStaticNode(&C, ntree, NODE_GROUP_INPUT); bNode *group_output = nodeAddStaticNode(&C, ntree, NODE_GROUP_OUTPUT); - bNode *deform_node = nodeAddStaticNode(&C, ntree, GEO_NODE_DEFORM_CURVES_WITH_SURFACE); + bNode *deform_node = nodeAddStaticNode(&C, ntree, GEO_NODE_DEFORM_CURVES_ON_SURFACE); ED_node_tree_propagate_change(&C, bmain, nmd.node_group); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 3af992da3ee..a68ef361f04 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -3583,8 +3583,8 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "modifier_flag", OB_MODIFIER_FLAG_ADD_REST_POSITION); RNA_def_property_ui_text(prop, "Add Rest Position", - "Add a rest_position attribute that is a copy of the position " - "attribute right before shape keys and modifiers are evaluated"); + "Add a \"rest_position\" attribute that is a copy of the position " + "attribute before shape keys and modifiers are evaluated"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_data"); /* render */ diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index 02b146b85fb..a63a89e076b 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -191,7 +191,7 @@ static bool node_needs_own_transform_relation(const bNode &node) return storage.transform_space == GEO_NODE_TRANSFORM_SPACE_RELATIVE; } - if (node.type == GEO_NODE_DEFORM_CURVES_WITH_SURFACE) { + if (node.type == GEO_NODE_DEFORM_CURVES_ON_SURFACE) { return true; } diff --git a/source/blender/nodes/NOD_geometry.h b/source/blender/nodes/NOD_geometry.h index 567307ec1e6..86c276fbd6f 100644 --- a/source/blender/nodes/NOD_geometry.h +++ b/source/blender/nodes/NOD_geometry.h @@ -47,7 +47,7 @@ void register_node_type_geo_curve_subdivide(void); void register_node_type_geo_curve_to_mesh(void); void register_node_type_geo_curve_to_points(void); void register_node_type_geo_curve_trim(void); -void register_node_type_geo_deform_curves_with_surface(void); +void register_node_type_geo_deform_curves_on_surface(void); void register_node_type_geo_delete_geometry(void); void register_node_type_geo_duplicate_elements(void); void register_node_type_geo_distribute_points_on_faces(void); diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index f015e5b6c4a..7c7f114bb78 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -301,7 +301,7 @@ DefNode(GeometryNode, GEO_NODE_CURVE_SPLINE_PARAMETER, 0, "SPLINE_PARAMETER", Sp DefNode(GeometryNode, GEO_NODE_CURVE_SPLINE_TYPE, def_geo_curve_spline_type, "CURVE_SPLINE_TYPE", CurveSplineType, "Set Spline Type", "") DefNode(GeometryNode, GEO_NODE_CURVE_TO_MESH, 0, "CURVE_TO_MESH", CurveToMesh, "Curve to Mesh", "") DefNode(GeometryNode, GEO_NODE_CURVE_TO_POINTS, def_geo_curve_to_points, "CURVE_TO_POINTS", CurveToPoints, "Curve to Points", "") -DefNode(GeometryNode, GEO_NODE_DEFORM_CURVES_WITH_SURFACE, 0, "DEFORM_CURVES_WITH_SURFACE", DeformCurvesWithSurface, "Deform Curves with Surface", "") +DefNode(GeometryNode, GEO_NODE_DEFORM_CURVES_ON_SURFACE, 0, "DEFORM_CURVES_ON_SURFACE", DeformCurvesOnSurface, "Deform Curves on Surface", "") DefNode(GeometryNode, GEO_NODE_DELETE_GEOMETRY, def_geo_delete_geometry, "DELETE_GEOMETRY", DeleteGeometry, "Delete Geometry", "") DefNode(GeometryNode, GEO_NODE_DUPLICATE_ELEMENTS, def_geo_duplicate_elements, "DUPLICATE_ELEMENTS", DuplicateElements, "Duplicate Elements", "") DefNode(GeometryNode, GEO_NODE_DISTRIBUTE_POINTS_ON_FACES, def_geo_distribute_points_on_faces, "DISTRIBUTE_POINTS_ON_FACES", DistributePointsOnFaces, "Distribute Points on Faces", "") diff --git a/source/blender/nodes/geometry/nodes/node_geo_deform_curves_with_surface.cc b/source/blender/nodes/geometry/nodes/node_geo_deform_curves_with_surface.cc index 28501e4fb10..00866bca48f 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_deform_curves_with_surface.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_deform_curves_with_surface.cc @@ -49,7 +49,7 @@ static void deform_curves(CurvesGeometry &curves, const Span<float3> corner_normals_new, const Span<float3> rest_positions, const float4x4 &surface_to_curves, - std::atomic<bool> &r_found_invalid_uv) + std::atomic<int> &r_invalid_uv_count) { /* Find attachment points on old and new mesh. */ const int curves_num = curves.curves_num(); @@ -67,12 +67,12 @@ static void deform_curves(CurvesGeometry &curves, for (const int curve_i : range) { const ReverseUVSampler::Result &surface_sample_old = surface_samples_old[curve_i]; if (surface_sample_old.type != ReverseUVSampler::ResultType::Ok) { - r_found_invalid_uv.store(true); + r_invalid_uv_count++; continue; } const ReverseUVSampler::Result &surface_sample_new = surface_samples_new[curve_i]; if (surface_sample_new.type != ReverseUVSampler::ResultType::Ok) { - r_found_invalid_uv.store(true); + r_invalid_uv_count++; continue; } @@ -132,7 +132,7 @@ static void deform_curves(CurvesGeometry &curves, * computed based on the rest position attribute instead of positions on the old mesh. This * way the old and new tangent reference use the same topology. * - * Todo: Figure out if this can be smoothly interpolated across the surface as well. + * TODO: Figure out if this can be smoothly interpolated across the surface as well. * Currently, this is a source of discontinuity in the deformation, because the vector * changes intantly from one triangle to the next. */ const float3 tangent_reference_dir_old = rest_pos_1 - rest_pos_0; @@ -280,7 +280,7 @@ static void node_geo_exec(GeoNodeExecParams params) reinterpret_cast<const float3 *>(CustomData_get_layer(&surface_mesh_eval->ldata, CD_NORMAL)), surface_mesh_eval->totloop}; - std::atomic<bool> found_invalid_uv = false; + std::atomic<int> invalid_uv_count = 0; const bke::CurvesSurfaceTransforms transforms{*self_ob_eval, surface_ob_eval}; @@ -294,12 +294,16 @@ static void node_geo_exec(GeoNodeExecParams params) corner_normals_eval, rest_positions, transforms.surface_to_curves, - found_invalid_uv); + invalid_uv_count); curves.tag_positions_changed(); - if (found_invalid_uv) { - params.error_message_add(NodeWarningType::Warning, "Invalid uvs found"); + if (invalid_uv_count) { + char *error = BLI_sprintfN( + TIP_("Invalid surface attachment UV coordinates found on %d curves"), + invalid_uv_count.load()); + params.error_message_add(NodeWarningType::Warning, error); + MEM_freeN(error); } params.set_output("Curves", curves_geometry); @@ -307,16 +311,15 @@ static void node_geo_exec(GeoNodeExecParams params) } // namespace blender::nodes::node_geo_deform_curves_with_surface_cc -void register_node_type_geo_deform_curves_with_surface() +void register_node_type_geo_deform_curves_on_surface() { namespace file_ns = blender::nodes::node_geo_deform_curves_with @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs