当前位置: 首页>>代码示例>>Python>>正文


Python GafferScene.exists方法代码示例

本文整理汇总了Python中GafferScene.exists方法的典型用法代码示例。如果您正苦于以下问题:Python GafferScene.exists方法的具体用法?Python GafferScene.exists怎么用?Python GafferScene.exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GafferScene的用法示例。


在下文中一共展示了GafferScene.exists方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __update

# 需要导入模块: import GafferScene [as 别名]
# 或者: from GafferScene import exists [as 别名]
	def __update( self ) :

		self.__pendingUpdate = False
		
		assert( len( self.__scenePlugs ) <= 2 )
		
		if self.__targetPaths is not None :
			paths = self.__targetPaths
		else :
			paths = self.getContext().get( "ui:scene:selectedPaths", [] )
		paths = paths[:2] if len( self.__scenePlugs ) < 2 else paths[:1]
		if not paths :
			paths = [ "/" ]
			
		targets = []
		for scene in self.__scenePlugs :
			for path in paths :
				if not GafferScene.exists( scene, path ) :
					# selection may not be valid for both scenes,
					# and we can't inspect invalid paths.
					path = None
				targets.append( self.Target( scene, path ) )
		
		if next( (target.path for target in targets if target.path is not None), None ) is None :
			# all target paths have become invalid - if we're
			# in a popup window then close it.
			window = self.ancestor( _SectionWindow )
			if window is not None :
				window.parent().removeChild( window )
		
		with self.getContext() :
			for section in self.__sections :
				section.update( targets )
			
		return False # remove idle callback
开发者ID:dboogert,项目名称:gaffer,代码行数:37,代码来源:SceneInspector.py

示例2: testSetFilter

# 需要导入模块: import GafferScene [as 别名]
# 或者: from GafferScene import exists [as 别名]
    def testSetFilter(self):

        sphere = GafferScene.Sphere()
        sphere["sets"].setValue("A")

        filter = GafferScene.SetFilter()
        filter["set"].setValue("A")

        isolate = GafferScene.Isolate()
        isolate["in"].setInput(sphere["out"])
        isolate["filter"].setInput(filter["out"])

        self.assertSceneValid(isolate["out"])
        self.assertTrue(GafferScene.exists(isolate["out"], "/sphere"))
开发者ID:HughMacdonald,项目名称:gaffer,代码行数:16,代码来源:IsolateTest.py

示例3: testExists

# 需要导入模块: import GafferScene [as 别名]
# 或者: from GafferScene import exists [as 别名]
	def testExists( self ) :

		sphere = GafferScene.Sphere()
		plane = GafferScene.Plane()
		group = GafferScene.Group()
		group["in"][0].setInput( sphere["out"] )
		group["in"][1].setInput( plane["out"] )

		self.assertTrue( GafferScene.exists( group["out"], "/" ) )
		self.assertTrue( GafferScene.exists( group["out"], "/group" ) )
		self.assertTrue( GafferScene.exists( group["out"], "/group/sphere" ) )
		self.assertTrue( GafferScene.exists( group["out"], "/group/plane" ) )

		self.assertFalse( GafferScene.exists( group["out"], "/a" ) )
		self.assertFalse( GafferScene.exists( group["out"], "/group2" ) )
		self.assertFalse( GafferScene.exists( group["out"], "/group/sphere2" ) )
		self.assertFalse( GafferScene.exists( group["out"], "/group/plane/child" ) )
开发者ID:mor-vfx,项目名称:gaffer,代码行数:19,代码来源:SceneAlgoTest.py

示例4: __sourceTarget

# 需要导入模块: import GafferScene [as 别名]
# 或者: from GafferScene import exists [as 别名]
	def __sourceTarget( self, target ) :
	
		if isinstance( target.scene.node(), Gaffer.DependencyNode ) :
		
			sourceScene = target.scene.node().correspondingInput( target.scene )
			if sourceScene is None :
				return None
				
			sourceScene = sourceScene.source()
			if sourceScene.node() == target.scene.node() :
				return None
			
			if not GafferScene.exists( sourceScene, target.path ) :
				return None
			
			return SceneInspector.Target( sourceScene, target.path )
	
		return None
开发者ID:dboogert,项目名称:gaffer,代码行数:20,代码来源:SceneInspector.py

示例5: testKeepLightsAndCameras

# 需要导入模块: import GafferScene [as 别名]
# 或者: from GafferScene import exists [as 别名]
    def testKeepLightsAndCameras(self):

        # - group
        #    - light
        #    - camera
        #    - model1
        #       - sphere
        #       - light
        # 	 - model2
        #       - sphere
        #       - light

        light = GafferSceneTest.TestLight()
        light["sets"].setValue("lightsAndSpheres")

        sphere = GafferScene.Sphere()
        sphere["sets"].setValue("lightsAndSpheres")

        camera = GafferScene.Camera()

        model1 = GafferScene.Group()
        model1["in"][0].setInput(sphere["out"])
        model1["in"][1].setInput(light["out"])
        model1["name"].setValue("model1")

        model2 = GafferScene.Group()
        model2["in"][0].setInput(sphere["out"])
        model2["in"][1].setInput(light["out"])
        model2["name"].setValue("model2")

        group = GafferScene.Group()
        group["in"][0].setInput(light["out"])
        group["in"][1].setInput(camera["out"])
        group["in"][2].setInput(model1["out"])
        group["in"][3].setInput(model2["out"])

        self.assertSceneValid(group["out"])

        filter = GafferScene.PathFilter()
        filter["paths"].setValue(IECore.StringVectorData(["/group/model1"]))

        isolate = GafferScene.Isolate()
        isolate["in"].setInput(group["out"])
        isolate["filter"].setInput(filter["out"])

        # Keep neither

        self.assertSceneValid(isolate["out"])

        self.assertTrue(GafferScene.exists(isolate["out"], "/group/model1/sphere"))
        self.assertTrue(GafferScene.exists(isolate["out"], "/group/model1/light"))
        self.assertTrue(GafferScene.exists(isolate["out"], "/group/model1"))

        self.assertFalse(GafferScene.exists(isolate["out"], "/group/model2/sphere"))
        self.assertFalse(GafferScene.exists(isolate["out"], "/group/model2"))

        self.assertFalse(GafferScene.exists(isolate["out"], "/group/light"))
        self.assertFalse(GafferScene.exists(isolate["out"], "/group/camera"))

        self.assertEqual(isolate["out"].set("__lights").value.paths(), ["/group/model1/light"])
        self.assertEqual(isolate["out"].set("__cameras").value.paths(), [])
        self.assertEqual(
            isolate["out"].set("lightsAndSpheres").value,
            GafferScene.PathMatcher(["/group/model1/sphere", "/group/model1/light"]),
        )

        self.assertNotEqual(isolate["out"].setHash("__lights"), group["out"].setHash("__lights"))
        self.assertNotEqual(isolate["out"].setHash("__cameras"), group["out"].setHash("__cameras"))

        # Keep lights

        isolate["keepLights"].setValue(True)

        self.assertSceneValid(isolate["out"])

        self.assertFalse(GafferScene.exists(isolate["out"], "/group/camera"))

        self.assertEqual(isolate["out"].set("__lights"), group["out"].set("__lights"))
        self.assertEqual(isolate["out"].set("__cameras").value.paths(), [])
        self.assertEqual(
            isolate["out"].set("lightsAndSpheres").value,
            GafferScene.PathMatcher(["/group/model1/sphere"] + group["out"].set("__lights").value.paths()),
        )

        self.assertEqual(isolate["out"].setHash("__lights"), group["out"].setHash("__lights"))
        self.assertNotEqual(isolate["out"].setHash("__cameras"), group["out"].setHash("__cameras"))

        # Keep cameras too

        isolate["keepCameras"].setValue(True)

        self.assertSceneValid(isolate["out"])

        self.assertTrue(GafferScene.exists(isolate["out"], "/group/camera"))

        self.assertEqual(isolate["out"].set("__lights"), group["out"].set("__lights"))
        self.assertEqual(isolate["out"].set("__cameras"), group["out"].set("__cameras"))
        self.assertEqual(
            isolate["out"].set("lightsAndSpheres").value,
            GafferScene.PathMatcher(["/group/model1/sphere"] + group["out"].set("__lights").value.paths()),
#.........这里部分代码省略.........
开发者ID:HughMacdonald,项目名称:gaffer,代码行数:103,代码来源:IsolateTest.py


注:本文中的GafferScene.exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。