XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : Trackbar filter

04-10-2012, 09:21 AM
I've made a small script that shows only the keys in the trackbar related to the currently selected modifier in the stack. This makes it easy to quickly adjust the right keys when there are a lot of overlapping things happening.

It works as is, but I have to use a #modPanelObjPostChange event to activate the filter each time.. isn't there a way to make the filter just do its jobs without retriggering it all time?

Not that you notice it but it just doesn't feel zen to do it like this :)

fn testCallbackFilterFunction theAnimatable theParent theSubAnimIndex theGrandParent theNode=(

if (superClassof theAnimatable == FloatController ) then
a= modPanel.getCurrentObject()
b= theGrandParent
if (a==b) then ( true ) else ( false)

fn testCallbackAdditionFunction arg1 arg2 = (true)
theInterface = maxOps.trackbar
theIndex = theInterface.registerFilter testCallbackFilterFunction callbackAdditionFunction "ModFilter" 8 active:true stopTraversal:false

callbacks.removeScripts id:#trackredraw
callbacks.addScript #modPanelObjPostChange "tbar = maxops.trackbar; ind=0; for i=1 to tbar.filterCount() do ( if ( (tbar.getFilterName i)==\"ModFilter\") do ( ind=i; ) ) ; if (tbar.isFilterActive ind) do ( tbar.setFilterActive ind true) " id:#trackredraw

04-10-2012, 10:58 AM
fn testCallbackFilterFunction theAnimatable theParent theSubAnimIndex theGrandParent theNode=
superClassof theAnimatable == FloatController and modPanel.getCurrentObject() == theGrandParent

Sorry, I couldn't help myself :)

I don't think you can trigger it without utilizing the modpanel callback, but you might not have to keep reregistering the filter each time. Have you tried to force a redraw of it?

04-10-2012, 11:06 AM
Thx for cleaning the code up! :)

I did try a forced .redraw method but that didn't help.. it does redraw but it does not seem to run the keys trough a filter again.

edit: btw, I doesn't re-register it self, it just sets itself to the active filter, even when it's already active, that triggers the filtering.

04-10-2012, 11:10 AM
you could try to broadcast a #selectionSetChanged callback but I suspect that will take more time than what you are already doing.

CGTalk Moderation
04-10-2012, 11:10 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.