Script Getting 2D screen position of vertex
Hi everyone,
I have made a script to get the position of all the vertex of an object during the timeline from the size of the viewport. i would like to do the same thing but not with the viewport (as I have to resize it) but from the camera. Is it possible?
Thanks in advance,
Denis
PS: here is the code :
try (destroydialog ::gvp) catch() rollout gvp "Print Vertex Point" ( Global obj, dir_path, outFile, gv button c_path "Path Save" button c "Stamp Vertex Pos. XY" on c_path pressed do ( dir_path = getSaveFileName caption:"Name Save File" initialDir:(getDir #export) filename: selection[1].name + ".txt" outFile = createFile dir_path ) on c pressed do if selection.count < 1 then ( messagebox "Nothing Selected !" title:"Nothing Selected" ) else ( ( selection.count == 1 and classof selection[1].baseobject == Editable_Poly --- oPoly = $ sliderTime = 0 sTime = animationRange.start eTime = animationRange.end format "Name: %\n\n" selection[1].name to:outFile ( ( for i=sTime to eTime do ( sliderTime = i forceCompleteRedraw() format "_" to:outFile ( local iNumVerts = polyOp.getNumVerts oPoly gw.setTransform (Matrix3 1) local p3PointWorldPos = [0,0,0] local p2PointScreenPos = [0,0] local ap2PointScreenPos = #() ap2PointScreenPos[iNumVerts] = [0,0] for iVert = 1 to iNumVerts do ( p3PointWorldPos = polyOp.getVert oPoly iVert /* la multiplication est à changer là si nécessaire (c'est le *2)pour le x et le y */ ap2PointScreenPos[iVert] = [ceil((((gw.transPoint p3PointWorldPos).x)*2)-42), ceil((((gw.transPoint p3PointWorldPos).y)*2)+27)] ) for p2Pos in ap2PointScreenPos do format "%" p2Pos to:outFile ) ) ) ) close outFile ) ) ) createdialog gvp style:#(#style_titlebar, #style_sysmenu, #style_toolwindow, #style_sunkenedge)
Comments
Little up? :)
Little up? :)