Slack Coding Channel

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

Topics

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.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#python

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))

VirtualModel - Feb 15 2019

You can implement a VirtualModel, which allows you to do stroke drawing, independent of an item or tool.

Let’s say for example you wanted to draw a heads up display, similar to the channel haul tool, you’d do that through a virtual model, and use the standard stroke drawing methods to draw things like simple shapes or lines.

We also have the [http://sdk.luxology.com/wiki/Drawover_(lx-drawover.hpp) DrawingOverride] object, which allows you to any kind of drawing using standard gl calls. I _think_ it has to be associated with an item. There’s a sample in the SDK called cc_drawover_pass.cpp that just draws a coloured triangle using standard calls like glBindBuffer.

The downside of DrawingOverride is that if we change the underlying implementation to something other than GL, your code will no longer work.