GafferHQ / gaffer

Gaffer is a node-based application for lookdev, lighting and automation
http://www.gafferhq.org
BSD 3-Clause "New" or "Revised" License
944 stars 205 forks source link

Support all Numeric Types In createPlugFromData #5600

Open danieldresser-ie opened 8 months ago

danieldresser-ie commented 8 months ago

John recently added support for more numeric types in for setPlugFromData: https://github.com/GafferHQ/gaffer/pull/5575

This was to cope with USD files using additional data types to represent basic numerical data.

We just got a bug report on the Discord noting similar problems using AttributeTweaks on an ai:subdiv_iterations value that is being stored as a UCharData - I think the fix would be pretty simple to just add support for these numeric types in createPlugFromData as well, mapping to the closest matching plug type ( double -> FloatPlug, uchar -> IntPlug ), and hopefully everything would just work?

Assigning to John since it's so similar to the work he recently did - though if you think it is actually simple and want me to put the PR in, I can do that in the New Year.

danieldresser-ie commented 8 months ago

Update from Discord - if the user manually creates the AttributeTweak ( as would happen using From Selected if createPlugFromData supported uchar ), then Create mode works ( and just overwrites the data type ), but Replace mode doesn't ( because the data types don't match ). So maybe this is a bit more complex than I'd hoped, but I think making createPlugFromData work with these types would still be a good first step.