Skip to content

Commit

Permalink
Fix CMake issues with the Arnold procedural.
Browse files Browse the repository at this point in the history
Make sure ProcLoader is visible, and fix some whitespace issues.
  • Loading branch information
lamiller0 committed Mar 27, 2015
1 parent a579c2a commit ba9e7ec
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 61 deletions.
21 changes: 5 additions & 16 deletions arnold/Procedural/CMakeLists.txt
Expand Up @@ -54,24 +54,13 @@ SET( CXX_FILES
WriteGeo.cpp
)

SET( CORE_LIBS
AlembicAbcGeom
AlembicAbc
AlembicAbcCoreHDF5
AlembicAbcCoreOgawa
AlembicAbcCoreAbstract
AlembicAbcCoreFactory
AlembicOgawa
AlembicUtil )

ADD_ARNOLD_CXX_PLUGIN( AlembicArnoldProcedural ProcMain.cpp ${H_FILES} ${CXX_FILES} )
TARGET_LINK_LIBRARIES( AlembicArnoldProcedural
${CORE_LIBS}
${ALEMBIC_HDF5_LIBS}
${ALEMBIC_ILMBASE_LIBS}
${CMAKE_THREAD_LIBS_INIT}
${ZLIB_LIBRARIES}
)
TARGET_LINK_LIBRARIES( AlembicArnoldProcedural ${CORE_LIBS})

set_target_properties(AlembicArnoldProcedural PROPERTIES
INSTALL_RPATH_USE_LINK_PATH TRUE
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)

INSTALL ( TARGETS
AlembicArnoldProcedural
Expand Down
90 changes: 45 additions & 45 deletions arnold/Procedural/ProcMain.cpp
@@ -1,6 +1,6 @@
//-*****************************************************************************
//
// Copyright (c) 2009-2011,
// Copyright (c) 2009-2015,
// Sony Pictures Imageworks Inc. and
// Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
//
Expand Down Expand Up @@ -57,11 +57,11 @@ void WalkObject( IObject parent, const ObjectHeader &ohead, ProcArgs &args,
{
//Accumulate transformation samples and pass along as an argument
//to WalkObject

IObject nextParentObject;

std::auto_ptr<MatrixSampleMap> concatenatedXformSamples;

if ( IXform::matches( ohead ) )
{
if ( args.excludeXform )
Expand All @@ -71,24 +71,24 @@ void WalkObject( IObject parent, const ObjectHeader &ohead, ProcArgs &args,
else
{
IXform xform( parent, ohead.getName() );

IXformSchema &xs = xform.getSchema();

if ( xs.getNumOps() > 0 )
{
{
TimeSamplingPtr ts = xs.getTimeSampling();
size_t numSamples = xs.getNumSamples();

SampleTimeSet sampleTimes;
GetRelevantSampleTimes( args, ts, numSamples, sampleTimes,
xformSamples);

MatrixSampleMap localXformSamples;

MatrixSampleMap * localXformSamplesToFill = 0;

concatenatedXformSamples.reset(new MatrixSampleMap);

if ( !xformSamples )
{
// If we don't have parent xform samples, we can fill
Expand All @@ -100,38 +100,38 @@ void WalkObject( IObject parent, const ObjectHeader &ohead, ProcArgs &args,
//otherwise we need to fill in a temporary map
localXformSamplesToFill = &localXformSamples;
}


for (SampleTimeSet::iterator I = sampleTimes.begin();
I != sampleTimes.end(); ++I)
{
XformSample sample = xform.getSchema().getValue(
Abc::ISampleSelector(*I));
(*localXformSamplesToFill)[(*I)] = sample.getMatrix();
}

if ( xformSamples )
{
ConcatenateXformSamples(args,
*xformSamples,
localXformSamples,
*concatenatedXformSamples.get());
}


xformSamples = concatenatedXformSamples.get();

}

nextParentObject = xform;
}
}
else if ( ISubD::matches( ohead ) )
{
std::string faceSetName;

ISubD subd( parent, ohead.getName() );

//if we haven't reached the end of a specified -objectpath,
//check to see if the next token is a faceset name.
//If it is, send the name to ProcessSubD for addition of
Expand All @@ -143,9 +143,9 @@ void WalkObject( IObject parent, const ObjectHeader &ohead, ProcArgs &args,
faceSetName = *I;
}
}

ProcessSubD( subd, args, xformSamples, faceSetName );

//if we found a matching faceset, don't traverse below
if ( faceSetName.empty() )
{
Expand All @@ -155,9 +155,9 @@ void WalkObject( IObject parent, const ObjectHeader &ohead, ProcArgs &args,
else if ( IPolyMesh::matches( ohead ) )
{
std::string faceSetName;

IPolyMesh polymesh( parent, ohead.getName() );

//if we haven't reached the end of a specified -objectpath,
//check to see if the next token is a faceset name.
//If it is, send the name to ProcessSubD for addition of
Expand All @@ -169,9 +169,9 @@ void WalkObject( IObject parent, const ObjectHeader &ohead, ProcArgs &args,
faceSetName = *I;
}
}

ProcessPolyMesh( polymesh, args, xformSamples, faceSetName );

//if we found a matching faceset, don't traverse below
if ( faceSetName.empty() )
{
Expand All @@ -182,21 +182,21 @@ void WalkObject( IObject parent, const ObjectHeader &ohead, ProcArgs &args,
{
INuPatch patch( parent, ohead.getName() );
// TODO ProcessNuPatch( patch, args );

nextParentObject = patch;
}
else if ( IPoints::matches( ohead ) )
{
IPoints points( parent, ohead.getName() );
// TODO ProcessPoints( points, args );

nextParentObject = points;
}
else if ( ICurves::matches( ohead ) )
{
ICurves curves( parent, ohead.getName() );
// TODO ProcessCurves( curves, args );

nextParentObject = curves;
}
else if ( IFaceSet::matches( ohead ) )
Expand All @@ -207,17 +207,17 @@ void WalkObject( IObject parent, const ObjectHeader &ohead, ProcArgs &args,
{
std::cerr << "could not determine type of " << ohead.getName()
<< std::endl;

std::cerr << ohead.getName() << " has MetaData: "
<< ohead.getMetaData().serialize() << std::endl;

nextParentObject = parent.getChild(ohead.getName());
}

if ( nextParentObject.valid() )
{
//std::cerr << nextParentObject.getFullName() << std::endl;

if ( I == E )
{
for ( size_t i = 0; i < nextParentObject.getNumChildren() ; ++i )
Expand All @@ -231,17 +231,17 @@ void WalkObject( IObject parent, const ObjectHeader &ohead, ProcArgs &args,
{
const ObjectHeader *nextChildHeader =
nextParentObject.getChildHeader( *I );

if ( nextChildHeader != NULL )
{
WalkObject( nextParentObject, *nextChildHeader, args, I+1, E,
xformSamples);
}
}
}



}

//-*************************************************************************
Expand All @@ -251,11 +251,11 @@ int ProcInit( struct AtNode *node, void **user_ptr )
ProcArgs * args = new ProcArgs( AiNodeGetStr( node, "data" ) );
args->proceduralNode = node;
*user_ptr = args;

#if (AI_VERSION_ARCH_NUM == 3 && AI_VERSION_MAJOR_NUM < 3) || AI_VERSION_ARCH_NUM < 3
#error Arnold version 3.3+ required for AlembicArnoldProcedural
#endif

if (!AiCheckAPIVersion(AI_VERSION_ARCH, AI_VERSION_MAJOR, AI_VERSION_MINOR))
{
std::cout << "AlembicArnoldProcedural compiled with arnold-"
Expand Down Expand Up @@ -312,8 +312,8 @@ int ProcInit( struct AtNode *node, void **user_ptr )
{
std::cerr << "exception thrown\n";
}


return 1;
}

Expand All @@ -338,12 +338,12 @@ int ProcNumNodes( void *user_ptr )
struct AtNode* ProcGetNode(void *user_ptr, int i)
{
ProcArgs * args = reinterpret_cast<ProcArgs*>( user_ptr );

if ( i >= 0 && i < (int) args->createdNodes.size() )
{
return args->createdNodes[i];
}

return NULL;
}

Expand All @@ -353,7 +353,7 @@ struct AtNode* ProcGetNode(void *user_ptr, int i)

extern "C"
{
int ProcLoader(AtProcVtable* api)
ALEMBIC_EXPORT int ProcLoader(AtProcVtable* api)
{
api->Init = ProcInit;
api->Cleanup = ProcCleanup;
Expand Down

0 comments on commit ba9e7ec

Please sign in to comment.