Slack Coding Channel

From The Foundry MODO SDK wiki
Revision as of 17:12, 13 February 2019 by Cgolchert (Talk | contribs)

Jump to: navigation, search

<Parked page for any insights on the slack developer channel>



Drop script - Feb 13 2019

Allows a Python script to be executed on the drag and drop. Source will be called when this item is dragged on to others in the 3D viewport, and Destination will be called when others are dragged onto this one. The Source and Destination item is passed as an argument to the script, and can be received using lx.args(). For example, this script will print out the source and destination of the drag and drop, and then call the parent command to parent the destination to the source. You get the source and destination item, what you do next is up to whatever you're trying to achieve.

import lx
source = lx.args()[0]
destination = lx.args()[1]
print "The Source item is: {}".format(source)
print "The Destination item is: {}".format(destination)
lx.eval("item.parent {} {} 0 inPlace:1 duplicate:0".format(source, destination))