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":
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.
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:
but since keyword arguments are optional, you can choose any subset of the keyword arguments you need, such as:
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.
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.