TDResources is a component containing system resources for TouchDesigner, some of which are available for use in your projects. Access TDResources using its Global OP Shortcut:
op.TDResources. Note: Access to these resources will be maintained in future versions of TouchDesigner, but the look of them may change. For example, the system popMenu will always be available, but the colors and font may change.
The system pop-up menu, which is a clone of popMenu, is available via
op.TDResources.op('popMenu').Open(...). It is commonly used for RMB option menus and has 2 layers of sub-menus available for use as well. Example code:
op.TDResources.op('popMenu').Open(['Go', 'Stop'], callback=debug, callbackDetails=['test'])
Button Pop-Up Menu
The system button pop-up menu, which is also a clone of popMenu, is available via
op.TDResources.op('buttonPopMenu'). It is commonly used for menus that pop up when a button is pressed and you want to align the menu to that button, but can technically be used to align a menu to any Panel Component. It does not have sub-menus available.
The difference between this and the system pop-up menu above is that it is meant to be attached to a button and the Buttoncomp, Horizontalattach, and Verticalattach parameters must be set before calling
Open. Example code:
buttonPopMenu = op.TDResources.op('buttonPopMenu') buttonPopMenu.par.Buttoncomp = op('/myButtonPanel') buttonPopMenu.par.Horizontalattach = 'Left' buttonPopMenu.par.Verticalattach = 'Top' buttonPopMenu.Open(['Go', 'Stop'], callback=debug, callbackDetails=['test'])
The system pop-up dialog, a clone of popDialog, is available via
op.TDResources.op('popDialog').OpenDefault(...). It is used for simple pop-up dialogs with up to four options and an optional text entry box.
There is a nice code example of this here.
There is mouse information in a CHOP available for system use in
op.TDResources.op('mouse/out1'). This can be used to get the mouse state without needing your own Mouse In CHOP. You can see all the channels and access this information by using a Select CHOP. You can also access it directly using code:
mouse = op.TDResources.op('mouse/out1') normalizedMouseX = mouse['tx'] absoluteMouseX = mouse['abs_mouse_x'] leftButton = mouse['left_button']