Skip to content

Commit 33d00d5

Browse files
committed
Move IECoreArnold into independent module
This emphasises the boundary between IECoreArnold and GafferArnold, with GafferArnold depending on IECoreArnold, and IECoreArnold only being dependent on other `IECore*` libs (apart from the temporary dependency on `IECoreScenePreview::Renderer`).
1 parent fb4397c commit 33d00d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+400
-148
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ jobs:
181181
scons -j 2 build BUILD_TYPE=${{ matrix.buildType }} OPTIONS=.github/workflows/main/sconsOptions
182182
# Test Arnold extension
183183
echo "::add-matcher::./.github/workflows/main/problemMatchers/unittest.json"
184-
${{ matrix.testRunner }} "${{ env.GAFFER_BUILD_DIR }}/bin/gaffer test GafferArnoldTest GafferArnoldUITest"
184+
${{ matrix.testRunner }} "${{ env.GAFFER_BUILD_DIR }}/bin/gaffer test IECoreArnoldTest GafferArnoldTest GafferArnoldUITest"
185185
echo "::remove-matcher owner=unittest::"
186186
# Publish ARNOLD_ROOT to the environment for subsequent steps,
187187
# so we can build the docs for GafferArnold.

SConstruct

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,10 +866,35 @@ libraries = {
866866
},
867867
},
868868

869+
"IECoreArnold" : {
870+
"envAppends" : {
871+
"LIBPATH" : [ "$ARNOLD_ROOT/bin" ],
872+
## \todo Remove GafferScene. We need it at present to get access to `IECoreScenePreview::Renderer`,
873+
# but IECoreArnold must never depend on Gaffer code; logically it is in the layer below Gaffer.
874+
"LIBS" : [ "GafferScene", "ai", "IECoreScene$CORTEX_LIB_SUFFIX", "IECoreVDB$CORTEX_LIB_SUFFIX" ],
875+
"CXXFLAGS" : [ "-DAI_ENABLE_DEPRECATION_WARNINGS" ],
876+
"CPPPATH" : [ "$ARNOLD_ROOT/include" ],
877+
},
878+
"pythonEnvAppends" : {
879+
"LIBPATH" : [ "$ARNOLD_ROOT/bin" ],
880+
"LIBS" : [ "IECoreScene$CORTEX_LIB_SUFFIX", "IECoreArnold" ],
881+
"CXXFLAGS" : [ "-DAI_ENABLE_DEPRECATION_WARNINGS" ],
882+
"CPPPATH" : [ "$ARNOLD_ROOT/include" ],
883+
},
884+
"requiredOptions" : [ "ARNOLD_ROOT" ],
885+
"installRoot" : arnoldInstallRoot,
886+
},
887+
888+
"IECoreArnoldTest" : {
889+
"additionalFiles" : [ "python/IECoreArnoldTest/metadata", "python/IECoreArnoldTest/assFiles" ],
890+
"requiredOptions" : [ "ARNOLD_ROOT" ],
891+
"installRoot" : arnoldInstallRoot,
892+
},
893+
869894
"GafferArnold" : {
870895
"envAppends" : {
871896
"LIBPATH" : [ "$ARNOLD_ROOT/bin" ],
872-
"LIBS" : [ "Gaffer", "GafferScene", "GafferDispatch", "ai", "GafferVDB", "openvdb$VDB_LIB_SUFFIX", "IECoreScene$CORTEX_LIB_SUFFIX", "IECoreVDB$CORTEX_LIB_SUFFIX", "GafferOSL" ],
897+
"LIBS" : [ "Gaffer", "GafferScene", "GafferDispatch", "ai", "GafferVDB", "openvdb$VDB_LIB_SUFFIX", "IECoreScene$CORTEX_LIB_SUFFIX", "IECoreVDB$CORTEX_LIB_SUFFIX", "IECoreArnold", "GafferOSL" ],
873898
"CXXFLAGS" : [ "-DAI_ENABLE_DEPRECATION_WARNINGS" ],
874899
"CPPPATH" : [ "$ARNOLD_ROOT/include" ],
875900
},
@@ -885,7 +910,7 @@ libraries = {
885910
},
886911

887912
"GafferArnoldTest" : {
888-
"additionalFiles" : glob.glob( "python/GafferArnoldTest/volumes/*" ) + glob.glob( "python/GafferArnoldTest/metadata/*" ) + glob.glob( "python/GafferArnoldTest/images/*" ) + [ "python/GafferArnoldTest/IECoreArnoldTest/metadata", "python/GafferArnoldTest/IECoreArnoldTest/assFiles" ],
913+
"additionalFiles" : glob.glob( "python/GafferArnoldTest/volumes/*" ) + glob.glob( "python/GafferArnoldTest/metadata/*" ) + glob.glob( "python/GafferArnoldTest/images/*" ),
889914
"requiredOptions" : [ "ARNOLD_ROOT" ],
890915
"installRoot" : arnoldInstallRoot,
891916
},
@@ -913,7 +938,7 @@ libraries = {
913938
"GafferArnoldPlugin" : {
914939
"envAppends" : {
915940
"LIBPATH" : [ "$ARNOLD_ROOT/bin" ],
916-
"LIBS" : [ "GafferArnold" ],
941+
"LIBS" : [ "IECoreArnold" ],
917942
"CXXFLAGS" : [ "-DAI_ENABLE_DEPRECATION_WARNINGS" ],
918943
"CPPPATH" : [ "$ARNOLD_ROOT/include" ],
919944
},

apps/test/test-1.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ def __allTestModules() :
166166

167167
result = set()
168168
for path in sys.path :
169-
for m in glob.glob( os.path.join( path, "Gaffer*Test" ) ) :
169+
modules = glob.glob( os.path.join( path, "Gaffer*Test" ) ) + glob.glob( os.path.join( path, "IECore*Test" ) )
170+
for m in modules :
170171
result.add( os.path.basename( m ) )
171172

172173
return sorted( result )

include/GafferArnold/Private/IECoreArnold/CameraAlgo.h renamed to include/IECoreArnold/CameraAlgo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#ifndef IECOREARNOLD_CAMERAALGO_H
3636
#define IECOREARNOLD_CAMERAALGO_H
3737

38-
#include "GafferArnold/Export.h"
38+
#include "IECoreArnold/Export.h"
3939

4040
#include "IECoreScene/Camera.h"
4141

@@ -47,8 +47,8 @@ namespace IECoreArnold
4747
namespace CameraAlgo
4848
{
4949

50-
GAFFERARNOLD_API AtNode *convert( const IECoreScene::Camera *camera, AtUniverse *universe, const std::string &nodeName, const AtNode *parentNode = nullptr );
51-
GAFFERARNOLD_API AtNode *convert( const std::vector<const IECoreScene::Camera *> &samples, float motionStart, float motionEnd, AtUniverse *universe, const std::string &nodeName, const AtNode *parentNode = nullptr );
50+
IECOREARNOLD_API AtNode *convert( const IECoreScene::Camera *camera, AtUniverse *universe, const std::string &nodeName, const AtNode *parentNode = nullptr );
51+
IECOREARNOLD_API AtNode *convert( const std::vector<const IECoreScene::Camera *> &samples, float motionStart, float motionEnd, AtUniverse *universe, const std::string &nodeName, const AtNode *parentNode = nullptr );
5252

5353
} // namespace CameraAlgo
5454

include/IECoreArnold/Export.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//////////////////////////////////////////////////////////////////////////
2+
//
3+
// Copyright (c) 2018, Image Engine Design Inc. All rights reserved.
4+
//
5+
// Redistribution and use in source and binary forms, with or without
6+
// modification, are permitted provided that the following conditions are
7+
// met:
8+
//
9+
// * Redistributions of source code must retain the above copyright
10+
// notice, this list of conditions and the following disclaimer.
11+
//
12+
// * Redistributions in binary form must reproduce the above copyright
13+
// notice, this list of conditions and the following disclaimer in the
14+
// documentation and/or other materials provided with the distribution.
15+
//
16+
// * Neither the name of Image Engine Design nor the names of any
17+
// other contributors to this software may be used to endorse or
18+
// promote products derived from this software without specific prior
19+
// written permission.
20+
//
21+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22+
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25+
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26+
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
//
33+
//////////////////////////////////////////////////////////////////////////
34+
35+
#ifndef IECOREARNOLD_EXPORT_H
36+
#define IECOREARNOLD_EXPORT_H
37+
38+
#include "IECore/Export.h"
39+
40+
#ifdef IECoreArnold_EXPORTS
41+
#define IECOREARNOLD_API IECORE_EXPORT
42+
#else
43+
#define IECOREARNOLD_API IECORE_IMPORT
44+
#endif
45+
46+
#endif // #ifndef IECOREARNOLD_EXPORT_H

include/GafferArnold/Private/IECoreArnold/NodeAlgo.h renamed to include/IECoreArnold/NodeAlgo.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#ifndef IECOREARNOLD_NODEALGO_H
3636
#define IECOREARNOLD_NODEALGO_H
3737

38-
#include "GafferArnold/Export.h"
38+
#include "IECoreArnold/Export.h"
3939

4040
#include "IECore/Object.h"
4141

@@ -50,12 +50,12 @@ namespace NodeAlgo
5050
/// Converts the specified IECore::Object into an equivalent
5151
/// Arnold object, returning nullptr if no conversion is
5252
/// available.
53-
GAFFERARNOLD_API AtNode *convert( const IECore::Object *object, AtUniverse *universe, const std::string &nodeName, const AtNode *parentNode = nullptr );
53+
IECOREARNOLD_API AtNode *convert( const IECore::Object *object, AtUniverse *universe, const std::string &nodeName, const AtNode *parentNode = nullptr );
5454
/// Converts the specified IECore::Object samples into an
5555
/// equivalent moving Arnold object. If no motion converter
5656
/// is available, then returns a standard conversion of the
5757
/// first sample.
58-
GAFFERARNOLD_API AtNode *convert( const std::vector<const IECore::Object *> &samples, float motionStart, float motionEnd, AtUniverse *universe, const std::string &nodeName, const AtNode *parentNode = nullptr );
58+
IECOREARNOLD_API AtNode *convert( const std::vector<const IECore::Object *> &samples, float motionStart, float motionEnd, AtUniverse *universe, const std::string &nodeName, const AtNode *parentNode = nullptr );
5959

6060
/// Signature of a function which can convert an IECore::Object
6161
/// into an Arnold object.
@@ -67,7 +67,7 @@ typedef AtNode * (*MotionConverter)( const std::vector<const IECore::Object *> &
6767
/// Registers a converter for a specific type.
6868
/// Use the ConverterDescription utility class in preference to
6969
/// this, since it provides additional type safety.
70-
GAFFERARNOLD_API void registerConverter( IECore::TypeId fromType, Converter converter, MotionConverter motionConverter = nullptr );
70+
IECOREARNOLD_API void registerConverter( IECore::TypeId fromType, Converter converter, MotionConverter motionConverter = nullptr );
7171

7272
/// Class which registers a converter for type T automatically
7373
/// when instantiated.

include/GafferArnold/Private/IECoreArnold/ParameterAlgo.h renamed to include/IECoreArnold/ParameterAlgo.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#ifndef IECOREARNOLD_PARAMETERALGO_H
3636
#define IECOREARNOLD_PARAMETERALGO_H
3737

38-
#include "GafferArnold/Export.h"
38+
#include "IECoreArnold/Export.h"
3939

4040
#include "IECore/CompoundData.h"
4141

@@ -47,28 +47,28 @@ namespace IECoreArnold
4747
namespace ParameterAlgo
4848
{
4949

50-
GAFFERARNOLD_API void setParameter( AtNode *node, const AtParamEntry *parameter, const IECore::Data *value );
51-
GAFFERARNOLD_API void setParameter( AtNode *node, AtString name, const IECore::Data *value );
52-
GAFFERARNOLD_API void setParameter( AtNode *node, const char *name, const IECore::Data *value );
53-
GAFFERARNOLD_API void setParameters( AtNode *node, const IECore::CompoundDataMap &values );
50+
IECOREARNOLD_API void setParameter( AtNode *node, const AtParamEntry *parameter, const IECore::Data *value );
51+
IECOREARNOLD_API void setParameter( AtNode *node, AtString name, const IECore::Data *value );
52+
IECOREARNOLD_API void setParameter( AtNode *node, const char *name, const IECore::Data *value );
53+
IECOREARNOLD_API void setParameters( AtNode *node, const IECore::CompoundDataMap &values );
5454

55-
GAFFERARNOLD_API IECore::DataPtr getParameter( AtNode *node, const AtParamEntry *parameter );
56-
GAFFERARNOLD_API IECore::DataPtr getParameter( AtNode *node, const AtUserParamEntry *parameter );
57-
GAFFERARNOLD_API IECore::DataPtr getParameter( AtNode *node, AtString name );
58-
GAFFERARNOLD_API IECore::DataPtr getParameter( AtNode *node, const char *name );
59-
GAFFERARNOLD_API void getParameters( AtNode *node, IECore::CompoundDataMap &values );
55+
IECOREARNOLD_API IECore::DataPtr getParameter( AtNode *node, const AtParamEntry *parameter );
56+
IECOREARNOLD_API IECore::DataPtr getParameter( AtNode *node, const AtUserParamEntry *parameter );
57+
IECOREARNOLD_API IECore::DataPtr getParameter( AtNode *node, AtString name );
58+
IECOREARNOLD_API IECore::DataPtr getParameter( AtNode *node, const char *name );
59+
IECOREARNOLD_API void getParameters( AtNode *node, IECore::CompoundDataMap &values );
6060

6161
/// Returns the Arnold parameter type (AI_TYPE_INT etc) suitable for
6262
/// storing Cortex data of the specified type, setting array to true
6363
/// or false depending on whether or not the Arnold type will be an
6464
/// array. Returns AI_TYPE_NONE if there is no suitable Arnold type.
65-
GAFFERARNOLD_API int parameterType( IECore::TypeId dataType, bool &array );
66-
GAFFERARNOLD_API int parameterType( const IECore::Data *data, bool &array );
65+
IECOREARNOLD_API int parameterType( IECore::TypeId dataType, bool &array );
66+
IECOREARNOLD_API int parameterType( const IECore::Data *data, bool &array );
6767

6868
/// If the equivalent Arnold type for the data is already known, then it may be passed directly.
6969
/// If not it will be inferred using parameterType().
70-
GAFFERARNOLD_API AtArray *dataToArray( const IECore::Data *data, int aiType = AI_TYPE_NONE );
71-
GAFFERARNOLD_API AtArray *dataToArray( const std::vector<const IECore::Data *> &samples, int aiType = AI_TYPE_NONE );
70+
IECOREARNOLD_API AtArray *dataToArray( const IECore::Data *data, int aiType = AI_TYPE_NONE );
71+
IECOREARNOLD_API AtArray *dataToArray( const std::vector<const IECore::Data *> &samples, int aiType = AI_TYPE_NONE );
7272

7373
} // namespace ParameterAlgo
7474

include/GafferArnold/Private/IECoreArnold/ProceduralAlgo.h renamed to include/IECoreArnold/ProceduralAlgo.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
#ifndef IECOREARNOLD_PROCEDURALALGO_H
3636
#define IECOREARNOLD_PROCEDURALALGO_H
3737

38+
#include "IECoreArnold/Export.h"
39+
3840
#include "IECoreScene/ExternalProcedural.h"
3941

4042
#include "ai_nodes.h"
@@ -45,7 +47,7 @@ namespace IECoreArnold
4547
namespace ProceduralAlgo
4648
{
4749

48-
AtNode *convert( const IECoreScene::ExternalProcedural *procedural, AtUniverse *universe, const std::string &nodeName, const AtNode *parentNode );
50+
IECOREARNOLD_API AtNode *convert( const IECoreScene::ExternalProcedural *procedural, AtUniverse *universe, const std::string &nodeName, const AtNode *parentNode );
4951

5052
} // namespace ProceduralAlgo
5153

include/GafferArnold/Private/IECoreArnold/ShaderNetworkAlgo.h renamed to include/IECoreArnold/ShaderNetworkAlgo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#ifndef IECOREARNOLD_SHADERNETWORKALGO_H
3838
#define IECOREARNOLD_SHADERNETWORKALGO_H
3939

40-
#include "GafferArnold/Export.h"
40+
#include "IECoreArnold/Export.h"
4141

4242
#include "IECoreScene/ShaderNetwork.h"
4343

@@ -55,12 +55,12 @@ namespace ShaderNetworkAlgo
5555
/// to Arnold. The output shader is the last node in the returned vector,
5656
/// and is given the specified `name`. All other nodes will be named
5757
/// uniquely using `name` as a prefix.
58-
GAFFERARNOLD_API std::vector<AtNode *> convert( const IECoreScene::ShaderNetwork *shaderNetwork, AtUniverse *universe, const std::string &name, const AtNode *parentNode = nullptr );
58+
IECOREARNOLD_API std::vector<AtNode *> convert( const IECoreScene::ShaderNetwork *shaderNetwork, AtUniverse *universe, const std::string &name, const AtNode *parentNode = nullptr );
5959
/// Updates a previously converted set of nodes to reflect changes in `shaderNetwork`,
6060
/// reusing AtNodes where possible. The `nodes` vector is updated in place, newly created
6161
/// nodes use the same parent as the original nodes, and unused nodes are destroyed with
6262
/// `AiNodeDestroy`. Returns true if the output shader node is reused.
63-
GAFFERARNOLD_API bool update( std::vector<AtNode *> &nodes, const IECoreScene::ShaderNetwork *shaderNetwork );
63+
IECOREARNOLD_API bool update( std::vector<AtNode *> &nodes, const IECoreScene::ShaderNetwork *shaderNetwork );
6464

6565
} // namespace ShaderNetworkAlgo
6666

include/GafferArnold/Private/IECoreArnold/ShapeAlgo.h renamed to include/IECoreArnold/ShapeAlgo.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#ifndef IECOREARNOLD_SHAPEALGO_H
3636
#define IECOREARNOLD_SHAPEALGO_H
3737

38-
#include "GafferArnold/Export.h"
38+
#include "IECoreArnold/Export.h"
3939

4040
#include "IECoreScene/Primitive.h"
4141

@@ -47,16 +47,16 @@ namespace IECoreArnold
4747
namespace ShapeAlgo
4848
{
4949

50-
GAFFERARNOLD_API void convertP( const IECoreScene::Primitive *primitive, AtNode *shape, const AtString name );
51-
GAFFERARNOLD_API void convertP( const std::vector<const IECoreScene::Primitive *> &samples, AtNode *shape, const AtString name );
50+
IECOREARNOLD_API void convertP( const IECoreScene::Primitive *primitive, AtNode *shape, const AtString name );
51+
IECOREARNOLD_API void convertP( const std::vector<const IECoreScene::Primitive *> &samples, AtNode *shape, const AtString name );
5252

53-
GAFFERARNOLD_API void convertRadius( const IECoreScene::Primitive *primitive, AtNode *shape );
54-
GAFFERARNOLD_API void convertRadius( const std::vector<const IECoreScene::Primitive *> &samples, AtNode *shape );
53+
IECOREARNOLD_API void convertRadius( const IECoreScene::Primitive *primitive, AtNode *shape );
54+
IECOREARNOLD_API void convertRadius( const std::vector<const IECoreScene::Primitive *> &samples, AtNode *shape );
5555

56-
GAFFERARNOLD_API void convertPrimitiveVariable( const IECoreScene::Primitive *primitive, const IECoreScene::PrimitiveVariable &primitiveVariable, AtNode *shape, const AtString name );
56+
IECOREARNOLD_API void convertPrimitiveVariable( const IECoreScene::Primitive *primitive, const IECoreScene::PrimitiveVariable &primitiveVariable, AtNode *shape, const AtString name );
5757
/// Converts primitive variables from primitive into user parameters on shape, ignoring any variables
5858
/// whose names are present in the ignore array.
59-
GAFFERARNOLD_API void convertPrimitiveVariables( const IECoreScene::Primitive *primitive, AtNode *shape, const char **namesToIgnore=nullptr );
59+
IECOREARNOLD_API void convertPrimitiveVariables( const IECoreScene::Primitive *primitive, AtNode *shape, const char **namesToIgnore=nullptr );
6060

6161
} // namespace ShapeAlgo
6262

0 commit comments

Comments
 (0)