PDA

View Full Version : sample render info


wilsimar
02-28-2009, 04:55 PM
how to get sample render info 'pointCamera' in my python custom node?
. no info into my node (always 0.0, 0.0, 0.0)
. even connecting 'maya samplerInfo1.pointCamera' in to my custom node pointCamera slot.


Wilsimar Ara˙jo
Goias-Brazil

my code...
#------------------ begin--------------------------------

import math, sys
import maya.OpenMaya as OpenMaya
import maya.OpenMayaMPx as OpenMayaMPx

kPluginNodeTypeName = "wNode"
kPluginNodeClassify = "utility/general"

wNodeId = OpenMaya.MTypeId(0x87003)

class wNode(OpenMayaMPx.MPxNode):

aPointCamera = OpenMaya.MObject()
output = OpenMaya.MObject()

def __init__(self):
OpenMayaMPx.MPxNode.__init__(self)

def compute(self,plug,dataBlock):
if ( plug == wNode.output or plug.parent() == wNode.output):
dataHandle = dataBlock.inputValue( wNode.aPointCamera )
cp = dataHandle.asFloatVector()

result = abs(cp.z)

outputHandle = dataBlock.outputValue( wNode.output )
outputHandle.setFloat( result )
dataBlock.setClean( plug )

return OpenMaya.kUnknownParameter


def nodeCreator():
return OpenMayaMPx.asMPxPtr( wNode() )

def nodeInitializer():
nAttr = OpenMaya.MFnNumericAttribute()
wNode.aPointCamera = nAttr.createPoint("pointCamera", "p")

nAttr = OpenMaya.MFnNumericAttribute()
wNode.output = nAttr.create( "output", "out", OpenMaya.MFnNumericData.kFloat, 0.0 )

wNode.addAttribute( wNode.aPointCamera )
wNode.addAttribute( wNode.output )

wNode.attributeAffects( wNode.aPointCamera, wNode.output )

def initializePlugin(mobject):
mplugin = OpenMayaMPx.MFnPlugin(mobject)
try:
mplugin.registerNode( kPluginNodeTypeName, wNodeId, nodeCreator, nodeInitializer, OpenMayaMPx.MPxNode.kDependNode, kPluginNodeClassify)
except:
sys.stderr.write( "Failed to register node: %s" % kPluginNodeTypeName )
raise


def uninitializePlugin(mobject):
mplugin = OpenMayaMPx.MFnPlugin(mobject)
try:
mplugin.deregisterNode( wNodeId )
except:
sys.stderr.write( "Failed to deregister node: %s" % kPluginNodeTypeName )
raise
#------------------------end-------------------------------------------------

I had tried compound attribute too...>> nAttr.create("pointCamera", "p", wNode.aPointCameraX, wNode.aPointCameraY, wNode.aPointCameraZ) <<

CGTalk Moderation
02-28-2009, 04:55 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.