Basic Features Object Manager Tags Menu Various Tags Interaction Tag
Function available in CINEMA 4D Prime, Visualize, Broadcast, Studio & BodyPaint 3D
Interaction Tag

Basic Tag Scripting Output Poly Info Proxy

Scripting

This tab can be used to create all types of commands or actions that can, for example, be called when the object to which the tag is assigned (tagged object) is clicked or double-clicked. For those of you who start to panic when they hear the word "script", adding commands (or commenting them out via # or //) is easy: Open the Customize Commands... Manager, enable the Edit Palettes if you want to drag an icon directly into the layout, and simply drag the respective command under the fitting function:

In this example, we switch to the Use Polygon mode when the tagged object is clicked upon.

Make sure to remove the comments (Python: #) from in front of functions and commands and to add a tab space (Tab key) in front of the latter.

Scripting Language

If None is selected, scripting will be disabled - existing scripts will not be deleted. Otherwise, select Python. the C.O.F.F.E.E. option will only be displayed for older scenes that are loaded so the old script can be adapted to Python.

Script
Script

This is where you enter your script(s). Several predefined functions are already included for which can be activated by simply removing the # or // in front of the respective function.

The following predefined functions are available (support and documentation for Python can also be found at http://developers.maxon.net):

mouseDown

This is called when the user first clicks the mouse button or taps the screen with the stylus. Here you can adjust the proxy object using a script, adjust the document mode using doc.SetMode(MODE_ID) or adjust the active tool to be used by this object with doc.SetAction(TOOL_ID). You can also prepare any data you need for the drag.

mouseDrag

This is called continuously during a mouse interaction for each refresh as the mouse moves. You cannot change the proxy object, document mode or tool at this point.

mouseUp

This is called when the user releases the mouse button and signals the end of the user interaction. You can reset tools or kill off any memory-hungry objects that have been allocated in mouseDown or mouseDrag at this point.

onSelect

This is called when the user selects the object to which the tag is assigned. The tag has to be selected (When Selected option).

onDeselect

This is called when the user deselects the object to which the tag is assigned.

onHighlight

This is called when the object is highlighted by the mouse cursor.

onUnhighlight

This is called when the object's highlight status is removed by the mouse cursor moving off of the object.

message

This is called when a message is set to the object, the arguments are id and data. The data is typically a dictionary in Python. See the SDK docs for an explanation of messages.

draw

This is called to allow you to draw directly into the Viewport using the passed argument bd (BaseDraw).

Edit Script

Clicking on this button will open the Expression-Editor, which offers a more comfortable coding field. Both script fields are linked with each other. Therefore, it doesn’t matter which field you use to enter your code - the other field will be updated automatically.