I think you still need a DAG path either way. The problem is with instancing--what if either your source or destination shape node has multiple DAG paths? It could conceivably have multiple world-space representations of the points if the DAG path is not specified.
On Sat, Jun 13, 2009 at 11:15 AM, Chad Vernon <[email protected]> wrote: > You can create a deformer and pipe in the worldMesh attribute into a plug > that accepts meshes. Then just set the points in the deformer. Since > you're piping in the worldMesh attribute, you don't need to worry about any > dagPath. > > oMesh = data.inputValue(aInWorldMesh) > inPoints = OpenMaya.MPointArray() > fnInMesh = OpenMaya.MFnMesh(oMesh) > fnInMesh.getPoints(inPoints) > > # 2008 > while not iter.isDone(): > iter.setPosition(inPoints[iter.index()]) > iter.next() > > # 2009 > iter.setPositions(inPoints) > > > > On Sat, Jun 13, 2009 at 9:39 AM, jasonosipa <[email protected]> wrote: > >> >> Hi All! >> >> Thanks for the responses. These are great ideas, but not what I am >> looking for. There are a number of ways to get this effect done, and >> in fact, I already had 2 different ones before posting - what I really >> *want*, isn't a way to get it done, so much as to learn specifically >> how to use this line: >> >> outFnMesh.setPoints( outPoints, om.MSpace.kWorld ) >> >> So that it doesn't give me this: >> >> // Error: (kInvalidParameter): Must have a DAG path to do world space >> transforms >> >> >> By accepting a "space" at all, it just seems like there is probably a >> way already built in to MFnMesh.setPoints to do this that doesn't >> involved manually math-ing away the destination world matrix. Right? >> >> >> >> >> >> On Jun 12, 11:45 pm, Nicolas Combecave <[email protected]> >> wrote: >> > Hello Jason, >> > >> > I don't know if you need to implement your own deformer for that, or if >> it's >> > part of something more complex, but I think that the effect you're after >> is >> > like what a blendShape does, with attribute "origin" is set to world... >> > >> > Nicolas >> > >> > On Sat, Jun 13, 2009 at 8:21 AM, Paul Molodowitch <[email protected] >> >wrote: >> > >> > >> > >> > > I suspect that you would have to have the worldMatrix fed in as an >> > > additional input attribute. >> > >> > > The basic problem, though, is that 'worldSpace' is always relative, >> > > and I'm not sure what you want it relative to. Since it seems like >> > > you want this shape "echoed" in multiple spots in the dagTree, each >> > > eventual "output" destination in the dag would have to feed this node >> > > it's world matrix (or, more likely, it's inverse world matrix) into >> > > some sort of 'destinationWorldMatrices' multi attribute, and then read >> > > out the shape node from a corresponding plug in a 'outputShapes' multi >> > > plug. >> > >> > > If this doesn't make sense, I can offer a fuller description... >> > >> > > - Paul >> > >> > > On Fri, Jun 12, 2009 at 3:20 PM, jasonosipa<[email protected]> >> wrote: >> > >> > > > Hi guys! >> > >> > > > I'm trying to push the global vert positions of one mesh to that of >> > > > another. Essentially, no matter what I do with either transform, I >> > > > want the shape on the second to always look exactly the same as that >> > > > of the first (in world space). That's it. Another way to describe >> it >> > > > would be to say - I just want the two objects to be the same, all >> the >> > > > time. I'm getting stumped though, in that it seems I need a dag >> path >> > > > for world space output, and I'm not sure how to get that given the >> > > > inputs/outputs I'm working with. Any ideas? Thanks in advance! -J. >> > >> > > > class noMovey( omMPx.MPxNode ): >> > >> > > > aInShape = om.MObject() >> > > > aOutShape = om.MObject() >> > >> > > > def __init__ ( self ) : >> > > > omMPx.MPxNode.__init__( self ) >> > >> > > > def compute( self, plug, data ): >> > >> > > > inMesh = data.inputValue( noMovey.aInShape ).asMesh() >> > > > inFnMesh = om.MFnMesh( inMesh ) >> > > > ins = om.MPointArray() >> > > > inFnMesh.getPoints( ins, om.MSpace.kWorld ) >> > >> > > > outPoints = om.MPointArray( ins ) >> > >> > > > outFnMeshData = om.MFnMeshData() >> > > > outMeshData = outFnMeshData.create() >> > > > outFnMesh = om.MFnMesh() >> > > > outFnMesh.copy( inMesh, outMeshData ) >> > >> > > > outFnMesh.setPoints( outPoints, om.MSpace.kWorld ) # Maya no >> > > > likey >> > >> > > > data.outputValue( noMovey.aOutShape ).setMObject( outMeshData ) >> > > > data.setClean( noMovey.aOutShape ) >> > >> > >> >> > > > -- > www.chadvernon.com > > > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
