本文整理匯總了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"]