ScriptSpot

Forum topic · General Scripting

Read trackview filters

By titane357 · 2019-05-22

Description

Hi,
Is there a way to know if a trackview filter is ckecked or no ?
I know how to check, how to uncheck... but can't manage to know its state.
Thanks.

Comments (5)

titane357 · 2019-06-13

@jahman
Hi, thank you it works fine.
I do not all understand, but it's usual...

titane357 · 2019-05-22

Thanks jahman. But DotNet is not for me...
I'm already a bungler in maxscript...

.

jahman · 2019-05-22

In this particular case there's no difference between using mxs or c# actually.
see for yourself


local getFilterState = (dotNetClass "Autodesk.Max.GlobalInterface").Instance.coreinterface7.TestTrackViewFilter

local tv_name = trackView.getTrackViewName 1 -- note, there may be more than one
local FILTER_SELOBJECTS = 2^0
local which = 0 -- for this particular filter, starting from FILTER_GEOM and further you will have to use 1
format "FILTER_SELOBJECTS is enabled:%\n" ((getFilterState tv_name FILTER_SELOBJECTS which) == 1)

titane357 · 2019-05-23

oookey. Thanks. I'll try to incorporate these things in my brain and in my script.
I'm a bit busy now, but i'll soon whimper again here :-)

.

jahman · 2019-05-22

check SDK reference for this function: TestTrackViewFilter
you can access it using c# sdk like this


(dotNetClass "Autodesk.Max.GlobalInterface").Instance.CoreInterface7.TestTrackViewFilter

It returns 0 or 1 according to current filter state

These are the filter masks:

-- from itreevw.h

-- These are stored in the 0th DWORD
FILTER_SELOBJECTS = 2^0, -- Selected objects
FILTER_SELCHANNELS = 2^1, -- Selected channels
FILTER_ANIMCHANNELS = 2^2, -- Animated channels
FILTER_WORLDMODS = 2^3, -- World Space Modifiers
FILTER_OBJECTMODS = 2^4, -- Object Space Modifiers
FILTER_TRANSFORM = 2^5, -- Transformations
FILTER_BASEPARAMS = 2^6, -- base parameters
FILTER_POSX = 2^7, -- X positions
FILTER_POSY = 2^8, -- Y positions
FILTER_POSZ = 2^9, -- Z positions
FILTER_POSW = 2^10, -- W Positions
FILTER_ROTX = 2^11, -- X rotations
FILTER_ROTY = 2^12, -- Y rotations
FILTER_ROTZ = 2^13, -- Z rotations
FILTER_SCALEX = 2^14, -- X scaling
FILTER_SCALEY = 2^15, -- Y scaling
FILTER_SCALEZ = 2^16, -- Z scaling
FILTER_RED = 2^17, -- Red
FILTER_GREEN = 2^18, -- Green
FILTER_BLUE = 2^19, -- Blue
FILTER_ALPHA = 2^20, --
FILTER_CONTTYPES = 2^21, --
FILTER_NOTETRACKS = 2^22, --
FILTER_SOUND = 2^23, --
FILTER_MATMAPS = 2^24, --
FILTER_MATPARAMS = 2^25, --
FILTER_VISTRACKS = 2^26, --
FILTER_GLOBALTRACKS = 2^27, --

-- These are stored in the 1th DWORD.
FILTER_GEOM = 2^0, -- All geometrical objects
FILTER_SHAPES = 2^1, -- All shape objects
FILTER_LIGHTS = 2^2, -- All lights
FILTER_CAMERAS = 2^3, -- All cameras
FILTER_HELPERS = 2^4, -- All helper objects
FILTER_WARPS = 2^5, -- All space warps
FILTER_VISIBLE_OBJS = 2^6, -- All visible objects
FILTER_POSITION = 2^7, -- All position controllers
FILTER_ROTATION = 2^8, -- All rotation controllers
FILTER_SCALE = 2^9, -- All scaling controllers
FILTER_CONTX = 2^10, -- All X axis controllers
FILTER_CONTY = 2^11, -- All Y axis controllers
FILTER_CONTZ = 2^12, -- All Z axis controllers
FILTER_CONTW = 2^13, -- All W axis controllers
FILTER_STATICVALS = 2^14, -- All static values
FILTER_HIERARCHY = 2^15, -- Based on hierarchy
FILTER_NODES = 2^16, -- All nodes
FILTER_BONES = 2^17, --
FILTER_KEYABLE = 2^18, -- corresponds to the "Keyable" checkbox in the Filters dialog in TrackView
FILTER_ACTIVELAYER = 2^19, -- Whether or not we show only active layer controls or all controls.
FILTER_LOCKED = 2^20 -- Whether or not we show only unlocked tracks or all tracks.