----****************************
---********
fn gt_selctt =
(
kol =1
if $selection.count !=1 then
(
if AboutRollout != undefined then destroydialog AboutRollout
rollout AboutRollout "About"
(
label lbl5 "选择数量!=1 将不执行," pos:[10,10]
label lbl3 "以此提醒。"
timer tmclose "" interval:1000 active:true
on AboutRollout rbuttonup press do destroydialog AboutRollout ------ 右键进行消除
on tmclose tick do destroydialog AboutRollout --时间按点到消除 给我提供了思路。
)createdialog AboutRollout 200 100 modal:true style:#(#style_border,#style_sysmenu,#style_sunkenedge)
kol+=1
return kol
)else ( return kol )
)
fn gt_select_spline_classof_shape =
(
kol =1
-- oop=true
if superclassof $ ==GeometryClass and classof $ ==Targetobject then
(
if AboutRollout != undefined then destroydialog AboutRollout
rollout AboutRollout "About"
(
label lbl5 "选择的将不是GeometryClass类,终止程序。" pos:[10,10]
label lbl3 "以此提醒。"
timer tmclose "" interval:1000 active:true
on AboutRollout rbuttonup press do destroydialog AboutRollout ------ 右键进行消除
on tmclose tick do destroydialog AboutRollout --时间按点到消除 给我提供了思路。
)createdialog AboutRollout 200 100 modal:true style:#(#style_border,#style_sysmenu,#style_sunkenedge)
kol+=1
return kol
)else ( return kol )
)
global sel_pivot_axis_fold=undefined ,sel_pivot_axis=undefined,deleting_marker_sp=undefined ,mouse_tools_customize =undefined------我用导入脚本的方法 这里的函数好像是要写成全局的、
----下面是物体 求交的全局函数。
global collect_poly_vertexs=undefined ,find_intersection_virects =undefined ,g_filter= undefined,gt_become_deformed_pick_Aligner=undefined
----下面是变形与包裹的 的全局函数。
global g_filte_plane=undefined,gt_pick_morpher_count=undefined ,gt_pick_skin_wrap_count=undefined
global gt_morpher_one_pick_plane =undefined , gt_morpher_two_pick_plane =undefined
try (DestroyDialog gt_obj_become_deformed ) catch ()
rollout gt_obj_become_deformed "物体变形脚本(盖天)" 200 height:532
(
GroupBox grp1 "架构面片" pos:[3,3] 195 height:123
GroupBox grp2 "物体求交" pos:[3,235] 195 height:69
GroupBox grp3 "变形" pos:[3,310] 195 height:93
GroupBox grp4 "包裹" pos:[3,404] 195 height:68
GroupBox grp5 "最终效果" pos:[3,475] 195 height:48
checkbutton jiaogou_add_ckb "+" pos:[16,21] 28 height:20 checked:true
checkbutton jiaogou_del_ckb "-" pos:[16,45] 28 height:20
checkbutton jiaogou_x_ckb "x" pos:[62,25] 28 height:28 checked:true
checkbutton jiaogou_y_ckb "y" pos:[110,25] 28 height:28
checkbutton jiaogou_z_ckb "z" pos:[158,25] 28 height:28
spinner jiagou_leng_spn "长段" pos:[13,79] 84 height:16 range:[1,100,10] type:#integer
spinner jiagou_width_spn "宽段" pos:[107,78] 84 height:16 range:[1,100,10] type:#integer
button jiagou_c_btn "创建辅助面" pos:[8,100] 180 height:20
button un_objects_btn "物体求交" pos:[13,254] 117 height:20
checkbutton un_jiaohu_ckb "交互" pos:[149,245] 30 height:28
button mothon_btn "变形" pos:[13,330] 117 height:20
button skin_ma_btn "创建包裹" pos:[13,424] 117 height:20
label obj_stad_lbl "状态:无" pos:[15,278] 80 height:17
label skin_lbl "状态:无" pos:[15,449] 80 height:17
label face_lbl ":这个面多了慢" pos:[141,421] 56 height:30
button else_btn "效果肯定" pos:[15,495] 117 height:20
progressBar mothon "0-100(%)" pos:[11,359] 180 height:16 enabled:false
label morpher_lbl "状态:无" pos:[15,380] 80 height:17
dropdownList mode_ddl1 "方法模式:" pos:[8,128] 186 height:4 items:#("第一:射线求交", "第二:系统射线")
edittext edt1 "" pos:[4,172] 186 height:56 text:"第一种方法是利用射线到物\n体的交点,求的物\n体变形。" --enabled:false
---第一个事件就是 架构面片,这个方法应该是很是有效。
---1.保证唯一性。
on jiaogou_add_ckb changed state do
(
if state == on then
(
jiaogou_del_ckb.checked=false
) else (
jiaogou_del_ckb.checked=true
) ----end if
)----end on
on jiaogou_del_ckb changed state do
(
if state == on then
(
jiaogou_add_ckb.checked=false
)else
(
jiaogou_add_ckb.checked=true
) ----end if
)----end on
-----下面是关于轴心的处理方法。
on jiaogou_x_ckb changed state do
(
if state == on then
(
jiaogou_y_ckb.checked=false
jiaogou_z_ckb.checked=false
)else
(
ram = random 1 2
if ram ==1 then
jiaogou_y_ckb.checked=true
else
jiaogou_z_ckb.checked=true
) ----end if
)----end on
on jiaogou_y_ckb changed state do
(
if state == on then
(
jiaogou_x_ckb.checked=false
jiaogou_z_ckb.checked=false
)else
(
ram = random 1 2
if ram ==1 then
jiaogou_x_ckb.checked=true
else
jiaogou_z_ckb.checked=true
) ----end if
)----end on
on jiaogou_z_ckb changed state do
(
if state == on then
(
jiaogou_x_ckb.checked=false
jiaogou_y_ckb.checked=false
)else
(
ram = random 1 2
if ram ==1 then
jiaogou_x_ckb.checked=true
else
jiaogou_y_ckb.checked=true
) ----end if
)----end on
-----------------------------------------------------------上面的脚本中达到了,操作唯一化。下面对唯一化进行输出。
on jiagou_c_btn pressed do
(
-----1.判断轴向指令
-----忘了最重要问题。选择一个模型的情况下。
gt_oo = gt_selctt()
if gt_oo ==2 then return false ---看来我要到处用到这两句了。
gt_oo_cl = gt_select_spline_classof_shape()
if gt_oo_cl ==2 then return false ---看来我要到处用到这两句了。
command = case of
(
(gt_obj_become_deformed.jiaogou_add_ckb.checked == true and gt_obj_become_deformed.jiaogou_x_ckb.checked == true ):
(
"x+"
)---end ()
( gt_obj_become_deformed.jiaogou_add_ckb.checked == true and gt_obj_become_deformed.jiaogou_y_ckb.checked == true ):
(
"y+"
)---end ()
(gt_obj_become_deformed.jiaogou_add_ckb.checked == true and gt_obj_become_deformed.jiaogou_z_ckb.checked == true ):
(
"z+"
)---end ()
( gt_obj_become_deformed.jiaogou_del_ckb.checked == true and gt_obj_become_deformed.jiaogou_x_ckb.checked == true ):
(
"x-"
)---end ()
(gt_obj_become_deformed.jiaogou_del_ckb.checked == true and gt_obj_become_deformed.jiaogou_y_ckb.checked == true ):
(
"y-"
)---end ()
( gt_obj_become_deformed.jiaogou_del_ckb.checked == true and gt_obj_become_deformed.jiaogou_z_ckb.checked == true ):
(
"z-"
)---end ()
)---end case
--print command
fg= include "E:\\工作文件\\2011.5.3\\新问题提出变形对齐\\物体正方向进行创建(创建面函数暂时搞定).ms" ----这种方法灰常好。
mouse_tools_customize command jiagou_leng_spn.value jiagou_width_spn.value
)----end pressed
--*********************************************
--*************************************************
-- 方法模式临时留出脚本空挡,不做处理。
on mode_ddl1 selected i do
(
if (i==1) then
(
edt1.text = "第一种方法是利用射线到物\n体的交点,求的物\n体变形。"
)
if (i==2) then
(
edt1.text = "第二种方法是利用系统的空\n间变形,求的物\n体变形。"
)
)----end on
----************************************************************
----*****************************************************************
--下面是物体求交的过程,提前声明函数的全局变量,用状态告知。
on un_objects_btn pressed do
(
gt_oo = gt_selctt()
if gt_oo ==2 then return false ---看来我要到处用到这两句了。
gt_oo_cl = gt_select_spline_classof_shape()
if gt_oo_cl ==2 then return false ---看来我要到处用到这两句了。
obj_stad_lbl.text ="状态:开始.."
----下面就是复制,查询、
copy $
include "E:\\工作文件\\2011.5.3\\新问题提出变形对齐\\射线的焦点(基本完成).ms"
gt_become_deformed_pick_Aligner()
obj_stad_lbl.text ="状态:结束.."
)---end pressed
-----下面是物体变形
on mothon_btn pressed do
(
gt_oo = gt_selctt()
if gt_oo ==2 then return false ---看来我要到处用到这两句了。
gt_oo_cl = gt_select_spline_classof_shape()
if gt_oo_cl ==2 then return false ---看来我要到处用到这两句了。
morpher_lbl.text ="状态:开始.."
try ( convertTo $ Editable_Poly )catch ( )
include "E:\\工作文件\\2011.5.3\\新问题提出变形对齐\\研发(函数)最后阶段命令的操作.ms"
gt_pick_morpher_count()
morpher_lbl.text ="状态:结束.."
---激活时间条
mothon.enabled=true
)----end on
-----下面是包裹物体,的处理方法。
on skin_ma_btn pressed do
(
/*
---模型包裹可以是多个,可以是线, 可以是组。所以这里不做什么手脚。
gt_oo = gt_selctt()
if gt_oo ==2 then return false ---看来我要到处用到这两句了。
gt_oo_cl = gt_select_spline_classof_shape()
if gt_oo_cl ==2 then return false ---看来我要到处用到这两句了。
*/
skin_lbl.text ="状态:开始.."
---因为这里是使用的一个函数,走了两遍我把它分开。
include "E:\\工作文件\\2011.5.3\\新问题提出变形对齐\\左后的包裹脚本.ms"
gt_pick_skin_wrap_count()
skin_lbl.text ="状态:结束.."
)----end skin_ma
-----下面就是创建最终的效果,
on else_btn pressed do
(
clearSelection()
select gt_global_skin_wrap_mode
---转poly
try ( convertTo gt_global_skin_wrap_mode Editable_Poly )catch ()
clearSelection()
-- select gt_morpher_one_pick_plane
-- selectMore gt_morpher_one_pick_plane
delete gt_morpher_one_pick_plane
delete gt_morpher_two_pick_plane
gt_global_skin_wrap_mode= undefined ;gt_morpher_one_pick_plane=undefined ;gt_morpher_one_pick_plane=undefined
)
on gt_obj_become_deformed open do
(
---一切都在创建面版操作,速度快。
max create mode
-- include "E:\\工作文件\\2011.5.3\\新问题提出变形对齐\\物体正方向进行创建(创建面函数暂时搞定).ms" ----这种方法灰常好。
)
)
createdialog gt_obj_become_deformed