Notifications
Clear all

[Closed] Trackbar filter?

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) 
	)
    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
 
4 Replies
 lo1

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?

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.

 lo1

you could try to broadcast a #selectionSetChanged callback but I suspect that will take more time than what you are already doing.

Thank you so much, that’s exactly what I was looking for.