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:
authorHans Goudey <h.goudey@me.com>2021-06-01 19:03:59 +0300
committerHans Goudey <h.goudey@me.com>2021-06-01 19:03:59 +0300
commit17b09b509c069dad6817e4c123bca50bd0682578 (patch)
tree225e11856aa38770ff00c13d1f69984ee376db46 /source/blender/nodes
parent5b6e0bad1bbc33faba2247602349942ce163b7df (diff)
Geometry Nodes: Skip calculating normals in transform node
This commit skips the eager recalculation of mesh normals in the transform node. Often another deformation or topology-altering operation will happen after the transform node, which means the recalculation was redundant anyway. In one of my test cases this made the node more than 14x faster. Though depending on the situation the cost of updating the normals may just be shifted elsewhere.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_transform.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_transform.cc b/source/blender/nodes/geometry/nodes/node_geo_transform.cc
index 9714a4f8a80..1ad5dbea492 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_transform.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_transform.cc
@@ -20,6 +20,7 @@
#include "BLI_float4x4.hh"
+#include "DNA_mesh_types.h"
#include "DNA_pointcloud_types.h"
#include "DNA_volume_types.h"
@@ -72,7 +73,8 @@ void transform_mesh(Mesh *mesh,
else {
const float4x4 matrix = float4x4::from_loc_eul_scale(translation, rotation, scale);
BKE_mesh_transform(mesh, matrix.values, false);
- BKE_mesh_calc_normals(mesh);
+ mesh->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
+ mesh->runtime.cd_dirty_poly |= CD_MASK_NORMAL;
}
}
@@ -158,7 +160,6 @@ static void transform_curve(CurveEval &curve,
const float3 rotation,
const float3 scale)
{
-
if (use_translate(rotation, scale)) {
curve.translate(translation);
}