ImageEngine/gaffer — pull request #1008 by johnhaddon (2014-10-01 14:16:37+00:00)
Title: SceneInspector Sets 

This is my second attempt at the aborted https://github.com/ImageEngine/gaffer/pull/928, aimed at getting #895 done. Hopefully it makes some sense, but I wouldn't be surprised if it needs some refinement.

![sets](https://cloud.githubusercontent.com/assets/1133871/4476367/8380d5cc-4975-11e4-93d3-ab9e3713fab5.png)

Here's a script I was using during testing - it might be handy for review since it has sets with each kind of intersection/difference.

```
import Gaffer
import GafferRenderMan
import GafferScene
import IECore

__children = {}

__children["Plane"] = GafferScene.Plane( "Plane" )
parent.addChild( __children["Plane"] )
__children["Plane"]["transform"]["translate"].setValue( IECore.V3f( 1, 0, 0 ) )
__children["Plane"].addChild( Gaffer.V2fPlug( "__uiPosition", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Plane"]["__uiPosition"].setValue( IECore.V2f( -20.412653, -4.06634235 ) )
__children["Plane1"] = GafferScene.Plane( "Plane1" )
parent.addChild( __children["Plane1"] )
__children["Plane1"]["transform"]["translate"].setValue( IECore.V3f( 1.10000002, 0, 0 ) )
__children["Plane1"]["transform"]["rotate"].setValue( IECore.V3f( 0, 90.0449982, 0 ) )
__children["Plane1"]["divisions"].setValue( IECore.V2i( 2, 2 ) )
__children["Plane1"].addChild( Gaffer.V2fPlug( "__uiPosition", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Plane1"]["__uiPosition"].setValue( IECore.V2f( -6.4139967, -4.06634235 ) )
__children["Group"] = GafferScene.Group( "Group" )
parent.addChild( __children["Group"] )
__children["Group"].addChild( Gaffer.V2fPlug( "__uiPosition", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Group"]["__uiPosition"].setValue( IECore.V2f( 2.08600187, -13.2304077 ) )
__children["Group"].addChild( GafferScene.ScenePlug( "in1", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Group"].addChild( GafferScene.ScenePlug( "in2", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Group"].addChild( GafferScene.ScenePlug( "in3", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Group"].addChild( GafferScene.ScenePlug( "in4", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["SetWithIntersection1"] = GafferScene.Set( "SetWithIntersection1" )
parent.addChild( __children["SetWithIntersection1"] )
__children["SetWithIntersection1"]["name"].setValue( 'setWithIntersection' )
__children["SetWithIntersection1"]["paths"].setValue( IECore.StringVectorData( [ '/group/plane', '/group/plane1' ] ) )
__children["SetWithIntersection1"].addChild( Gaffer.V2fPlug( "__uiPosition", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["SetWithIntersection1"]["__uiPosition"].setValue( IECore.V2f( 10.3530903, -22.3944702 ) )
__children["SetWithIntersection"] = GafferScene.Set( "SetWithIntersection" )
parent.addChild( __children["SetWithIntersection"] )
__children["SetWithIntersection"]["name"].setValue( 'setWithIntersection' )
__children["SetWithIntersection"]["paths"].setValue( IECore.StringVectorData( [ '/group/plane', '/group/camera' ] ) )
__children["SetWithIntersection"].addChild( Gaffer.V2fPlug( "__uiPosition", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["SetWithIntersection"]["__uiPosition"].setValue( IECore.V2f( -6.18108892, -22.394619 ) )
__children["SetWithIntersection"].addChild( Gaffer.V2fPlug( "__uiPosition1", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["SetA"] = GafferScene.Set( "SetA" )
parent.addChild( __children["SetA"] )
__children["SetA"]["name"].setValue( 'setA' )
__children["SetA"]["paths"].setValue( IECore.StringVectorData( [ '/group/plane' ] ) )
__children["SetA"].addChild( Gaffer.V2fPlug( "__uiPosition", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["SetA"]["__uiPosition"].setValue( IECore.V2f( -6.1754179, -31.558815 ) )
__children["SetA"].addChild( Gaffer.V2fPlug( "__uiPosition1", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["SetA"].addChild( Gaffer.V2fPlug( "__uiPosition2", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["pointlight"] = GafferRenderMan.RenderManLight( "pointlight" )
parent.addChild( __children["pointlight"] )
__children["pointlight"]["parameters"].addChild( Gaffer.FloatPlug( "intensity", defaultValue = 1, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["pointlight"]["parameters"].addChild( Gaffer.Color3fPlug( "lightcolor", defaultValue = IECore.Color3f( 1, 1, 1 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["pointlight"]["parameters"].addChild( Gaffer.V3fPlug( "from", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["pointlight"]["parameters"].addChild( Gaffer.FloatPlug( "decay", defaultValue = 2, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["pointlight"]["parameters"].addChild( Gaffer.StringPlug( "__category", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["pointlight"]["__shaderName"].setValue( 'pointlight' )
__children["pointlight"].addChild( Gaffer.V2fPlug( "__uiPosition", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["pointlight"]["__uiPosition"].setValue( IECore.V2f( 7.58533144, -4.06634235 ) )
__children["Camera"] = GafferScene.Camera( "Camera" )
parent.addChild( __children["Camera"] )
__children["Camera"].addChild( Gaffer.V2fPlug( "__uiPosition", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Camera"]["__uiPosition"].setValue( IECore.V2f( 21.585331, -4.06634235 ) )
__children["SetB"] = GafferScene.Set( "SetB" )
parent.addChild( __children["SetB"] )
__children["SetB"]["name"].setValue( 'setB' )
__children["SetB"]["paths"].setValue( IECore.StringVectorData( [ '/group/plane', '/group/plane1' ] ) )
__children["SetB"].addChild( Gaffer.V2fPlug( "__uiPosition", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["SetB"]["__uiPosition"].setValue( IECore.V2f( 10.3474178, -31.5585308 ) )
__children["SetB"].addChild( Gaffer.V2fPlug( "__uiPosition1", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["SetWithoutIntersection"] = GafferScene.Set( "SetWithoutIntersection" )
parent.addChild( __children["SetWithoutIntersection"] )
__children["SetWithoutIntersection"]["name"].setValue( 'setWithoutIntersection' )
__children["SetWithoutIntersection"]["paths"].setValue( IECore.StringVectorData( [ '/group/plane1' ] ) )
__children["SetWithoutIntersection"].addChild( Gaffer.V2fPlug( "__uiPosition", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["SetWithoutIntersection"]["__uiPosition"].setValue( IECore.V2f( -6.17042971, -40.7229919 ) )
__children["SetWithoutIntersection1"] = GafferScene.Set( "SetWithoutIntersection1" )
parent.addChild( __children["SetWithoutIntersection1"] )
__children["SetWithoutIntersection1"]["name"].setValue( 'setWithoutIntersection' )
__children["SetWithoutIntersection1"]["paths"].setValue( IECore.StringVectorData( [ '/group/plane' ] ) )
__children["SetWithoutIntersection1"].addChild( Gaffer.V2fPlug( "__uiPosition", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["SetWithoutIntersection1"]["__uiPosition"].setValue( IECore.V2f( 10.3424301, -40.7225952 ) )
__children["SetWithoutIntersection1"].addChild( Gaffer.V2fPlug( "__uiPosition1", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Group"]["in"].setInput( __children["Plane"]["out"] )
__children["Group"]["in1"].setInput( __children["Plane1"]["out"] )
__children["Group"]["in2"].setInput( __children["pointlight"]["out"] )
__children["Group"]["in3"].setInput( __children["Camera"]["out"] )
__children["SetWithIntersection1"]["in"].setInput( __children["Group"]["out"] )
__children["SetWithIntersection"]["in"].setInput( __children["Group"]["out"] )
__children["SetA"]["in"].setInput( __children["SetWithIntersection"]["out"] )
__children["SetB"]["in"].setInput( __children["SetWithIntersection1"]["out"] )
__children["SetWithoutIntersection"]["in"].setInput( __children["SetA"]["out"] )
__children["SetWithoutIntersection1"]["in"].setInput( __children["SetB"]["out"] )

del __children
```