Execution Logic. Part 1
“Execution Logic” allows create custom Pilot templates. It does not cancel scripts in Pilot templates for interface logic.
Previous to Execution Logic we was using implemented script block into Viz Template Wizard for sending custom commands to VizENgine. We used to use “Live Update” option. It was generating a lot of problem. Every “Live Update” template was generating extra load on a computer. When you opened or run bunch of templates it was turning into big extra problem with computer memory and сonsequently interface latency.
“EL” allows put control logic to MSE as backend service. And it’s allow use several VizPilot safely because each Pilot not control VizEngine directly anymore. Pilot sends commands to MSE, and MSE decides what to do.
EL is really different from ordinary programming languages like visual basic. EL is like traditional logic of scripting into XML form. Lets compare how to create and fill a variable:
Visual Basic | Execution Logic |
---|---|
Dim s As String = "xyz" |
<def var="s">xyz</def> |
It’s so unusual… isn’t it? :)
From Pilot 5.7 knowing EL has become must-have if you would like to create custom templates. For beginning we need to know only basic elements and debug instruments.
Basic stuff of Execution Logic
There are three things you have to know:
- how to create and use variables
- how to send commands to Engine
- how to get data from template fields to put it into commands.
1. Variables. <var>
or <ref>
Creating and using typical variable:
<def var="s">xyz</def>
<var>s</var>
By <var>
you get value of variable.
Also, there is a list of ready useful system variables:
<var>channel</var> <!-- name of current channel -->
<var>profile</var> <!-- name of current profile -->
<var>element</var> <!-- path to current data-element -->
<var>scene</var> <!-- name of vizrt scene of current template -->
<var>viz_layer</var> <!-- scene layer of current template -->
And, if you want to get a part of VDOM tree use <ref>
:
<ref>/custom_logic/take</ref>
takes piece of VDOM tree contains custom logic of “take”.
<var>
just returns value of variable.<ref>
returns and integrates part of tree.
Bonus variable: <time>
There is a special variable. This is the current time by format — <time>%c</time>
<log>Time: <time utc="yes">%H:%M:%S:%ff</time></log> <!-- Time: 12:00:00:00 -->
<log>Now: <time>%Y %m %d %H:%M:%S</time></log> <!-- Now: 2019 01 01 12:00:00 -->
List of all options you can find in MSE documentation.
2. Send commands to VizEngine
Useful in practice commands is <forked_exec>
and <viz>
. <forked_exec>
define area where you can choose channel of Pilot profile and send commands to this profile. And <viz>
contains viz-command(s).
Simple example with two commands send to “LowerThird” channel:
<forked_exec>
<entry name="execution_group">LowerThird</entry>
<viz>RENDERER GET</viz>
<viz>RENDERER SET_OBJECT </viz>
</forked_exec>
<entry name="execution_group">
defines profile within current <forked_exec>
.
<entry>
often meets in VDOM, there is a name parameter which is important. name="execution_group"
define “entry” with name of channel.
If you want to send commands to defined Program channel you can use system variable <var>channel</var
. And, you can write several commands into one <viz>
tag divided by “new line”:
<forked_exec>
<entry name="execution_group"><var>channel</var></entry>
<viz>
RENDERER GET
RENDERER SET_OBJECT
</viz>
</forked_exec>
If you don’t want wait a response of command you can add parameter “no_responce” <viz no_responce="yes">
. This command runs little bit faster but you can get some bugs if you start using it with no reason. “no_responce” commands runs not consistently! Second command don’t wait finished first.
3. Get data from template
If you have TextEdit with ControlName parameter = “123” you can get the content by <ref>
:
<ref><var>element</var>/data/123</ref>
There is the system standart variable <var>element</var>
. This is the path to current data-element into VDOM xml. We dig to data by /data/123
. And we are getting content of this part VDOM xml by <ref>
.
There is a full working example:
<forked_exec>
<entry name="execution_group"><var>channel</var></entry>
<viz no_response="yes">GLOBAL*MAP SET_STRING_ELEMENT Surname <ref><var>element</var>/data/surname</ref></viz>
</forked_exec>
We have change the global variable into the VizEngine which is in current Program channel in VizPilot ;)
Debug Execution Logic
You can debug only by printing strings into consoles.
<log><var>test</var></log>
prints into MSE console. If you run MSE in console mode.
<viz><var>test</var></viz>
sends command to VizEngine console. I prefer this way because MSE have a lot of garbage outputs that bothers me.
Update checking
Sometimes you need to be sure that new logic was updatet in MSE.
- Launch VizPilot and open playlist with template for checking.
- Enter
http://localhost:8580/app/vdomconfig/vdomconfig.html
in a browser. Wherelocalhost
is the MSE host. - Dig down to
external/master_templates/#####
. Where ##### is number your template. Obviuosly you won’t know it, just go throung all of existing elements. - Look
commands
section. There are all your actual EL commands. Just check it visually.
This information in enough for begin. You have know how to control Engine by template data.
In the next part you will know:
- if-else branch
- delayed commands
- infinity cycles