Thread: Maya API: How to smooth a polyObject thats in a dataHandle of a
deformerNode?
Started 3 months, 2 weeks ago by nsimagine
I am trying to write a little deformer,
Being fairly new to API I am still having trouble understanding the basic fundamentals,
I have a sourceMesh that I am connecting to my deformer node that I would like to use
as a driver. I would like to create a smoothed Mesh out of that sourceMesh, but the way I
have it now, its crashing MAYA.
I seem to be able to "query" and "print" the ...
Hmmm,
but for MFnMeshData I don`t have generateSmoothMesh, do I?
I am not quite sure how I would use that to generate a smooth version of the sourceMesh, then.
No, that s true but it give you a waz to actually access your data, as right now I think that you try to attach MFnMesh to your MObject from the MDataHandle and that might be the cause of failure. I think that the MObject you are getting from the datahandle is a data MObject and not the node itself. Maybe try to print out what kind of MObject you are dealing with something like this:
cout<<...
Your usage of generateSmoothMesh is incorrect.
As Buexe was pointing out, the MObject you receive from the dataHandle is of type MFnMeshData. MFnMesh can accept and operate on this type, but you have to treat it as such rather than as a shape. MFnData types are the data packets that flow through the DG. They do not have a name or path because they are not DAG entities (shape/transforms)....
Thanks for the replies!
I tried using your code, Keilun, but when I am trying to compile the plug, I am getting an error:
116: error: expected primary-expression before . token
line 116 is this:
MObject outData = MFnMeshData.create();
I am not sure what I am doing wrong! :-(
Nico.
My code is just pseudocode. There's bound to be errors. It was meant to guide you.
Create an MFnMeshData object, then use create:
Code:
MFnMeshData meshDataFn;
MObject outData = meshDataFn.create();
Thanks for the fast reply, Keilun!
I am still in the process of understanding how API works and how to use it.
I have done MEL for a very long time, but API is a completely different beast! :-)
So this is what I have now for the deform part:
MStatus n_simpleDeform::deform( MDataBlock& data, MItGeometry & iterator, const MMatrix & matrix, unsigned int multiIndex)
{
MStatus status = ...
Hm. I guess contrary to the documentation, it doesn't work on anything except shapes. Would it be possible to run a smooth operation after the deform, outside of your node?
Eg.
inMesh --> yourDeformer --> polySmoothFace --> outMesh
So basically have your command setup the above connection structure?
Unfortunately not,
What I am ultimately after is a deformer that has a lowRes polyMesh as an input (srcMesh)
which drives / deforms a highRes (poly)-Mesh.
My first approach was to convert the lowRes poly to a subD and then iterate over
deformed Mesh points and find the closest Point and Normal on the sub.
With that I could then calc the offset / distance.
My only problem was that the ...
I don't see how doing it inside the node is any different. From what I'm reading, it sounds like you want it setup like this:
lowResMesh --> polySmoothFace --> deform --> hiResMesh
Note that with this setup, the smoothed mesh isn't floating around all the time and it will only be calculated when the lowResMesh changes. Am I misunderstanding? Doing this inside your deform node just ...
Now I know what you mean, with just having the smooth-node but not the actual result in the scene! :-) I played a little with it, but haven`t had a chance to test the workflow with my code yet, my I guess it could work! :-) The only thing I found curious was, I tried to recreate the polySmooth as you would get it with the poly smooth command, (I first create a lowRes sphere and smoothed it) Then I created another loRes sphere and a smooth...
Did you check all the values of the polySmooth node that you manually created to make sure they're the same? The polySmooth command does set some values on the smooth node after creation/connection.
What does API GL mean?API stands for American Petroleum... What does API GL mean?API stands for American Petroleum Industry and GL stands for GearLubricant, see below for their definitions:API GL-1 Straight mineral oilAPI GL-2 Mild EP for worm gearsAPI GL-3 Mild EP for spur and spiral bevel gears in axles and tra
Thread profile page for "Maya API: How to smooth a polyObject thats in a dataHandle of a
deformerNode?" on http://forums.cgsociety.org.
This report page is a snippet summary view from a single thread "Maya API: How to smooth a polyObject thats in a dataHandle of a
deformerNode?", located on the Message Board at http://forums.cgsociety.org.
This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity