PDA

View Full Version : TrackView: selectTrack


MikieK
06-21-2011, 05:39 AM
Greetings All

This has been driving me NUTS all day, mainly due to the sheer randomness of the results.

I (like a few others in old threads) am trying to write a quick script that opens a new trackview, with only some custom attributes shown. I kinda thought it would be easy, but am just fining no consistency from max session to max session, file to file. Sometimes it works, sometimes it doesn't, sometimes it finds some of the CAs...

I guess the big caveat I'm fighting is that the track for selection needs to be visible in the track view... what is the best way to ensure that it is?
(commented out lines have been tried in various configurations)
(axs.baseObject.axis_Params[#load] does return a subAnim...)


if (trackviews.isOpen "All: Basic Parameters") do trackviews.close "All: Basic Parameters"
if (trackviews.exists "All: Basic Parameters") do trackviews.delete "All: Basic Parameters"
trackviews.open "All: Basic Parameters" pos:[6,100] width:1400 height:600
trackviews.current.ui.loadLayout "Function Curve Layout (Classic)"
trackviews.current.clearFilter #all
trackviews.current.setFilter #default
trackviews.current.manualNavigation = false
trackviews.current.expandTracks()
clearSelection()
--trackviews.current.autoExpandObjects = true
--trackviews.current.autoScrollToSelected = true
for axs in STK.axisList do -- list of objects that has apropriate attributes applied
(
selectmore axs
trackviews.current.selectTrack axs.baseObject.axis_Params[#axisPos] false
trackviews.current.selectTrack axs.baseObject.axis_Params[#speed] false
trackviews.current.selectTrack axs.baseObject.axis_Params[#accel] false
trackviews.current.selectTrack axs.baseObject.axis_Params[#load] false
)
trackviews.current.setfilter #selectedTracks
trackviews.current.manualNavigation = true
clearSelection()



Any Advice?


Cheers

Mikie

MikieK
06-21-2011, 08:11 AM
hmm it's still fairly random... I added another 4 or 5 CA tracks per object to display, and it's all over the place again, with no errors being generated, not all tracks showing, and some completely unrelated ones popping up.

hmmm the scripted CAs seem to work more or less consistently with the above setup. When i try to add tracks to regular Float, or Bool, or integers it tends to go all over the place.

There must be a better/more consistent wat to do this?

MikieK
06-22-2011, 01:20 AM
Got to the bottom of some of the above randomess, and found a solution, but don't quite understand the cause...

In the listener, some of the CAs which were not showing up would return a sub-anim, so I thought they should work, especially as I can view these in an unfiltered trackView just fine...
$Axis_145.baseObject.axis_Params[#MaxAccel]
SubAnim:MaxAccel

However, as these CAs were just storing a value, ( an int, or float ) I never bothered to assign a controller... Which I realised when I was trying to send the controller to the trackview rather then the sub anim. For Instance, in the listener:
$Axis_145.maxaccel.controller
undefined

As soon as i assigned a controller, like a linear float, or something, it would be selected correctly by the above script. I'm not sure what the ramifications are of adding controllers to all of these CAs is yet, so I'm a bit hesitent...

I guess technically, unitl it has a controller, it is not an animation track, just a value, so would get filtered out?

CGTalk Moderation
06-22-2011, 01:20 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.