本文整理汇总了Python中GafferSceneTest.connectTraverseSceneToContextChangedSignal方法的典型用法代码示例。如果您正苦于以下问题:Python GafferSceneTest.connectTraverseSceneToContextChangedSignal方法的具体用法?Python GafferSceneTest.connectTraverseSceneToContextChangedSignal怎么用?Python GafferSceneTest.connectTraverseSceneToContextChangedSignal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GafferSceneTest
的用法示例。
在下文中一共展示了GafferSceneTest.connectTraverseSceneToContextChangedSignal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testContextChangedAndGIL
# 需要导入模块: import GafferSceneTest [as 别名]
# 或者: from GafferSceneTest import connectTraverseSceneToContextChangedSignal [as 别名]
def testContextChangedAndGIL( self ) :
script = Gaffer.ScriptNode()
script["plane"] = GafferScene.Plane()
script["plane"]["divisions"].setValue( imath.V2i( 20 ) )
script["sphere"] = GafferScene.Sphere()
script["expression"] = Gaffer.Expression()
script["expression"].setExpression( "parent['sphere']['radius'] = context.get( 'minRadius', 0.1 ) + context.getFrame() + float( context['instancer:id'] )" )
script["instancer"] = GafferScene.Instancer()
script["instancer"]["in"].setInput( script["plane"]["out"] )
script["instancer"]["instance"].setInput( script["sphere"]["out"] )
script["instancer"]["parent"].setValue( "/plane" )
context = Gaffer.Context()
traverseConnection = Gaffer.ScopedConnection( GafferSceneTest.connectTraverseSceneToContextChangedSignal( script["instancer"]["out"], context ) )
with context :
context.setFrame( 10 )
context.setFramesPerSecond( 50 )
context.setTime( 1 )
context.set( "a", 1 )
context.set( "a", 2.0 )
context.set( "a", "a" )
context.set( "a", imath.V2i() )
context.set( "a", imath.V3i() )
context.set( "a", imath.V2f() )
context.set( "a", imath.V3f() )
context.set( "a", imath.Color3f() )
context.set( "a", IECore.BoolData( True ) )
context["b"] = 1
context["b"] = 2.0
context["b"] = "b"
context["b"] = imath.V2i()
context["b"] = imath.V3i()
context["b"] = imath.V2f()
context["b"] = imath.V3f()
context["b"] = imath.Color3f()
context["b"] = IECore.BoolData( True )
with Gaffer.BlockedConnection( traverseConnection ) :
# Must add it with the connection disabled, otherwise
# the addition causes a traversal, and then remove() gets
# all its results from the cache.
context["minRadius"] = 0.2
context.remove( "minRadius" )
with Gaffer.BlockedConnection( traverseConnection ) :
context["minRadius"] = 0.3
del context["minRadius"]