Houdini 20.5 Nodes TOP nodes

Python Mapper TOP node

Maps work items using a Python script

This node type is deprecated. It is scheduled to be deleted in an upcoming revision of Houdini.

Use partitioner nodes instead of mappers

(Since version 18.6.)

On this page
Since 17.5

This node can be used to write custom mapper logic using the Python API.

For use cases that can expressed as a single line Python or HScript expression, the Map by Expression is a simpler alternative.

Parameters

Save to Python Script

Saves the callbacks defined on this node to a Python script, which can be imported and registered with PDG. The parameter template associated with the node is also saved and embedded into the Python script. After saving the script is automatically imported and the node type is made available in the TAB menu.

Save to Digital Asset

Saves the callbacks defined on this node to a standalone Houdini Digital asset. The callbacks are stored inside the .hda itself and are registered with PDG as an embedded PDG node type.

onMapStatic Callback

This script is run in order to map upstream static items to downstream static items. It is always run once during the static cook step.

Several variables are available in the script:

self

Refers to the underlying PDG node associated with the TOP node. Note that this is different than TOP node itself, which is a standard Houdini operator.

Spare parameters added to the TOP node’s parameter interface will automatically be added to the PDG node.

upstream_items

The list of upstream static work items - these are the items that can be added as dependencies on the downstream items.

downstream_items

The list of downstream static work items - these are the items below the mapper that will be made to depend on some of the upstream static items.

dependency_holder

The object used to construct dependencies. For example, to add a dependency between the first upstream item and downstream item, one could write dependency_holder.addDependency(upstream_items[0], downstream_items[0]). The order the dependent/dependency are specified does not matter, as PDG will be able to determine which is which on its own.

onMapDynamic Callback

This script is run in order to map upstream dynamic items to downstream static items. It is run multiple times during the cook when dynamic work items are generated about the mapper node.

The dynamic work items passed in are pre-filtered by the results of the onMapStatic script, such that only dynamic items that descend from the static items selected in that script will be considered.

Several variables are available in the script:

self

Refers to the underlying PDG node associated with the TOP node. Note that this is different than TOP node itself, which is a standard Houdini operator.

Spare parameters added to the TOP node’s parameter interface will automatically be added to the PDG node.

upstream_items

The list of upstream dynamic work items - these are the items that can be added as dependencies on the downstream items.

downstream_items

The list of downstream static work items - these are the items below the mapper that will be made to depend on some of the upstream dynamic items.

dependency_holder

The object used to construct dependencies. For example, to add a dependency between the first upstream item and downstream item, one could write dependency_holder.addDependency(upstream_items[0], downstream_items[0]). The order the dependent/dependency are specified does not matter, as PDG will be able to determine which is which on its own.

Examples

PythonMapper

This example demonstrates how to use the Python Mapper TOP node to create dependencies between upstream and downstream work items.

See also

TOP nodes