[ANSWERED] Javascript Actor and Control Watcher Data Type Issue
-
Hello,
I am in the process of putting together a patch to read all of the CC values from LoupDeck touch buttons based on the touch button page. I have put together a Javascript calculator to accomplish this. There are 9 pages, each page has 12 touch buttons. I have programmed the controller with CC values in ascending order: page 1 is cc controllers 1-12, page 2 is cc controllers 13-24....etc.
Here is the calculator:
function main() {
var page = arguments[0];
let TB = [];
for (let i = 1; i < 13; i++) {
TB[i] = ((page-1)*12)+i;}
return [TB[1],TB[2],TB[3],TB[4],TB[5],TB[6],TB[7],TB[8],TB[9],TB[10],TB[11],TB[12]]; }Javascript outputs a float value instead of an integer. When I plug this in the Control Watcher, it zeros out the Javascript output and converts the output to a range disabling the output of the javascript actor.
I have a workaround: If I simultaneously connect the Javascript actor output to a "Float to Integer" node, the control watcher will accept the output of the Javascript node.Is there a better way of doing this?
Thanks in advance. -
@jtsteph said:
Is there a better way of doing this?
Not really, that's just how the mutable inputs and outputs on Isadora actors work. If they're green dots, then they'll mutate into what you connect them to, so connecting mutable inputs/outputs first to something to lock in the data type, and then connecting them to something else is what I do all the time.
Here's something that might help: mutator-user-actors.zip
Best wishes,
Woland
-
Thanks @Woland . I thought this might be the case. I just wanted to make sure I was not being a goober about it. Thanks for the user actors. They're very cool and will definitely come in handy.
-
I made them because I got tired of having to recall an actor with the right data type off the top of my head. 😅