panelCOMP Class

From TouchDesigner Documentation
Revision as of 10:25, 9 August 2017 by Admin (talk | contribs) (PanelCOMP Class Auto Create)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The PanelCOMP describes an instance of a Panel Component. The state is represented by Panel Values.


Members[edit]

baseHeight(Read Only):

baseHeight. Does not include children scaling/fitting options.

baseWidth(Read Only):

baseWidth. Does not include children scaling/fitting options.

height(Read Only):

height

marginHeight(Read Only):

marginHeight

marginWidth(Read Only):

marginWidth

marginX(Read Only):

marginX

marginY(Read Only):

marginY

panel(Read Only):

The Panel from which Panel Values and the PanelValue Class may be accessed. (The second form is usually sufficient.)

v = op('button1').panel.u.val

v = op('button1').panel.u

panelChildren(Read Only):

panelChildren

panelRoot(Read Only):

panelRoot

width(Read Only):

width

x(Read Only):

x

y(Read Only):

y

Methods[edit]

interactTouch(u, v, hover='id', start='id', move='id', end='id', pixels=False, screen=False, quiet=True, aux='data'):

: -> PanelCOMP

Simulates virtual multiple touches and hovers on a panel via user assigned id. It will also update the panel values: inside, insideu, insidev, state, u and v, in panels all the way up to the parent panel. The first (primary) mouse down/touch on a panel takes precedence over subsequent mouse downs and touches, and overrides any hovers. The primary state on a panel is global. u - The first coordinate for the click to occur at. v - The second coordinate for the click to occur at. hover - (Keyword, Optional) Indicates a hover performed by the touch identifiable by 'id'. If 'id' is used by a touch, the touch is ended. If the <u,v> is out of bounds, the hover will end. start - (Keyword, Optional) Start a touch identifiable by 'id'. If 'id' is already touching or hovering, the action is ended and a new touch is started. move - (Keyword, Optional) Move a touch identifiable by 'id'. Nothing happens if 'id' is not found. end - (Keyword, Optional) End a touch identifiable by 'id'. Nothing happens if 'id' is not found. pixels - (Keyword, Optional) When True, the coordinates are treated as pixel offsets. When False, they are treated as normalized values. screen - (Keyword, Optional) When True, the coordinates are relative to the screen. When False, they are relative to the calling container. quiet - (Keyword, Optional) Print warning messages, such as starting a touch down on a panel that already has a touch. op('container1').interactTouch(0.5, 0.5, hover='finger') # roll over the middle of container1 op('container1').interactTouch(0.5, 0.5, start='finger') # ends the hover and start a touch op('container1').interactTouch(0.7, 0.5, move='finger') # move the touch op('container1').interactTouch(0.3, 0.4, start='finger') # ends the previous touch and start a new touch

op('container1').interactTouch(-1, -1, hover='finger') # ends the previous touch, and end any rollover state

panelParent(n):

: -> OP or None

The nth panel parent of this operator. If n not specified, returns the panel parent. If n = 2, returns the parent of the parent, etc. If no panel parent exists at that level, None is returned. n - (Optional) n is the number of levels up to climb. When n = 1 it will return the operator's panel parent.

p = me.panelParent(2) #grandfather

locateMouseUV():

: -> (u,v) Returns a tuplet containing the normalized mouse coordinates relative to the Panel Component. If the mouse is not over a window containing the panel, None is returned instead.

setFocus(moveMouse=False):

:

Set the hierarchical focus to this component, which sets the Panel value focusselect to 1. Focus will only be set successfully if the panel is open.

moveMouse - (Keyword, Optional) If set to True, the mouse will be moved to the component as well.

interactMouse(u, v, leftClick=0, middleClick=0, rightClick=0, left=False, middle=False, right=False, wheel=0, pixels=False, Screen=False, quiet=True):

: -> PanelCOMP

Simulates virtual mouse clicks, rollovers, moves and drags on a panel. It will also update the panel values: inside, insideu, insidev, state, u and v, in panels all the way up to the parent panel. The first (primary) mouse down/touch on a panel takes precedence over subsequent mouse downs and touches, and overrides any hovers. The primary state on a panel is global as each panel can only have one interaction updating its state. u - The first coordinate for the click to occur at. v - The second coordinate for the click to occur at. leftClick, middleClick, rightClick - (Keyword, Optional) Use to specify the number of times a button is clicked on left, middle, right - (Keyword, Optional) Use to specify if the button is being pressed. When set to False it simulates a mouse move with the button up. The first time the button is set to True will initiate a virtual mouse down on the child panel at the coordinates u,v. Subsequent True states will simulate a drag (mouse button down and moving). Simulate a mouse-up by calling the button set to False, e.g. left=False. wheel - (Keyword, Optional) Roll the mouse wheel pixels - (Keyword, Optional) When True, the coordinates are treated as pixel offsets. When False, they are treated as normalized values. screen - (Keyword, Optional) When True, the coordinates are relative to the screen. When False, they are relative to the calling container. quiet - (Keyword, Optional) When False, print warning messages, such as starting a mouse-down-move on a panel that is already being moved (dragged). aux - (Keyword, Optional) Auxiliary data. op('container1').interactMouse(0.5, 0.5) # roll over the middle of container1 op('container1').interactMouse(0.5, 0.5, leftClick=2) # double click the middle of container1 op('container1').interactMouse(0.5, 0.5, left=True) # left mouse down on the middle of container1 op('container1').interactMouse(0.6, 0.6, left=True) # move with left mouse down in container1 op('container1').interactMouse(0.6, 0.6) # mouse up op('container1').interactMouse(0.5, 0.5, wheel=0.3) # roll the mouse wheel in the middle of container1

op('container1').interactMouse(10, 20, pixels=True) # send a mouse event 10 pixels to the right, and 20 pixels above the lower left corner of container1

interact(u, v, left=False, middle=False, right=False, pixels=False, screen=False):

: -> PanelCOMP

interact() has been deprecated and is replaced by interactTouch() and interactMouse(). Simulated a mouse click in the container, possibly clicking a child panel component. It returns the PanelCOMP at that location, or None if nothing found. u - The first coordinate for the click to occur at. v - The second coordinate for the click to occur at. left,middle,right - (Keyword, Optional) Override the default mouse button used. When none are set, the left mouse button is pressed, and the other buttons released. pixels - (Keyword, Optional) When True, the coordinates are treated as pixel offsets. When False, they are treated as normalized values. screen - (Keyword, Optional) When True, the coordinates are relative to the screen. When False, they are relative to the calling container. op('container1').interact(0.5, 0.5) #send a mouse event to the center of container1

op('container1').interact(10, 20, pixels=True) #send a mouse event 10 pixels to the right, and 20 pixels above the lower left corner of container1

locateMouse():

: -> (x,y) Returns a tuplet containing the mouse coordinates relative to the Panel Component. If the mouse is not over a window containing the panel, None is returned instead.

interactStatus():

: -> list

Returns a list of panel interactions. Each interaction is encapsulated in a list as follows: [id, panel, state, primary]. id - The unique string identifying the interaction. '__MOUSE__' is used if the interaction was established via interactMouse. panel - The child panel being interacted with . state - Interaction types 'hover' or 'touch'. primary - True if the interaction is the first to act on the panel. op('container1').interactStatus # list the current hover over a slider and 2 touches over a button in container1 'touch1', type:sliderCOMP path:/project1/container1/slider1, 'hover', False], ['__MOUSE__', type:buttonCOMP path:/project1/container1/button1, 'touch', True],

['touch2', type:buttonCOMP path:/project1/container1/button1, 'touch', False

interactClear():

: Terminates any existing interactions. Touch or mouse interactions will end. Panels that are hovered over will end their rollover state.

TouchDesigner Build:

{list}

The component types (e.g. Slider, Button, Field, Container) that are used to create custom control panels, also known simply as Panel or Gadget