Mouse event visualizer: a basic scripting example

Hello,

I shared this component in the Beginners sections because I think it may be of some help to get into scripting in TD… And also because I didn’t know about this section :smiley:

So in a few words:

WkMouse:

Purpose: Displays a mouse image with highlighted buttons according to the state of the actual mouse buttons. Basic but useful for debug purposes.

Use: Juste drop WkMouse_V1.0.tox into your project.

TD version: Touch Designer 077

Limitations: The component does not reflect the state of 2 or more buttons pressed at the same time because of a bug currently in 077 in mouse CHOP.

Interesting points for beginners:

  • The visual part of the project is quite simple, it is just a hierarchy of images layered in a Composite chop
  • All the images are embedded in the WkMouse container. See the documentation of “vfs” command to manipulate them
  • The arrow giving the direction of the mouse is driven by a script in the CHOP Execute DAT named “chopexec1”. This script calls and uptates variables permanentll stored in a Table DAT named previousMouseValues. It is clearly commented, open it for more details.

WkMouse.jpg
WkMouse_V1.0.tox (65.5 KB)

Any comments or feedback are welcome,

Hope that helps newcomers :wink: