From b8374c53fbe7e171fbc5497d3a42e043d3d49d10 Mon Sep 17 00:00:00 2001 From: Andrew Kaufman Date: Wed, 4 Jun 2014 12:47:49 -0700 Subject: [PATCH 1/2] Fixed bug in SceneCache ROP when re-rooting flattened geo with errors. Previously, if the render SOP had errors, the ROP would continue on trying to write the file, and would return successfully. We know notice that the geo doesn't exist and abort the render. Note that this does leave a partial file on disk, since we aborted after opening the file handle. --- src/IECoreHoudini/ROP_SceneCacheWriter.cpp | 25 ++++++++++++++++++++++ test/IECoreHoudini/SceneCacheTest.py | 17 ++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/IECoreHoudini/ROP_SceneCacheWriter.cpp b/src/IECoreHoudini/ROP_SceneCacheWriter.cpp index f33828a502..a4a5df798e 100644 --- a/src/IECoreHoudini/ROP_SceneCacheWriter.cpp +++ b/src/IECoreHoudini/ROP_SceneCacheWriter.cpp @@ -42,6 +42,7 @@ #include "PRM/PRM_Parm.h" #include "PRM/PRM_SpareData.h" #include "ROP/ROP_Error.h" +#include "SOP/SOP_Node.h" #include "UT/UT_PtrArray.h" #include "UT/UT_StringMMPattern.h" @@ -271,6 +272,30 @@ ROP_RENDER_CODE ROP_SceneCacheWriter::renderFrame( fpreal time, UT_Interrupt *bo } } } + else + { + UT_String msg; + std::string messages = "Re-rooting flat geo failed."; + node->getErrorMessages( msg ); + if ( msg != UT_String::getEmptyString() ) + { + messages += "\n\nErrors from " + nodePath.toStdString() + ":\n" + msg.toStdString(); + } + + if ( SOP_Node *sop = node->getRenderSopPtr() ) + { + sop->getErrorMessages( msg ); + if ( msg != UT_String::getEmptyString() ) + { + sop->getFullPath( nodePath ); + messages += "\n\nErrors from " + nodePath.toStdString() + ":\n" + msg.toStdString(); + } + } + + addError( 0, messages.c_str() ); + progress->opEnd(); + return ROP_ABORT_RENDER; + } if ( reRoot ) { diff --git a/test/IECoreHoudini/SceneCacheTest.py b/test/IECoreHoudini/SceneCacheTest.py index 5f76334eb0..19239d24cf 100644 --- a/test/IECoreHoudini/SceneCacheTest.py +++ b/test/IECoreHoudini/SceneCacheTest.py @@ -1,6 +1,6 @@ ########################################################################## # -# Copyright (c) 2013, Image Engine Design Inc. All rights reserved. +# Copyright (c) 2013-2014, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -2106,6 +2106,21 @@ def testRopFlattenedAndHidden( self ) : self.assertTrue( child.isInstanceOf( IECore.TypeId.MeshPrimitive ) ) self.assertEqual( root.childNames(), [] ) + def testRopFlattenedWithErrors( self ) : + + self.writeSCC() + geo = self.geometry() + geo.parm( "expand" ).pressButton() + rop = self.rop( geo ) + rop.parm( "rootObject" ).set( geo.path() ) + rop.parm( "trange" ).set( 1 ) + rop.parmTuple( "f" ).set( ( 1, 10, 1 ) ) + geo.renderNode().parm( "file" ).set( "fake.scc" ) + rop.parm( "execute" ).pressButton() + self.assertNotEqual( rop.errors(), "" ) + self.assertTrue( geo.renderNode().path() in rop.errors() ) + self.assertTrue( geo.renderNode().errors() in rop.errors() ) + def testRopLinked( self ) : self.writeTaggedSCC() From eafb75c5618484e0c6a124535ff9fd379a8ee42b Mon Sep 17 00:00:00 2001 From: Andrew Kaufman Date: Wed, 4 Jun 2014 12:50:02 -0700 Subject: [PATCH 2/2] Preventing postFrameScript from running if we aborted early. --- src/IECoreHoudini/ROP_SceneCacheWriter.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/IECoreHoudini/ROP_SceneCacheWriter.cpp b/src/IECoreHoudini/ROP_SceneCacheWriter.cpp index a4a5df798e..d7905c570d 100644 --- a/src/IECoreHoudini/ROP_SceneCacheWriter.cpp +++ b/src/IECoreHoudini/ROP_SceneCacheWriter.cpp @@ -304,7 +304,11 @@ ROP_RENDER_CODE ROP_SceneCacheWriter::renderFrame( fpreal time, UT_Interrupt *bo } ROP_RENDER_CODE status = doWrite( m_liveScene, outScene, writeTime, progress ); - executePostFrameScript( time ); + if ( status != ROP_ABORT_RENDER ) + { + executePostFrameScript( time ); + } + progress->opEnd(); return status; }