From 43c9dafd08120dc59b66d978870442f83529ad6f Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Fri, 19 Jul 2019 22:10:09 +0200 Subject: [PATCH] Document the imperative 1.9.0 functions. --- theme.rst | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/theme.rst b/theme.rst index 39424bd..e45d636 100644 --- a/theme.rst +++ b/theme.rst @@ -248,18 +248,17 @@ preview). The number of channels is determined by calling this function once at the start of the program:: - function num_channels() + Nageru.set_num_channels(2) -It should simply return the number of channels (0 is allowed, -but doesn't make a lot of sense). Live and preview comes in addition to this. +0 is allowed, but doesn't make a lot of sense. Live and preview comes in +addition to this. -Each channel will have a label on it; Nageru asks the theme -by calling this function:: +Each channel will have a label on it; you set it by calling:: - function channel_name(channel) + Nageru.set_channel_name(2, "Side-by-side") -Here, channel is 2, 3, 4, etc.—0 is always called “Live” and -1 is always called “Preview”. +Here, channel is 2, 3, 4, etc.—by default, 0 is called “Live” and +1 is called “Preview”, and you probably don't need to change this. Each channel has its own scene, starting from number 2 for the first one (since 0 is live and 1 is preview). The simplest form is simply a direct copy @@ -267,24 +266,18 @@ of an input, and most themes will include one such channel for each input. (Below, we will see that there are more types of channels, however.) Since the mapping between the channel UI element and inputs is so typical, Nageru allows the theme to simply declare that a channel corresponds to -a given signal, by asking it:: - - function channel_signal(channel) - if channel == 2 then - return 0 - elseif channel == 3 then - return 1 - else - return -1 - end - end +a given signal:: + + Nageru.set_channel_signal(2, 0) + Nageru.set_channel_signal(3, 1) Here, channels 2 and 3 (the two first ones) correspond directly to inputs 0 and 1, respectively. The others don't, and return -1. The effect on the UI is that the user can right-click on the channel and configure the input that way; in fact, this is currently the only way to configure them. -Furthermore, channels can have a color:: +Furthermore, channels can have a color, which is governed by Nageru calling +a function your theme:: function channel_color(channel) @@ -294,10 +287,10 @@ the currently playing input as red, or the preview as green. And finally, there are two entry points related to white balance:: - function supports_set_wb(channel) + Nageru.set_supports_wb(2, true) function set_wb(channel, red, green, blue) -If the first function returns true (called once, at the start of the program), +If the first function is called with a true value (at the start of the theme), the channel will get a “Set WB” button next to it, which will activate a color picker. When the user picks a color (ostensibly with a gray point), the second function will be called (with the RGB values in linear light—not sRGB!), -- 2.39.2