Hey guys. long time lurker, first post...
I posted this over on stack overflow, but I think this might be a better
place for it..
I am creating a toolset for creating nurbs curves/surfaces inside maya
using python.
I have a set of dictionaries that include cvPositions, knots, form etc.
each of which describe a preset 3d shape (cube, circle, pyramid etc). I
also have a 3d matrix stored in the nodes metadata that is used as an
offset for the shape. This allows you to scale/move/rotate the shape
without moving the transform.
The problem is in the way I am applying this matrix is very slow:
First I will create a new (edit)transform at the position of the
(orig)transform containing the curves. Next I will transfer cv positions in
world space from (orig)transform to (edit)transform. Next i will move the
(edit)transform into the matrix position. Finally I will world space
transfer the cvPositions back to the (orig)transform
When creating hundreds of shapes, this is becoming prohibitively slow...
Can someone describe a mathematical way to apply a matrix to a set of 3d
points? maybe using one of pythons math modules or perhaps numpy?
Alternatively,
Is there a way using OpenMaya api functions to do this? Perhaps with
MPointArray? The following code block is about as far as I have gotten on
that front:
cheers,
-Paxton
crv = OpenMaya.MFnNurbsCurve( self.dagPath )
cvs = OpenMaya.MPointArray()
space = OpenMaya.MSpace.kWorld
crv.getCVs(cvs, space)
positions = []
for i in range(cvs.length()):
pt = cvs[i]
positions.append( (pt[0], pt[1], pt[2]) )
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/20487b33-cb96-4bd6-8b99-de2d6e02c73e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.