Page MenuHome

Geometry Nodes: Translate Instances node
ClosedPublic

Authored by Erik Abrahamsson (erik85) on Sep 28 2021, 8:17 PM.

Details

Summary

Adds a node that can translate instances in global or local space.
Task T91655

Diff Detail

Repository
rB Blender

Event Timeline

Erik Abrahamsson (erik85) requested review of this revision.Sep 28 2021, 8:17 PM
Erik Abrahamsson (erik85) created this revision.

Nice work!

source/blender/nodes/geometry/nodes/node_geo_translate_instances.cc
57–62

How about this? It's a bit nicer looking IMO:

if (local_space) {
  const float4x4 loc_matrix = float4x4::from_location(translation);
  instance_transform = instance_transform * loc_matrix;
}
else {
  const float3 new_position = instance_transform.translation() + translation;
  copy_v3_v3(instance_transform.values[3], new_position);
}
This revision is now accepted and ready to land.Oct 12 2021, 12:06 AM
Hans Goudey (HooglyBoogly) requested changes to this revision.Oct 12 2021, 12:31 AM
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_translate_instances.cc
50–51

I have the same comment as the scale node here:

I don't think this is quite right, the index here is the index into the mask, not the index of the index. Here's an example from the curve reverse node:

threading::parallel_for(selection.index_range(), 128, [&](IndexRange range) {
  for (const int i : range) {
    splines[selection[i]]->reverse();
  }
});
This revision now requires changes to proceed.Oct 12 2021, 12:31 AM
source/blender/nodes/geometry/nodes/node_geo_translate_instances.cc
44–45

extract_input

  • Fixed all review comments

LGTM.
@Hans Goudey (HooglyBoogly) What's the state of moving the selection input to right after the geometry?

This revision is now accepted and ready to land.Oct 13 2021, 12:59 PM