Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RenderPassEditor : Render pass creation and deletion #5672

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Improvements

- SceneReader : Added basic loding of UsdGeomNurbsCurves, converting them to CurvesPrimitives (basis curves).
- Console output : Every line is now prefixed with the message level.
- RenderPasses : Added validation of render pass names entered in the `names` plug.
- RenderPassEditor :
- Added support for adding a new render pass to an EditScope by clicking the plus button at the bottom of the editor.
- Added support for deleting selected render passes by clicking the minus button at the bottom of the editor, or by right-clicking one of the names and selecting 'Delete Selected Render Passes'.

Fixes
-----
Expand All @@ -25,6 +29,14 @@ Documentation
- Added Render Pass Editor shortcuts to the "Controls and Shortcuts" section.
- Added Render Pass Editor (Arnold) example demonstrating use of the Render Pass Editor, as well as the RenderPasses and RenderPassWedge nodes.

API
---

- EditScopeAlgo : Added support for creating render passes.
- RenderPasses : Added `registerRenderPassNameWidget()` and `createRenderPassNameWidget()` methods for registration and creation of the widget used for editing render pass names.
- RenderPassEditor : Added `addRenderPassButtonMenuSignal()` to allow customisation of the add render pass button behaviour.
- ConfirmationDialogue : The cancel button may now be omitted by passing `cancelLabel = None` to the constructor.

Build
-----

Expand Down
2 changes: 2 additions & 0 deletions include/GafferScene/EditScopeAlgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ GAFFERSCENE_API Gaffer::TweakPlug *acquireRenderPassOptionEdit( Gaffer::EditScop
GAFFERSCENE_API void removeRenderPassOptionEdit( Gaffer::EditScope *scope, const std::string &renderPass, const std::string &option );
GAFFERSCENE_API const Gaffer::GraphComponent *renderPassOptionEditReadOnlyReason( const Gaffer::EditScope *scope, const std::string &renderPass, const std::string &option );

GAFFERSCENE_API const Gaffer::GraphComponent *renderPassesReadOnlyReason( const Gaffer::EditScope *scope );

} // namespace EditScopeAlgo

} // namespace GafferScene
55 changes: 55 additions & 0 deletions python/GafferSceneTest/EditScopeAlgoTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1653,5 +1653,60 @@ def testOptionEditFromDefaultValueMetadata( self ) :
self.assertIsNotNone( GafferScene.EditScopeAlgo.acquireOptionEdit( editScope, "test:bogus" ) )
self.assertNotEqual( editScope.keys(), emptyKeys )

def testRenderPassesReadOnlyReason( self ) :

s = Gaffer.ScriptNode()

s["cube"] = GafferScene.Cube()

s["scope"] = Gaffer.EditScope()
s["scope"].setup( s["cube"]["out"] )
s["scope"]["in"].setInput( s["cube"]["out"] )

s["box"] = Gaffer.Box.create( s, Gaffer.StandardSet( [ s["cube"], s["scope"] ] ) )

self.assertIsNone( GafferScene.EditScopeAlgo.renderPassesReadOnlyReason( s["box"]["scope"] ) )

for component in ( s["box"], s["box"]["scope"] ):
Gaffer.MetadataAlgo.setReadOnly( component, True )
self.assertEqual( GafferScene.EditScopeAlgo.renderPassesReadOnlyReason( s["box"]["scope"] ), s["box"] )

Gaffer.MetadataAlgo.setReadOnly( s["box"], False )
self.assertEqual( GafferScene.EditScopeAlgo.renderPassesReadOnlyReason( s["box"]["scope"] ), s["box"]["scope"] )

Gaffer.MetadataAlgo.setReadOnly( s["box"]["scope"], False )
renderPasses = s["box"]["scope"].acquireProcessor( "RenderPasses", createIfNecessary = True )
renderPasses["names"].setValue( IECore.StringVectorData( [ "renderPassA" ] ) )

self.assertIsNone( GafferScene.EditScopeAlgo.renderPassesReadOnlyReason( s["box"]["scope"] ) )

for component in (
s["box"]["scope"]["RenderPasses"]["names"],
s["box"]["scope"]["RenderPasses"],
s["box"]["scope"],
s["box"]
) :
Gaffer.MetadataAlgo.setReadOnly( component, True )
self.assertEqual( GafferScene.EditScopeAlgo.renderPassesReadOnlyReason( s["box"]["scope"] ), component )

def testRenderPassesSerialisation( self ) :

s = Gaffer.ScriptNode()

s["plane"] = GafferScene.Plane()

s["editScope"] = Gaffer.EditScope()
s["editScope"].setup( s["plane"]["out"] )

renderPasses = s["editScope"].acquireProcessor( "RenderPasses", createIfNecessary = True )
renderPasses["names"].setValue( IECore.StringVectorData( [ "renderPassA" ] ) )

self.assertEqual( s["editScope"]["out"]["globals"].getValue().get( "option:renderPass:names" ), IECore.StringVectorData( [ "renderPassA" ] ) )

s2 = Gaffer.ScriptNode()
s2.execute( s.serialise() )

self.assertEqual( s2["editScope"]["out"]["globals"].getValue().get( "option:renderPass:names" ), IECore.StringVectorData( [ "renderPassA" ] ) )

if __name__ == "__main__":
unittest.main()
Loading
Loading