Skip to content

Conversation

@Firestar99
Copy link
Collaborator

@Firestar99 Firestar99 commented Aug 25, 2025

prep work for shaders, does not contain any shader stuff:

  • fix cargo b -p graster-nodes --no-default-features being broken on master
  • random stuff I need for shaders to work
  • change Table<Color> -> Color where only the first row is used anyway

GradientStops,
)]
mut image: T,
#[default(Color::BLACK)] tint: Table<Color>,
Copy link
Collaborator Author

@Firestar99 Firestar99 Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please verify that changing Table<Color> -> Color indeed changes absolutely nothing, since with the table you're just using the first entry of the table anyway. Affects both this black_and_white node and the color_overlay node.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change shouldn't occur, we do need it to take a Table since that is the only data type relating to colors that is processed within the node graph.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now replaced Table<Color> with Option<Color> (instead of just Color) and added an into_node!(from: Table<Color>, to: Option<Color>),, since we already have a impl From<Table<Color>> for Option<Color>. So there's no need to adjust anything in the preprocessing!

However, both Color and Option<Color> makes the tint property disappear in the properties panel.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried adding Option<Color> to TaggedValue to the UI to show, but I couldn't get it to work. Would appreciate it if someone with more editor experience took a look, so I can focus on other important things.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In PR #3048, Keavon removed Color and Option<Color> from the properties system and also from the TaggedValue (used to serialize properties). This seems to me to be a bad idea. I wonder what your opinions are on this matter?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The into nodes should now be added automatically if needed. The gpu node declares it's input as Color or Option<Color> but you can still feed a Table<Color> as input.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Even on the CPU side, there is no need for nodes that work only on a single colour to accept a table.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is approved by Keavon (at least for the GPU case). @0HyperCube if you want you can make a pr to just revert the removal of Color and Option<Color> from the node_properties

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Even on the CPU side, there is no need for nodes that work only on a single colour to accept a table.

And I think there is an argument to be made that now that we have automatic into node insertion we should revert this for nodes which only ever operate on a single color, but I assume @Keavon will have opinions on that

Copy link
Member

@Keavon Keavon Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's please do Option<Color> only, not Color, since this is somewhat temporary as discussed in our Discord conversation.

@Firestar99
Copy link
Collaborator Author

I just noticed that I'll need them to be Color for them to work with the current shaders PR. But I'm working on a followup PR, which would allow us to switch them to Option<Color> easily.

@Firestar99
Copy link
Collaborator Author

Actually, if they'd just default to black color if the Option is None, why have it be optional in the first place?

@Firestar99
Copy link
Collaborator Author

@TrueDoctor are you sure you want to merge this, even though it'll break the UI for color selection of the two nodes?

@Firestar99 Firestar99 force-pushed the shaders-graster-prep3 branch from ea2e61b to 68f195c Compare August 26, 2025 17:45
@Firestar99 Firestar99 marked this pull request as ready for review August 26, 2025 17:45
@Firestar99
Copy link
Collaborator Author

I removed the one problematic change of Table<Color> -> Color from this PR so we can handle that separately and get this merged.

@Firestar99 Firestar99 enabled auto-merge (squash) August 26, 2025 17:47
@TrueDoctor
Copy link
Member

Feel free to merge at your own discretion, if the change to colors is only temporary it is fine break the ui for now and fix that in a followup pr

@Firestar99 Firestar99 merged commit a744499 into master Aug 26, 2025
5 checks passed
@Firestar99 Firestar99 deleted the shaders-graster-prep3 branch August 26, 2025 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants