Op Creation from TOX questions

I’m up to some usual mischief, and am wondering if other’s have experimented with this idea. I want to do a little op creation / rearrangement in the network view in Touch, and ideally I’d like to take advantage of the existing UI conventions in Touch, and like the way placeOps() from the NetworkEditor Class works so far.

What I really want is a way to use this idea while loading a TOX - my work around right now is to use the loadTox() from the COMP Class to create the operator, then call the placeOPs(). That’s fine, but it means I have a messy stand in op that’s created in my network at 0,0 - which is then deleted after placing the op. I’ve also tried setting my loaded TOX’s expose flag to False, which is a nice work around… but it means my placed Op also has it’s expose flag set to False. placeOps() doesn’t return a list of placed ops (which would allow me to change the expose flag back)… so I’m looking for a better solution.

Maybe what I really want/need is a new method in the Network Editor Class - placeLoadedTox() that would invoke the same op-create style controls, and allow me to load a TOX in a fixed location of the network. Ideas welcome :slight_smile:

Hey @raganmd,

there is this funny place /sys/quiet that might be a useful place to temporarily load things before placing them.

This is in development and I haven’t looked at it in a while but generally it works something like this:

def placeTox(self, file=None):
	# create a place in /sys/quiet
	tmp = op('/sys/quiet').create(baseCOMP)
	if tmp:
		placeThis = tmp.loadTox(file, unwired=True)
		# if it's a palette component it will have a component of the same name inside
		compName = splitext(basename(file))[0]
		placeList = []
		if placeThis.op(compName):
			placeList.append(placeThis.op(compName))
		else:
			placeList.append(placeThis)

		inputIndex = None
		outputIndex = None

		# if we are comming from a connector, let's see if we can hook this up
		if self.invokedBy in ['input','output'] and self.Family != 'COMP':
			compIns = placeList[0].findChildren(type=eval('in{0}'.format(self.Family)))
			compOuts = placeList[0].findChildren(type=eval('out{0}'.format(self.Family)))
			if compIns:
				inputIndex = 0
			if compOuts:
				outputIndex = 0

		self.pane.placeOPs(placeList, inputIndex=inputIndex, outputIndex=outputIndex, undoName=placeList[0])
		self.ownerComp.Close()

Best
Markus

2 Likes

@snaut Brilliant!
That’s just the kind of suggestion I was hoping for.

Thank you!

@snaut - not sure if you’re interested, but here’s part of this goofy experiment I’ve been working on:

base_palette.tox (2.0 MB)

You should be able to drop this into any toe file and then get to the palette with ctrl+l. You should see a little pop-up window similar to the op-create dialogue that lets you pull pieces form the palette instead. The left side palette has always been a little space eating IMO, and I’ve been kicking around a different style approach to that kind of idea. Some day this will turn into a tool for loading a set of reusable toxes.

Thought you and @ben or some of the other crew might be interested. :slight_smile:

2 Likes

I should comment that there are still some pieces that are a little rough here, it’s very much an alpha draft. :slight_smile: