PDA

View Full Version : thePainterInterface problem


spider853
06-27-2011, 06:37 PM
Hi,
I have a problem with thePainterInterface interface,

I want to create a UV poly rotation on UVWUnwrap modificator with paint interface by clicking the face and dragging to rotate it. (We need this to rotate the hair handles)

The problem is that all meshes are editable poly and the thePainterInterface.getCustomHitFaceData returns the faceIndex from editableMesh (Triangle index) and can't use that data for UVWUnwrap or at least editablePoly

is there any possibility to convert the triMesh index to polygon index? or to tell thePainterInterface to return polyFace index?

to divide the index by 2 its not a solution as mesh can contain faces with one triangle or more than 2

Thanks

denisT
06-27-2011, 07:18 PM
convert mesh face to mesh verts, mesh verts to poly (or unwrap_uvw face)

spider853
06-27-2011, 07:31 PM
convert mesh face to mesh verts, mesh verts to poly (or unwrap_uvw face)

did that, but I need to shrink the selection because its selecting the neighbor faces too

and one more problem with shrinking will be that having an triangle ID on the face with 3+ triangles and converting in faces by triangle -> vertex -> face will not get all the nearest faces of the face so I can detect the central face,

needs a different approach

denisT
06-27-2011, 07:37 PM
did that, but I need to shrink the selection because its selecting the neighbor faces too

and one more problem with shrinking will be that having an triangle ID on the face with 3+ triangles and converting in faces by triangle -> vertex -> face will not get all the nearest faces of the face so I can detect the central face,

that's right. just shrink the selection...
there is meshop.getpolysusingface method... use it to get all poly's verts.

spider853
06-27-2011, 07:51 PM
that's right. just shrink the selection...
there is meshop.getpolysusingface method... use it to get all poly's verts.

getPolyUsingFace doesn't work or at least needs fine tuning of angle threshold that can be incorrect in some cases after vertex manipulation,

also about shrinking I wrote the problem with it, as it doesn't select all the nearest faces (described in previous post)

and even if I'll get all the nearest faces (don't know how) I didn't see a function for selection shrinking in UVW_Unwrap modifier, maybe just by checking the face with all the edges sharing with the other faces... but again this method could work only when all the nearest faces are selected which wouldn't be in case of triangle -> vertex -> face

Here is a representation of the problem

http://i55.tinypic.com/xbe0l0.png

you can see the face (with blue line around it) that I need to select
the triangle returned from paint interface (marked with red) and the near faces after tri - vertex - face operation (marked with yellow)

From this picture you can see that I cannot recognize the selected face from this because:
1. I don't have a central face
2. All the faces shares the same proprieties (shares the vertices)

on solution that goes in mind is to loop thru selection and see which face have all the selected vertex, but all this transformation and looping will have a big impact on performance

denisT
06-27-2011, 08:02 PM
fn getPolyByMeshIndex node face show:on =
(
local mesh = node.mesh
polys = meshop.getpolysusingface mesh face
vv = meshop.getvertsusingface mesh polys
faces = meshop.getfacesusingvert mesh vv
verts = meshop.getvertsusingface mesh faces

delete mesh

epolys = (polyop.getfacesusingvert node vv) - (polyop.getfacesusingvert node (verts - vv))
if show do node.selectedfaces = epolys
epolys
)

spider853
06-27-2011, 08:22 PM
fn getPolyByMeshIndex node face show:on =
(
local mesh = node.mesh
polys = meshop.getpolysusingface mesh face
vv = meshop.getvertsusingface mesh polys
faces = meshop.getfacesusingvert mesh vv
verts = meshop.getvertsusingface mesh faces

delete mesh

epolys = (polyop.getfacesusingvert node vv) - (polyop.getfacesusingvert node (verts - vv))
if show do node.selectedfaces = epolys
epolys
)



Good trick, Big Thanks! :bowdown: Solved! +rep

CGTalk Moderation
06-27-2011, 08:22 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.