顺便写一个给你看看吧,你要求的功能是否这样
脚本内容:
rollout renameObj_Rollout "RenameOBJ" width:318 height:119
(
edittext edt1 "" pos:[98,22] width:170 height:23
label lbl1 "物体名:" pos:[40,26] width:49 height:17
button btn1 "重命名" pos:[96,74] width:131 height:26
fn FindSelName = (
if $ != undefined and selection.count == 1 do edt1.text = $.name
)
on renameObj_Rollout open do
(
registerRedrawViewsCallback FindSelName --打开工具时注册获取物体名函数
)
on renameObj_Rollout close do
(
unregisterRedrawViewsCallback FindSelName --关闭工具时注消获取物体名函数
)
on btn1 pressed do
(
if $ != undefined and selection.count == 1 do(
$.name = edt1.text
)
)
)
createdialog renameObj_Rollout
|