Difference between revisions of "Modifier (lxu-modifier.hpp)"

From The Foundry MODO SDK wiki
Jump to: navigation, search
Line 1: Line 1:
{{DISPLAYTITLE:Modifier (lxu_modifier.hpp)}}
This module provides utility classes for creating [[EvalModifier Object|EvalModifier servers]].
This module provides utility classes for creating [[EvalModifier Object|EvalModifier servers]].

Latest revision as of 18:25, 16 August 2013

This module provides utility classes for creating EvalModifier servers.

CLxItemModifierElement & CLxItemModifierServer

These classes are used to implement a fairly general-purpose modifier. The only assumption it makes is that there is one modifier node for each item of a specific type.


The client subclasses the server type and defines these two virtual methods to declare their behaviors.

  • ItemType() -- returns the name of the item type for this modifier
  • GraphNames() -- returns a list of space-separated graph names that trigger this modifier to update (optional)

When a modifier node is added for an item, this method is called. It returns the element object that the client has also subclassed


The element is subclassed to perform the operation of the modifier by overriding these virtual methods.

  • Eval() -- reads from input channels and writes to output(s)
  • Test() -- returns false if this element no longer matches the state of the scene (defaults to true)

The element can also maintain cached state so that it can do incremental updates.

  • Cache() -- returns new cache object (derived from CLxObject)
  • EvalCache() -- if this modifier uses caches, then this method is called instead of Eval()
  • Validate() -- called when an input channel has been re-validated, with its change code (optional)

Adding the server is done with a special constructor which does the right voodoo given the server class and name.

initialize ()
	CLxExport_ItemModifierServer<CMyModifier> ("myModifier");


This class is used to create somewhat simpler modifiers whose only purpose is to set object channels on items. These are also configured by virtual methods:

  • ItemType() -- name of the item type
  • Channel() -- name of the OBJREF channel
  • Attach() -- add channels for reading
  • Alloc() -- read inputs and allocate the destination object

It supports a similar initialization function.

initialize ()
	CLxExport_ItemModifierServer<CLxObjectRefModifier<CMyCore> > ("myModifierServer");


Utility class for accessing the current render camera. The method support reading the camera index inside a modifier.