I'm trying to register a render swatch generator to trigger maya to
execute a custom renderSwatchImage method that generates a swatch for
my shader node.

the code I'm using is the follow (you can copy/paste this into maya
for testing):

import maya.OpenMaya as OpenMaya
import maya.OpenMayaMPx as OpenMayaMPx
import maya.OpenMayaUI as OpenMayaUI
import maya.OpenMayaRender as OpenMayaRender

swatchName = "slumShaderSwatch"
OpenMayaRender.MSwatchRenderRegister.registerSwatchRender(swatchName,
OpenMayaUI.MHWShaderSwatchGenerator.createObj )
UserClassify = shader/surface/utility/:swatch/%s" % swatchName


and I keep getting this error message:

# Error: argument number 2: a 'MSwatchRenderCreatorFnPtr' is expected,
'builtin_function_or_method(<built-in function
MHWShaderSwatchGenerator_createObj>)' is received
# Traceback (most recent call last):
#   File "<maya console>", line 2, in ?
# TypeError: argument number 2: a 'MSwatchRenderCreatorFnPtr' is
expected, 'builtin_function_or_method(<built-in function
MHWShaderSwatchGenerator_createObj>)' is received #

I tried to find some sort of pointer conversor, like
"OpenMayaMPx.asMPxPtr" method, but no success so far...

I actually found a "OpenMayaUI.MHWShaderSwatchGeneratorPtr" method,
which basically is the same as the one I'm using, but with the Ptr in
front of it, which would suggest some sort of pointer something... but
I'm not sure how to use it or even what it is...

HEEELP!! :)

-H

PS: I really wish I can make this work whitout going back to C++...

--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---

Reply via email to