I'm doing a tool that's using os.system() a lot to run some
commandline tools. Does anyone know an alternative or trick to have
the prompt not appear every time?
Cheers,
-- Alan
I guess that does it.
i have a script that calculates per vertex tangent space and constructs
a matrix. which all works fine but now i'm just looking at trying to get
it to work in a global position.
what is the best way in Api to get the objects Inverse Square matrix or
an object? there seems to be a few options whats the deference
*MPxTransformationMatrix* <cid:part1.01030...@gmail.com> ()
*MPxTransform* <cid:part2.04070...@gmail.com> ()
any guidance would be great
john
# Get a transformation matrix of the “moon” to the “earth”.
my_matrix = moon.transform * inverse earth.transform
# Then use that matrix to snap the “asteroid1” to the location I recorded relative to the “earth” in worldspace.
In coordsys world
(
asteroid1.transform = my_matrix * earth.transform
)
In 3DS Max, that would snap "asteroid1" to where "moon" was relative to the "earth". As a bonus, I'd love the option of being able to snap ONLY "asteroid1"'s translation OR ONLY it's rotation if I so choose.
I've tried using maya's xform and getAttr commands. I've also tried some OpenMaya commands suggested by a friend, like .MTransformationMatrix(), and .asMatrixInverse(), but I don't have enough experience to know how to get the result I'm looking for. Usually it comes down to me not knowing how to "multiply" the matrix * the child object's transform node. I'm eager to learn how to use the MfnTransform and inclusiveMatrix, but I don't have a good jumping off point. The simpler solution the better for me.
Any advice would be appreciated!
Thanks
Yep, I think the better and faster way it's MfnTransform and inclusiveMatrix :)
--------------------------------
Marco D'Ambros
phone : (+61) 0431 830085
mail : dambro...@gmail.com
wave : dambro...@googlewave.com
On Tue, Aug 3, 2010 at 6:40 AM, Chad Vernon <chadv...@gmail.com> wrote:
You can get matrices with MDagPath::inclusiveMatrix or exclusiveMatrix. To set a matrix, you can use MFnTransform. The MPx* classes are proxy classes that you only use when creating a custom object like a node or context.
Chad
On Mon, Aug 2, 2010 at 1:05 PM, johnvdz <john.va...@gmail.com> wrote:
Hi all,
i have a script that calculates per vertex tangent space and constructs a matrix. which all works fine but now i'm just looking at trying to get it to work in a global position.
what is the best way in Api to get the objects Inverse Square matrix or an object? there seems to be a few options whats the deference
*MPxTransformationMatrix* <cid:part1.010...@gmail.com> ()
*MPxTransform* <cid:part2.040...@gmail.com> ()
any guidance would be great
john
--
http://groups.google.com/group/python_inside_maya
Sounds like you’ve got a number of problems here and I’m not sure which ones solves your problem, but I might be able to help you with this.
Usually it comes down to me not knowing how to “multiply” the matrix * the child object’s transform node
In Maya, there’s an output on each transform node that carries it’s matrix; it’s called simply matrix. It’s also got inverseMatrix and worldMatrix which are self-explanatory. You can multiply these with a multMatrix node, that you can create and connect like so:
from maya import cmds
multMatrix = cmds.createNode("multMatrix")
# Connect to multMatrix
cmds.connectAttr("moon.worldMatrix", multMatrix + ".matrixIn[0]")
cmds.connectAttr("earth.worldMatrix", multMatrix + ".matrixIn[1]")
At this point, multMatrix will contain the multiplied matrix.
print cmds.getAttr(multMatrix + ".matrixSum")
# [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]
You can convert the matrix back to translation values using decomposeMatrix, so that you can hook it back up to whichever node you are looking to drive.
As for saving it out, you can export the multMatrix node and import it back in, it will still contain the values, although ideally you’d simply make it procedural and maintain the connections. But I must admit I’m not fully understanding what you’re trying to accomplish. Maybe if you break it down into one question at a time, we could get a little closer to a solution.
Best,
Marcus
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/29fe8851-9e8a-49df-afcb-f32cc4b35abf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.