]> git.sesse.net Git - nageru/blobdiff - simple.lua
Release Nageru 1.7.2.
[nageru] / simple.lua
index 10c9bebbd03da404670602bbcda7e5f90a7fb035..2bff8f341a09387f643d92bc397b14b1d92ea501 100644 (file)
@@ -77,6 +77,15 @@ function channel_signal(channel)
        end
 end
 
+-- API ENTRY POINT
+-- Called every frame. Returns the color (if any) to paint around the given
+-- channel. Returns a CSS color (typically to mark live and preview signals);
+-- "transparent" is allowed.
+-- Will never be called for live (0) or preview (1).
+function channel_color(channel)
+       return "transparent"
+end
+
 -- API ENTRY POINT
 -- Returns if a given channel supports setting white balance (starting from 2).
 -- Called only once for each channel, at the start of the program.
@@ -89,9 +98,9 @@ end
 -- The color is in linear light (not sRGB gamma).
 function set_wb(channel, red, green, blue)
        if channel == 2 then
-               input_neutral_color[0] = { red, green, blue }
-       elseif channel == 3 then
                input_neutral_color[1] = { red, green, blue }
+       elseif channel == 3 then
+               input_neutral_color[2] = { red, green, blue }
        end
 end
 
@@ -157,9 +166,13 @@ function get_chain(num, t, width, height, signals)
                signal_num = num - 2
        end
 
-       prepare = function()
+       -- Make a copy of the current neutral color before returning, so that the
+       -- returned prepare function is unaffected by state changes made by the UI
+       -- before it is rendered.
+       local color = input_neutral_color[signal_num + 1]
+
+       local prepare = function()
                chain.input:connect_signal(signal_num)
-               local color = input_neutral_color[signal_num + 1]
                chain.wb_effect:set_vec3("neutral_color", color[1], color[2], color[3])
        end
        return chain.chain, prepare