Maxscript - Changing the value for all Box objects in a Scene, on different Keyframes?

给你一囗甜甜゛ 提交于 2019-12-11 15:41:55

问题


I am new to Maxcscript, I try to explain a problem the best I can,

I am trying to make a script in Maxscript, that would change a height to a zero of all box objects in a scene on their first keyframe.

I have several scenes that all have a number of boxes, some have 12, some 20 boxes, etc. And all boxes are animated - but on different keyframes, for example first box is animated from 12-23rd frame, second box is animated from 30-45 frame, etc. (so I cant put specific frame number in a script) Right now I am using this script to change a height of a box:

set animate on
modPanel.setCurrentObject $.baseObject
$.height = 0

using this script I have to manualy go to every boxs first keyframe and then execute the script. So, Is there a way in Maxscript to make a script that would go to every box in a scene - go to their first keyframe, turn animate and change its height to a zero; from first to last box in a scene?


回答1:


I am a beginner too.
but try this?

actionMan.executeAction 0 "40021"  -- Selection: Select All

for i in $ do
(
    if matchpattern i.name pattern: "*Box*" == true do --ObjectName matching part
    (
        local foo = i.height.track  --set Your Animation Controller
        slidertime = getkeytime foo 1

        set animate on
        i.height = 0
        set animate off
    )
)


来源:https://stackoverflow.com/questions/46342140/maxscript-changing-the-value-for-all-box-objects-in-a-scene-on-different-keyf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!