Python Generator Object Manual

Introduction

A Python Generator object is used to generate objects in Python. It can be found in the generator menu.

../_images/Python_generator.jpg
A Python Generator is implemented through a ObjectData plugin, registered with the next flags:
  • OBJECT_GENERATOR

  • OBJECT_USECACHECOLOR

Note

A Python Generator should not create/modify objects in the scene, instead it should clone the object, modify and return this object.

See also

The important Threading Manual.

Methods

main()

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

Return type

BaseObject

Returns

The BaseObject generated (can be a PolygonObject or None).

Note

If you want to return multiple objects, add objects under a null and returns this null object.

message(id, data)

Override - It corresponds to the Message method of the Python Generator. Called when a node receives messages.

Parameters
  • id (int) – The message type.

  • data (any) – The message data.

Return type

bool

Returns

Depends on the message type.

Variables

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

  • op: BaseObject : The Python Generator.

  • hh: HierarchyHelp - Not implementedAn optional hierarchy helper for the operation.
    Only for some special cases a hierarchy help must be passed.
    Usually passed through a calling function, for example from ObjectData.GetVirtualObjects() or a Python Generator main().