The Node Factory
 
 
 

The Node Factory is a special part of mental ray for Maya that creates Maya-type nodes from custom shader declarations and Phenomena declarations. (When you export an assembled shading network to be used a Phenomenon, the network is exported to the .mi declaration file.)

The Node Factory parses the declaration and packs it into a single node—a shader or Phenomenon, depending on what you are creating.

To see each node type being created in the Script Editor, set option Var miFactoryVerbosity to 4 or higher.

Successfully created node types are available in the Create Render Node window and Hypershade, either in the mental ray > Miscellaneous section or one of the other sections (if the appropriate flag was set when you wrote the shader or exported the Phenomenon).

The Node Factory Parser

The Node Factory parser accepts any valid mental ray shader or Phenomenon declarations and special extensions. Messages are written to the Script Editor to inform you about parsing progress and any errors that have occurred.

Parsing error messages

The parser prints the name of the file it is processing. If an error occurs, the line number and a hint of what the parser actually expected are written.

Note

The Factory Node parser does not understand the full mental ray syntax, so parsing errors frequently occur within Phenomenon declarations when unknown shader requirements or commands are encountered. The parser recovers from these errors without harm and proceeds.

Unrecoverable errors occur only if the syntax of parts of a shader or phenomenon declaration is wrong. The parser is unable to recognize, for example, commas in the parameter lists are missing. In such a case, the declaration is discarded.

Custom Node Factory Verbosity

The custom node factory usually reports various stages of progress, including a message for every node processed. These messages appear in the Script editor window, and they may fill it up quickly if many nodes are parsed. A new option allows you to control the message verbosity. It is set with the MEL function miSetFactoryVerbosity(verbosity_level)

with the following verbosity levels:

  • 1-error
  • 2-warning
  • 3-info
  • 4-progress (default)
  • 5-details

This option is stored in the user preferences. Therefore, Maya retains this preference the next time Maya is restarted. This is important since the node factory starts up before any mental ray UI and related scripts have been established.