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:
authorJacques Lucke <jacques@blender.org>2022-01-06 19:20:57 +0300
committerJacques Lucke <jacques@blender.org>2022-01-06 20:19:06 +0300
commit32e8381e0e4b97e6acbaa145dc222ca1bdbbac11 (patch)
tree9690d07134bc714b61326ca28cdfabdaa2d78cc5
parentc31a346ec555b9830f5a48a56c731d5a12f2624c (diff)
Geometry Nodes: Experimental Scale Elements node (WIP).
This node is best used in combination with e.g. the Extrude node. Differential Revision: https://developer.blender.org/D13757
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc b/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc
index 052197fd259..299d8ec813a 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc
@@ -99,14 +99,6 @@ static void scale_faces(MeshComponent &mesh_component, const InputFields &input_
group_info.tot_faces++;
}
- for (GroupData &group_data : groups_data) {
- if (group_data.tot_faces >= 2) {
- const float f = 1.0f / group_data.tot_faces;
- group_data.scale *= f;
- group_data.pivot *= f;
- }
- }
-
Array<float4x4> transforms(group_amount);
threading::parallel_for(IndexRange(mesh->totvert), 1024, [&](const IndexRange range) {
for (const int vert_index : range) {
@@ -116,6 +108,10 @@ static void scale_faces(MeshComponent &mesh_component, const InputFields &input_
continue;
}
+ const float f = 1.0f / group_data.tot_faces;
+ group_data.scale *= f;
+ group_data.pivot *= f;
+
const float3 x_axis = group_data.x_axis.normalized();
const float3 y_axis = -float3::cross(x_axis, group_data.up).normalized();
const float3 z_axis = float3::cross(x_axis, y_axis);