3ds Max SDK: First Steps for Scripters

Even for seasoned scripters, the idea of dipping their toes into the C++/SDK territory often looks daunting, even more so when confronted with the sheer volume of the documentation and all the topics covered. That said, there's no need to go full C++ right away. I'll cover the process of creating your own MAXScript functions using the Function Publishing system, and how to leverage them in a pair of sample scripted simpleMeshMods.

I'm gonna briefly touch a lot of topics, and many tangentially related concepts and features will be referenced. It's not important that everything makes sense on the first read, maybe not on the tenth either but I hope you'll stick around long enough that everything eventually falls into place and when it does, the code you write will be more robust.

1. Visual Studio
2. Max SDK
3. Max Plugin Wizard
4. New Project
5. First Build
6. Core Interface
7. Core Interface Instance
8. Interface Methods
9. Static Interface
10. Interface Methods Continued
11. THE Core Interface
12. Convenience Features

Read more »

Removing Controller with MAXScript

Since there's no built-in MAXScript function to remove controller once you add it to a parameter, here's a function to do that for you. Big thanks to Larry Minton for revealing how to handle ParamBlock2 PB2Values.

fn removeController subAnim = if isKindOf subAnim ::SubAnim and isController subAnim.controller do
    local originalValue = subAnim.value

    if isKindOf subAnim.parent ParamBlock2 then
        local iGlobal = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
        local pBlockNET = iGlobal.Animatable.GetAnimByHandle (getHandleByAnim subAnim.parent)
        local pValNET = pBlockNET.GetPB2Value (pBlockNET.IndexToId (subAnim.index - 1)) 0

        pValNET.Flags = bit.or pValNET.Flags 0x40 -- set the flag on the PB2Value which controls if the parameter is animated - this effectively removes the controller
        local ctrl = subAnim.controller
        local parent = subAnim.parent
        local index = for i = 1 to refs.getNumRefs parent where refs.getReference parent i == ctrl do exit with i

        refs.replaceReference parent index undefined

    if classOf subAnim.value == classOf originalValue do subAnim.value = originalValue
    notifyDependents subAnim.parent msg:REFMSG_CONTROLREF_CHANGE
Read more »

KeyHydra WheelControl Customization

With the latest KeyHydra update comes the possibility to use scroll wheel in conjunction with modifier keys to control properties of primitives at creation time, as well as various editable/edit poly tool properties. There's a pretty straightforward UI configuration when you want to tweak the values and an .xml configuration file if you want to go beyond that and add your own presets.

Read more »

KeyHydra LazerCut

I am happy to share a tool that's nearing release now: LazerCut, part of the KeyHydra package (see also the polycount discussion). It provides an interactive boolean workflow inside 3ds max using the object manipulation tools everyone is used to, without ever having to go to the boolean subobjects and settings:

The cutters can be created in any view, perpective, orthogonal, camera etc. Depending on the current mode, they can be used to split the selected geometry, add to it, subtract from it or create independent objects. Since all the cutters (with the exception of multi-object subtractions) are created in a separate layer as children of the object operated on, you can easily select those relevant to the object with PgDn, or unhide them using unhide $.children.
Read more »

Undocumented MAXScript Features

Every now and then, I stumbled upon an undocumented command or optional keyword. Some of them were later added to the documentation, many of them are still undocumented. Some of those are listed in this article (I'm skipping a lot of stuff I don't find useful like the non-creatable MEditBkgnd texture map, creatable PFlow related classes etc).

Read more »

Vectors Primer

Understanding vectors is a crucial skill for any technical artist. In this article, we will look at the very basics, both as a refresher for those who already know the concepts and an introduction for the uninitiated.
Read more »

Comparing float values

Dealing with floating point values in MAXScript is almost inevitable, as are the accuracy problems connected to that.

Read more »
Return to top