PDA

View Full Version : Api set Point does not work


bj1
05-22-2006, 04:26 PM
Hello,

i am trying to move one vertex of an Edge by

listEdges.setPoint(startPoints[i],0,MSpace::kObject);

but it does not work!?

Any Idee why?

tciny
05-22-2006, 06:45 PM
Please paste the entire code thats relevant for that problem and use the MStatus to find out if that step and the preceeding ones actually succeed.

bj1
05-22-2006, 07:23 PM
MStatus says that it succeed.


for ( ; !listEdges.isDone(); listEdges.next())

{

startPoints.append( listEdges.point(0, MSpace::kObject) );

endPoints.append( listEdges.point(1, MSpace::kObject) );

}

for(int cnt = 0;cnt < (int)startPoints.length();cnt++)

{

startPoints.set(cnt,endPoints[cnt].x-0.1,endPoints[cnt].y-0.1,endPoints[cnt].z-0.1);

}

int vertcnt = 0;

for ( ; !listEdges.isDone(); listEdges.next())

{



MPoint pt = startPoints[vertcnt];

listEdges.setPoint(pt.,0,MSpace::kObject);

vertcnt+=1;

}

Robert Bateman
05-23-2006, 11:10 AM
It works perfectly, it just doesn't work in the way you'd expect!

Create a polycube in maya, take at look at the hypegraph for it's connections. You'll notice, a polyCube node, and a mesh node. The polyCube generates a mesh, and passes the result to the mesh object. If you delete a face in the GUI, you'll see that there is a node "deleteFacet" that gets created. Deleting a face/vtx or even moving them is pointless, it wont affect the final geometry because the DG will evaluate a new result for it - and your changes are not part of the DG. You need to insert a node that is responsible for manipulating those points. Take a look at the polyModifier examples in the API for hints on how to do this.

bj1
05-29-2006, 02:43 PM
Thank you so far. Can you please give me an example on how to move a single vertex through API?

tciny
05-29-2006, 06:03 PM
Are you writing a node or mel command?

bj1
05-29-2006, 07:27 PM
i am trying to write a node, of course i am a newbie, so there is a lot to find about get information about geometry, but nearly nothing about modifying...

Robert Bateman
05-31-2006, 09:39 AM
have a look at the polyModifier example in the API devkit, that's probably your best starting point.

bj1
05-31-2006, 10:58 AM
ok now i habe created a geometry, but the problem is that i achieve the geometry like the first one on the picture. But i want a regular geometry like the square. but when i say the polyconnects sholud be 0,1,2,3 i receive the wrong geometry. I know it comes form the orientation and numeration of the polygon, but how can i achieve the right geometry?

bj1
05-31-2006, 11:30 AM
now i changed the connects from 0,1,2,3 to 0,2,3,1 and it works but why?

bj1
05-31-2006, 11:58 AM
ok is it like that:

If i have an Point Array of vier indices (0,1,2,3) with my points 1,2,3,4 and i define in the polyconnects attribute 0,2,3,1 it means that the Vertex with the index 0 is connected to the vertex with index 2, then Vertex with the index 2 is connected to the vertex with index 3, then
Vertex with the index 3 is connected to the vertex with index 1 and finally Vertex with the index 1 is connected to the vertex with index 0.
Is this assumption right ?

CGTalk Moderation
05-31-2006, 11:58 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.