O'Reilly logo

Practical Maya Programming with Python by Robert Galanakis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building the node factory

In the following sections, we will implement the concepts explained in Designing the node factory. This will involve moving incrementally from the traditional circle node plugin we built in Understanding Dependency Graph plugins, first extracting out some of the duplication to use attribute specifications, then tying in the node specification, and finally overriding the compute method.

Specifying attributes

The first step in building the node factory is to create the attribute specification base class and the concrete subclass we will need for float attributes. Create a file at C:\mayapybook\pylib\nodefactory.py and type into it the following code:

from maya import OpenMaya, OpenMayaMPx

class AttrSpec(object): #(1) def createfnattr(self): ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required