Dependency graph plug-in not rendering in Hardware 2.0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
So I've been working on a dependency graph plugin which I'd like to preview in the Hardware 2.0 Material Viewer in the Hypershade.
It's working in the Software Renderer and the Hardware Renderer but I can't seem to get it to work in the Hardware 2.0 Renderer which is used for the Material Viewer. So that being said, the little swatch preview in the Attribute Editor, Hypershade and even the Legacy Viewport are working just not anything that's using the Hardware 2.0.
I followed these guides here:
http://help.autodesk.com/view/MAYAUL/2016/ENU/?guid=__files_GUID_A9070270_9B5D_4511_8012_BC948149884...
and here:
http://help.autodesk.com/view/MAYAUL/2016/ENU/?guid=__files_Dependency_graph_plugins_htm
And here's the code I got. I tried to make it as simple as possible:
import maya.api.OpenMaya as OpenMaya def maya_useNewAPI(): pass class myNode(OpenMaya.MPxNode): kPluginNodeName = 'myNode' kPluginNodeClassify = 'texture/2d' kPluginNodeId = OpenMaya.MTypeId(0x00000121) color = OpenMaya.MObject() outColor = OpenMaya.MObject() def __init__(self): OpenMaya.MPxNode.__init__(self) def compute(self, pPlug, pDataBlock): if(pPlug == myNode.outColor or pPlug.parent() == myNode.outColor): value = pDataBlock.inputValue(myNode.color).asFloatVector() outColorHandle = pDataBlock.outputValue(myNode.outColor) outColorHandle.setMFloatVector(value) pDataBlock.setClean(pPlug) def creator(): return myNode() def initializer(): nAttr = OpenMaya.MFnNumericAttribute() myNode.color = nAttr.createColor('color', 'c') nAttr.writable = True nAttr.storable = True nAttr.hidden = False myNode.addAttribute(myNode.color) myNode.outColor = nAttr.createColor('outColor', 'oc') nAttr.readable = True nAttr.writable = False nAttr.storable = False nAttr.hidden = False myNode.addAttribute(myNode.outColor) myNode.attributeAffects(myNode.color, myNode.outColor) def initializePlugin(mobject): mplugin = OpenMaya.MFnPlugin(mobject) try: mplugin.registerNode(myNode.kPluginNodeName, myNode.kPluginNodeId, creator, initializer, OpenMaya.MPxNode.kDependNode, myNode.kPluginNodeClassify) except: raise RuntimeError, 'Failed to initialize plugin' def uninitializePlugin(mobject): mplugin = OpenMaya.MFnPlugin(mobject) try: mplugin.deregisterNode(myNode.kPluginNodeId) except: raise RuntimeError, 'Failed to unload plugin'
Any ideas what's wrong?