Notifications
Clear all

[Closed] Editpoly Detach objects elements

Hello everybodies.

I try to make a script to transform a natfx tree in editable poly.
The nat fx tree is made of a solid trunk and some plane to make the foliage.

By now, the script can convert the tree in editable poly (passing trough editable mesh) detach the trunk by selecting his faces using his mat ID.

But i have a problem.
I must detach all elements that make the foliage (the planes), in objects, and make them look at (constraint) the camera. All planes are made of two faces and i don’t know how get the faces to detach them.

Do you know how select elements directly or by faces or by detecting connected faces ?

Thank you a lot for your help guys

6 Replies

you could always select a face and use the grow function. However there should be a way to select by element…

Hello Gibbz

That’s a good idea. I don’t think to use it.

I test it.

Thanks a lot for your help

Hi,

This routine will detach elements into new objects.


 	while obj.faces.count>0 do
 	(
 		newmesh=editable_mesh()									-- create an empty mesh object
 		newmesh.pos=obj.pos										-- position the new mesh
 		newmesh.name=(obj.name+"_"+(i as String))				-- name the new mesh
 		newmesh.mesh=meshop.detachFaces obj (meshop.getelementsusingface obj 1) delete:true asmesh:true
 		update newmesh											-- update the new mesh
 		update obj												-- update the old mesh
 	)
 

J.

Hello j-man.

Thank you a lot for your code.

I test it, it works perflectly.

But i have a problem. I loose the material and the uvw mapping.

I don’t know how to do it.

Do you have an idea ?

hello Bébète,

you lose the material, but not the mapping or the faceID’s. Just re-assign the material again.

Josh.

Hello J-man

You’re right. it’s works

thanks again for your help

Thanx thanx thanx :buttrock: