Fix the 'Repeat', 'Circular Repeat', and 'Mirror' nodes to work on point cloud vector data (#2553)

* Include points in bounding box calculations

* Fix unrelated crash from debug assert when reordering root-level folders

* Fix another unrelated crash from debug assert when GRS scaling to size 0

* Fix several vector nodes to respect and propagate local transform space
This commit is contained in:
Keavon Chambers
2025-04-12 02:18:31 -07:00
committed by GitHub
parent e4d998a400
commit 69069ef723
5 changed files with 75 additions and 58 deletions

View File

@@ -413,21 +413,13 @@ impl<'a> ModifyInputsContext<'a> {
pub fn transform_set_direct(&mut self, transform: DAffine2, skip_rerender: bool, transform_node_id: Option<NodeId>) {
// If the Transform node didn't exist yet, create it now
let Some(transform_node_id) = transform_node_id.or_else(|| {
// Check if the transform is the identity transform within an epsilon
let is_identity = {
let transform = transform.to_scale_angle_translation();
let identity = DAffine2::IDENTITY.to_scale_angle_translation();
(transform.0.x - identity.0.x).abs() < 1e-6
&& (transform.0.y - identity.0.y).abs() < 1e-6
&& (transform.1 - identity.1).abs() < 1e-6
&& (transform.2.x - identity.2.x).abs() < 1e-6
&& (transform.2.y - identity.2.y).abs() < 1e-6
};
// We don't want to pollute the graph with an unnecessary Transform node, so we avoid creating and setting it by returning None
if is_identity {
return None;
// Check if the transform is the identity transform and if so, don't create a new Transform node
if let Some((scale, angle, translation)) = (transform.matrix2.determinant() != 0.).then(|| transform.to_scale_angle_translation()) {
// Check if the transform is the identity transform within an epsilon
if scale.x.abs() < 1e-6 && scale.y.abs() < 1e-6 && angle.abs() < 1e-6 && translation.x.abs() < 1e-6 && translation.y.abs() < 1e-6 {
// We don't want to pollute the graph with an unnecessary Transform node, so we avoid creating and setting it by returning None
return None;
}
}
// Create the Transform node

View File

@@ -80,6 +80,11 @@ impl DocumentMetadata {
}
pub fn transform_to_viewport(&self, layer: LayerNodeIdentifier) -> DAffine2 {
// We're not allowed to convert the root parent to a node id
if layer == LayerNodeIdentifier::ROOT_PARENT {
return self.document_to_viewport;
}
let footprint = self.upstream_footprints.get(&layer.to_node()).map(|footprint| footprint.transform).unwrap_or(self.document_to_viewport);
let local_transform = self.local_transforms.get(&layer.to_node()).copied().unwrap_or_default();