Package slumMaya :: Module shaderBase :: Class shaderBase
[hide private]
[frames] | no frames]

Class shaderBase

source code

maya.OpenMayaMPx.MPxNode --+
                           |
                          shaderBase

This is the base class used by slum shader nodes. Every node is initialized based on a class that derivates from this one. For surface shaders for example, we use the shaderSurface class, which is derivate from this class and MPxHardwareShader. For light shaders, we use shaderLight class, which is derivate from this one and MPxLocatorNode

Instance Methods [hide private]
 
__init__(self)
placeholder.
source code
 
compute(self, plug, dataBlock)
this method is called by maya when rendering in software mode or viewport texture mode.
source code
 
setDependentsDirty(self, plugBeingDirtied, affectedPlugs) source code
 
setInternalValueInContext(self, plug, dataHandle, ctx)
callback when user changes parameters in the node.
source code
 
getInternalValueInContext(self, plug, dataHandle, ctx)
callback when reading parameters from the node.
source code
 
renderSwatchImage(self, image) source code
Static Methods [hide private]
 
nodeCreator()
plugin creation method (returns the class object).
source code
 
nodeInitializer()
plugin initializaton method.
source code
 
slumInitializer(object, data=None, forceRefresh=False, refreshNodeOnly=False)
this is the real initialization function...
source code
Class Variables [hide private]
  slum = None
hash(x)
Method Details [hide private]

__init__(self)
(Constructor)

source code 

placeholder. not used at the moment

compute(self, plug, dataBlock)

source code 

this method is called by maya when rendering in software mode or viewport texture mode. we need to come up with a way to have a maya software code inside a slum template that can be executed here. The way maya software shaders are written is pretty complex, compared to rsl and others, so my plan is to create some python classes that would simplify the maya software shader development, bringing it more close to rsl...

nodeCreator()
Static Method

source code 

plugin creation method (returns the class object). this is needed to register a new node in maya.

nodeInitializer()
Static Method

source code 

plugin initializaton method. this is needed to register a new node in maya. usually, this method would handle all the initialization of parameters for the node. Instead, we initialize the node in another method that is called AFTER the node already exists in maya. This make the whole process much simple, and if we need to update a node from a new version of a slum template, we just call the same method again.

slumInitializer(object, data=None, forceRefresh=False, refreshNodeOnly=False)
Static Method

source code 

this is the real initialization function... this is called after the node exists in maya. so we can use this to dinamicaly add the shader attributes. Also, this same method can be called to update the node if the class code changes.

setInternalValueInContext(self, plug, dataHandle, ctx)

source code 

callback when user changes parameters in the node. Returning false forces maya to set the value of the attribute as it would whitout a callback. returning true means that this function set the value and maya dont need to do a thing. False is default!

getInternalValueInContext(self, plug, dataHandle, ctx)

source code 

callback when reading parameters from the node. returning false forces maya to get teh value of the attribute as it would whitout a callback. returning true forces maya to avoid getting the value itself, and will return whatever this method put inside dataHandle. False is default!