XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : Problem using "meshop.cloneVerts"

02-08-2005, 10:47 PM

I've just recently started exploring MAXscript, and i seem to have run into a bit of a problem with the "meshop.cloneVerts" method.

The script i'm trying to produce is a basic mesh exporter to put geometry into my own game rendering engine. I'd like to be able to preserve smoothing group detail through my export, which requires me to duplicate vertices wherever a hard edge between two differing smoothing groups appears.

Now i thought I had this cracked with a simple enough algorithim to identify such areas and manipulate the geometry as needed. All seemed to be going fine up untill the point I tried to clone a vertex using the above mentioned method.

I have the index of the vertex I wish to clone (i), and a variable that references my mesh object (obj). From what i can gather reading through the help, a simple call to (meshop.cloneVerts obj i) would appear to be what i want. Only that doesn't seem to be having any effect. The method returns success (OK), but the mesh information remains the same, backed up by calls to (meshop.getNumVerts obj) confirming that the vertex count hasn't changed.

My initial thoughts were that my variables were screwed up (afterall coming from a C/C++ background working without type checking can be a little problamatic!). However, i can make calls such as (meshop.deletVerts obj i) and (meshops.breakVerts obj i) fine, both of which effect the geometry as expected.

Now this seems a bit of a stupid problem to have been stumped by, and i really am stumped at the minute. Before i start looking into more elaborate ways of breaking the mesh by the vertex and rebuilding faces I thought i'd try you guys for some help.

The fact that a quick trawl of the web turned up no information on either this problem or the "cloneVerts" method itself is a little worrying, so apologies if i'm missing something incredibly obvious. At the minute i'm prepared to risk looking a bit stupid as i really haven't a clue why this isn't working.

Any help would be much appreciated,


02-09-2005, 12:37 AM
Hi Ben,

I think this is a bug (or the online reference is incorrect). The function always seems to operate on the current vertex selection, no matter what input (the <vertlist> argument) you give it. I tried arrays, bitarrays and integers.. The function does throw an error when you specify an out of bounds vertex index though.

I'll report this to Discreet.

.... which requires me to duplicate vertices wherever a hard edge between two differing smoothing groups appears .... ways of breaking the mesh by the vertex and rebuilding faces I thought i'd try you guys for some help ....

Mind you that the cloned vertices produced by meshop.cloneVerts do not connect to any existing faces! They're just a bunch of vertices floating in space. Of course I don't know what your realtime engine expects, but I thought I'd just let you know ;)

- Martijn

02-09-2005, 11:14 AM
Cheers Martijn,

Thanks for such a speedy reply. At least now i know that its not me screwing it up. (I swear, hair was about to be pulled out!)

Yeah, i was aware of the outcome of the (cloneVerts) operation, but I already have a list containing faces that share the vertex in question, so I can loop back through them and reconstruct faces to use the new cloned vertex (I'm assuming that cloned vertices are appended to the end of the mesh vertex stack, and so once created I can reference them through the mesh vertex count i.e.(mesh.getNumVerts)).

The more I think about it though, it may actually be easier to break on the vertex, which will both create the duplicate vertices and rebuild the faces for me. I could then loop back through the faces affected and weld uneccersary duplicates back together.

Anyhow, i'm sure i'll figure something out.

Cheers again for your help Martijn, very much appreciated.


CGTalk Moderation
02-09-2006, 12:00 PM
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.