a blog of links related to computer animation and production technology Sponsored by ReelMatters.com

Subscribe to PixelSham.com RSS for free

Basic GafferHQ python introduction

,

Working with the Python Scripting API
http://www.gafferhq.org/documentation/1.0.2.0/WorkingWithThePythonScriptingAPI/index.html

 

Node Graph editing in Python
https://www.gafferhq.org/documentation/1.0.0.0/WorkingWithThePythonScriptingAPI/TutorialNodeGraphEditingInPython/index.html

 

Common operations
https://www.gafferhq.org/documentation/1.0.0.0/Reference/ScriptingReference/CommonOperations/index.html

 

Scripting box nodes
https://blog.gafferhq.org/?p=278

 

Dev and pipe tips
https://blog.gafferhq.org/?cat=35

 

 

import GafferScene
import Gaffer

# return a list of selections
# (nodes HAVE TO BE selected for the following)
sel = root.selection() # gaffer standard set

list(sel)
sel[0].typeName()
dir( sel[0] )
sel[0].getName()
sel.clear()
root.removeChild( sel[0] )

# store the selected nodes in a variable
>>> sel = root.selection()
>>> myGroup = sel[0]
>>> light = sel[1]

# set location name
myGroup['name'].setValue('groupLocation')
light['name'].setValue('photometricLightLocation')
# connect a node to a group
>>> myGroup['in'][0].setInput( light['out'] )

# return the node/port attached to a group port
>>> myGroup['in'][0].childNames('/')
photometricLightLocation

>>> myGroup['in'][0].getInput().fullName()
>>> myGroup['in'][0].source().fullName()
gui.scripts.ScriptNode.lighting_in1.PhotometricLightNode.out

# return the full name of one of the objects
# attached to the out port
>>> light['out'].outputs()[0].fullName()
gui.scripts.ScriptNode.lighting_in1.GroupNode.in.in0

>>> light
GafferArnold.ArnoldLight( "PhotometricLightNode" )

>>> light['out'].childNames('')
photometricLightLocation

>>> light['out'].outputs()[0].node()
GafferScene.Group( "Group" )

Popular Searches unreal | pipeline | virtual production | free | learn | photoshop | 360 | macro | google | nvidia | resolution | open source | hdri | real-time | photography basics | nuke