Two Color Converter Script bugs: Color.lerp overflow + nested component Input fields break
Hi team, I ran into two bugs while building a fuel bar with Converter Scripts. Sharing both since they seem related to how converters handle data.
Bug 1: Color.lerp returns corrupted value
When using Color.lerp to blend between two ViewModel colors (e.g. yellow #FFFFC700 and red #FFFF0000), the result is always 2147483647 (0x7FFFFFFF). This is a signed 32-bit integer overflow - color values exceed 2^31-1 and get clamped.
Workaround: Extract each channel individually with Color.red(), Color.green(), etc., blend them separately, and set result.red / result.green / result.blue / result.alpha directly instead of assigning to result.value.
Bug 2: Converter Input fields break inside nested components
When a component (LastBar) has a Converter with Input fields (e.g. Input of type Color), it works correctly on the root artboard. But when that component is placed inside another component (Fuel), the Input values stop propagating - they fall back to defaults (white/black), producing grey.
Workaround: Use context:rootViewModel() in an init function instead of Input fields. But this means the colors are effectively hardcoded to the root ViewModel - I lose the ability to make them truly dynamic and customizable per converter instance. Input fields on converters should work regardless of nesting depth.
Both issues cost significant debugging time and agent credits to diagnose. Would appreciate if these could be addressed.
Happy to share the .riv file if helpful. Thanks!