Python Interaction Tag

Introduction

Python code can be executed in various situations from an interaction tag.

../../_images/python_interaction_tag.jpg

See also

The important Threading Information.

Methods

mouseDown()

Override - Called when the user presses his mouse button on the host object of the tag. Good place for variables initialization.

mouseDrag()

Override - Called when the user holds and tweak on the host object of the tag. It’s called for each tick in the mouse drag loop.

mouseUp()

Override - Called when the user releases his mouse button. Good place for variables freeing.

doubleClick()

Override - Called when the user double clicks on the host object of the tag.

onSelect()

Override - Called when the host object of the tag gets selected.

onDeselect()

Override - Called when the host object of the tag gets unselected.

onHighlight()

Override - Called when the host object of the tag gets highlighted.

onUnhighlight()

Override - Called when the host object of the tag gets unhighlighted.

draw(bd)

Override - It corresponds to the Draw method of the tag. Called when the display is updated for you to display some visual element of your tag in the 3D view.

Parameters

bd (c4d.BaseDraw) – The editor’s view.

Return type

bool

Returns

Success of drawing into the editor view.

message(id, data)

Override - It correspond to the Message method of the tag. Called when a tag receives messages.

Parameters
  • id (int) – The message type.

  • data (any) – The message data.

Return type

bool

Returns

Depends on the message type.

Variables

The following variables are defined in a Python Interaction Tag scope (in all functions even yours):
  • tag: BaseTag : The interaction tag.

  • op: BaseObject : The object hosting the tag.

  • proxy: BaseObject : The proxy object. Not defined if no proxy.

  • thread: BaseThread : The Thread where the tag is executed.

  • qualifier: int : Any qualifier keys that were pressed

    QUALIFIER_SHIFT

    SHIFT key.

    QUALIFIER_CTRL

    CTRL key.

    QUALIFIER_MOUSEHIT

    Indication in ObjectData.DetectHandle() that the user pressed the mouse (ObjectData.DetectHandle() is also called for cursor information, when hovering over a handle). For instance if QUALIFIER_MOUSEHIT and QUALIFIER_CTRL are set, ObjectData.DetectHandle() could create a new element.