[BUG]Style Customizer Dataset Gradient

v8.1.35

I have a shape with a custom property that drives a style customizer to update the fill paint. This is what my styles dataset looks like.

I am trying to update the gradient color(s). I cannot edit the fillPaint column at all in the dataset viewer, but I am able to edit the other columns. I try to copy the dataset and edit it in n++.

"#NAMES"
"status","animationIndex","animationDuration","fillPaint"
"#TYPES"
"I","I","I","java.awt.Paint"
"#ROWS","5"
"0","0","1000","com.inductiveautomation.ignition.client.util.gui.paints.RelativeLinearGradientPaint@651f0ade"
"1","0","1000","com.inductiveautomation.ignition.client.util.gui.paints.RelativeLinearGradientPaint@2723f246"
"2","0","1000","com.inductiveautomation.ignition.client.util.gui.paints.RelativeLinearGradientPaint@3576b796"
"3","0","800","com.inductiveautomation.ignition.client.util.gui.paints.RelativeLinearGradientPaint@36107dbe"
"3","1","800","color(0,255,255,255)"

→ (second gradient updated)

"#NAMES"
"status","animationIndex","animationDuration","fillPaint"
"#TYPES"
"I","I","I","java.awt.Paint"
"#ROWS","5"
"0","0","1000","com.inductiveautomation.ignition.client.util.gui.paints.RelativeLinearGradientPaint@7e4450d2"
"1","0","1000","com.inductiveautomation.ignition.client.util.gui.paints.RelativeLinearGradientPaint@5d0869fc"
"2","0","1000","com.inductiveautomation.ignition.client.util.gui.paints.RelativeLinearGradientPaint@3e18aba5"
"3","0","800","com.inductiveautomation.ignition.client.util.gui.paints.RelativeLinearGradientPaint@11f7da90"
"3","1","800","color(71,255,255,255)"

But I get this error when pasting it back

ClassCastException: Cannot coerce string value 'com.inductiveautomation.ignition.client.util.gui.paints.RelativeLinearGradientPaint@5d0869fc' into a color

What’s weird is that this error isn’t thrown on the first gradient, but the one that was updated.

That's a default Java toString() representation of an object, which is fine while the object lives in memory or when it's serialized by Vision, but is not sufficient if you copy out to CSV and paste back in (a necessarily lossy serialization/deserialization operation).

There's no canonical acceptable string format for a complicated gradient paint, so you'll have to do what you're trying to do in some other way; you cannot copy out to clipboard and paste back in.

1 Like

Alright, I’m also trying to figure out how it got in there in the first place…

If you set up a shape with a gradient (by directly editing the fill paint property), you're allowed to set up a gradient fill, because the property type is Paint, not the more restrictive Color (which is all the style customizer is intended to support.)

But as a convenience, the style customizer 'grabs' the current value of the property when you open it and attempt to create a new style, which can lead you to an otherwise "impossible" style in the style customizer:

At least, that's one possible way to do it; there might be others. It's basically a bug that we allow this, though it does appear to work (as long as you're careful not to edit the fill through the customizer or dataset).

That explains how to get one gradient in the styles table. Still unsure how there are multiple in this one

Such a dataset could be created with a script. Who made it originally?

Me :sweat_smile:

I don’t think I used a script…

1 Like

If you do what I said once and then add rows, it'll repeat the gradient to the other rows.

1 Like