Layout TOP reordering inputs by script?

Hello,

Layout TOP

setInputs with a list is nice.
But, I don’t achieve to do it.

I have 10 inputs.
operator1/out1
operator2/out1
etc
… are related to input 0, 1, etc of my Layout TOP.

if I send an osc message building a list made of something like :
newOrder 2 3 1 4 5 6 7 9 8 0
then I process it like that :

thislist = []
for i in range(1, 11, 1):
  thislist.append(OP('operator'+str(args[i])))
op('myLayoutTOP').setInputs(thislist)

But it doesn’t work.
It … is disconnecting everything.
I tried to add the string “/out1” somewhere. to add outputConnectors[0] etc . Same.

What am I missing here ??

Thanks a lot.

I found an easier way, and workaround:

Using Select TOPs, connected to the Layout TOP.

And my script Just changing the TOP in my Select TOPs dynamically.

Hey @julien,

what was the error message you were getting? I see in your script a reference to OP which would cause an error like this:

td.tdError: OP object expected. Value:'/project1/constant5' Type:<class 'str'>.
Results of run operation resulted in exception.
Traceback (most recent call last):
  File "</project1/text4:op('/project1/text4').run()>", line 1
td.tdError: td.tdError: Invalid OP object. The node this python object referenced has likely been deleted.

The above exception was the direct cause of the following exception:

  File "/project1/text4", line 4
SystemError: <built-in method setInputs of td.layoutTOP object at 0x00000241D82E7780> returned a result with an error set
Results of run operation resulted in exception.

using instead op and making sure that the operators are in the same network as the Layout TOP would make this work properly.

Another option would be to dump a list of paths into the operator’s TOPs parameter. This would allow to reference operators from all kind of places in the file.

cheers
Markus