diff --git a/Changes.md b/Changes.md index 2f61a9e5da2..dee47bd39f7 100644 --- a/Changes.md +++ b/Changes.md @@ -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) ======= diff --git a/src/IECoreDelight/Renderer.cpp b/src/IECoreDelight/Renderer.cpp index 50d6a8f488d..0ddbe55910b 100644 --- a/src/IECoreDelight/Renderer.cpp +++ b/src/IECoreDelight/Renderer.cpp @@ -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() ); @@ -1323,14 +1323,27 @@ class DelightRenderer final : public IECoreScenePreview::Renderer }; } + void *handler = reinterpret_cast( &DelightRenderer::nsiErrorHandler ); + void *data = this; if( messageHandler ) { - void *handler = reinterpret_cast( &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() ); @@ -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; @@ -1870,4 +1883,19 @@ const std::vector DelightRenderer::g_ieMsgLevels IECoreScenePreview::Renderer::TypeDescription 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 diff --git a/startup/GafferScene/renderers.py b/startup/GafferScene/renderers.py index fbe5f47f733..8c8260607d8 100644 --- a/startup/GafferScene/renderers.py +++ b/startup/GafferScene/renderers.py @@ -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