View Full Version : key Obj?
Technofreak 04-15-2004, 12:44 AM Hello all, so I'm back again..hehe....so heres the problem......
- how do I check if my selected object has animation and if there
is which attribute or channel (translate x, translate y, and blah blah) is keyed.
- how do I run a startup script? basically what I want to do is to tell Max to run a script when a load a new scene or maybe when I imported something in Max.
Thanks All
|
|
Originally posted by Technofreak
Hello all, so I'm back again..hehe....so heres the problem......
- how do I check if my selected object has animation and if there
is which attribute or channel (translate x, translate y, and blah blah) is keyed.
- how do I run a startup script? basically what I want to do is to tell Max to run a script when a load a new scene or maybe when I imported something in Max.
Thanks All
These return true or false:
$.position.isAnimated
$.rotation.isAnimated
$.scale.isAnimated
.isAnimated can be used with any property of an object.
Also, you could ask for the number of keys in the animation controller:
$.position.controller.keys.count > 0
--returns true if there are keys, false otherwise
Since the position controller has 3 sub-controllers for X, Y and Z,
you can go down and ask those separately, too:
$.position.controller[2].isAnimated
or
$.position.controller[2].keys.count > 0
There are Startup scripts that are evaluated when you startup Max itself (program launch time).
And there are so-called Callback scripts that can be registered to monitor for events like #filePostOpen etc. See the MAXScript Online Help on Callbacks and the included "How To" tutorial about changing resolution at render time which should get you started.
You could place a short script that defines the callback in the \Scripts\Startup folder so the code is activated each time you launch Max...
Cheers,
ThaMan
Originally posted by Bobo
These return true or false:
$.position.isAnimated
$.rotation.isAnimated
$.scale.isAnimated
Forgot to mention - since you want to ask the WHOLE object about being animated or not, you could even do
YourObject.isAnimated
to get true or false whether there is anything to look for.
If it returns true, you could go down and scan the complete hierarchy of the object using indexed access to its properties...
Like this:
fn getAllAnimatedProperties theObject =
(
scan_properties = #(theObject)
animated_props = #()
cnt = 0
while cnt < scan_properties.count do
(
cnt +=1
currentObj = scan_properties[cnt]
try(is_animated = currentObj.isAnimated)catch(is_animated = false)
if is_animated do append animated_props currentObj
for i = 1 to currentObj.numSubs do
append scan_properties currentObj[i]
)
animated_props
)
result = getAllAnimatedProperties $Teapot01
print result
Technofreak
04-15-2004, 06:53 AM
:bowdown: :bowdown: :bowdown: <----- this says it all..........
Thanks BoBo
CGTalk Moderation
01-18-2006, 02:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.