Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ fn label(x: impl Into<String>) -> Vec<LayoutGroup> {
vec![LayoutGroup::row(error)]
}

trait TableRowLayout {
trait TableItemLayout {
fn type_name() -> &'static str;
fn identifier(&self) -> String;
fn layout_with_breadcrumb(&self, data: &mut LayoutData) -> Vec<LayoutGroup> {
Expand All @@ -245,7 +245,7 @@ trait TableRowLayout {
}
}

impl<T: TableRowLayout> TableRowLayout for Table<T> {
impl<T: TableItemLayout> TableItemLayout for Table<T> {
fn type_name() -> &'static str {
"Table"
}
Expand Down Expand Up @@ -307,7 +307,7 @@ impl<T: TableRowLayout> TableRowLayout for Table<T> {
}
}

impl TableRowLayout for Artboard {
impl TableItemLayout for Artboard {
fn type_name() -> &'static str {
"Artboard"
}
Expand All @@ -323,7 +323,7 @@ impl TableRowLayout for Artboard {
}
}

impl TableRowLayout for Graphic {
impl TableItemLayout for Graphic {
fn type_name() -> &'static str {
"Graphic"
}
Expand Down Expand Up @@ -353,7 +353,7 @@ impl TableRowLayout for Graphic {
}
}

impl TableRowLayout for Vector {
impl TableItemLayout for Vector {
fn type_name() -> &'static str {
"Vector"
}
Expand Down Expand Up @@ -512,7 +512,7 @@ impl TableRowLayout for Vector {
}
}

impl TableRowLayout for Raster<CPU> {
impl TableItemLayout for Raster<CPU> {
fn type_name() -> &'static str {
"Raster"
}
Expand Down Expand Up @@ -543,7 +543,7 @@ impl TableRowLayout for Raster<CPU> {
}
}

impl TableRowLayout for Raster<GPU> {
impl TableItemLayout for Raster<GPU> {
fn type_name() -> &'static str {
"Raster"
}
Expand All @@ -556,7 +556,7 @@ impl TableRowLayout for Raster<GPU> {
}
}

impl TableRowLayout for Color {
impl TableItemLayout for Color {
fn type_name() -> &'static str {
"Color"
}
Expand All @@ -576,7 +576,7 @@ impl TableRowLayout for Color {
}
}

impl TableRowLayout for GradientStops {
impl TableItemLayout for GradientStops {
fn type_name() -> &'static str {
"Gradient"
}
Expand All @@ -596,7 +596,7 @@ impl TableRowLayout for GradientStops {
}
}

impl TableRowLayout for f64 {
impl TableItemLayout for f64 {
fn type_name() -> &'static str {
"Number (f64)"
}
Expand All @@ -611,7 +611,7 @@ impl TableRowLayout for f64 {
}
}

impl TableRowLayout for u8 {
impl TableItemLayout for u8 {
fn type_name() -> &'static str {
"Byte"
}
Expand All @@ -624,7 +624,7 @@ impl TableRowLayout for u8 {
}
}

impl TableRowLayout for u32 {
impl TableItemLayout for u32 {
fn type_name() -> &'static str {
"Number (u32)"
}
Expand All @@ -639,7 +639,7 @@ impl TableRowLayout for u32 {
}
}

impl TableRowLayout for u64 {
impl TableItemLayout for u64 {
fn type_name() -> &'static str {
"Number (u64)"
}
Expand All @@ -655,7 +655,7 @@ impl TableRowLayout for u64 {
}
}

impl TableRowLayout for bool {
impl TableItemLayout for bool {
fn type_name() -> &'static str {
"Bool"
}
Expand All @@ -670,7 +670,7 @@ impl TableRowLayout for bool {
}
}

impl TableRowLayout for String {
impl TableItemLayout for String {
fn type_name() -> &'static str {
"String"
}
Expand All @@ -689,7 +689,7 @@ impl TableRowLayout for String {
}
}

impl TableRowLayout for Option<f64> {
impl TableItemLayout for Option<f64> {
fn type_name() -> &'static str {
"Option<f64>"
}
Expand All @@ -704,7 +704,7 @@ impl TableRowLayout for Option<f64> {
}
}

impl TableRowLayout for DVec2 {
impl TableItemLayout for DVec2 {
fn type_name() -> &'static str {
"Vec2"
}
Expand All @@ -719,7 +719,7 @@ impl TableRowLayout for DVec2 {
}
}

impl TableRowLayout for Vec2 {
impl TableItemLayout for Vec2 {
fn type_name() -> &'static str {
"Vec2"
}
Expand All @@ -734,7 +734,7 @@ impl TableRowLayout for Vec2 {
}
}

impl TableRowLayout for DAffine2 {
impl TableItemLayout for DAffine2 {
fn type_name() -> &'static str {
"Transform"
}
Expand All @@ -749,7 +749,7 @@ impl TableRowLayout for DAffine2 {
}
}

impl TableRowLayout for Affine2 {
impl TableItemLayout for Affine2 {
fn type_name() -> &'static str {
"Transform"
}
Expand All @@ -765,7 +765,7 @@ impl TableRowLayout for Affine2 {
}
}

impl TableRowLayout for BlendMode {
impl TableItemLayout for BlendMode {
fn type_name() -> &'static str {
"BlendMode"
}
Expand All @@ -780,7 +780,7 @@ impl TableRowLayout for BlendMode {
}
}

impl TableRowLayout for GradientType {
impl TableItemLayout for GradientType {
fn type_name() -> &'static str {
"GradientType"
}
Expand All @@ -795,7 +795,7 @@ impl TableRowLayout for GradientType {
}
}

impl TableRowLayout for GradientSpreadMethod {
impl TableItemLayout for GradientSpreadMethod {
fn type_name() -> &'static str {
"GradientSpreadMethod"
}
Expand All @@ -820,7 +820,7 @@ fn node_id_display_label(node_id: NodeId, network_interface: &NodeNetworkInterfa
}
}

impl TableRowLayout for NodeId {
impl TableItemLayout for NodeId {
fn type_name() -> &'static str {
"NodeId"
}
Expand Down Expand Up @@ -932,7 +932,7 @@ impl TableRowLayout for NodeId {
}
}

/// Invokes another macro with the full list of `TableRowLayout`-implementing types whose values may appear
/// Invokes another macro with the full list of `TableItemLayout`-implementing types whose values may appear
/// as attribute values. Both the value-rendering and drilldown-navigation dispatchers iterate this list,
/// so adding a new attribute-displayable type is a single edit here.
macro_rules! known_table_row_types {
Expand Down Expand Up @@ -984,9 +984,9 @@ fn display_value_override(any: &dyn Any) -> Option<String> {
}

/// Type-dispatched widget for displaying an attribute value in a `Table<T>` item.
/// Delegates to [`TableRowLayout::value_widget`] so the same widget code is shared between
/// element-column rendering and attribute-column rendering. Returns `None` for unrecognized types so the
/// caller can fall back to a debug-formatted [`TextLabel`].
/// Delegates to [`TableItemLayout::value_widget`] so the same widget code is shared between
/// element-column rendering and attribute-column rendering. Returns `None` for unrecognized
/// types so the caller can fall back to a debug-formatted [`TextLabel`].
fn dispatch_value_widget(any: &dyn Any, target: PathStep, data: &LayoutData) -> Option<WidgetInstance> {
macro_rules! check {
( $($ty:ty),* $(,)? ) => {
Expand Down Expand Up @@ -1041,7 +1041,7 @@ fn table_node_id_path_layout_with_breadcrumb(path: &Table<NodeId>, data: &mut La
}

/// Type-dispatched recursion into an attribute value for the Data panel breadcrumb navigation.
/// Mirrors [`dispatch_value_widget`] but routes to [`TableRowLayout::layout_with_breadcrumb`].
/// Mirrors [`dispatch_value_widget`] but routes to [`TableItemLayout::layout_with_breadcrumb`].
/// Returns `None` for unrecognized types.
fn drilldown_attribute_layout(any: &dyn Any, data: &mut LayoutData) -> Option<Vec<LayoutGroup>> {
// `Table<NodeId>` is interpreted as a path (e.g. the `editor:layer_path` attribute), so each item's NodeId value
Expand Down
16 changes: 8 additions & 8 deletions node-graph/graph-craft/src/document/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,16 @@ macro_rules! tagged_value {
Self::from_type_or_none(&Type::Concrete(td)).to_dynany()
}
Self::F64Array(values) => {
let table: Table<f64> = values.into_iter().map(core_types::table::TableRow::new_from_element).collect();
let table: Table<f64> = values.into_iter().map(core_types::table::Item::new_from_element).collect();
Box::new(table)
}
Self::Color(color) => {
let table: Table<Color> = color.into_iter().map(core_types::table::TableRow::new_from_element).collect();
let table: Table<Color> = color.into_iter().map(core_types::table::Item::new_from_element).collect();
Box::new(table)
}
Self::Gradient(stops) => Box::new(Table::<GradientStops>::new_from_element(stops)),
Self::BrushStrokes(strokes) => {
let table: Table<BrushStroke> = strokes.into_iter().map(core_types::table::TableRow::new_from_element).collect();
let table: Table<BrushStroke> = strokes.into_iter().map(core_types::table::Item::new_from_element).collect();
Box::new(table)
}
// =======================
Expand All @@ -163,7 +163,7 @@ macro_rules! tagged_value {
// =======================
Self::RenderOutput(x) => Box::new(x),
Self::NodeIdPath(path) => {
let table: Table<NodeId> = path.into_iter().map(core_types::table::TableRow::new_from_element).collect();
let table: Table<NodeId> = path.into_iter().map(core_types::table::Item::new_from_element).collect();
Box::new(table)
}
Self::DocumentNode(node) => Box::new(node),
Expand Down Expand Up @@ -191,16 +191,16 @@ macro_rules! tagged_value {
Self::from_type_or_none(&Type::Concrete(td)).to_any()
}
Self::F64Array(values) => {
let table: Table<f64> = values.into_iter().map(core_types::table::TableRow::new_from_element).collect();
let table: Table<f64> = values.into_iter().map(core_types::table::Item::new_from_element).collect();
Arc::new(table)
}
Self::Color(color) => {
let table: Table<Color> = color.into_iter().map(core_types::table::TableRow::new_from_element).collect();
let table: Table<Color> = color.into_iter().map(core_types::table::Item::new_from_element).collect();
Arc::new(table)
}
Self::Gradient(stops) => Arc::new(Table::<GradientStops>::new_from_element(stops)),
Self::BrushStrokes(strokes) => {
let table: Table<BrushStroke> = strokes.into_iter().map(core_types::table::TableRow::new_from_element).collect();
let table: Table<BrushStroke> = strokes.into_iter().map(core_types::table::Item::new_from_element).collect();
Arc::new(table)
}
// =======================
Expand All @@ -212,7 +212,7 @@ macro_rules! tagged_value {
// =======================
Self::RenderOutput(x) => Arc::new(x),
Self::NodeIdPath(path) => {
let table: Table<NodeId> = path.into_iter().map(core_types::table::TableRow::new_from_element).collect();
let table: Table<NodeId> = path.into_iter().map(core_types::table::Item::new_from_element).collect();
Arc::new(table)
}
Self::DocumentNode(node) => Arc::new(node),
Expand Down
34 changes: 17 additions & 17 deletions node-graph/interpreted-executor/src/node_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use graphene_std::raster::color::Color;
use graphene_std::raster::*;
use graphene_std::raster::{CPU, Raster};
use graphene_std::render_node::RenderIntermediate;
use graphene_std::table::{AttributeColumnDyn, AttributeValueDyn, Table, TableDyn};
use graphene_std::table::{AttributeDyn, AttributeValueDyn, Table, TableDyn};
use graphene_std::transform::Footprint;
use graphene_std::uuid::NodeId;
use graphene_std::vector::Vector;
Expand All @@ -42,19 +42,19 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
#[cfg(feature = "gpu")]
convert_node!(from: Table<Raster<GPU>>, to: Table<Graphic>),
// Type-erased attribute column conversions for the `Attach Attribute` node, so it monomorphizes only over the destination table type.
convert_node!(from: Table<Artboard>, to: AttributeColumnDyn),
convert_node!(from: Table<Graphic>, to: AttributeColumnDyn),
convert_node!(from: Table<Vector>, to: AttributeColumnDyn),
convert_node!(from: Table<Raster<CPU>>, to: AttributeColumnDyn),
convert_node!(from: Table<Color>, to: AttributeColumnDyn),
convert_node!(from: Table<GradientStops>, to: AttributeColumnDyn),
convert_node!(from: Table<f64>, to: AttributeColumnDyn),
convert_node!(from: Table<bool>, to: AttributeColumnDyn),
convert_node!(from: Table<String>, to: AttributeColumnDyn),
convert_node!(from: Table<DAffine2>, to: AttributeColumnDyn),
convert_node!(from: Table<BlendMode>, to: AttributeColumnDyn),
convert_node!(from: Table<graphene_std::vector::style::GradientType>, to: AttributeColumnDyn),
convert_node!(from: Table<graphene_std::vector::style::GradientSpreadMethod>, to: AttributeColumnDyn),
convert_node!(from: Table<Artboard>, to: AttributeDyn),
convert_node!(from: Table<Graphic>, to: AttributeDyn),
convert_node!(from: Table<Vector>, to: AttributeDyn),
convert_node!(from: Table<Raster<CPU>>, to: AttributeDyn),
convert_node!(from: Table<Color>, to: AttributeDyn),
convert_node!(from: Table<GradientStops>, to: AttributeDyn),
convert_node!(from: Table<f64>, to: AttributeDyn),
convert_node!(from: Table<bool>, to: AttributeDyn),
convert_node!(from: Table<String>, to: AttributeDyn),
convert_node!(from: Table<DAffine2>, to: AttributeDyn),
convert_node!(from: Table<BlendMode>, to: AttributeDyn),
convert_node!(from: Table<graphene_std::vector::style::GradientType>, to: AttributeDyn),
convert_node!(from: Table<graphene_std::vector::style::GradientSpreadMethod>, to: AttributeDyn),
convert_node!(from: Table<Artboard>, to: TableDyn),
convert_node!(from: Table<Graphic>, to: TableDyn),
convert_node!(from: Table<Vector>, to: TableDyn),
Expand Down Expand Up @@ -151,7 +151,7 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => Table<BlendMode>]),
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => Table<graphene_std::vector::style::GradientType>]),
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => Table<graphene_std::vector::style::GradientSpreadMethod>]),
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => AttributeColumnDyn]),
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => AttributeDyn]),
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => AttributeValueDyn]),
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => TableDyn]),
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => Graphic]),
Expand Down Expand Up @@ -190,7 +190,7 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
async_node!(graphene_core::context_modification::ContextModificationNode<_, _>, input: Context, fn_params: [Context => &PlatformEditorApi, Context => graphene_std::ContextFeatures]),
async_node!(graphene_core::context_modification::ContextModificationNode<_, _>, input: Context, fn_params: [Context => RenderIntermediate, Context => graphene_std::ContextFeatures]),
async_node!(graphene_core::context_modification::ContextModificationNode<_, _>, input: Context, fn_params: [Context => RenderOutput, Context => graphene_std::ContextFeatures]),
async_node!(graphene_core::context_modification::ContextModificationNode<_, _>, input: Context, fn_params: [Context => AttributeColumnDyn, Context => graphene_std::ContextFeatures]),
async_node!(graphene_core::context_modification::ContextModificationNode<_, _>, input: Context, fn_params: [Context => AttributeDyn, Context => graphene_std::ContextFeatures]),
async_node!(graphene_core::context_modification::ContextModificationNode<_, _>, input: Context, fn_params: [Context => AttributeValueDyn, Context => graphene_std::ContextFeatures]),
async_node!(graphene_core::context_modification::ContextModificationNode<_, _>, input: Context, fn_params: [Context => TableDyn, Context => graphene_std::ContextFeatures]),
#[cfg(target_family = "wasm")]
Expand All @@ -216,7 +216,7 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
async_node!(graphene_core::memo::MemoizeNode<_, _>, input: Context, fn_params: [Context => Table<BlendMode>]),
async_node!(graphene_core::memo::MemoizeNode<_, _>, input: Context, fn_params: [Context => Table<graphene_std::vector::style::GradientType>]),
async_node!(graphene_core::memo::MemoizeNode<_, _>, input: Context, fn_params: [Context => Table<graphene_std::vector::style::GradientSpreadMethod>]),
async_node!(graphene_core::memo::MemoizeNode<_, _>, input: Context, fn_params: [Context => AttributeColumnDyn]),
async_node!(graphene_core::memo::MemoizeNode<_, _>, input: Context, fn_params: [Context => AttributeDyn]),
async_node!(graphene_core::memo::MemoizeNode<_, _>, input: Context, fn_params: [Context => AttributeValueDyn]),
async_node!(graphene_core::memo::MemoizeNode<_, _>, input: Context, fn_params: [Context => TableDyn]),
#[cfg(target_family = "wasm")]
Expand Down
Loading
Loading