import math from Gaffer.Expression import Expression expression = Expression() expression["engine"].setValue("python") expression["expression"].setValue("math.sin(context.getTime()) + 1") expression["out"].setInput(node["transform"]["scale"])
from Gaffer.Expression import Expression expression = Expression() expression["engine"].setValue("python") expression["expression"].setValue("parent['control'].getValue() == 1") expression["out"].setInput(node["object"]["visible"])In this example, the visibility attribute of an object is controlled based on the value of a control attribute. If the control attribute is 1, the object is visible, and if it is 0, the object is hidden. Python Gaffer Expression is part of the Gaffer software suite and comes as part of a Python package library that includes various modules and functions to handle data, rendering, and advanced graphics processing.