-
Notifications
You must be signed in to change notification settings - Fork 206
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
Render Pass Menu #6177
base: 1.5_maintenance
Are you sure you want to change the base?
Render Pass Menu #6177
Changes from 1 commit
e4e5b4e
b9e8e63
27a348b
83ff385
89a4281
34f5783
d65b37a
a39941a
b40973a
9293fc3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,8 +195,10 @@ using PathMatcherCache = IECorePreview::LRUCache<IECore::MurmurHash, IECore::Pat | |
PathMatcherCache g_pathMatcherCache( pathMatcherCacheGetter, 25 ); | ||
|
||
const InternedString g_renderPassContextName( "renderPass" ); | ||
const InternedString g_disableAdaptorsContextName( "renderPassEditor:disableAdaptors" ); | ||
const InternedString g_renderPassNamePropertyName( "renderPassPath:name" ); | ||
const InternedString g_renderPassEnabledPropertyName( "renderPassPath:enabled" ); | ||
const InternedString g_renderPassEnabledWithoutAdaptorsPropertyName( "renderPassPath:enabledWithoutAdaptors" ); | ||
const InternedString g_renderPassNamesOption( "option:renderPass:names" ); | ||
const InternedString g_renderPassEnabledOption( "option:renderPass:enabled" ); | ||
|
||
|
@@ -303,6 +305,7 @@ class RenderPassPath : public Gaffer::Path | |
Path::propertyNames( names, canceller ); | ||
names.push_back( g_renderPassNamePropertyName ); | ||
names.push_back( g_renderPassEnabledPropertyName ); | ||
names.push_back( g_renderPassEnabledWithoutAdaptorsPropertyName ); | ||
} | ||
|
||
IECore::ConstRunTimeTypedPtr property( const IECore::InternedString &name, const IECore::Canceller *canceller = nullptr ) const override | ||
|
@@ -315,12 +318,17 @@ class RenderPassPath : public Gaffer::Path | |
return new StringData( names().back().string() ); | ||
} | ||
} | ||
else if( name == g_renderPassEnabledPropertyName ) | ||
else if( name == g_renderPassEnabledPropertyName || name == g_renderPassEnabledWithoutAdaptorsPropertyName ) | ||
{ | ||
const PathMatcher p = pathMatcher( canceller ); | ||
if( p.match( names() ) & PathMatcher::ExactMatch ) | ||
{ | ||
Context::EditableScope scopedContext( getContext() ); | ||
if( name == g_renderPassEnabledWithoutAdaptorsPropertyName ) | ||
{ | ||
const bool disableAdaptors = true; | ||
scopedContext.set<bool>( g_disableAdaptorsContextName, &disableAdaptors ); | ||
Comment on lines
+338
to
+339
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could I make a case for having an
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also wonder if the context monkeying might be better off in the RenderPassNameColumn, so RenderPassPath is a bit conceptually purer, and the adaptor juggling is in higher-level parts of the UI. I suppose RenderPassPath is already a bit UI-focussed what with the grouping options, but it still feels like maybe it'd be nice to keep it closer to just a raw Path-based view onto a single scene. |
||
} | ||
if( canceller ) | ||
{ | ||
scopedContext.setCanceller( canceller ); | ||
|
@@ -452,9 +460,12 @@ RenderPassPath::Ptr constructor2( ScenePlug &scene, Context &context, const std: | |
// RenderPassNameColumn | ||
////////////////////////////////////////////////////////////////////////// | ||
|
||
ConstStringDataPtr g_adaptorDisabledRenderPassIcon = new StringData( "adaptorDisabledRenderPass.png" ); | ||
ConstStringDataPtr g_disabledRenderPassIcon = new StringData( "disabledRenderPass.png" ); | ||
ConstStringDataPtr g_renderPassIcon = new StringData( "renderPass.png" ); | ||
ConstStringDataPtr g_renderPassFolderIcon = new StringData( "renderPassFolder.png" ); | ||
ConstStringDataPtr g_disabledToolTip = new StringData( "Disabled." ); | ||
ConstStringDataPtr g_adaptorDisabledToolTip = new StringData( "Automatically disabled by a render adaptor."); | ||
const Color4fDataPtr g_dimmedForegroundColor = new Color4fData( Imath::Color4f( 152, 152, 152, 255 ) / 255.0f ); | ||
|
||
class RenderPassNameColumn : public StandardPathColumn | ||
|
@@ -482,8 +493,25 @@ class RenderPassNameColumn : public StandardPathColumn | |
{ | ||
if( const auto renderPassEnabled = runTimeCast<const IECore::BoolData>( path.property( g_renderPassEnabledPropertyName, canceller ) ) ) | ||
{ | ||
result.icon = renderPassEnabled->readable() ? g_renderPassIcon : g_disabledRenderPassIcon; | ||
result.foreground = renderPassEnabled->readable() ? nullptr : g_dimmedForegroundColor; | ||
if( renderPassEnabled->readable() ) | ||
{ | ||
result.icon = g_renderPassIcon; | ||
} | ||
else | ||
{ | ||
result.foreground = g_dimmedForegroundColor; | ||
const auto renderPassEnabledWithoutAdaptors = runTimeCast<const IECore::BoolData>( path.property( g_renderPassEnabledWithoutAdaptorsPropertyName, canceller ) ); | ||
if( !renderPassEnabledWithoutAdaptors || !renderPassEnabledWithoutAdaptors->readable() ) | ||
{ | ||
result.icon = g_disabledRenderPassIcon; | ||
result.toolTip = g_disabledToolTip; | ||
} | ||
else | ||
{ | ||
result.icon = g_adaptorDisabledRenderPassIcon; | ||
result.toolTip = g_adaptorDisabledToolTip; | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we don't need to mention the RenderPassChooserWidget here, since it is in Features?