Drag-and-Drop Manager


Interface: dragAndDrop

A new type of datasrc file in an i-drop XML file can be specified that contains a macroScript with drag-and-drop handlers that will be run when you drag and drop the i-drop control onto a 3ds Max viewport. These new kinds of files are called 'drop scripts' and have the extension ".ds". Such files should contain a single macroScript definition with handlers for one or more of the special dropscript events. If there is more than just a single macroScript in the .ds file, all other text is ignored.

Here is a sample XML specifying a dropScript file called "foo.ds":

XML Code:

<?xml version="1.0"?>

<package xmlns="x-schema:file:///C:/Temp/idrop-schema.xml">

<proxy defaultsrc="file:///C:/Temp/blob.gif">

<caption>i-Drop Script!</caption>

<img src="file:///C:/Temp/blob.gif"/>



<datasrc clipformat="CF_IDROP.MAX">

<datafile src="file:///C:/Temp/foo.ds"/>




dropScript Events

The current dropScript events are delivered as a mixture of positional and keyword parameters. The first parameter is positional and is always the code name for the window on which the drop is currently occurring. Subsequent parameters are keyword parameters that vary in name and number depending on the window being currently dragged over or dropped on.

on droppable <window> node: point: do ...

on drop <window> node: point: do ...


Possible values are #max and #viewport. #max is returned if the mouse is over the MAX window, #viewport is returned if the mouse is over a viewport.


any item (scene node) currently under the mouse pointer.


The coordinates of the mouse. When <window> returns #max, point: will be in screen coordinates. When <window> returns #viewport, point will be the coordinates within the viewport.

If supplied, the 'droppable' handler is called continuously while the i-drop control is dragged over the MAX viewport, and should return true or false depending on whether the item is droppable at that position. If the mouse is not over a scene node, the <item> argument value is undefined. You implement the 'droppable' filter if the dropScript wants to limit droppability in any way.

The 'drop' handler is called when the user finally drops the i-drop control over a viewport and is given the same parameters as 'droppable'.

For example, currently for viewport windows, the full signatures are:

on droppable window node: point: do ...

on drop window node: point: do ...

but since keyword arguments are optional, you can choose any subset of the keyword arguments you need, such as:

on drop window node: do ...


on drop window do ...

Passing by keyword like this allows different context windows to supply a variable and large range of context info without requiring an unwieldy and fixed set of positional args.


Here is a sample 'foo.ds' file.

macroScript foo


on droppable window node: return

window == #viewport and

node != undefined and

classOf node == sphere

on drop window item do


node.scale *= 1.2

node.material = meditmaterials[1]



The droppable handle only allows dropping when the mouse is over a sphere scene node. When dropped, that sphere will be scaled up by 1.2 and be assigned the material currently in slot 1 in the material editor.