if floater_B != undefined do
(
closerolloutfloater floater_B
)
floater_B = newrolloutfloater "场景处理B" 240 300
------------------------------------------------------------------------------------
rollout newroll_3 "对单个或多个物体操作"
(
button align2surf "对齐到指定物体表面" pos:[10,2] width:120 height:18 tooltip:"选择一个或多个几何体将对齐到目标物体表面,选择单个几何体的点将点对齐到目标物体表面,选择单个线条将所有点对齐到目标物体表面。"
button flat_line "弄平样条线" pos:[140,2] width:70 height:18 tooltip:"弄平一条或多条样条线。"
edittext zz "Z坐标" text:"0" pos:[10,20] width:70 height:18
button z_p "one shape's verts pos.Z set" pos:[80,20] width:140 height:18 tooltip:"选择的单个shape的选择的单个或多个点的Z坐标设置为左边的值"
button del_modifier "删除第一个修改器" pos:[10,38] width:120 height:18 tooltip:"删除选择物体的第一个修改器,没有修改器的将不操作。"
button reset_shape "重置样条线" pos:[140,38] width:70 height:18 tooltip:"跟统一物体坐标是一样的道理,总之碰到怪问题时对线条操作。"
button noclose "分离未封闭的线条元素" pos:[5,56] width:120 height:18 tooltip:"对单个物体操作,分离线条内未封闭的元素"
button dir "统一样条线方向" pos:[130,56] width:90 height:18 tooltip:"对单个物体操作,先对线进行0.001的outline,再执行此命令!既可统一线内元素的方向,为下一步做好准备。"
button duiqi "对齐选择的点到指定面(相对移动)" pos:[10,74] width:200 height:18 tooltip:"将物体的选择点一起移动某个距离对方到目标表面(即选择的点整体移动)。"
group "复制多个物体并对齐目标物体"
(
checkbox rotate_ "旋转适配" pos:[13,114] tristate:1
checkbox scale_ "缩放适配" pos:[100,114] tristate:1
pickbutton getG "点选目标物体组" pos:[13,134] width:110 height:16 tooltip:"简面用的工具,如段数很多的圆柱可以用段数少的圆柱来复制对齐。"
button copy_M "开始复制物体" pos:[130,139] width:80 height:16 tooltip:"简面用的工具,如段数很多的圆柱可以用段数少的圆柱来复制对齐。"
)
button rotateAlgin "根据选择的两个点旋转物体到正方向" pos:[10,170] width:200 height:18
-------------------------------------------------------------
on z_p pressed do
(
v_g=getKnotSelection $ 1
num=v_g.count
for i = 1 to num do
(
a=getKnotPoint $ 1 v_g[i]
pos_=a
pos_.z=zz.text as float
setKnotPoint $ 1 v_g[i] pos_
)
updateShape $
)
on noclose pressed do
(
global open_ = #()
numS = numSplines $
for i = 1 to numS do
(
if isClosed $ i == false do append open_ i
)
subobjectLevel = 3
setSplineSelection $ open_
splineOps.detach $
)
-------------------------------------------------------------
on dir pressed do
(
subobjectLevel = 0
global tempS = #()
numS = (numSplines $)/2
for i = 1 to numS do
(
orL = curveLength $ i
cL = curveLength $ (i+numS)
out = cL - orL
if out < 0 do reverse $ i
append tempS (i + numS)
)
subobjectLevel = 3
setSplineSelection $ tempS
splineOps.delete $
)
------------------------------------------------------------
on getG picked obj do
(--1
global sel = #()
a=obj
global b
if a.parent == undefined then
(
getG.caption = a.name + "(组)"
b = a
)
else
(
getG.caption = a.parent.name + "(组)"
b = a.parent
)
print getG.caption
sel = b.children
)--1
-------------------------------------------------------------------------------------------
on copy_M pressed do ----------复制多个物体并对齐目标物体
(
print "Eee"
for i = 1 to sel.count do
(
cc = instance $
cc.name = sel[i].name
cc.wirecolor = sel[i].wirecolor
cc.pos = sel[i].pos
if rotate_.tristate == 1 do cc.rotation = sel[i].rotation
if scale_.tristate == 1 do cc.scale = sel[i].scale
--cc.pos.x = 0.5*(sel[i].max.x + sel[i].min.x)
--cc.pos.y = 0.5*(sel[i].max.y + sel[i].min.y)
--cc.pos.z = 0.5*(sel[i].max.z + sel[i].min.z)
)
)
-------------------------------------------------------------------------------------------
on flat_line pressed do --------------弄平样条线
(----1
if selection.count == 0 do messageBox "请选择一个或多个线条" title:"联创警告!"
for i = 1 to selection.count do
(---2
new_z = selection[i].pos.z
for s = 1 to (numSplines selection[i]) do
( --s
for k = 1 to (numKnots selection[i] s) do
( --k
knt = getKnotPoint selection[i] s k
in_vec = getInVec selection[i] s k
out_vec = getOutVec selection[i] s k
knt.z = in_vec.z = out_vec.z = new_z
setInVec selection[i] s k in_vec
setOutVec selection[i] s k out_vec
setKnotPoint selection[i] s k knt
)--end k loop
)--end s loop
updateshape $
)---2
)----1
--------------------------------------------------------------------------------------------
on align2surf pressed do -----------------对齐到指定物体表面
(------dodo
do
( --选择对齐到的物体
if selection.count == 0 then messageBox "请选择一个或多个物体" title:"联创警告!" else
(
surf = pickObject message:"请选择一个几何体"
isObj = 0
if classof(classof surf) == GeometryClass then isObj = 1 else messageBox "请选择一个几何体" title:"联创警告!"
)
)
while isObj == 0
---------------------------
if selection.count > 1 do --对齐多个物体到物体表面
(
for i = 1 to selection.count do
(
testray = ray [selection[i].pos.x,selection[i].pos.y,(surf.max.z + 10000)] [0,0,-1]
insurf = intersectRay surf testray
if insurf != undefined do (move selection[i] [0,0,(insurf.pos.z - selection[i].min.z)])
)
)
---------------------------
if selection.count ==1 and classof(classof selection[1]) == GeometryClass and subobjectLevel == 0 do --对齐单个几何体到物体表面
(
testray = ray [selection[1].pos.x,selection[1].pos.y,(surf.max.z + 10000)] [0,0,-1]
insurf = intersectRay surf testray
if insurf != undefined do (move selection[1] [0,0,(insurf.pos.z - selection[1].min.z)])
)
if selection.count ==1 and classof(classof selection[1]) == GeometryClass and subobjectLevel == 1 do --对齐单个几何体的点到物体表面
(
vt = selection[1].selectedVerts
for i = 1 to vt.count do
(
p=vt[i].pos
testray = ray [(p.x),(p.y),(surf.max.z + 10000)] [0,0,-1]
insurf = intersectRay surf testray
if insurf != undefined do vt[i].pos = insurf.pos
)
)--end if
if selection.count ==1 and classof(classof selection[1]) == shape and subobjectLevel == 0 do--对齐单个线条的所有到物体表面
(
num = numKnots selection[1]
for i = 1 to num do
(
a = getKnotPoint selection[1] 1 i
testray = ray [a.x,a.y,(surf.max.z + 10000)] [0,0,-1]
insurf = intersectRay surf testray
if insurf != undefined do (setknotpoint selection[1] 1 i insurf.pos)
)
updateShape selection[1]
)
if selection.count ==1 and classof(classof selection[1]) == shape and subobjectLevel == 1 do--对齐单个线条的所有到物体表面
(
v_g = getKnotSelection selection[1] 1
num = v_g.count
--num = numKnots selection[1]
for i = 1 to num do
(
a = getKnotPoint selection[1] 1 v_g[i]
testray = ray [a.x,a.y,(surf.max.z + 10000)] [0,0,-1]
insurf = intersectRay surf testray
if insurf != undefined do (setknotpoint selection[1] 1 v_g[i] insurf.pos)
)
updateShape selection[1]
)
)-------dodo
------------------------------------------------------------------------------------
)
addrollout newroll_3 floater_B
网友评论