mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Convert the node catalog to rank-polymorphic kernels, materialize stored values as ranked wires, and display wire rank in the graph
Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
committed by
Dennis Kobert
parent
83cfd0225a
commit
04d6c0d5cf
@@ -1,5 +1,6 @@
|
||||
use core_types::attribute::{Attr, EditorLayerPath, RemoveAttr, Transform as TransformAttr};
|
||||
use core_types::gpoll::{GraphError, Interrupt};
|
||||
use core_types::transform::BakeTransform;
|
||||
use core_types::uuid::NodeId;
|
||||
use core_types::{Ctx, ExtractIndex, InjectIndex};
|
||||
use glam::DAffine2;
|
||||
@@ -38,14 +39,12 @@ fn path_modify<'e>(
|
||||
Ok((element, Attr(parked.as_slice()), RemoveAttr::new()))
|
||||
}
|
||||
|
||||
/// Applies the vector path's local transformation to its geometry and resets the transform to the identity.
|
||||
/// Bakes the content's transform attribute into its underlying value, resetting the attribute to the identity.
|
||||
#[node_macro::node(category("Vector"))]
|
||||
fn apply_transform(_ctx: impl Ctx, (mut vector, transform): (Vector, Attr<TransformAttr>)) -> (Vector, Attr<TransformAttr>) {
|
||||
// Monomorphic on Vector: our macro cannot yet read a record element through an open generic, so master's DAffine2 and DVec2 rows have no node here.
|
||||
fn bake_transform(_ctx: impl Ctx, (mut content, transform): (Vector, Attr<TransformAttr>)) -> (Vector, Attr<TransformAttr>) {
|
||||
let transform: DAffine2 = *transform;
|
||||
for (_, point) in vector.point_domain.positions_mut() {
|
||||
*point = transform.transform_point2(*point);
|
||||
}
|
||||
vector.segment_domain.transform(transform);
|
||||
content.bake_transform(&transform);
|
||||
|
||||
(vector, Attr(DAffine2::IDENTITY))
|
||||
(content, Attr(DAffine2::IDENTITY))
|
||||
}
|
||||
|
||||
@@ -1278,10 +1278,10 @@ fn dimensions(_: impl Ctx, content: IList<Vector>) -> DVec2 {
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Type-asserts a value to be vector data.
|
||||
/// Type-asserts a value to be vector data. A position becomes a single-anchor vector.
|
||||
#[node_macro::node(category("Vector"), name("As Vector"), path(core_types::vector))]
|
||||
fn as_vector(_: impl Ctx, value: Vector) -> Vector {
|
||||
value
|
||||
fn as_vector<T: Into<Vector>>(_: impl Ctx, #[implementations(Vector, DVec2)] value: T) -> Vector {
|
||||
value.into()
|
||||
}
|
||||
|
||||
/// Creates a polyline from a series of vector points, replacing any existing segments and regions that may already exist.
|
||||
|
||||
Reference in New Issue
Block a user