Dragging DropScripts from Toolbars

Drag-and-drop of dropScripts from the MAX toolbars is possible. DropScripts are simply macroScripts with 'on drop' and optionally 'on droppable' handlers, as defined above. If a macroScript button on a toolbar has an 'on drop' handler defined, you can drag that button off the toolbar to initiate dropScript drag-and-drop.

EXAMPLE

Here's a simple dropScript that applies a newly created brick material to the object that it is dropped on. Note that it also has an 'on execute' handler that does the same thing to the current selection. By providing both 'on drop' and 'on execute' handlers, you can make such a macroScript installable in menus, hotkeys and toolbars or droppable from toolbars, the web, etc.

   macroScript dropBricks category:"DropScripts" Icon:#("MAXScript", 3)
   (
   on droppable window node: return
   window == #viewport and node != undefined
   on drop window node: do
   node.material = standard diffuseMap:(bricks()) showInViewport:true
   on execute do if selection.count == 1 then
   $.material = standard diffuseMap:(bricks()) showInViewport:true
   )

Note the use of the 'showInViewport' property at material level.