diff --git a/apps/screengrab/screengrab-1.py b/apps/screengrab/screengrab-1.py index 6c429619824..a1a63420bba 100644 --- a/apps/screengrab/screengrab-1.py +++ b/apps/screengrab/screengrab-1.py @@ -328,19 +328,19 @@ def _run( self, args ) : # Set up the scene expansion and selection. - GafferSceneUI.ContextAlgo.clearExpansion( script.context() ) + GafferSceneUI.ScriptNodeAlgo.setVisibleSet( script, GafferScene.VisibleSet() ) pathsToExpand = IECore.PathMatcher( list( args["scene"]["fullyExpandedPaths"] ) + list( args["scene"]["expandedPaths"] ) ) - GafferSceneUI.ContextAlgo.expand( script.context(), pathsToExpand ) + GafferSceneUI.ScriptNodeAlgo.expandInVisibleSet( script, pathsToExpand ) pathsToFullyExpand = IECore.PathMatcher( list( args["scene"]["fullyExpandedPaths"] ) ) with script.context() : for node in script.selection() : for scenePlug in [ p for p in node.children( GafferScene.ScenePlug ) if p.direction() == Gaffer.Plug.Direction.Out ] : - GafferSceneUI.ContextAlgo.expandDescendants( script.context(), pathsToFullyExpand, scenePlug ) + GafferSceneUI.ScriptNodeAlgo.expandDescendantsInVisibleSet( script, pathsToFullyExpand, scenePlug ) - GafferSceneUI.ContextAlgo.setSelectedPaths( script.context(), IECore.PathMatcher( args["scene"]["selectedPaths"] ) ) + GafferSceneUI.ScriptNodeAlgo.setSelectedPaths( script, IECore.PathMatcher( args["scene"]["selectedPaths"] ) ) # Add a delay. diff --git a/doc/source/GettingStarted/TutorialAssemblingTheGafferBot/screengrab.py b/doc/source/GettingStarted/TutorialAssemblingTheGafferBot/screengrab.py index 2871ab1182a..941a422dc84 100644 --- a/doc/source/GettingStarted/TutorialAssemblingTheGafferBot/screengrab.py +++ b/doc/source/GettingStarted/TutorialAssemblingTheGafferBot/screengrab.py @@ -75,23 +75,23 @@ def __delay( delay ) : GafferUI.WidgetAlgo.grab( widget = scriptWindow, imagePath = "images/viewerSceneReaderBounding.png" ) # GafferBot torso in Hierarchy View -GafferSceneUI.ContextAlgo.setExpandedPaths( script.context(), IECore.PathMatcher( [ "/GAFFERBOT", "/GAFFERBOT/C_torso_GRP" ] ) ) +GafferSceneUI.ScriptNodeAlgo.setVisibleSet( script, GafferScene.VisibleSet( expansions = IECore.PathMatcher( [ "/GAFFERBOT", "/GAFFERBOT/C_torso_GRP" ] ) ) ) __delay( 0.1 ) GafferUI.WidgetAlgo.grab( widget = hierarchyView, imagePath = "images/hierarchyViewExpandedTwoLevels.png" ) # GafferBot head and left leg in main window paths = IECore.PathMatcher( [ "/GAFFERBOT/C_torso_GRP/C_head_GRP", "/GAFFERBOT/C_torso_GRP/R_legUpper_GRP" ] ) -GafferSceneUI.ContextAlgo.expand( script.context(), paths ) -GafferSceneUI.ContextAlgo.expandDescendants( script.context(), paths, script["SceneReader"]["out"] ) -GafferSceneUI.ContextAlgo.expandDescendants( script.context(), paths, readerNode["out"] ) +GafferSceneUI.ScriptNodeAlgo.expandInVisibleSet( script, paths ) +GafferSceneUI.ScriptNodeAlgo.expandDescendantsInVisibleSet( script, paths, script["SceneReader"]["out"] ) +GafferSceneUI.ScriptNodeAlgo.expandDescendantsInVisibleSet( script, paths, readerNode["out"] ) viewer.view().viewportGadget().getPrimaryChild().waitForCompletion() GafferUI.WidgetAlgo.grab( widget = scriptWindow, imagePath = "images/mainHeadAndLeftLegExpanded.png" ) # GafferBot head and both legs in Viewer paths = IECore.PathMatcher( [ "/GAFFERBOT/C_torso_GRP/L_legUpper_GRP" ] ) -GafferSceneUI.ContextAlgo.expand( script.context(), paths ) -GafferSceneUI.ContextAlgo.expandDescendants( script.context(), paths, readerNode["out"] ) -GafferSceneUI.ContextAlgo.setSelectedPaths( script.context(), paths ) +GafferSceneUI.ScriptNodeAlgo.expandInVisibleSet( script, paths ) +GafferSceneUI.ScriptNodeAlgo.expandDescendantsInVisibleSet( script, paths, readerNode["out"] ) +GafferSceneUI.ScriptNodeAlgo.setSelectedPaths( script, paths ) viewer.view().viewportGadget().getPrimaryChild().waitForCompletion() GafferUI.WidgetAlgo.grab( widget = viewer, imagePath = "images/viewerHeadAndLegsExpanded.png" ) @@ -115,15 +115,14 @@ def __delay( delay ) : script.selection().add( groupNode ) script.setFocus( groupNode ) viewer.view()["minimumExpansionDepth"].setValue( 999 ) -GafferSceneUI.ContextAlgo.clearExpansion( script.context() ) -GafferSceneUI.ContextAlgo.expand( script.context(), IECore.PathMatcher( [ "/group" ] ) ) +GafferSceneUI.ScriptNodeAlgo.setVisibleSet( script, GafferScene.VisibleSet( expansions = IECore.PathMatcher( [ "/group" ] ) ) ) viewer.view().viewportGadget().getPrimaryChild().waitForCompletion() GafferUI.WidgetAlgo.grab( widget = scriptWindow, imagePath = "images/mainGroupNode.png" ) # Camera repositioned, with translate tool on, in Viewer cameraNode["transform"]["translate"].setValue( imath.V3f( 16, 13, 31 ) ) viewer.view().viewportGadget().frame( groupNode["out"].bound( "/group" ) ) -GafferSceneUI.ContextAlgo.setSelectedPaths( script.context(), IECore.PathMatcher( [ "/group/camera" ] ) ) +GafferSceneUI.ScriptNodeAlgo.setSelectedPaths( script, IECore.PathMatcher( [ "/group/camera" ] ) ) for i in viewer._Viewer__toolChooser.tools(): if type( i ) == GafferSceneUI.TranslateTool: translateTool = i @@ -252,7 +251,7 @@ def __renderAndGrab( script, widget, imagePath, delay = 15 ) : script.selection().add( script["ShaderAssignment1"] ) script.setFocus( script["ShaderAssignment1"] ) paths = IECore.PathMatcher( [ "/group/GAFFERBOT/C_torso_GRP/C_head_GRP/C_head_CPT/C_browNose001_REN", "/group/GAFFERBOT/C_torso_GRP/C_head_GRP/C_head_CPT/C_mouthGrill001_REN" ] ) -GafferSceneUI.ContextAlgo.setSelectedPaths( script.context(), paths ) +GafferSceneUI.ScriptNodeAlgo.setSelectedPaths( script, paths ) GafferUI.EventLoop.waitForIdle() paths = IECore.PathMatcher( [ "/group/GAFFERBOT/C_torso_GRP/C_head_GRP/C_head_CPT" ] ) viewer.view().frame( paths, direction = imath.V3f( -0.2, -0.2, -1 ) ) diff --git a/doc/source/WorkingWithScenes/AnatomyOfACamera/screengrab.py b/doc/source/WorkingWithScenes/AnatomyOfACamera/screengrab.py index 29061c413a6..47c65a9b056 100644 --- a/doc/source/WorkingWithScenes/AnatomyOfACamera/screengrab.py +++ b/doc/source/WorkingWithScenes/AnatomyOfACamera/screengrab.py @@ -29,8 +29,7 @@ script.selection().add( script["Camera"] ) __path = "/camera" -__paths = IECore.PathMatcher( [ __path ] ) -GafferSceneUI.ContextAlgo.expand( script.context(), __paths ) +GafferSceneUI.ScriptNodeAlgo.expandInVisibleSet( script, IECore.PathMatcher( [ __path ] ) ) from GafferSceneUI.SceneInspector import __TransformSection, __BoundSection, __ObjectSection, __AttributesSection, __SetMembershipSection diff --git a/doc/source/WorkingWithScenes/AnatomyOfAScene/screengrab.py b/doc/source/WorkingWithScenes/AnatomyOfAScene/screengrab.py index 3b5cd4d75b8..e80a87049f6 100644 --- a/doc/source/WorkingWithScenes/AnatomyOfAScene/screengrab.py +++ b/doc/source/WorkingWithScenes/AnatomyOfAScene/screengrab.py @@ -43,11 +43,11 @@ def __delay( delay ) : # The Scene Inspector __paths = IECore.PathMatcher( [ __path ] ) -GafferSceneUI.ContextAlgo.expand( script.context(), __paths ) -GafferSceneUI.ContextAlgo.expandDescendants( script.context(), __paths, script["SceneReader"]["out"] ) -GafferSceneUI.ContextAlgo.setSelectedPaths( script.context(), __paths ) +GafferSceneUI.ScriptNodeAlgo.expandInVisibleSet( script, __paths ) +GafferSceneUI.ScriptNodeAlgo.expandDescendantsInVisibleSet( script, __paths, script["SceneReader"]["out"] ) +GafferSceneUI.ScriptNodeAlgo.setSelectedPaths( script, __paths ) scriptWindow = GafferUI.ScriptWindow.acquire( script ) -GafferSceneUI.ContextAlgo.setExpandedPaths( script.context(), IECore.PathMatcher( [ __path ] ) ) +GafferSceneUI.ScriptNodeAlgo.setVisibleSet( script, GafferScene.VisibleSet( expansions = IECore.PathMatcher( [ __path ] ) ) ) hierarchyView = scriptWindow.getLayout().editors( GafferSceneUI.HierarchyView )[0] __delay( 1.0 ) GafferUI.WidgetAlgo.grab( widget = hierarchyView, imagePath = "images/hierarchyView.png" ) diff --git a/doc/source/WorkingWithScenes/Camera/screengrab.py b/doc/source/WorkingWithScenes/Camera/screengrab.py index bb3d6152211..91d8e3ea600 100644 --- a/doc/source/WorkingWithScenes/Camera/screengrab.py +++ b/doc/source/WorkingWithScenes/Camera/screengrab.py @@ -71,8 +71,8 @@ def __dispatchScript( script, tasks, settings ) : __delay( 0.1 ) viewer.view()["grid"]["visible"].setValue( False ) paths = IECore.PathMatcher( [ "/camera" ] ) -GafferSceneUI.ContextAlgo.expand( script.context(), paths ) -GafferSceneUI.ContextAlgo.setSelectedPaths( script.context(), paths ) +GafferSceneUI.ScriptNodeAlgo.expandInVisibleSet( script, paths ) +GafferSceneUI.ScriptNodeAlgo.setSelectedPaths( script, paths ) viewer.view().viewportGadget().getPrimaryChild().waitForCompletion() GafferUI.WidgetAlgo.grab( widget = viewer, imagePath = "images/interfaceCameraVisualizer.png" ) script.selection().clear() diff --git a/doc/source/WorkingWithScenes/LightLinking/screengrab.py b/doc/source/WorkingWithScenes/LightLinking/screengrab.py index 7f3102a167d..81d4ddc01bd 100644 --- a/doc/source/WorkingWithScenes/LightLinking/screengrab.py +++ b/doc/source/WorkingWithScenes/LightLinking/screengrab.py @@ -53,7 +53,7 @@ script.selection().add( script["StandardAttributes"] ) __path = "/group/sphere" __paths = IECore.PathMatcher( [ __path ] ) -GafferSceneUI.ContextAlgo.setSelectedPaths( script.context(), __paths ) +GafferSceneUI.ScriptNodeAlgo.setSelectedPaths( script, __paths ) from GafferSceneUI.SceneInspector import __AttributesSection diff --git a/doc/source/WorkingWithTheNodeGraph/Contexts/screengrab.py b/doc/source/WorkingWithTheNodeGraph/Contexts/screengrab.py index eb4c4597cc6..21e7811f858 100644 --- a/doc/source/WorkingWithTheNodeGraph/Contexts/screengrab.py +++ b/doc/source/WorkingWithTheNodeGraph/Contexts/screengrab.py @@ -106,7 +106,7 @@ def __delay( delay ) : __delay( 0.1 ) # Concept: Querying results -GafferSceneUI.ContextAlgo.setSelectedPaths( script.context(), IECore.PathMatcher( [ "/cube2" ] ) ) +GafferSceneUI.ScriptNodeAlgo.setSelectedPaths( script, IECore.PathMatcher( [ "/cube2" ] ) ) #sceneInspector.reveal() # Expand the "Transform" section #sceneInspector._SceneInspector__sections[2]._Section__collapsible.setCollapsed( False ) diff --git a/doc/source/WorkingWithThePythonScriptingAPI/TutorialNodeGraphEditingInPython/screengrab.py b/doc/source/WorkingWithThePythonScriptingAPI/TutorialNodeGraphEditingInPython/screengrab.py index 2eed4a53ebe..f167b592733 100644 --- a/doc/source/WorkingWithThePythonScriptingAPI/TutorialNodeGraphEditingInPython/screengrab.py +++ b/doc/source/WorkingWithThePythonScriptingAPI/TutorialNodeGraphEditingInPython/screengrab.py @@ -98,7 +98,7 @@ def __delay( delay ) : script["Camera"]["transform"]["translate"]["z"].setValue( 8 ) script.setFocus( script["Camera"] ) paths = IECore.PathMatcher( [ "/camera" ] ) -GafferSceneUI.ContextAlgo.setSelectedPaths( script.context(), paths ) +GafferSceneUI.ScriptNodeAlgo.setSelectedPaths( script, paths ) __delay( 0.1 ) GafferUI.WidgetAlgo.grab( widget = viewer, imagePath = "images/viewerCameraPosition.png" ) @@ -125,8 +125,8 @@ def __delay( delay ) : # Final script in Viewer script.setFocus( script["Group"] ) paths = IECore.PathMatcher( [ "/group" ] ) -GafferSceneUI.ContextAlgo.setExpandedPaths( script.context(), paths ) -GafferSceneUI.ContextAlgo.expandDescendants( script.context(), paths, script["Group"]["out"] ) +GafferSceneUI.ScriptNodeAlgo.setVisibleSet( script, GafferScene.VisibleSet( expansions = paths ) ) +GafferSceneUI.ScriptNodeAlgo.expandDescendantsInVisibleSet( script, paths, script["Group"]["out"] ) __delay( 0.1 ) GafferUI.WidgetAlgo.grab( widget = viewer, imagePath = "images/viewerFinalScene.png" ) diff --git a/doc/source/WorkingWithThePythonScriptingAPI/TutorialStartupConfig1/screengrab.py b/doc/source/WorkingWithThePythonScriptingAPI/TutorialStartupConfig1/screengrab.py index e10d8fb857a..3afd41a2207 100644 --- a/doc/source/WorkingWithThePythonScriptingAPI/TutorialStartupConfig1/screengrab.py +++ b/doc/source/WorkingWithThePythonScriptingAPI/TutorialStartupConfig1/screengrab.py @@ -103,6 +103,6 @@ def __dispatchScript( script, tasks, settings ) : viewer.view().viewportGadget().frame( script["SceneReader"]["out"].bound( "/" ) ) viewer.view().viewportGadget().getPrimaryChild().waitForCompletion() paths = IECore.PathMatcher( [ "/" ] ) - GafferSceneUI.ContextAlgo.expand( script.context(), paths ) - GafferSceneUI.ContextAlgo.expandDescendants( script.context(), paths, script["SceneReader"]["out"] ) + GafferSceneUI.ScriptNodeAlgo.expandInVisibleSet( script, paths ) + GafferSceneUI.ScriptNodeAlgo.expandDescendantsInVisibleSet( script, paths, script["SceneReader"]["out"] ) GafferUI.WidgetAlgo.grab( widget = scriptWindow, imagePath = "images/tutorialVariableSubstitutionTest.png" )