Vähään aikaan ei ole tullut väsättyä mitään, mutta nyt alko taas ketuttaa kun piti centeröidä roinaa face selection keskelle. Tässä hommaan scripta.
Valitse obu jonka haluat keskittää ja aja scripti. Scripti pyytää valitsemaan obun johon centeröidään, joten valitse obu josta olet valinnut, vaikka editmeshillä faceja.
struct xcxCenterToFaceSel
(
fn getFaceCenter obj f =
(
iFaceInd = getFace obj f
cp = [0,0,0]
for i=1 to 3 do cp += getVert obj (iFaceInd[i])
cp = cp / 3.0
)
-------------------------------------------------------------------
)
-------------------------------------------------------------------
if ( selection[1] != undefined ) do
(
obj = pickObject "Pick object" prompt:"Pick object" rubberBand:(selection[1].position)
if obj != undefined do
(
try
(
ctfs = xcxCenterToFaceSel()
faces = getFaceSelection obj
faces = faces as array
p = [0,0,0]
for i in faces do
(
p += ctfs.getFaceCenter obj i
)
p = p / (faces.count)
for o in selection do
o.position = p
)
catch
(
messageBox ("Can not get face selection from object "+(obj.name)+".")
)
)
)