Skip to content

Commit

Permalink
Merge pull request #18 from johnhaddon/cortexUpdate
Browse files Browse the repository at this point in the history
Update Cortex to 9.14.1.
  • Loading branch information
johnhaddon authored Nov 1, 2016
2 parents e47b939 + 741e344 commit c695fd0
Show file tree
Hide file tree
Showing 3,926 changed files with 431 additions and 136 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion build/buildCortex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

cd `dirname $0`/../cortex-9.13.0
cd `dirname $0`/../cortex-9.14.1

mkdir -p $BUILD_DIR/doc/licenses
cp LICENSE $BUILD_DIR/doc/licenses/cortex
Expand Down
File renamed without changes.
File renamed without changes.
44 changes: 44 additions & 0 deletions cortex-9.13.0/Changes → cortex-9.14.1/Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
9.14.1
======

Fixes
-----

- Arnold `UniverseBlock`
- Shutdown lazily to improve read-only access (e.g. shader loading on script open).
- Fixed threadsafety issues with construction/destruction.
- Fixed writability issues in `Renderer` and tests.
- `IECoreGL::Selector`: Fixed leak of `glClearColor` and `glClearDepth`.

9.14.0
======

#### IECore

- ParameterAlgo
- Added manual conversion from BoolVectorData to AtArray.
- DisplayDriverServer
- Supporting automatic selection of a free port.

#### IECoreMaya

- SceneShape
- Added preserveNamespace argument to convertAllToGeometry().
- Recursive expandAsGeometry() now preserves namespace.
- Fixed bug converting multiple curves to geometry.
- Fixed naming backward compatibility when converting and connecting to curves.

9.13.2
======

#### IECore

- Added 'tx' support for TIFFImageReader

9.13.1
======

#### IECoreArnold

- CurvesAlgo : Convert "N" to orientations.

9.13.0
======

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions cortex-9.13.0/SConstruct → cortex-9.14.1/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ EnsureSConsVersion( 0, 97 )
SConsignFile()

ieCoreMajorVersion=9
ieCoreMinorVersion=13
ieCorePatchVersion=0
ieCoreMinorVersion=14
ieCorePatchVersion=1
ieCoreVersionSuffix="" # used for alpha/beta releases. Example: "a1", "b2", etc.

###########################################################################################
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ if targetApp=="nuke" :
PNG_INCLUDE_PATH = "/usr/local/include/"

NUKE_ROOT = nukeReg["location"]
NUKE_LICENSE_FILE = nukeReg["wrapperEnvVars"]["LM_LICENSE_FILE"]
NUKE_LICENSE_FILE = nukeReg["wrapperEnvVars"]["foundry_LICENSE"]
INSTALL_NUKELIB_NAME = os.path.join( appPrefix, "lib", "$IECORE_NAME-$IECORE_MAJOR_VERSION" )
INSTALL_NUKEPYTHON_DIR = os.path.join( appPrefix, "python" )
INSTALL_NUKEPLUGIN_NAME = os.path.join( appPrefix, "plugins", "$IECORE_NAME" )
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
namespace IECoreArnold
{

/// Wraps Arnold universe creation and destruction. This is
/// problematic because there can be only one instance at a time,
/// but many applications have need for more than one.
/// Manages the Arnold universe. This is problematic because there
/// can be only one instance at a time, but many applications have
/// need for more than one.
class IECOREARNOLD_API UniverseBlock : public boost::noncopyable
{

Expand All @@ -53,18 +53,20 @@ class IECOREARNOLD_API UniverseBlock : public boost::noncopyable
/// \deprecated
UniverseBlock();
/// Ensures that the Arnold universe has been created and
/// that all plugins on the ARNOLD_PLUGIN_PATH have been
/// loaded. If writable is true, then throws if there is
/// already a writer.
/// that all plugins and metadata files on the ARNOLD_PLUGIN_PATH
/// have been loaded. If writable is true, then throws if
/// there is already a writer.
UniverseBlock( bool writable );
/// Destroys the Arnold universe when the last active
/// UniverseBlock is destructed.
/// "Releases" the universe. Currently we only actually
/// call `AiEnd()` for writable universes, because it is
/// essential to clean them up properly. We leave readable
/// universes active to avoid the startup cost the next
/// time around.
~UniverseBlock();

private :

void init( bool writable );
void loadMetadata( const std::string &pluginPaths );

};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@
#include "ai.h"

#include "IECore/CurvesPrimitive.h"
#include "IECore/Exception.h"
#include "IECore/MessageHandler.h"

#include "IECoreArnold/NodeAlgo.h"
#include "IECoreArnold/ShapeAlgo.h"
#include "IECoreArnold/CurvesAlgo.h"
#include "IECoreArnold/ParameterAlgo.h"

using namespace std;
using namespace IECore;
Expand Down Expand Up @@ -93,7 +94,7 @@ AtNode *convertCommon( const IECore::CurvesPrimitive *curves )

// add arbitrary user parameters

const char *ignore[] = { "P", "width", "radius", 0 };
const char *ignore[] = { "P", "N", "width", "radius", 0 };
ShapeAlgo::convertPrimitiveVariables( curves, result, ignore );

return result;
Expand All @@ -108,6 +109,18 @@ AtNode *CurvesAlgo::convert( const IECore::CurvesPrimitive *curves )
ShapeAlgo::convertP( curves, result, "points" );
ShapeAlgo::convertRadius( curves, result );

// Convert "N" to orientations

if( const V3fVectorData *n = curves->variableData<V3fVectorData>( "N", PrimitiveVariable::Vertex ) )
{
AiNodeSetStr( result, "mode", "oriented" );
AiNodeSetArray(
result,
"orientations",
AiArrayConvert( n->readable().size(), 1, AI_TYPE_VECTOR, (void *)&( n->readable()[0] ) )
);
}

return result;
}

Expand All @@ -119,6 +132,29 @@ AtNode *CurvesAlgo::convert( const std::vector<const IECore::CurvesPrimitive *>
ShapeAlgo::convertP( primitiveSamples, result, "points" );
ShapeAlgo::convertRadius( primitiveSamples, result );

// Convert "N" to orientations

vector<const Data *> nSamples;
nSamples.reserve( samples.size() );
for( vector<const CurvesPrimitive *>::const_iterator it = samples.begin(), eIt = samples.end(); it != eIt; ++it )
{
if( const V3fVectorData *n = (*it)->variableData<V3fVectorData>( "N", PrimitiveVariable::Vertex ) )
{
nSamples.push_back( n );
}
}

if( nSamples.size() == samples.size() )
{
AiNodeSetStr( result, "mode", "oriented" );
AtArray *array = ParameterAlgo::dataToArray( nSamples, AI_TYPE_VECTOR );
AiNodeSetArray( result, "orientations", array );
}
else if( nSamples.size() )
{
IECore::msg( IECore::Msg::Warning, "CurvesAlgo::convert", "Missing sample for primitive variable \"N\" - not setting orientations." );
}

AiNodeSetArray( result, "deform_time_samples", AiArrayConvert( sampleTimes.size(), 1, AI_TYPE_FLOAT, &sampleTimes.front() ) );

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,19 @@ AtArray *dataToArray( const IECore::Data *data, int aiType )
return NULL;
}
}
// bools are a special case because of how the STL implements vector<bool>.
// Since the base for vector<bool> are not actual booleans, we need to manually
// convert to an AtArray here.
else if( aiType == AI_TYPE_BOOLEAN )
{
const vector<bool> &booleans = static_cast<const BoolVectorData *>( data )->readable();
vector<bool>::size_type booleansSize = booleans.size();
AtArray* array = AiArrayAllocate( booleansSize, 1, AI_TYPE_BOOLEAN );
for(vector<bool>::size_type i = 0; i < booleansSize; ++i){
AiArraySetBool(array, i, booleans[i]);
}
return array;
}

const void *dataAddress = despatchTypedData<TypedDataAddress, TypeTraits::IsTypedData, DespatchTypedDataIgnoreError>( const_cast<Data *>( data ) );
size_t dataSize = despatchTypedData<TypedDataSize, TypeTraits::IsTypedData, DespatchTypedDataIgnoreError>( const_cast<Data *>( data ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void IECoreArnold::RendererImplementation::constructCommon( Mode mode )
m_mode = mode;
if( mode != Procedural )
{
m_universe = boost::shared_ptr<UniverseBlock>( new UniverseBlock() );
m_universe = boost::shared_ptr<UniverseBlock>( new UniverseBlock( /* writable = */ true ) );
m_instancingConverter = new InstancingConverter;

/// \todo Control with an option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

#include "ai.h"

#include "tbb/spin_mutex.h"

#include "boost/tokenizer.hpp"
#include "boost/filesystem/operations.hpp"

Expand All @@ -46,9 +48,53 @@
using namespace IECore;
using namespace IECoreArnold;

static int g_count = 0;
static bool g_haveWriter = false;
static ClassData<UniverseBlock, bool> g_writable;
namespace
{

void loadMetadata( const std::string &pluginPaths )
{
typedef boost::tokenizer<boost::char_separator<char> > Tokenizer;
Tokenizer t( pluginPaths, boost::char_separator<char>( ":" ) );
for( Tokenizer::const_iterator it = t.begin(), eIt = t.end(); it != eIt; ++it )
{
try
{
for( boost::filesystem::recursive_directory_iterator dIt( *it ), deIt; dIt != deIt; ++dIt )
{
if( dIt->path().extension() == ".mtd" )
{
if( !AiMetaDataLoadFile( dIt->path().c_str() ) )
{
throw IECore::Exception( boost::str( boost::format( "Failed to load \"%s\"" ) % dIt->path().string() ) );
}
}
}
}
catch( const std::exception &e )
{
IECore::msg( IECore::Msg::Debug, "UniverseBlock", e.what() );
}
}
}

void begin()
{
AiBegin();

const char *pluginPaths = getenv( "ARNOLD_PLUGIN_PATH" );
if( pluginPaths )
{
AiLoadPlugins( pluginPaths );
loadMetadata( pluginPaths );
}
}

tbb::spin_mutex g_mutex;
int g_count = 0;
bool g_haveWriter = false;
ClassData<UniverseBlock, bool> g_writable;

} // namespace

UniverseBlock::UniverseBlock()
{
Expand All @@ -65,6 +111,8 @@ UniverseBlock::UniverseBlock( bool writable )

void UniverseBlock::init( bool writable )
{
tbb::spin_mutex::scoped_lock lock( g_mutex );

if( writable )
{
if( g_haveWriter )
Expand All @@ -84,52 +132,35 @@ void UniverseBlock::init( bool writable )
return;
}

AiBegin();

const char *pluginPaths = getenv( "ARNOLD_PLUGIN_PATH" );
if( pluginPaths )
{
AiLoadPlugins( pluginPaths );
loadMetadata( pluginPaths );
}
begin();
}

UniverseBlock::~UniverseBlock()
{
tbb::spin_mutex::scoped_lock lock( g_mutex );

g_count--;
if( g_writable[this] )
{
g_haveWriter = false;
}
g_writable.erase( this );

if( --g_count == 0 )
{
// We _must_ call AiEnd() to clean up ready
// for the next writer, regardless of whether
// or not readers still exist.
AiEnd();
}
}

void UniverseBlock::loadMetadata( const std::string &pluginPaths )
{
typedef boost::tokenizer<boost::char_separator<char> > Tokenizer;
Tokenizer t( pluginPaths, boost::char_separator<char>( ":" ) );
for( Tokenizer::const_iterator it = t.begin(), eIt = t.end(); it != eIt; ++it )
{
try
if( g_count )
{
for( boost::filesystem::recursive_directory_iterator dIt( *it ), deIt; dIt != deIt; ++dIt )
{
if( dIt->path().extension() == ".mtd" )
{
if( !AiMetaDataLoadFile( dIt->path().c_str() ) )
{
throw IECore::Exception( boost::str( boost::format( "Failed to load \"%s\"" ) % dIt->path().string() ) );
}
}
}
}
catch( const std::exception &e )
{
IECore::msg( IECore::Msg::Debug, "UniverseBlock", e.what() );
// If readers do exist, restart the universe.
// This is not threadsafe, since a reader on
// another thread could be making Ai calls
// in between shutdown and startup. But it is
// the best we can do given that Arnold has
// only one universe. The alternative is to
// only shutdown when g_count reaches 0, but
// then a long-lived reader can cause Arnold
// state to be carried over from one writer
// to the next.
begin();
}
}
g_writable.erase( this );
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class CameraAlgoTest( unittest.TestCase ) :

def testConvertPerspective( self ) :

with IECoreArnold.UniverseBlock() :
with IECoreArnold.UniverseBlock( writable = True ) :

n = IECoreArnold.NodeAlgo.convert(
IECore.Camera(
Expand All @@ -64,7 +64,7 @@ def testConvertPerspective( self ) :

def testConvertCustomProjection( self ) :

with IECoreArnold.UniverseBlock() :
with IECoreArnold.UniverseBlock( writable = True ) :

n = IECoreArnold.NodeAlgo.convert(
IECore.Camera(
Expand Down
Loading

0 comments on commit c695fd0

Please sign in to comment.