[Closed] Collect controller
Hi all
Let’s say I have a lot of objects on the scene and I want to specifically collect all the scripted controllers into an array. How do I do that?
The purpose of this is that I want to use setTimeRange for many controllers so I don’t have to open DopeSheet all over again.
Any input will be greatly appreciated.
Hi.
Take a look to the website of Diego Garcia. He wrote an article about references and one of the functions he developed collected all the controllers of an object.
I’ve modified the script so it’ll collect all the scripted controllers for all scene nodes (maybe exists a better way to do that):
fn getScriptedControllers ref =
(
local ctrlList = #()
local refList = refs.dependsOn ref
for r in refList do
(
local ctrlClass = (classOf r) as String
if (isProperty r #keyable == true and \
(findString ctrlClass "_script") != undefined) then
append ctrlList r
join ctrlList (getScriptedControllers r)
)
return ctrlList
)
for obj in objects do (
objControllers = getScriptedControllers obj
for c in objControllers do
format "% - %
" c (exprForMaxObject c)
)
Hope that helps.
Hi
I saw a similar thread sometime ago and someone showed this method of returning an array of any class in 3dsmax.
“The getClassInstances method returns an array of all instances of specified class that exist in the scene. “
I just have 1 sphere with a position script applyed in this teste scene.
ex: getClassInstances position_Script
returns: [size=1]#(Controller:Position_Script)[/size]
[size=1][/size]
[size=1]Hope it helps
[/size]
thank you very much for the help guys. well, i’ve still got a long way to go :).
this forum is amazing, it’s like magic. you want to know something, and there it is.