【maxscript_ui按钮集合】

maxscript_ui按钮集合

2022-06-09 09:58

禁止点击
button PerOffset “前移” pos:[10,60] width:50 height:29 enabled:false
允许点击
PerOffset .enabled = true

一个保存文件的窗口 rollout test "test" ( edittext edt_test "" button btn_browse "..." ``button CloseWindow"..."`` on btn_browse pressed do ( `` local dir = getSavePath caption:"Test path..." `` if (dir != undefined) do ( edt_test.text = dir )
) ) on CloseWindow pressed do
(DestroyDialog test) --关闭窗口
createDialog test --建立窗口
最简单窗体

图片
rollout bangzhu “帮助” width:220 height:220
(
button Clo_btn12 “x” pos:[10,0] width:15 height:15 toolTip:“关闭”
label PreviewWindow “关于” pos:[100,44] width:25 height:15 align:#center
HyperLink help12 “脚本说明” pos:[88,149] width:72 height:15 color:(color 255 0 0) hovercolor:(color 0 255 255) address:“http://xxxx
HyperLink help1 “脚本更新下载地址” pos:[63,180] width:96 height:15 color:(color 255 0 0) hovercolor:(color 0 255 255) address:“http://xxxxx
GroupBox grp1 “” pos:[23,23] width:171 height:111
label lbl9 “” pos:[40,91] width:132 height:15

on bangzhu lbuttondblclk g11 do  
(  
    DestroyDialog bangzhu  
    )  
on bangzhu lbuttonup pos1 do  
    mousedd1=false  
on bangzhu lbuttondown pos1 do  
(  
mousedd1=true  
Thepos1=pos1  
    )  
on bangzhu mouseMove pos1 do  
(    if mousedd1==true Then  
    (SetDialogPos bangzhu (mouse.screenpos-Thepos1))  
     
    )  
on Clo\_btn12 pressed do  
    (DestroyDialog bangzhu)  \--关闭窗口  

)
颜色拾取框
图片
colorPicker cpParts “123” pos:[5,5] fieldWidth:40 height:20 visible:true
button ChangeMat “改变材质” pos:[20,85] width:150 height:32 enabled:true

on ChangeMat pressed do(
for i=1 to scenematerials.count do (
cmat = scenematerials[i]
if (getClassName cmat) == “Standard” do
(
cmat.Diffuse = cpParts.color
)
)
)
具体看 统一改场景材质球颜色脚本为standard.ms

下拉菜单
图片

rollout ddl_test “windows name”
(
dropdownlist scale_dd “Scale” items:#(“1/2”, “1/4”, “1/8”, “1/16”)

on scale_dd selected i do
format “You selected ‘%’!\n” scale_dd.items[i]
)
createDialog ddl_test
或者
on scale_dd selected i do(
i=scale_dd .selection
print i

反馈 1 2 3
如果是scale_dd .selected
反馈 “1/2” “1/4” “1/8” “1/16”
另外说明!例如选择了菜单的一个选项
aaa=scale_dd .selected
print aaa
反馈选择项的文本
1/2
1/4
1/8
1/16
1/8

例如选择了菜单的一个选项
aaa=scale_dd .selection
print aaa
反馈选择项的项目编号
1
2
3
UI窗体
图片

rollout 打印残影动画 “打印残影动画21.04.29” width:184 height:330
(
GroupBox grp1 “要打印的虚拟体名” pos:[3,10] width:179 height:130
edittext DummyName1 “目标骨骼1名” pos:[8,30] width:157 height:19
—打开窗口文本框默认内容
on 打印残影动画 open do (
DummyName1.text = “weapon_bone_001”
)
button printer “《打印关键帧》Esc终止” pos:[24,270] width:148 height:29
on printer pressed do
(
– 初始化–申明变量–获取文本框中的ABCDE虚拟体名字
nameA=DummyName1.text
DummyA=getnodebyname nameA
)
)
globalrollout = newrolloutfloater “打印残影动画” 200 330
addRollout 打印残影动画 globalrollout

------------------------------------------------------------------------------------------
区域
groupBox AnimTool “优化关键帧” pos:[5,5] width:178 height:185
group AnimTool “优化关键帧” (
各种按钮

UI按钮集合
zsz_cstools.ms

button btn1 “创建骨骼by物体” pos:[4,45] width:85 height:20基本按钮
button btn1 “创建骨骼by物体” pos:[4,45] width:85 height:20
图片

代码执行
on btn1 pressed do
(
try(
xxx
)–try
catch( )
)

滑块
图片

rollout unnamedRollout “Untitled” width:162 height:100
(
slider sld1 “Slider” pos:[24,16] width:114 height:44 range:[-100000,100000,5] type:#integer
Timer tmr1 “计时器” pos:[27,52] width:24 height:24 enabled:true interval:100 active:true
edittext edt5 “物体数目” pos:[24,70] width:107 height:27

on sld1 changed val do
(
for a in objects where hasproperty a “radius” do a.radius=sld1.value
)
on tmr1 tick do
(
edt5.text = (selection.count as string)
)
)
createdialog unnamedRollout

进度条
图片
progressbar SkinProgressBar"SkinProgressBar" color:(color 20 150 240) width:100 height:5 align:#center
label EscStop “按Esc键终止” color:(color 255 0 0)
global Objlist =#()–zsz
i=1
for obj in Objlist do(
skinOps.addBone $.modifiers[#Skin] obj 1 --执行命令,obj为变量因子,Objlist.coun为变量总数,也可以用i来代替
SkinProgressBar.value = 100.0 *i / Objlist.count–SkinProgressBar
if (keyboard.escPressed==true) then exit
i+=1
)

图片

下拉菜单
图片
【例1】:
dropdownList bip_list “” pos:[0,1] width:55 height:22 items:#(“Bip01”)
代码执行
if cstoolroll.bip_list.selected==“女” then
(
bip2=$男.controller
bipfile2=filepath+“\\”+bipfileitems[bhindex]
biped.loadBipfile bip2 bipfile2
)
【例2】:

rollout ddl_test “Drop-Down List”
(
dropdownlist scale_dd “Scale” items:#(“1/2”, “1/4”, “1/8”, “1/16”)
on scale_dd selected i do
format “You selected ‘%’!\n” scale_dd.items[i]
)
createDialog ddl_test
—下拉列表—
bbtools\breakableobj_bb.ms
button refresh_btn “刷新列表” pos:[15,112] width:137 height:26 toolTip:"刷新动力学物体和骨骼选择集列表"dropdownList boneSet_ddl “动力学骨骼选择集列表:” pos:[16,409] width:139 height:41 selection:0 items:SetList
button btn8 “刷新列表” pos:[16,380] width:136 height:25 toolTip:“刷新动力学物体和骨骼选择集列表”
dropdownList objSet_ddl “动力学物体选择集列表:” pos:[14,148] width:136 height:41 selection:0 items:SetList

local SetList = updateList()
on refresh_btn pressed do
(
boneSet_ddl.items = updateList()
objSet_ddl.items = updateList()
)
on btn8 pressed do
(
boneSet_ddl.items = updateList()
objSet_ddl.items = updateList()
)

sel = objSet_ddl.selection
objList = selectionsets[sel]
单选按钮
图片
radioButtons rdo1 “” pos:[1,354] width:168 height:16 labels:#(“1/4”, “1/2”,“1X”) default:3 columns:3
代码执行
on rdo1 changed stat do
(
if stat1 then print “1”
if stat
2 then print “2”
if stat3 then print “3”
if stat
4 then print “4”
)
-------------------button按钮提交单选按钮选择的结果-------------------------
radioButtons rdo1 “” pos:[10,40] width:168 height:16 labels:#(“脚踏帧”, “滑动帧”,“自由帧”) default:3 columns:3
button excude “执行” pos:[80,70] width:31 height:30

–用function缓存下选择state,主意这个fn不能放在radioButtons rdo1的前面,否则报错
fn updateButton = (
if rdo1.state ==1 then (
print(“111”)
)
if rdo1.state ==2 then (
print(“222”)
)
if rdo1.state ==3 then (
print(“333”)
)
)
–用press按钮调用fn
on excude pressed do
(
updateButton()
)

数值输入
图片

button btn6 “偏移关键帧>” pos:[92,109] width:81 height:20
spinner spn7 “错偏帧数” pos:[35,90] width:55 height:16 range:[0,1e+006,0] type:#integer
代码执行
on btn6 pressed do
(
try(
if (SelAllObj.state==true)then (
actionMan.executeAction 0 “40021”
)
for i in $ do (
movekeys i (spn7.value)
)
)–try
catch()
)
单选按钮
图片
UE4_顶点动画工具VertexAnimationTools.ms
checkbox captureAbsolutePositions “Capture Absolute Positions” tooltip:“捕获绝对位置” checked:true
代码执行
if (captureAbsolutePositions.checked)
then (
currentOffset=currentModelVertPos
)
else (
currentOffset=(currentModelVertPos-originalVertPos)
)
单选按钮 ZSZ_破碎动画工具2022.5.16.mcr
图片
GroupBox grp1 “target Axis” pos:[4,209] width:174 height:61
radiobuttons targetAxis “” pos:[14,239] width:97 height:16 labels:#(“X”, “Y”, “Z”) default:1 columns:3
checkbox chk21 “翻转” pos:[119,237] width:46 height:26 tooltip:“翻转轴向.” checked:false
代码执行
addlookat2.rotation.controller = LookAt_Constraint ()
B = addlookat2.rotation.controller
B.appendtarget lookatTarget2 50

B.target_axis = targetAxis.state --返回值1,2,3
if (chk21.checked)
then (
currentOffset= true
)
else (
currentOffset=false
)
文本按钮
图片
rollout 打印残影动画 “打印残影动画21.04.29” width:184 height:330
(
GroupBox grp1 “要打印的虚拟体名” pos:[3,10] width:179 height:130
edittext DummyName1 “目标骨骼1名” pos:[8,30] width:157 height:19
—打开窗口文本框默认内容
on 打印残影动画 open do (
DummyName1.text = “weapon_bone_001”
)
button printer “《打印关键帧》Esc终止” pos:[24,270] width:148 height:29
on printer pressed do
(
– 初始化–申明变量–获取文本框中的ABCDE虚拟体名字
nameA=DummyName1.text
DummyA=getnodebyname nameA
)
)
globalrollout = newrolloutfloater “打印残影动画” 200 330
addRollout 打印残影动画 globalrollout
点选按钮
图片
button btn5 “<偏移关键帧” pos:[3,109] width:80 height:20
checkbutton SelAllObj “选择全部物体” pos:[92,153] width:81 height:20 checked:true
代码执行

checkbutton theBTN “Button” width:125 height:30 checked:true

on theBTN changed state do (
if state == on then (code 1)
else (code 2)
)

—拾取按钮—
图片

fn FilterPoly obj = classof obj==Editable_Poly
rollout ddl_test “windows name”
(
pickbutton PickPoly “选择模型” pos:[50,20] width:100 height:40 message:“Pick” filter:FilterPoly
button test “test” pos:[50,60] width:70 height:40 enabled:false
on PickPoly picked obj do
(
PickPoly.text = obj.name
test.enabled = true
)
)
createDialog ddl_test width:200 height:100

--------------进度条-------
progressBar myprogress"" pos:[13,88] width:194 height:9 color:(color 30 10 190)
on xxx pressed do(
myprogress.value = 0
)
on xxx pressed do(
myprogress.value = 50
)
—列表窗格—
bippy- v1.97.ms
图片
dotNetControl lv_objects “system.windows.forms.listView” pos:[6,23] width:303 height:299
范例2
图片

AutoFbxtoBip v1.3_无乱码.ms
rollout AutoFbxtoBip “AutoFbxtoBip v1.3” width:200 height:315
(
dotNetControl dn_tabs “System.Windows.Forms.TabControl” width:200 height:22 align:#center
subRollout theSubRollout width:200 height:285 align:#center

on dn\_tabs Selected itm do  
(  
        if SubRollout != (itm.TabPageIndex+1) do  
        (  
        for subroll in ExportFbx\_Rollouts\[SubRollout\]\[2\] do  
        removeSubRollout theSubRollout subroll  
        for subroll in ExportFbx\_Rollouts\[SubRollout = itm.TabPageIndex+1\]\[2\] do    (  
        addSubRollout theSubRollout subroll  
        )  
    )  
)             
  
on dn\_tabs Selected itm do  
(  
    if SubRollout != (itm.TabPageIndex+1) do  
        (  
        for subroll in ExportFbx\_Rollouts\[SubRollout\]\[2\] do  
        removeSubRollout theSubRollout subroll  
        for subroll in ExportFbx\_Rollouts\[SubRollout = itm.TabPageIndex+1\]\[2\] do    (  
        addSubRollout theSubRollout subroll  
        Relocate\_bone\_size.open=false  
        Findtext.open=false  
        Help\_bone\_list.open=false     
        )  
    )  
)  

—列表盒体—
multi_pickobjects2.ms
图片

简化代码:
listbox LB01 “Influencing Objs” height:5; --5行高度. ReadOnly:True; --只读列表
local RV_ArrayNodes = #(); --通过多选按钮选择的物体阵列
nodeNameArray = #();
RV_ArrayNodes = #();
for i = 1 to selection.count do(
nodeNameArray[i] = selection[i].name;
RV_ArrayNodes[i] = selection[i];
)
LB01.items = nodeNameArray;

—///源码///–

rollout MainRollout “Multi-PickButton Demo”(
local RV_ArrayNodes = #(); --Array of nodes selected by button ArrayPick

button ArrayPick “Select Objects, THEN click me.”;

–The list box displays what you currently have selected by the ArrayPick button.
listbox LB01 “Influencing Objs”
height:5; --5 lines tall.
ReadOnly:True; --Read Only List.

–Control for MULTI-OBJECT PICK BUTTON
on ArrayPick Pressed do(
if selection.count == 0 then(
if(LB01.items.count==0)then(
ArrayPick.Caption = “LIST EMPTY”;
)else(
ArrayPick.Caption = “List Unchanged”;
)–[x]
)else(
MSTAT = #no; --Do not append;
if (LB01.items.count > 0)then(
mstatText = “”;
mstatText = mstatText + “[YES]: Append to previous selection.” + “\n”;
mstatText = mstatText + “[NO]: Replace old selection.” + “\n”;
mstatText = mstatText + “[CANCEL]: Don’t do anything.” + “\n”;
MSTAT = yesNoCancelBox mstatText \
title:“Append or Replace?” beep:False;
print(MSTAT);
)–[x]

if (MSTAT!=#cancel)then(  
 nodeNameArray = #();  
   
 --If #no: Create New Selection.  
 if(MSTAT==#no)then(  
  RV\_ArrayNodes = #();  
  for i = 1 to selection.count do(  
   nodeNameArray\[i\] = selection\[i\].name;  
   RV\_ArrayNodes\[i\] = selection\[i\];  
  )--\[X\]  
  ArrayPick.Caption = "List Populated";  
  LB01.items = nodeNameArray;  
  print("Rv array nodes===" + RV\_ArrayNodes as string);  
 )--\[#no\]  
   
 --If #yes: Append to Original selection.  
 if(MSTAT==#yes)then(  
  nodeNameArray = LB01.items;  
  for i = 1 to selection.count do(  
   APN = appendIfUnique RV\_ArrayNodes selection\[i\];  
   if(APN)then(append nodeNameArray selection\[i\].name);  
  )--\[X\]  
  ArrayPick.Caption = "List Appended To";  
  LB01.items = nodeNameArray;  
  print("Rv array nodes===" + RV\_ArrayNodes as string);  
    
 )--\[#yes\]  
)--\[MSTAT!=#cancel\]  

)–[Selection.count]
)–[ArrayPick Pressed]
)–[End Rollout]
CreateDialog MainRollout;
---------YesNoCancel窗体-------
多重选择Multi_pickobjects.ms
图片

MSTAT = yesNoCancelBox mstatText title:“Append or Replace?” beep:False;
if (MSTAT!=#cancel)then(
nodeNameArray = #();
ArrayPick.Caption = “列表取消”;

 if(MSTAT==#no)then(  
  RV\_ArrayNodes = #();  
  for i = 1 to selection.count do(  
   nodeNameArray\[i\] = selection\[i\].name;  
   RV\_ArrayNodes\[i\] = selection\[i\];  
  )  
   
  if(MSTAT==#yes)then(  
  nodeNameArray = LB01.items;  
  for i = 1 to selection.count do(  
   APN = appendIfUnique RV\_ArrayNodes selection\[i\];  
   if(APN)then(append nodeNameArray selection\[i\].name);  
  )--\[X\]  
  ArrayPick.Caption = "添加到了列表";  
  LB01.items = nodeNameArray;  
  print("Rv array nodes===" + RV\_ArrayNodes as string);  
   )  

)

评论(0)

  • 12
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值