MAXScript Tools and Interaction with 3ds Max > Creating MAXScript Tools > Defining Macro Scripts >

# Context Filters

| Creating User Interfaces - Quick Navigation

Filter functions for context-sensitive menus.

Use this for .IsEnabled or .IsVisible handlers in macrocripts. isEnabled and isChecked handlers have been added to many of the existing macroScripts. All of the modifier, creation and polygon toolbox macroScripts have these two handlers.

These handlers allow object creation CUI buttons to turn green while creating objects, and modifier buttons are only enabled if they apply to the current selection. The polygon toolbox buttons also only enable when applicable, and the selection level buttons stay pressed while in the sub-object level.

This structure is defined in .\stdplugs\stdscripts\ FilterFunctions.ms.

An example use of the filter functions can be found in the Selection and Display Callbacks Script File, .\stdplugs\stdscripts\ Selection_Display_Filters.ms

    #Struct:Filters(
    Is_EditMesh:<fn>,
    Is_NURBS:<fn>,
    Is_EditPoly:<fn>,
    Is_EditPatch:<fn>,
    Is_EditSpline:<fn>,
    Is_MeshSelect:<fn>,
    Is_PolySelect:<fn>,
    Is_SplineSelect:<fn>,
    Is_PatchSelect:<fn>,
    Is_PosXYZ:<fn>,
    Is_RotationXYZ:<fn>,
    Is_ScaleXYZ:<fn>,
    is_Child:<fn>,

This is used for the new IK assignments.

    is_Parent:<fn>,

This is used for the new IK assignments.

CanSwitchTo_XXXX for SubObject levels:

    CanSwitchTo_Vertex:<fn>,
    CanSwitchTo_Edge:<fn>,
    CanSwitchTo_Face:<fn>,
    CanSwitchTo_Polygon:<fn>,
    CanSwitchTo_Element:<fn>,
    CanSwitchTo_Border:<fn>,
    CanSwitchTo_Patch:<fn>,
    CanSwitchTo_Segment:<fn>,
    CanSwitchTo_Spline:<fn>,

These can be used to check if MeshSelect, PatchSelect, SplineSelect, Edit(able) Patch, Edit(able)Mesh, and Edit(able) Spline can go into these subobject levels.

    Are_Modifiers_Applied:<fn>,

The following requires a node to be passed into the function:

    Is_Bone:<fn>,
    Is_IKChain:<fn>,
    Is_Point:<fn>,
    Is_Light:<fn>,
    Is_Camera:<fn>,

These return true if the selected object’s function name condition is met.

    Is_Target:<fn>,

Returns true if the node is a target of a LookAt controller, false otherwise.

    HasBaseObjectProperty:<fn>,

Returns true if the node's base object has the specified property, or if the base object is a scripted plugin, and the delegate has the specified property. Is either a string or name value.

    GetBaseObjectProperty:<fn>,

Returns the value for the node's base object property, or the delegate's property if the base object is a scripted plugin. If the specified property is not found, a name value of '#error' will be returned. Is either a string or name value.

    SetBaseObjectProperty:<fn>,

Sets the value for the node's base object property, or the delegate's property if the base object is a scripted plugin. If the specified property is not found, or does not accept the type of value specified, a name value of '#error' will be returned. Otherwise will be returned. Is either a string or name value.

    -- returns new value/#errorToggleBaseObjectProperty:<fn>)

Toggles the value for the node's base object property, or the delegate's property if the base object is a scripted plugin. If the specified property is not found, or is not a boolean, a name value of '#error' will be returned. Otherwise the property's new value will be returned. Is either a string or name value.

#### See Also

- Macro Scripts

- Defining Macro Scripts