Main Menu

Scripting Wishlist

Started by sethcshort, May 24, 2017, 10:35:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sethcshort

Hi! I have a few scripting features I'd love to see in future releases, so I thought I'd list them here.

1. Have the lux.importFile() return a reference to the node that was imported.
Script example:

node = lux.importFile(filename, opts = opts)                   # function returns the node reference
node.addToGroup(myGroup)
nodeArray.append(node)
node.setMaterial("Matte White")
node.applyTransform(newMatrix, absolute = True)


2. Add the ability to aquire the transform matrix of a node, so it can be stored and applied to other nodes
Script example:

newMatrix = luxmath.Matrix().makeIdentity(node.getTransform())    # getTransform() = transform matrix of node
# or, perhaps:
newMatrix = node.getTransform()
matrixArray.append(newMatrix)
newNode.applyTransform(newMatrix)


3. Similarly, add the ability to capture individual transforms from a node, to store them, do math, apply to new nodes, etc
Script example:

nodePosition = luxmath.Vector(node.getPosition())    # getPosition() , getRotation() -- get vectors from node
nodeRotation = luxmath.Vector(node.getRotation())
newPosition = nodePosition.translate(luxmath.Vector((1, 2, 3)))
newRotation = nodeRotation.rotate(luxmath.Vector((0, 0, 90)), left = true)
newMatrix = luxmath.Matrix().makeIdentity()
newMatrix.setTransformation(trans = newPosition, rotate = newRotation)
node.applyTransform(newMatrix)


4. Allow the ability to create new groups and geometry, similar to how we can create new cameras
Example:

lux.newGroup("myNewGroup")
lux.newGeometry("myNewSphere", type = sphere)
# or, attach to existing nodes
myGroup = node.newGroup("myNewGroup")
print(myGroup.getName())    # returns "node.myNewGroup" or similar


As I encounter more, I'll add to this list.

Thanks!
Seth