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


Python GafferScene.matchingPaths方法代码示例

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


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

示例1: test

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

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

		plane2 = GafferScene.Plane()
		plane2["divisions"].setValue( IECore.V2i( 99, 99 ) ) # 10000 instances

		instancer = GafferScene.Instancer()
		instancer["in"].setInput( plane2["out"] )
		instancer["parent"].setValue( "/plane" )
		instancer["instance"].setInput( group["out"] )

		filter = GafferScene.PathFilter()
		filter["paths"].setValue( IECore.StringVectorData( [ "/plane/instances/*1/group/plane" ] ) )

		matchingPaths = GafferScene.PathMatcher()
		GafferScene.matchingPaths( filter, instancer["out"], matchingPaths )

		self.assertEqual( len( matchingPaths.paths() ), 1000 )
		self.assertEqual( matchingPaths.match( "/plane/instances/1/group/plane" ), GafferScene.Filter.Result.ExactMatch )
		self.assertEqual( matchingPaths.match( "/plane/instances/1121/group/plane" ), GafferScene.Filter.Result.ExactMatch )
		self.assertEqual( matchingPaths.match( "/plane/instances/1121/group/sphere" ), GafferScene.Filter.Result.NoMatch )
开发者ID:mor-vfx,项目名称:gaffer,代码行数:28,代码来源:SceneAlgoTest.py

示例2: testMatchingPathsWithPathMatcher

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

		s = GafferScene.Sphere()
		g = GafferScene.Group()
		g["in"][0].setInput( s["out"] )
		g["in"][1].setInput( s["out"] )
		g["in"][2].setInput( s["out"] )

		f = GafferScene.PathMatcher( [ "/group/s*" ] )
		m = GafferScene.PathMatcher()
		GafferScene.matchingPaths( f, g["out"], m )

		self.assertEqual( set( m.paths() ), { "/group/sphere", "/group/sphere1", "/group/sphere2" } )
开发者ID:HughMacdonald,项目名称:gaffer,代码行数:15,代码来源:SceneAlgoTest.py

示例3: __selectAffected

# 需要导入模块: import GafferScene [as 别名]
# 或者: from GafferScene import matchingPaths [as 别名]
def __selectAffected(node, context):

    if isinstance(node, GafferScene.FilteredSceneProcessor):
        filter = node["filter"]
        scenes = [node["in"]]
    else:
        filter = node
        scenes = []

        def walkOutputs(plug):
            for output in plug.outputs():
                node = output.node()
                if isinstance(node, GafferScene.FilteredSceneProcessor) and output.isSame(node["filter"]):
                    scenes.append(node["in"])
                walkOutputs(output)

        walkOutputs(filter["out"])

    pathMatcher = GafferScene.PathMatcher()
    with context:
        for scene in scenes:
            GafferScene.matchingPaths(filter, scene, pathMatcher)

    context["ui:scene:selectedPaths"] = IECore.StringVectorData(pathMatcher.paths())
开发者ID:hradec,项目名称:gaffer,代码行数:26,代码来源:FilteredSceneProcessorUI.py

示例4: _run

# 需要导入模块: import GafferScene [as 别名]
# 或者: from GafferScene import matchingPaths [as 别名]

#.........这里部分代码省略.........
			editors = scriptWindow.getLayout().editors( editor )
			if not editors :
				IECore.msg( IECore.Msg.Level.Error, "screengrab", "Unable to find an editor of type \"%s\"" % editor )
				return 1

			if args["panel"].value :
				self.setGrabWidget( editors[0].parent() )
			else :
				self.setGrabWidget( editors[0] )

			editors[0].reveal()

		# Set up some default framing for the node graphs.

		self.__waitForIdle()

		for nodeGraph in scriptWindow.getLayout().editors( GafferUI.NodeGraph ) :
			if args["nodeGraph"]["frame"] :
				nodeGraph.frame( [ script.descendant( n ) for n in args["nodeGraph"]["frame"] ] )
			else :
				nodeGraph.frame( script.children( Gaffer.Node ) )

		# Set up the NodeEditors as requested.

		for nodeEditor in scriptWindow.getLayout().editors( GafferUI.NodeEditor ) :

			for name in args["nodeEditor"]["reveal"] :
				plugValueWidget = nodeEditor.nodeUI().plugValueWidget( script.descendant( name ) )
				plugValueWidget.reveal()

			if args["nodeEditor"]["grab"].value :
				grabWidget = nodeEditor.nodeUI().plugValueWidget( script.descendant( args["nodeEditor"]["grab"].value ) )
				grabWidget = grabWidget.ancestor( GafferUI.PlugWidget ) or grabWidget
				grabWidget.reveal()
				self.setGrabWidget( grabWidget )

		# Set up the ScriptEditors as requested.

		for scriptEditor in scriptWindow.getLayout().editors( GafferUI.ScriptEditor ) :

			if args["scriptEditor"]["execute"].value :
				scriptEditor.inputWidget().setText( args["scriptEditor"]["execute"].value )
				scriptEditor.inputWidget()._qtWidget().selectAll()
				scriptEditor.execute()

		# Set up the Viewers as requested.

		for viewer in scriptWindow.getLayout().editors( GafferUI.Viewer ) :
			if isinstance( viewer.view(), GafferSceneUI.SceneView ) :
				viewer.view()["minimumExpansionDepth"].setValue( args["viewer"]["minimumExpansionDepth"].value )
				if args["viewer"]["framedObjects"] :
					bound = IECore.Box3f()
					for path in args["viewer"]["framedObjects"] :
						objectBound = viewer.view()["in"].bound( path )
						objectFullTransform = viewer.view()["in"].fullTransform( path )
						bound.extendBy( objectBound.transform( objectFullTransform ) )
					viewer.view().viewportGadget().frame( bound, args["viewer"]["viewDirection"].value.normalized() )

		del viewer

		# Set up the scene expansion and selection.

		pathsToExpand = GafferScene.PathMatcher()

		for path in list( args["scene"]["fullyExpandedPaths"] ) + list( args["scene"]["expandedPaths"] ) :
			# Add paths and all their ancestors.
			while path :
				pathsToExpand.addPath( path )
				path = path.rpartition( "/" )[0]

		fullyExpandedPathsFilter = GafferScene.PathFilter()
		fullyExpandedPathsFilter["paths"].setValue(
			IECore.StringVectorData( [ path + "/..." for path in args["scene"]["fullyExpandedPaths"] ] )
		)
		for node in script.selection() :
			for scenePlug in [ p for p in node.children( GafferScene.ScenePlug ) if p.direction() == Gaffer.Plug.Direction.Out ] :
				GafferScene.matchingPaths( fullyExpandedPathsFilter, scenePlug, pathsToExpand )

		script.context()["ui:scene:expandedPaths"] = GafferScene.PathMatcherData( pathsToExpand )
		script.context()["ui:scene:selectedPaths"] = args["scene"]["selectedPaths"]

		# Write the image, creating a directory for it if necessary.

		self.__waitForIdle()

		imageDir = os.path.dirname( args["image"].value )
		if imageDir and not os.path.isdir( imageDir ) :
			IECore.msg( IECore.Msg.Level.Info, "screengrab", "Creating target directory [ %s ]" % imageDir )
			os.makedirs( imageDir )

		pixmap = QtGui.QPixmap.grabWindow( self.getGrabWidget()._qtWidget().winId() )
		IECore.msg( IECore.Msg.Level.Info, "screengrab", "Writing image [ %s ]" % args["image"].value )
		pixmap.save( args["image"].value )

		# Remove the script and any reference to the grab widget up so
		# we can shut down cleanly.
		self.root()["scripts"].clearChildren()
		self.setGrabWidget( None )

		return 0
开发者ID:Kthulhu,项目名称:gaffer,代码行数:104,代码来源:screengrab-1.py

示例5: __selectAffected

# 需要导入模块: import GafferScene [as 别名]
# 或者: from GafferScene import matchingPaths [as 别名]
def __selectAffected( node, context ) :

	with context :
		pathMatcher = GafferScene.PathMatcher()
		GafferScene.matchingPaths( node["filter"], node["in"], pathMatcher )
		context["ui:scene:selectedPaths"] = IECore.StringVectorData( pathMatcher.paths() )
开发者ID:cedriclaunay,项目名称:gaffer,代码行数:8,代码来源:FilteredSceneProcessorUI.py


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