global op shortcuts for non-COMP OPs

It would be useful to be able to assign global op shortcuts to things other than COMPs.
I often end up having DATs that are referenced from a bunch of places (settings tables, etc). Global shortcuts would mean being able to use op.ClipTable rather than /_/config/content/whatever/clips. You can do it by assigning the path of whatever OP to a custom parameter on a COMP and then using a shortcut to that comp, but that results in things like op.Whatever.par.Cliptable.eval() which is about the same as using the full path (it just makes it a bit easier to change the path from one central place).

What about adding an extension to that OP, (promoted) so that you can access any interior DATs easily ?

class MyClass:
def ClipTable(self):
return me.op(‘ClipTable’)

You could bury the DATs anywhere inside this special component as well if needed.

Using an extension class would mean things like (if using @property):
op.Whatever.StuffTable

That’s a bit cleaner than op.Whatever.par.StuffTable.eval(), though it does then make it a bit less clear what’s bound to that property since you’d need to find the extension class code, locate the method and change the code instead of just looking at the custom parameter.

For what it’s worth, I have thought the same thing as Tommy about global shortcuts. Why not give people quick easy access to any operator? Like any global variable, use with caution, but it does make for easy to read and quick to write paths to important stuff.

1 Like

It seems like Global OP Shortcuts would be useful on any operator, though it could get messy, but that would up to the author to manage. We’ll consider adding that capability in.

+1 on this, it would be nice to use this on any OP. The documentation implies that this should work already: “Global Operator Shortcuts help you get to any component from any operator.”

This is an old thread, but a new response to ebalsley’s +1 today:
Instead of a Global OP Shortcut, you can use Internal OPs : Internal Operators - Derivative

You can point it to any operator type, its syntax is simple: iop.Constants. And you don’t need an eval() to get at the OP… just iop.Constants.par.value0

You put the IOP in some upper-level COMP like your /project1, or you can even put it in root. How do you get at root’s parameters? When in /, rclick → Open Parent Parameters. Define the IOP there.

Disclaimer, I rarely put numeric constants in a Constant CHOP these days - I use custom parameters, or Internal Parameters.

1 Like

You can also use a combination of op/iop and a nested path to reference other types of ops:
iop.Stuff.op('thingTable').
I find that iop works great but it can be a bit unwieldy when you have large numbers of those shortcuts defined on a root component. You can use the iop to refer to sub-systems and then use a named path to access different things within them without needing a shortcut for each one.
You do need to be careful about renaming when doing that though. It does have some of the brittleness issues that the op/iop approach is intended to avoid.

1 Like