本文整理汇总了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 )
示例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" } )
示例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())
示例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
示例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() )