Skip to content

Commit

Permalink
Merge branch '1.4_maintenance'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhaddon committed May 1, 2024
2 parents 9d88d22 + 78f85bf commit ceb83f5
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
1.4.x.x (relative to 1.4.2.0)
=======

Features
--------

- 3Delight : Added "3Delight Cloud" renderer, for rendering using the 3Delight cloud.

1.4.2.0 (relative to 1.4.1.0)
=======
Expand Down
36 changes: 32 additions & 4 deletions src/IECoreDelight/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ class DelightRenderer final : public IECoreScenePreview::Renderer

public :

DelightRenderer( RenderType renderType, const std::string &fileName, const IECore::MessageHandlerPtr &messageHandler )
DelightRenderer( RenderType renderType, const std::string &fileName, const IECore::MessageHandlerPtr &messageHandler, bool cloud = false )
: m_renderType( renderType ), m_messageHandler( messageHandler )
{
const IECore::MessageHandler::Scope s( m_messageHandler.get() );
Expand All @@ -1323,14 +1323,27 @@ class DelightRenderer final : public IECoreScenePreview::Renderer
};
}

void *handler = reinterpret_cast<void *>( &DelightRenderer::nsiErrorHandler );
void *data = this;
if( messageHandler )
{
void *handler = reinterpret_cast<void *>( &DelightRenderer::nsiErrorHandler );
void *data = this;
params.push_back( { "errorhandler", &handler, NSITypePointer, 0, 1, 0 } );
params.push_back( { "errorhandlerdata", &data, NSITypePointer, 0, 1, 0 } );
}

const int one = 1;
if( cloud )
{
if( renderType == Renderer::RenderType::Batch )
{
params.push_back( { "cloud", &one, NSITypeInteger, 0, 1, 0 } );
}
else
{
IECore::msg( IECore::Msg::Level::Warning, "DelightRenderer", "Cloud rendering is only available for batch renders. Rendering locally instead." );
}
}

m_context = NSIBegin( params.size(), params.data() );
m_instanceCache = new InstanceCache( m_context, ownership() );
m_attributesCache = new AttributesCache( m_context, ownership() );
Expand Down Expand Up @@ -1636,7 +1649,7 @@ class DelightRenderer final : public IECoreScenePreview::Renderer
{
if( boost::starts_with( name.string(), "dl:" ) || name.string().find( ":" ) == string::npos )
{
IECore::msg( IECore::Msg::Warning, "IECoreDelight::Renderer::command", boost::format( "Unknown command \"%s\"." ) % name.c_str() );
IECore::msg( IECore::Msg::Warning, "IECoreDelight::Renderer::command", fmt::format( "Unknown command \"{}\".", name.c_str() ) );
}

return nullptr;
Expand Down Expand Up @@ -1870,4 +1883,19 @@ const std::vector<IECore::MessageHandler::Level> DelightRenderer::g_ieMsgLevels

IECoreScenePreview::Renderer::TypeDescription<DelightRenderer> DelightRenderer::g_typeDescription( "3Delight" );

struct CloudTypeDescription
{
CloudTypeDescription()
{
IECoreScenePreview::Renderer::registerType(
"3Delight Cloud",
[] ( IECoreScenePreview::Renderer::RenderType renderType, const std::string &fileName, const IECore::MessageHandlerPtr &messageHandler ) {
return new DelightRenderer( renderType, fileName, messageHandler, /* cloud = */ true );
}
);
}
};

CloudTypeDescription g_cloudTypeDescription;

} // namespace
1 change: 1 addition & 0 deletions startup/GafferScene/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def __creator( renderType, fileName, messageHandler, renderer, module ) :
( "Cycles", "GafferCycles" ),
( "Arnold", "IECoreArnold" ),
( "3Delight", "IECoreDelight" ),
( "3Delight Cloud", "IECoreDelight" ),
] :
if renderer in GafferScene.Private.IECoreScenePreview.Renderer.types() :
# Already registered
Expand Down

0 comments on commit ceb83f5

Please sign in to comment.