Share

LookdevX Developer Help

LookdevX shading graphs can be accessed and manipulated through Python. This can be used, for example, to automate reoccurring tasks, to create conversion scripts from other shading graphs like Hypershade to MaterialX or USD, to add custom functionality, or to integrate LookdevX functionality into other custom tooling. This page serves as a starting point for LookdevX scripting by providing example scripts for common operations, and an overview over the relevant APIs.

Python APIs

There are three relevant Python modules for LookdevX scripting: UFE, Maya, and LookdevX.

UFE

Most functionality is accessed via the UFE (universal front-end) module, a unified API for interacting with foreign data models like MaterialX, and USD in Maya. UFE supports operations such as traversing hierarchies, managing nodes, editing attributes, and metadata, and handling connections. Being data model agnostic, the same functions apply to both MaterialX and USD graphs. This page showcases common UFE operations; for more, see the C++ UFE documentation, which closely mirrors Python.

Maya

The Maya module provides access to built-in Maya commands and MEL. It's only needed when starting from an empty scene to create the MaterialX stack or the USD stage.

LookdevX

The LookdevX module builds on top of UFE and will expose more complex operations that are not available in UFE itself, like creating and deleting nodes. It might also re-expose some UFE functionality in a more convenient way. The LookdevX module is currently in development and will grow in the future. Currently, it consists of two parts:

Additional functionality not available in UFE:

  • Creating compounds

Alternatives for functionality available in UFE:

  • Deleting nodes
  • Renaming nodes

See the examples below to know how the LookdevX module is used.

LookdevX Python Scripting

Common actions can be automated in LookdevX through scripting. Below are examples of how to use Python commands to help make it easier to execute reoccurring tasks.

MaterialX Specific Scripting Examples

USD Specific Scripting Examples

Generic Examples for both MaterialX and USD

The following examples work in both MaterialX and USD due to UFE being data model agnostic. Most of them assume that a "shading container", for example, a MaterialX document or a USD material, already exists. Refer to Create a MaterialX document or Create a USD material to create a new shading container for the desired data model or use Navigate Hierarchy to point to an existing one.

Was this information helpful?