Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ddad201
IE Config : Add solidangle_LICENSE to ENV_VARS_TO_IMPORT
danieldresser Sep 14, 2017
ba7a2f9
SConstruct : Arnold tests depend on Arnold lib
danieldresser Sep 21, 2017
6e51598
IECoreArnold::PointsTest and RenderTest : This test could never have …
danieldresser Sep 14, 2017
1d3e5df
IECoreArnold::ProceduralTest : Need a tiny tolerance when checking va…
danieldresser Sep 14, 2017
574ec8a
IECoreArnold::RendererTest : With extreme motion blur, we need more s…
danieldresser Sep 18, 2017
cacc56c
IECoreArnold tests : Don't dump render output during tests
danieldresser Sep 22, 2017
5320eae
IECoreArnold tests : When testing example parameters, use ones that …
danieldresser Sep 15, 2017
86fcb48
IECoreArnold tests : Signature of AiNodeGetMatrix changed in Arnold 5
danieldresser Sep 15, 2017
efa1b5d
IECoreArnold::UniverseBlockTest : Accessing Metadata from Python now …
danieldresser Sep 18, 2017
4130ffa
IECoreArnold::RendererTest : Use correct types so we don't get warnings
danieldresser Sep 22, 2017
73f9798
IECoreArnold : Arnold 5 removes point types, and just uses vectors
danieldresser Sep 14, 2017
f8d2571
IECoreArnold : Arnold 5 replaces AtByte with uint8_t
danieldresser Sep 14, 2017
c146478
IECoreArnold : Arnold 5 replaces AtColor with AtRGB
danieldresser Sep 15, 2017
2f06053
IECoreArnold : In Arnold 5, member variables of AtArray are not decla…
danieldresser Sep 14, 2017
e1cdb1e
IECoreArnold::OutputDriver : Many API changes in Arnold 5
danieldresser Sep 15, 2017
5765d45
IECoreAnold::Parameter Algo : Use AtString
danieldresser Sep 15, 2017
3ab0ea5
IECoreArnold : Update M44f to AtMatrix casts for Arnold 5
danieldresser Sep 15, 2017
4acc625
IECoreArnold::RendererImplementation : Updated visibility attributes …
danieldresser Sep 15, 2017
45a5156
IECoreArnold : Arnold 5 doesn't support non-uniform sample times
danieldresser Sep 15, 2017
dde6223
IECoreArnold : Arnold 5 renamed aspect_ratio to pixel_aspect_ratio
danieldresser Sep 15, 2017
a78e362
IECoreArnold::RenderImplemenation : Update for Arnold 5 procedural in…
danieldresser Sep 18, 2017
c3771b6
IECoreArnold::Procedural : Update for Arnold 5, remove obselete test
danieldresser Sep 18, 2017
7ad6595
IECoreArnold::RendererImplemention : Remove duplicate AiEnd - the des…
danieldresser Sep 19, 2017
eeb3f92
IECoreArnold::ParameterAlgo : Support V3i and V2i parameters by casti…
danieldresser Sep 20, 2017
5ad3e9e
ICoreArnold : Without any options for setting log verbosity, default …
danieldresser Sep 22, 2017
96b708e
IECoreArnold::AutomaticInstancingTest : Force on console output so we…
danieldresser Sep 22, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ class RendererImplementation : public IECore::Renderer
RendererPtr renderer;
};

static int procLoader( AtProcVtable *vTable );
static int procFunc( AtProceduralNodeMethods *methods );
static int procInit( AtNode *node, void **userPtr );
static int procCleanup( void *userPtr );
static int procNumNodes( void *userPtr );
static AtNode *procGetNode( void *userPtr, int i );
static int procCleanup( const AtNode *node, void *userPtr );
static int procNumNodes( const AtNode *node, void *userPtr );
static AtNode *procGetNode( const AtNode *node, void *userPtr, int i );

boost::shared_ptr<UniverseBlock> m_universe;
InstancingConverterPtr m_instancingConverter;
Expand Down
48 changes: 15 additions & 33 deletions contrib/IECoreArnold/src/IECoreArnold/RendererImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,14 +645,12 @@ void IECoreArnold::RendererImplementation::geometry( const std::string &type, co
/////////////////////////////////////////////////////////////////////////////////////////
// procedurals
/////////////////////////////////////////////////////////////////////////////////////////

int IECoreArnold::RendererImplementation::procLoader( AtProcVtable *vTable )
int IECoreArnold::RendererImplementation::procFunc( AtProceduralNodeMethods *methods )
{
vTable->Init = procInit;
vTable->Cleanup = procCleanup;
vTable->NumNodes = procNumNodes;
vTable->GetNode = procGetNode;
strcpy( vTable->version, AI_VERSION );
methods->Init = procInit;
methods->Cleanup = procCleanup;
methods->NumNodes = procNumNodes;
methods->GetNode = procGetNode;
return 1;
}

Expand All @@ -665,20 +663,20 @@ int IECoreArnold::RendererImplementation::procInit( AtNode *node, void **userPtr
return 1;
}

int IECoreArnold::RendererImplementation::procCleanup( void *userPtr )
int IECoreArnold::RendererImplementation::procCleanup( const AtNode *node, void *userPtr )
{
ProceduralData *data = (ProceduralData *)( userPtr );
delete data;
return 1;
}

int IECoreArnold::RendererImplementation::procNumNodes( void *userPtr )
int IECoreArnold::RendererImplementation::procNumNodes( const AtNode *node, void *userPtr )
{
ProceduralData *data = (ProceduralData *)( userPtr );
return data->renderer->m_implementation->m_nodes.size();
}

AtNode* IECoreArnold::RendererImplementation::procGetNode( void *userPtr, int i )
AtNode* IECoreArnold::RendererImplementation::procGetNode( const AtNode *node, void *userPtr, int i )
{
ProceduralData *data = (ProceduralData *)( userPtr );
return data->renderer->m_implementation->m_nodes[i];
Expand All @@ -697,17 +695,12 @@ void IECoreArnold::RendererImplementation::procedural( IECore::Renderer::Procedu

if( const ExternalProcedural *externalProc = dynamic_cast<ExternalProcedural *>( proc.get() ) )
{
// Allow a parameter "ai:nodeType" == "volume" to create a volume shape rather
// than a procedural shape. Volume shapes provide "dso", "min" and "max" parameters
// just as procedural shapes do, so the mapping is a fairly natural one.
CompoundDataMap::const_iterator nodeTypeIt = externalProc->parameters().find( "ai:nodeType" );
if( nodeTypeIt != externalProc->parameters().end() && nodeTypeIt->second->isInstanceOf( StringData::staticTypeId() ) )
{
nodeType = static_cast<const StringData *>( nodeTypeIt->second.get() )->readable();
}
node = AiNode( nodeType.c_str() );

AiNodeSetStr( node, "dso", externalProc->fileName().c_str() );
// \todo In Arnold, external procedurals register node types, and then we use the node types
// just like built in nodes - we don't reference the filename of the dso that defines the node type.
// So here we just interpret "filename" as the node type to create.
// Where should this be documented. Should we change the name of the parameter to ExternalProcedural
// to be something other than "filename" in Cortex 10?
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable, maybe just calling it "name" is generic enough? Let's not mix that up with the Arnold update though - what you have here seems fine for now.

node = AiNode( externalProc->fileName().c_str() );
ParameterAlgo::setParameters( node, externalProc->parameters() );
applyTransformToNode( node );
}
Expand All @@ -728,7 +721,7 @@ void IECoreArnold::RendererImplementation::procedural( IECore::Renderer::Procedu
bound = transformedBound;
}

AiNodeSetPtr( node, "funcptr", (void *)procLoader );
AiNodeSetPtr( node, "funcptr", (void *)procFunc );

ProceduralData *data = new ProceduralData;
data->procedural = proc;
Expand All @@ -737,17 +730,6 @@ void IECoreArnold::RendererImplementation::procedural( IECore::Renderer::Procedu
AiNodeSetPtr( node, "userptr", data );
}

if( bound != Procedural::noBound )
{
AiNodeSetVec( node, "min", bound.min.x, bound.min.y, bound.min.z );
AiNodeSetVec( node, "max", bound.max.x, bound.max.y, bound.max.z );
}
else
{
// No bound available - expand procedural immediately.
AiNodeSetBool( node, "load_at_init", true );
}

if( nodeType == "procedural" )
{
// We call addNode() rather than addShape() as we don't want to apply transforms and
Expand Down
16 changes: 6 additions & 10 deletions contrib/IECoreArnold/test/IECoreArnold/RendererTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ def testExternalProcedural( self ) :

r.procedural(
r.ExternalProcedural(
"test.so",
"volume",
IECore.Box3f(
IECore.V3f( 1, 2, 3 ),
IECore.V3f( 4, 5, 6 )
Expand All @@ -739,10 +739,7 @@ def testExternalProcedural( self ) :

ass = "".join( file( self.__assFileName ).readlines() )

self.assertTrue( "procedural" in ass )
self.assertTrue( "min 1 2 3" in ass )
self.assertTrue( "max 4 5 6" in ass )
self.assertTrue( "dso \"test.so\"" in ass )
self.assertTrue( "volume" in ass )
self.assertTrue( "declare stringParm constant STRING" in ass )
self.assertTrue( "declare floatParm constant FLOAT" in ass )
self.assertTrue( "declare intParm constant INT" in ass )
Expand Down Expand Up @@ -880,12 +877,14 @@ def testProcedural( self ) :

with IECore.WorldBlock( r ) :

# In Arnold 5, external procedurals register node types that look just like the built-in
# ones. So we need to be able to use ExternalProcedural to create an arbitrary node type,
# instead of passing in a filename. Test with a volume, because this node type exists by default.
r.procedural(
r.ExternalProcedural(
"someVolumeThing.so",
"volume",
IECore.Box3f( IECore.V3f( -1, -2, -3 ), IECore.V3f( 4, 5, 6 ) ),
{
"ai:nodeType" : "volume",
"testFloat" : 0.5
}
)
Expand All @@ -894,9 +893,6 @@ def testProcedural( self ) :
volume = self.__allNodes( type = arnold.AI_NODE_SHAPE )[-1]
self.assertEqual( arnold.AiNodeEntryGetName( arnold.AiNodeGetNodeEntry( volume ) ), "volume" )

self.assertEqual( arnold.AiNodeGetVec( volume, "min" ), arnold.AtVector( -1, -2, -3 ) )
self.assertEqual( arnold.AiNodeGetVec( volume, "max" ), arnold.AtVector( 4, 5, 6 ) )
self.assertEqual( arnold.AiNodeGetStr( volume, "dso" ), "someVolumeThing.so" )
self.assertEqual( arnold.AiNodeGetFlt( volume, "testFloat" ), 0.5 )

def tearDown( self ) :
Expand Down