mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-20 03:18:06 +08:00
Fix Path tool's Path node transform calculation by skipping local transform based on first instance source ID (#2843)
* First instance source id * Set source node id and migrations
This commit is contained in:
@@ -356,7 +356,7 @@ pub struct ContextImpl<'a> {
|
||||
}
|
||||
|
||||
impl<'a> ContextImpl<'a> {
|
||||
pub fn with_footprint<'f>(&self, new_footprint: &'f Footprint, varargs: Option<&'f impl (Borrow<[DynRef<'f>]>)>) -> ContextImpl<'f>
|
||||
pub fn with_footprint<'f>(&self, new_footprint: &'f Footprint, varargs: Option<&'f impl Borrow<[DynRef<'f>]>>) -> ContextImpl<'f>
|
||||
where
|
||||
'a: 'f,
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::*;
|
||||
use crate::Ctx;
|
||||
use crate::instances::Instance;
|
||||
use crate::uuid::generate_uuid;
|
||||
use crate::uuid::{NodeId, generate_uuid};
|
||||
use bezier_rs::BezierHandles;
|
||||
use dyn_any::DynAny;
|
||||
use kurbo::{BezPath, PathEl, Point};
|
||||
@@ -420,12 +420,17 @@ impl Hash for VectorModification {
|
||||
|
||||
/// A node that applies a procedural modification to some [`VectorData`].
|
||||
#[node_macro::node(category(""))]
|
||||
async fn path_modify(_ctx: impl Ctx, mut vector_data: VectorDataTable, modification: Box<VectorModification>) -> VectorDataTable {
|
||||
async fn path_modify(_ctx: impl Ctx, mut vector_data: VectorDataTable, modification: Box<VectorModification>, node_path: Vec<NodeId>) -> VectorDataTable {
|
||||
if vector_data.is_empty() {
|
||||
vector_data.push(Instance::default());
|
||||
}
|
||||
let vector_data_instance = vector_data.get_mut(0).expect("push should give one item");
|
||||
modification.apply(vector_data_instance.instance);
|
||||
|
||||
// Update the source node id
|
||||
let this_node_path = node_path.iter().rev().nth(1).copied();
|
||||
*vector_data_instance.source_node_id = vector_data_instance.source_node_id.or(this_node_path);
|
||||
|
||||
if vector_data.len() > 1 {
|
||||
warn!("The path modify ran on {} instances of vector data. Only the first can be modified.", vector_data.len());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user