Python Scripting Tag

Introduction

A Python Tag is used to write and execute Python code. It can be found in the scripting part of the Tag Menu.

../../_images/scripting_tag.jpg

See also

The important Threading Information below.

A Python Tag is implemented through a TagData plugin.

Functions

main()

Override - It corresponds to the Execute method of the Python Tag. It can be called multiple time per frame.

message(id, data)

Override - It corresponds to the Message method of the Python 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.

draw(bd)

Override - It corresponds to the Draw method of the Python Tag. Called to display some visual element in the viewport.

Parameters

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

Return type

bool

Returns

Success of drawing into the editor view.

Variables

The following variables are defined in a Python Tag scope (in all functions even yours):
  • doc: BaseDocument : The document hosting the tag.

  • op: BaseTag : The Python Tag.

  • flags: int : A combination of the following flags:

    EXECUTIONFLAGS_NONE

    None.

    EXECUTIONFLAGS_ANIMATION

    Animation is calculated.

    EXECUTIONFLAGS_EXPRESSION

    Expressions are calculated.

    EXECUTIONFLAGS_CACHEBUILDING

    Cache building is done.

    EXECUTIONFLAGS_CAMERAONLY

    Only camera dependent expressions shall be executed.

    EXECUTIONFLAGS_INDRAG

    Pipeline is done within scrubbing.

    EXECUTIONFLAGS_INMOVE

    Pipeline is done within moving.

    EXECUTIONFLAGS_RENDER

    The external renderer (Picture Viewer) is running.

    EXECUTIONFLAGS_ALLOW_PRIORITYSHIFT

    New in version R18: Allow to shift the priority with the priority shift tag. Private.

  • priority: int : One of the following flags:

    EXECUTIONPRIORITY_INITIAL

    Initial.

    EXECUTIONPRIORITY_ANIMATION

    Animation.

    EXECUTIONPRIORITY_ANIMATION_NLA

    NLA.

    EXECUTIONPRIORITY_EXPRESSION

    Expression.

    EXECUTIONPRIORITY_DYNAMICS

    Dynamics.

    EXECUTIONPRIORITY_GENERATOR

    Generators.

    EXECUTIONPRIORITY_SCENENODE

    Scene nodes.

    EXECUTIONPRIORITY_FORCE

    Highest priority that will ensure execution even if the execution pipeline is cancelled before. Only use this to e.g. release locks or do super-fast non-blocking operations.

  • tp: TP_MasterSystem : The Thinking Particle Master system of the document.