Skip to content

Commit db736bb

Browse files
committed
Bugfixes for scene conversion, make sure cameras don't try to convert to a mesh. Also the last build wasn't changing devices properly.
1 parent f61c00e commit db736bb

File tree

7 files changed

+27
-11
lines changed

7 files changed

+27
-11
lines changed

build_docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22

3-
python build.py --version 0.5.1 --cyclesVersion 0.5.0 --docker 1 --upload 0 $@
3+
python build.py --version 0.5.2 --cyclesVersion 0.5.0 --docker 1 --upload 0 $@

build_linux_osx.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if [[ -z "${GAFFER_ROOT}" ]]; then
88
fi
99

1010
# Packaging variables
11-
VERSION=0.5.1
11+
VERSION=0.5.2
1212
GAFFERVERSION=0.53.4.0
1313

1414
if [[ -z "${GAFFER_BUILD_TYPE}" ]]; then

build_ubuntu.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22

3-
python build.py --version 0.5.1 --cyclesVersion 0.5.0 --forceCxxCompiler g++-6 --docker false
3+
python build.py --version 0.5.2 --cyclesVersion 0.5.0 --forceCxxCompiler g++-6 --docker false

src/GafferCycles/IECoreCyclesPreview/CameraAlgo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
//////////////////////////////////////////////////////////////////////////
3434

3535
#include "GafferCycles/IECoreCyclesPreview/CameraAlgo.h"
36-
36+
#include "GafferCycles/IECoreCyclesPreview/ObjectAlgo.h"
3737
#include "GafferCycles/IECoreCyclesPreview/SocketAlgo.h"
3838

3939
#include "IECoreScene/Camera.h"
@@ -54,6 +54,7 @@ namespace
5454

5555
ccl::Camera *convertCommon( const IECoreScene::Camera *camera, const std::string &nodeName )
5656
{
57+
assert( camera->typeId() == IECoreScene::Camera::staticTypeId() );
5758
ccl::Camera *ccam = new ccl::Camera();
5859
ccam->name = ccl::ustring(nodeName.c_str());
5960

src/GafferCycles/IECoreCyclesPreview/CurvesAlgo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ namespace
5656

5757
ccl::Mesh *convertCommon( const IECoreScene::CurvesPrimitive *curve )
5858
{
59+
assert( curve->typeId() == IECoreScene::CurvesPrimitive::staticTypeId() );
5960
ccl::Mesh *cmesh = new ccl::Mesh();
6061

6162
size_t numCurves = curve->numCurves();

src/GafferCycles/IECoreCyclesPreview/MeshAlgo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ void convertUVSet( const string &uvSet, const IECoreScene::PrimitiveVariable &uv
118118

119119
ccl::Mesh *convertCommon( const IECoreScene::MeshPrimitive *mesh )
120120
{
121+
assert( mesh->typeId() == IECoreScene::MeshPrimitive::staticTypeId() );
121122
ccl::Mesh *cmesh = new ccl::Mesh();
122123

123124
const size_t numFaces = mesh->numFaces();

src/GafferCycles/IECoreCyclesPreview/Renderer.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,7 +1793,8 @@ class CyclesRenderer final : public IECoreScenePreview::Renderer
17931793
m_session( nullptr ),
17941794
m_scene( nullptr ),
17951795
m_renderCallback( nullptr ),
1796-
m_rendering( false )
1796+
m_rendering( false ),
1797+
m_deviceDirty( false )
17971798
{
17981799
// Set path to find shaders
17991800
ccl::path_init( getenv("GAFFERCYCLES") );
@@ -1967,20 +1968,21 @@ class CyclesRenderer final : public IECoreScenePreview::Renderer
19671968
}
19681969
else if( name == g_deviceOptionName )
19691970
{
1970-
if( const StringData *data = reportedCast<const StringData>( value, "option", name ) )
1971+
if( value == nullptr )
19711972
{
1972-
auto device_name = data->readable();
1973-
m_deviceName = device_name;
1973+
m_deviceName = "CPU";
19741974
}
1975-
else if( value == nullptr )
1975+
else if( const StringData *data = reportedCast<const StringData>( value, "option", name ) )
19761976
{
1977-
m_deviceName = "CPU";
1977+
auto device_name = data->readable();
1978+
m_deviceName = device_name;
19781979
}
19791980
else
19801981
{
19811982
m_deviceName = "CPU";
19821983
IECore::msg( IECore::Msg::Warning, "CyclesRenderer::option", boost::format( "Unknown value \"%s\" for option \"%s\"." ) % m_deviceName % name.string() );
19831984
}
1985+
m_deviceDirty = true;
19841986
return;
19851987
}
19861988
else if( name == g_shadingsystemOptionName )
@@ -2396,6 +2398,10 @@ class CyclesRenderer final : public IECoreScenePreview::Renderer
23962398

23972399
ObjectInterfacePtr object( const std::string &name, const IECore::Object *object, const AttributesInterface *attributes ) override
23982400
{
2401+
if( object->typeId() == IECoreScene::Camera::staticTypeId() )
2402+
{
2403+
return nullptr;
2404+
}
23992405
Instance instance = m_instanceCache->get( object, name );
24002406

24012407
ObjectInterfacePtr result = new CyclesObject( instance );
@@ -2405,6 +2411,10 @@ class CyclesRenderer final : public IECoreScenePreview::Renderer
24052411

24062412
ObjectInterfacePtr object( const std::string &name, const std::vector<const IECore::Object *> &samples, const std::vector<float> &times, const AttributesInterface *attributes ) override
24072413
{
2414+
if( samples.front()->typeId() == IECoreScene::Camera::staticTypeId() )
2415+
{
2416+
return nullptr;
2417+
}
24082418
Instance instance = m_instanceCache->get( samples, times, name );
24092419

24102420
ObjectInterfacePtr result = new CyclesObject( instance );
@@ -2571,8 +2581,10 @@ class CyclesRenderer final : public IECoreScenePreview::Renderer
25712581
m_sessionParams.denoising = m_denoiseParams;
25722582
// If anything changes in scene or session, we reset.
25732583
if( m_scene->params.modified( m_sceneParams ) ||
2574-
m_session->params.modified( m_sessionParams ) )
2584+
m_session->params.modified( m_sessionParams ) ||
2585+
m_deviceDirty )
25752586
{
2587+
m_deviceDirty = false;
25762588
reset();
25772589
}
25782590

@@ -2785,6 +2797,7 @@ class CyclesRenderer final : public IECoreScenePreview::Renderer
27852797
int m_frame;
27862798
string m_camera;
27872799
bool m_rendering;
2800+
bool m_deviceDirty;
27882801

27892802
// Caches.
27902803
CameraCachePtr m_cameraCache;

0 commit comments

Comments
 (0)