Connector Class help

I’m trying to us the connector class to wire some text TOPs to a GLSL TOP from within the script field of a replicator comp and I’m having some problems. I can get Python commands to execute from a text dat but not from the replicator. Also if I use outputConnectors the text dat will only connect to an op already connected to the GLSL TOP.

this line works in a text dat:

op(‘Mix’).inputConnectors[0].connect (op(‘null7’))

but not in the replicator ( even when replacing op(‘null7’) with me.curItem )

this line works in a text dat but only will connect to an op connected to the GLSL TOP and not directly to the the TOP

op(‘text8’).outputConnectors[0].connect (op(‘Mix’).inputs[0])

Ideally I would like to use the replicator to connect any number for text TOPs to the GLSL TOP using a line something like this:

me.curItem.outputConnectors0].connect (op(‘Mix’).inputs[me.curItem.digits])

I’m not sure about the me.curItem.digits if that is valid but either way even with an integer for the index I get the error:

Traceback (most recent call last):
File “”, line 1, in
AttributeError: ‘NoneType’ object has no attribute ‘inputs’

Any suggestions?

thanks
Keith

Hi Keith.
Can you post a small example with this issue?
Offhand sounds like its not able to resolve the op() references properly.
Perhaps its at a different location then you expect?

Hi Rob, thanks I wasn’t sure if it was a bug or not. It does look like it though. Here is a quick example.

cheers
Keith
replicator connectorClass example.toe (10.1 KB)

Hi Keith.
Your example works if you change it to:

me.curItem.outputConnectors[0].connect(op('../Mix').inputConnectors[me.curItem.digits])

differences:

  1. op(‘…/Mix’) instead of op(‘Mix’)

  2. .inputConnectors, instead of .inputs

  3. is a known issue we’ve been having with this operator but are reluctant to change its ‘starting script location’ to avoid breaking existing scripts.
    We are thinking of getting rid of that script line altogether and making it function call based like the CHOP Execute DAT for example.

  4. Ive simplified the way connecting works so in the next build you’ll be able to change it to:

me.curItem.outputConnectors[0].connect(op('../Mix'))

Ideally in the future this would all be a function in a separate docked DAT that looks like:

def onCreate(curItem):
    curItem.outputConnectors[0].connect(op('Mix'))

Hi Rob, thanks for all the info that’s great. I’ll implement the new method when the next build is released.

You definitely have my vote for removing the script parameter and replacing it with a text dat. I’ve wanted that feature in the past when having to write many different expressions.

Now with python it seems to be much easier to get attributes using curItem that was using Tscript $ITEM.

thanks
Keith

Hi Rob and all,

In a related issue, is there a way of having multiple lines execute in the replicator script parameter? For example, I’m trying to get three separate output connectors from each replicated operator to connect to three separate input connectors on merge operators. It currently works with the first connection script but when I repeat the command the whole script gets broken.

It looks like this:

me.curItem.outputConnectors[0].connect(op('../merge_1')) me.curItem.outputConnectors[1].connect(op('../merge_2')) me.curItem.outputConnectors[2].connect(op('../merge_3'))
I have a feeling there’s a simple answer to this but I haven’t found it yet. Frankly, to follow up on this thread, a separate DAT operator connected to the Replicator would be great!

Thanks!

Patricio

Hi Patricio looks like you just need a comma after each command.

Hi Keith,

Awesome. Thanks for the tip (kinda obvious I guess).

Patricio