Skip to content

Segment IDs are wrong when no path node exists #3481

@0HyperCube

Description

@0HyperCube

pub fn compute_modified_vector(&self, layer: LayerNodeIdentifier) -> Option<Vector> {
let graph_layer = graph_modification_utils::NodeGraphLayer::new(layer, self);
if let Some(path_node) = graph_layer.upstream_visible_node_id_from_name_in_layer("Path")
&& let Some(vector) = self.document_metadata.vector_modify.get(&path_node)
{
let mut modified = vector.clone();
let path_node = self.document_network().nodes.get(&path_node);
let modification_input = path_node.and_then(|node: &DocumentNode| node.inputs.get(1)).and_then(|input| input.as_value());
if let Some(TaggedValue::VectorModification(modification)) = modification_input {
modification.apply(&mut modified);
}
return Some(modified);
}
self.document_metadata
.click_targets
.get(&layer)
.map(|click| click.iter().map(ClickTarget::target_type))
.map(|target_types| Vector::from_target_types(target_types, true))
}

It tries to get a path node and then falls back on the document_metadata.click_targets. SegmentIds are not stored in the click targets. Therefore this code will just incorrectly assume incremental SegmentIds (the actual generation of SegmentIds occurs inside Vector::from_target_types in vector.append_subpath).

This means that trying to delete a segment or modify a handle when the SegmentIds are not contiguous (e.g. after a boolean operation) will result in confusing results (targeting the wrong segment or no segment at all). As seen by «Keavon» on discord here.

I find that calling it Vector is really confusing since I always thing of a C++ std::vector.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions