Just one thing. You don't have to use MScriptutil/createIntArrayFromList,
just create the MIntArray and append to it.
connecArray = om.MIntArray()
connecArray.append(1)
etc

On Sat, Jan 7, 2012 at 4:09 AM, borgus <[email protected]> wrote:

> you're right, .set() isn't supported. I've found out that
> I should use .setMObject() instead. The new error is "invalid
> Null reference".
>
> Cheers, Seb
>
> On 6 Jan., 09:13, André Adam <[email protected]> wrote:
> > Moin Sebastian,
> >
> > I haven't completely debugged your code snippet, but I can tell you
> > this much, MDataHandle.set() is not script-supported. MDataHandle
> > offers data type specific, non-polymorph functions to set data through
> > Python, like MDataHandle.setFloat() or MDataHandle.setMObject(). I
> > have not yet tried to generate geometry through custom DG nodes, so
> > unfortunately I can't tell you if you are on the right track in
> > general.
> >
> > Cheers!
> >
> >   -André
> >
> > On Jan 6, 12:49 am, borgus <[email protected]> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > 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
>



-- 
Sebastian Schoellhammer

Sr. Technical Artist
Square Enix LTD
www.square-enix.com

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to