hi guys!
I simply want to create a node wich produces a simple polygon and pass
it to an output attribute ( kMesh).
#head of file
import maya.OpenMaya as om
import maya.OpenMayaMPx as ommpx
inside of the compute method I do this:
if plug == PlaceBetween.outputMesh:
#create handle
outputDataHandle =
om.MDataHandle( dataBlock.outputValue( PlaceBetween.outputMesh ) )
dataCreator = om.MFnMeshData()
moOutputData = dataCreator.create()
points = om.MFnPointArrayData()
meshFn = om.MFnMesh()
vtx1 = om.MFloatPoint( 0.0, 0.0, 0.0 )
vtx2 = om.MFloatPoint( 0.0, 1.0, 0.0 )
vtx3 = om.MFloatPoint( 1.0, 1.0, 0.0 )
points = om.MFloatPointArray()
#append points to array
points.append( vtx1 )
points.append( vtx2 )
points.append( vtx3 )
#number of faces
su1 = om.MScriptUtil()
polyArray = om.MIntArray()
su1.createIntArrayFromList( [1], polyArray)
#number of connections
su2 = om.MScriptUtil()
connecArray = om.MIntArray()
su2.createIntArrayFromList( [0,1,2], connecArray)
#create the mesh data here...
meshFn.create( 3, 1, points, polyArray, connecArray,
moOutputData)
#pass the create meshdata to the output attribute....
ERROR
outputDataHandle.set( moOutputData )
#set the plug clean
dataBlock.setClean( plug )
The problem is that when I set the output attribute using
dataHandle.set( ) I get an attribute error in maya, just
"attribute error... set() "
I really can't find it out and I hope you can spread some light here.
I'm very new to maya python API programming
and doing my first steps here :)
what I do in Maya is:
createNode "myNode";
createNode "mesh";
connectAttr nameOfMyNode.outmesh nameOfMesh.geometry;
I hope that's correct so far....when I connect the nodes and the
compute method of my node is called, I get the
error.
Thanks, Seb.
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe