Skip to content

Commit b8374c5

Browse files
committed
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.
1 parent 7535ab7 commit b8374c5

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

src/IECoreHoudini/ROP_SceneCacheWriter.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "PRM/PRM_Parm.h"
4343
#include "PRM/PRM_SpareData.h"
4444
#include "ROP/ROP_Error.h"
45+
#include "SOP/SOP_Node.h"
4546
#include "UT/UT_PtrArray.h"
4647
#include "UT/UT_StringMMPattern.h"
4748

@@ -271,6 +272,30 @@ ROP_RENDER_CODE ROP_SceneCacheWriter::renderFrame( fpreal time, UT_Interrupt *bo
271272
}
272273
}
273274
}
275+
else
276+
{
277+
UT_String msg;
278+
std::string messages = "Re-rooting flat geo failed.";
279+
node->getErrorMessages( msg );
280+
if ( msg != UT_String::getEmptyString() )
281+
{
282+
messages += "\n\nErrors from " + nodePath.toStdString() + ":\n" + msg.toStdString();
283+
}
284+
285+
if ( SOP_Node *sop = node->getRenderSopPtr() )
286+
{
287+
sop->getErrorMessages( msg );
288+
if ( msg != UT_String::getEmptyString() )
289+
{
290+
sop->getFullPath( nodePath );
291+
messages += "\n\nErrors from " + nodePath.toStdString() + ":\n" + msg.toStdString();
292+
}
293+
}
294+
295+
addError( 0, messages.c_str() );
296+
progress->opEnd();
297+
return ROP_ABORT_RENDER;
298+
}
274299

275300
if ( reRoot )
276301
{

test/IECoreHoudini/SceneCacheTest.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
##########################################################################
22
#
3-
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
3+
# Copyright (c) 2013-2014, Image Engine Design Inc. All rights reserved.
44
#
55
# Redistribution and use in source and binary forms, with or without
66
# modification, are permitted provided that the following conditions are
@@ -2106,6 +2106,21 @@ def testRopFlattenedAndHidden( self ) :
21062106
self.assertTrue( child.isInstanceOf( IECore.TypeId.MeshPrimitive ) )
21072107
self.assertEqual( root.childNames(), [] )
21082108

2109+
def testRopFlattenedWithErrors( self ) :
2110+
2111+
self.writeSCC()
2112+
geo = self.geometry()
2113+
geo.parm( "expand" ).pressButton()
2114+
rop = self.rop( geo )
2115+
rop.parm( "rootObject" ).set( geo.path() )
2116+
rop.parm( "trange" ).set( 1 )
2117+
rop.parmTuple( "f" ).set( ( 1, 10, 1 ) )
2118+
geo.renderNode().parm( "file" ).set( "fake.scc" )
2119+
rop.parm( "execute" ).pressButton()
2120+
self.assertNotEqual( rop.errors(), "" )
2121+
self.assertTrue( geo.renderNode().path() in rop.errors() )
2122+
self.assertTrue( geo.renderNode().errors() in rop.errors() )
2123+
21092124
def testRopLinked( self ) :
21102125

21112126
self.writeTaggedSCC()

0 commit comments

Comments
 (0)