Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

what is my deformer issues?

what is my deformer issues?

egoldid1
Advocate Advocate
433 Views
2 Replies
Message 1 of 3

what is my deformer issues?

egoldid1
Advocate
Advocate

 

hi,

this is compute function in my deformer node:

 

MArrayDataHandle inputDataArray = data.inputArrayValue(input);
inputDataArray.jumpToArrayElement(0);
MDataHandle meshData = inputDataArray.inputValue().child(inputGeom);

//mesh:
MObject inMesh = meshData.asMesh();
MFnMesh inMeshFn;
inMeshFn.setObject(inMesh);
//======== output:outMeshFn, geometry data. 
MDataHandle outputData = data.outputValue(plug);
outputData.copy(meshData);

MObject outMesh = outputData.asMesh();
MFnMesh outMeshFn;
outMeshFn.setObject(outMesh);

//============ define neccessary variables:
MFloatPointArray points, newpoints;
MFloatVectorArray inNormals;
//
inMeshFn.getPoints(points, MSpace::kWorld);
inMeshFn.getNormals(inNormals, MSpace::kWorld);
//
newpoints = points;

for (int index = 0; index < points.length(); index++)
{
newpoints[index] = points[index] + 3 * envelope_attr*inNormals[index].normal();
}

outMeshFn.setPoints(newpoints, MSpace::kWorld);
data.setClean(outputGeom);

why this deformer doesn't quite work??

( i want Move Vertex along point normal direction)

aaq.jpg

 

 
0 Likes
434 Views
2 Replies
Replies (2)
Message 2 of 3

olarn
Advocate
Advocate

I think the normals were wrong because that function is returning list of all face-vertex normals data not 1 normal per vertex so calculations would be off. The index in to that array is not vtx id as you expected but the "normal id" for a particular face-vtx.

The normals are the per-polygon per-vertex normals. 

http://help.autodesk.com/cloudhelp/2018/ENU/Maya-SDK/cpp_ref/class_m_fn_mesh.html#a638962fd4d516c8b1...

 

Perhaps consider query per vtx normal using this instead. (or get polygon normal id etc and look it up manually)

http://help.autodesk.com/cloudhelp/2018/ENU/Maya-SDK/cpp_ref/class_m_it_mesh_vertex.html#a160d912ad4...

0 Likes
Message 3 of 3

Christoph_Schaedl
Mentor
Mentor

You could also rebuild your deformer in Bifrost to get a better understanding whats goin on.

https://www.youtube.com/watch?v=SPQ5vB4qKQQ

----------------------------------------------------------------
https://linktr.ee/cg_oglu
0 Likes