當前位置: 首頁>>代碼示例>>Python>>正文


Python GafferSceneTest.traverseScene方法代碼示例

本文整理匯總了Python中GafferSceneTest.traverseScene方法的典型用法代碼示例。如果您正苦於以下問題:Python GafferSceneTest.traverseScene方法的具體用法?Python GafferSceneTest.traverseScene怎麽用?Python GafferSceneTest.traverseScene使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在GafferSceneTest的用法示例。


在下文中一共展示了GafferSceneTest.traverseScene方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __writeScene

# 需要導入模塊: import GafferSceneTest [as 別名]
# 或者: from GafferSceneTest import traverseScene [as 別名]
	def __writeScene( self, script, args ) :

		import GafferScene
		import GafferSceneTest

		scene = script.descendant( args["scene"].value )
		if isinstance( scene, Gaffer.Node ) :
			scene = next( ( x for x in scene.children( GafferScene.ScenePlug ) ), None )

		if scene is None :
			IECore.msg( IECore.Msg.Level.Error, "stats", "Scene \"%s\" does not exist" % args["scene"].value )
			return

		if args["preCache"].value :
			GafferSceneTest.traverseScene( scene )

		memory = _Memory.maxRSS()
		with _Timer() as sceneTimer :
			with self.__performanceMonitor or _NullContextManager(), self.__contextMonitor or _NullContextManager() :
				with Gaffer.Context( script.context() ) as context :
					for frame in self.__frames( script, args ) :
						context.setFrame( frame )
						GafferSceneTest.traverseScene( scene )

		self.__timers["Scene generation"] = sceneTimer
		self.__memory["Scene generation"] = _Memory.maxRSS() - memory
開發者ID:lucienfostier,項目名稱:gaffer,代碼行數:28,代碼來源:stats-1.py

示例2: computeScene

# 需要導入模塊: import GafferSceneTest [as 別名]
# 或者: from GafferSceneTest import traverseScene [as 別名]
		def computeScene() :

			with self.__context( script, args ) as context :
				for frame in self.__frames( script, args ) :
					context.setFrame( frame )
					if args["sets"] :
						GafferScene.SceneAlgo.sets( scene, args["sets"] )
					else :
						GafferSceneTest.traverseScene( scene )
開發者ID:appleseedhq,項目名稱:gaffer,代碼行數:11,代碼來源:stats-1.py

示例3: computeScene

# 需要導入模塊: import GafferSceneTest [as 別名]
# 或者: from GafferSceneTest import traverseScene [as 別名]
		def computeScene() :

			with self.__context( script, args ) as context :
				for frame in self.__frames( script, args ) :
					context.setFrame( frame )

					if isinstance( scene, GafferDispatch.TaskNode.TaskPlug ) :
						context["scene:render:sceneTranslationOnly"] = IECore.BoolData( True )
						scene.execute()
					else :
						if args["sets"] :
							GafferScene.SceneAlgo.sets( scene, args["sets"] )
						else :
							GafferSceneTest.traverseScene( scene )
開發者ID:andrewkaufman,項目名稱:gaffer,代碼行數:16,代碼來源:stats-1.py

示例4: testThreading

# 需要導入模塊: import GafferSceneTest [as 別名]
# 或者: from GafferSceneTest import traverseScene [as 別名]
    def testThreading(self):

        sphere = IECore.SpherePrimitive()
        instanceInput = GafferSceneTest.CompoundObjectSource()
        instanceInput["in"].setValue(
            IECore.CompoundObject(
                {
                    "bound": IECore.Box3fData(IECore.Box3f(IECore.V3f(-2), IECore.V3f(2))),
                    "children": {
                        "sphere": {
                            "object": sphere,
                            "bound": IECore.Box3fData(sphere.bound()),
                            "transform": IECore.M44fData(IECore.M44f.createScaled(IECore.V3f(2))),
                        }
                    },
                }
            )
        )

        seeds = IECore.PointsPrimitive(
            IECore.V3fVectorData([IECore.V3f(1, 0, 0), IECore.V3f(1, 1, 0), IECore.V3f(0, 1, 0), IECore.V3f(0, 0, 0)])
        )
        seedsInput = GafferSceneTest.CompoundObjectSource()
        seedsInput["in"].setValue(
            IECore.CompoundObject(
                {
                    "bound": IECore.Box3fData(IECore.Box3f(IECore.V3f(1, 0, 0), IECore.V3f(2, 1, 0))),
                    "children": {
                        "seeds": {
                            "bound": IECore.Box3fData(seeds.bound()),
                            "transform": IECore.M44fData(IECore.M44f.createTranslated(IECore.V3f(1, 0, 0))),
                            "object": seeds,
                        }
                    },
                }
            )
        )

        instancer = GafferScene.Instancer()
        instancer["in"].setInput(seedsInput["out"])
        instancer["instance"].setInput(instanceInput["out"])
        instancer["parent"].setValue("/seeds")
        instancer["name"].setValue("instances")

        GafferSceneTest.traverseScene(instancer["out"])
開發者ID:mor-vfx,項目名稱:gaffer,代碼行數:47,代碼來源:InstancerTest.py

示例5: __printScene

# 需要導入模塊: import GafferSceneTest [as 別名]
# 或者: from GafferSceneTest import traverseScene [as 別名]
    def __printScene(self, script, args):

        import GafferScene
        import GafferSceneTest

        scene = script.descendant(args["scene"].value)
        if isinstance(scene, Gaffer.Node):
            scene = next((x for x in scene.children(GafferScene.ScenePlug)), None)

        if scene is None:
            IECore.msg(IECore.Msg.Level.Error, "stats", 'Scene "%s" does not exist' % args["scene"].value)
            return

        memory = _Memory.maxRSS()
        with _Timer() as sceneTimer:
            with self.__performanceMonitor or _NullContextManager():
                GafferSceneTest.traverseScene(scene)
        self.__timers["Scene generation"] = sceneTimer
        self.__memory["Scene generation"] = _Memory.maxRSS() - memory
開發者ID:HughMacdonald,項目名稱:gaffer,代碼行數:21,代碼來源:stats-1.py

示例6: testAlembicThreading

# 需要導入模塊: import GafferSceneTest [as 別名]
# 或者: from GafferSceneTest import traverseScene [as 別名]
	def testAlembicThreading( self ) :

		mesh = IECoreScene.MeshPrimitive.createPlane( imath.Box2f( imath.V2f( -1 ), imath.V2f( 1 ) ) )
		fileName = self.temporaryDirectory() + "/test.abc"

		root = IECoreScene.SceneInterface.create( fileName, IECore.IndexedIO.OpenMode.Write )
		root.writeBound( imath.Box3d( mesh.bound() ), 0 )
		for i in range( 0, 1000 ) :
			child = root.createChild( str( i ) )
			child.writeObject( mesh, 0 )
			child.writeBound( imath.Box3d( mesh.bound() ), 0 )

		del root, child

		sceneReader = GafferScene.SceneReader()
		sceneReader["fileName"].setValue( fileName )

		for i in range( 0, 20 ) :
			sceneReader["refreshCount"].setValue( sceneReader["refreshCount"].getValue() + 1 )
			GafferSceneTest.traverseScene( sceneReader["out"] )
開發者ID:andrewkaufman,項目名稱:gaffer,代碼行數:22,代碼來源:SceneReaderTest.py

示例7: testNameClashesWithThreading

# 需要導入模塊: import GafferSceneTest [as 別名]
# 或者: from GafferSceneTest import traverseScene [as 別名]
	def testNameClashesWithThreading( self ) :

		sphere = IECoreScene.SpherePrimitive()
		input1 = GafferSceneTest.CompoundObjectSource()
		input1["in"].setValue(
			IECore.CompoundObject( {
				"bound" : IECore.Box3fData( sphere.bound() ),
				"children" : {
					"myLovelyObject1" : {
						"bound" : IECore.Box3fData( sphere.bound() ),
						"object" : sphere,
					},
				},
			} ),
		)

		plane = IECoreScene.MeshPrimitive.createPlane( imath.Box2f( imath.V2f( -1 ), imath.V2f( 1 ) ) )
		input2 = GafferSceneTest.CompoundObjectSource()
		input2["in"].setValue(
			IECore.CompoundObject( {
				"bound" : IECore.Box3fData( plane.bound() ),
				"children" : {
					"myLovelyObject1" : {
						"bound" : IECore.Box3fData( plane.bound() ),
						"object" : plane,
					},
				},
			} ),
		)

		group = GafferScene.Group()
		group["name"].setValue( "topLevel" )
		group["in"][0].setInput( input1["out"] )
		group["in"][1].setInput( input2["out"] )

		GafferSceneTest.traverseScene( group["out"] )
開發者ID:mattigruener,項目名稱:gaffer,代碼行數:38,代碼來源:GroupTest.py

示例8: traverser

# 需要導入模塊: import GafferSceneTest [as 別名]
# 或者: from GafferSceneTest import traverseScene [as 別名]
		def traverser() :

			try :
				GafferSceneTest.traverseScene( g["out"] )
			except Exception, e :
				exceptions.append( e )
開發者ID:HughMacdonald,項目名稱:gaffer,代碼行數:8,代碼來源:SceneNodeTest.py


注:本文中的GafferSceneTest.traverseScene方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。