Skip to content

Instantly share code, notes, and snippets.

@Hoikohroh
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hoikohroh/1c0508c43af106682d68 to your computer and use it in GitHub Desktop.
Save Hoikohroh/1c0508c43af106682d68 to your computer and use it in GitHub Desktop.
Maxscript:TimeTool
/*
Time Tool
スクリプト内容
1:時間を "秒+フレーム"で表示
2:タイムスライダをオフセット
更新履歴
v20140320
初版
*/
try destroyDialog Roll_Time catch()
Rollout Roll_Time ""
(
--時間表示
label lbl_Time "" width:80 style_sunkenedge:true
--ボタン類
Group ""(
button btn_sub_12 "-12" width:40 across:4
button btn_sub_06 "-6" width:40
button btn_add_06 "+6" width:40
button btn_add_12 "+12" width:40
)
--時間表示変更ファンクション
fn Fn_Time = (
TimeValue = currentTime.frame as integer
TempS = TimeValue / frameRate
TempF = TimeValue - (frameRate * TempS)
lbl_Time.caption = (TempS as string + "+" + TempF as string)
)
--タイムスライダ変更ファンクション
Fn Fn_TimeOffset Val =(
if Val > 0 then(
TempTime = slidertime + val
if animationRange.end >= TempTime
then (slidertime = TempTime)
else (
animationRange = interval animationRange.start TempTime
slidertime = TempTime
)
)
else(
TempTime = slidertime + val
if animationRange.start <= TempTime
then (slidertime = TempTime)
else (
animationRange = interval TempTime animationRange.end
slidertime = TempTime
)
)
)
--ボタンのアクション
on btn_sub_06 Pressed do (
Fn_TimeOffset -6
)
on btn_sub_12 Pressed do (
Fn_TimeOffset -12
)
on btn_add_06 Pressed do (
Fn_TimeOffset 6
)
on btn_add_12 Pressed do (
Fn_TimeOffset 12
)
--ロールアウト開閉時に時間変更コールバック追加/削除
on Roll_Time open do (
Fn_Time()
registerTimeCallback Fn_Time)
on Roll_Time close do (unregisterTimeCallback Fn_Time)
)
createDialog Roll_Time 200 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment