Skip to content

Commit

Permalink
Merge pull request #351 from johnhaddon/multipleCameraEditsFix
Browse files Browse the repository at this point in the history
Fixed bug in IECoreRI::Renderer camera editing.
  • Loading branch information
andrewkaufman committed Oct 23, 2014
2 parents f4a0dc8 + aa63909 commit 24d4e6b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions include/IECoreRI/private/RendererImplementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class RendererImplementation : public IECore::Renderer
size_t m_numDisplays;
std::string m_lastCamera;
bool m_inWorld;
bool m_inEdit;

struct AttributeState
{
Expand Down
20 changes: 13 additions & 7 deletions src/IECoreRI/RendererImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ std::vector<int> IECoreRI::RendererImplementation::g_nLoops;
// This constructor launches a render within the current application. It creates a SharedData instance,
// which gets propagated down to the renderers this object creates by launching procedurals.
IECoreRI::RendererImplementation::RendererImplementation( const std::string &name )
: m_sharedData( new SharedData ), m_inWorld( false )
: m_sharedData( new SharedData ), m_inWorld( false ), m_inEdit( false )
{
m_options = new CompoundData();
constructCommon();
Expand Down Expand Up @@ -120,7 +120,7 @@ IECoreRI::RendererImplementation::RendererImplementation( const std::string &nam
// This constructor gets called in procSubdivide(), and inherits the SharedData from the RendererImplementation
// that launched the procedural
IECoreRI::RendererImplementation::RendererImplementation( SharedData::Ptr sharedData, IECore::CompoundDataPtr options )
: m_context( 0 ), m_sharedData( sharedData ), m_options( options ), m_inWorld( true )
: m_context( 0 ), m_sharedData( sharedData ), m_options( options ), m_inWorld( true ), m_inEdit( false )
{
constructCommon();

Expand All @@ -144,7 +144,7 @@ IECoreRI::RendererImplementation::RendererImplementation( SharedData::Ptr shared
// set m_sharedData to that entry, otherwise we set it to a new SharedData.
//
IECoreRI::RendererImplementation::RendererImplementation()
: m_context( 0 ), m_options( 0 ), m_inWorld( true )
: m_context( 0 ), m_options( 0 ), m_inWorld( true ), m_inEdit( false )
{
constructCommon();

Expand Down Expand Up @@ -486,11 +486,15 @@ void IECoreRI::RendererImplementation::camera( const std::string &name, const IE
// then camera itself
RiCamera( name.c_str(), RI_NULL );

if( name == m_lastCamera )
if( m_inEdit )
{
// we're in an edit, and need to update
// the world camera as well.
RiCamera( RI_WORLD, RI_NULL );
if( name == m_lastCamera )
{
// we've just edited the world camera,
// and we have to say explicitly that
// that has happened.
RiCamera( RI_WORLD, RI_NULL );
}
}
else
{
Expand Down Expand Up @@ -2222,6 +2226,7 @@ void RendererImplementation::editBegin( const std::string &name, const IECore::C
RiEditBeginV( name.c_str(), p.n(), p.tokens(), p.values() );

m_inWorld = name != "option";
m_inEdit = true;
}

void RendererImplementation::editEnd()
Expand All @@ -2230,4 +2235,5 @@ void RendererImplementation::editEnd()
RiEditEnd();

m_inWorld = false;
m_inEdit = false;
}

0 comments on commit 24d4e6b

Please sign in to comment.