diff --git a/CMakeLists.txt b/CMakeLists.txt index f58bffd..2268cb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.0) project(AtomsGaffer) option( USE_GAFFER_DEPENDENCIES "Turn this off you're building against your own dependencies (eg boost, python, tbb, exr, cortex) rather than the versions included with Gaffer" ON ) -option( USE_ATOMS_PROCEDURAL "Turn this off you plan to load AtomsGaffer in maya or another environment that requires a full atoms license" ON ) set(CMAKE_VERBOSE_MAKEFILE ON) @@ -40,21 +39,17 @@ set(DEPENDENCY_INCLUDE_PATHS file( GLOB AtomsGafferSrc src/AtomsGaffer/*.cpp ) link_directories( AtomsGaffer ${GAFFER_ROOT}/lib ${ATOMS_LIB_PATH} ) add_library( AtomsGaffer SHARED ${AtomsGafferSrc} ) -target_compile_definitions( AtomsGaffer PRIVATE BOOST_SIGNALS_NO_DEPRECATION_WARNING=1 LINUX=1 ) +target_compile_definitions( AtomsGaffer PRIVATE BOOST_SIGNALS_NO_DEPRECATION_WARNING=1 LINUX=1 _GLIBCXX_USE_CXX11_ABI=0) target_include_directories( AtomsGaffer SYSTEM PRIVATE ${DEPENDENCY_INCLUDE_PATHS} ) target_include_directories( AtomsGaffer PRIVATE include ) -if(USE_ATOMS_PROCEDURAL) - target_link_libraries( AtomsGaffer Gaffer GafferScene AtomsProcedural ) -else() - target_link_libraries( AtomsGaffer Gaffer GafferScene AtomsCore AtomsGraph Atoms AtomsUtils ) -endif() +target_link_libraries( AtomsGaffer Gaffer GafferScene AtomsCore AtomsGraph Atoms AtomsUtils ) install( TARGETS AtomsGaffer DESTINATION lib ) # build the python bindings file( GLOB AtomsGafferModuleSrc src/AtomsGafferModule/*.cpp ) add_library( AtomsGafferModule SHARED ${AtomsGafferModuleSrc} ) set_target_properties( AtomsGafferModule PROPERTIES PREFIX "" OUTPUT_NAME "_AtomsGaffer" ) -target_compile_definitions( AtomsGafferModule PRIVATE BOOST_SIGNALS_NO_DEPRECATION_WARNING=1 LINUX=1 ) +target_compile_definitions( AtomsGafferModule PRIVATE BOOST_SIGNALS_NO_DEPRECATION_WARNING=1 LINUX=1 _GLIBCXX_USE_CXX11_ABI=0) target_link_libraries( AtomsGafferModule AtomsGaffer ) target_include_directories( AtomsGafferModule SYSTEM PRIVATE ${DEPENDENCY_INCLUDE_PATHS} ${PYTHON_ROOT}/include/python2.7 ) target_include_directories( AtomsGafferModule PRIVATE include ) diff --git a/README.md b/README.md index 027de56..e8f3f8e 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ setenv ATOMS_ROOT setenv ATOMSGAFFER_INSTALL_PREFIX cd atomsGaffer -cmake -DGAFFER_ROOT=$GAFFER_ROOT -DATOMS_ROOT=$ATOMS_ROOT -DCMAKE_CXX_FLAGS='-std=c++11' -DCMAKE_INSTALL_PREFIX=$ATOMSGAFFER_INSTALL_PREFIX . +cmake -DGAFFER_ROOT=$GAFFER_ROOT -DATOMS_ROOT=$ATOMS_ROOT -DCMAKE_CXX_FLAGS='-std=c++14' -DCMAKE_INSTALL_PREFIX=$ATOMSGAFFER_INSTALL_PREFIX . make install -j ) ``` diff --git a/examples/scripts/atomsExampleScene.gfr b/examples/scripts/atomsExampleScene.gfr index 47add3a..273b179 100644 --- a/examples/scripts/atomsExampleScene.gfr +++ b/examples/scripts/atomsExampleScene.gfr @@ -8,21 +8,15 @@ import IECore import imath Gaffer.Metadata.registerValue( parent, "serialiser:milestoneVersion", 0, persistent=False ) -Gaffer.Metadata.registerValue( parent, "serialiser:majorVersion", 53, persistent=False ) -Gaffer.Metadata.registerValue( parent, "serialiser:minorVersion", 0, persistent=False ) +Gaffer.Metadata.registerValue( parent, "serialiser:majorVersion", 59, persistent=False ) +Gaffer.Metadata.registerValue( parent, "serialiser:minorVersion", 4, persistent=False ) Gaffer.Metadata.registerValue( parent, "serialiser:patchVersion", 0, persistent=False ) __children = {} -parent["variables"].addChild( Gaffer.CompoundDataPlug.MemberPlug( "imageCataloguePort", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -parent["variables"]["imageCataloguePort"].addChild( Gaffer.StringPlug( "name", defaultValue = 'image:catalogue:port', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -parent["variables"]["imageCataloguePort"].addChild( Gaffer.IntPlug( "value", defaultValue = 0, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -parent["variables"].addChild( Gaffer.CompoundDataPlug.MemberPlug( "projectName", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -parent["variables"]["projectName"].addChild( Gaffer.StringPlug( "name", defaultValue = 'project:name', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -parent["variables"]["projectName"].addChild( Gaffer.StringPlug( "value", defaultValue = 'default', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -parent["variables"].addChild( Gaffer.CompoundDataPlug.MemberPlug( "projectRootDirectory", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -parent["variables"]["projectRootDirectory"].addChild( Gaffer.StringPlug( "name", defaultValue = 'project:rootDirectory', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -parent["variables"]["projectRootDirectory"].addChild( Gaffer.StringPlug( "value", defaultValue = '$HOME/gaffer/projects/${project:name}', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) +parent["variables"].addChild( Gaffer.NameValuePlug( "image:catalogue:port", Gaffer.IntPlug( "value", defaultValue = 0, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "imageCataloguePort", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) ) +parent["variables"].addChild( Gaffer.NameValuePlug( "project:name", Gaffer.StringPlug( "value", defaultValue = 'default', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "projectName", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) ) +parent["variables"].addChild( Gaffer.NameValuePlug( "project:rootDirectory", Gaffer.StringPlug( "value", defaultValue = '$HOME/gaffer/projects/${project:name}', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "projectRootDirectory", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) ) __children["defaultFormat"] = GafferImage.FormatPlug( "defaultFormat", defaultValue = GafferImage.Format( 1920, 1080, 1.000 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) parent.addChild( __children["defaultFormat"] ) __children["AtomsVariationReader"] = AtomsGaffer.AtomsVariationReader( "AtomsVariationReader" ) @@ -31,9 +25,6 @@ __children["AtomsVariationReader"].addChild( Gaffer.V2fPlug( "__uiPosition", def __children["AtomsCrowdReader"] = AtomsGaffer.AtomsCrowdReader( "AtomsCrowdReader" ) parent.addChild( __children["AtomsCrowdReader"] ) __children["AtomsCrowdReader"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["AtomsCrowdGenerator"] = AtomsGaffer.AtomsCrowdGenerator( "AtomsCrowdGenerator" ) -parent.addChild( __children["AtomsCrowdGenerator"] ) -__children["AtomsCrowdGenerator"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) __children["AtomsCrowdClothReader"] = AtomsGaffer.AtomsCrowdClothReader( "AtomsCrowdClothReader" ) parent.addChild( __children["AtomsCrowdClothReader"] ) __children["AtomsCrowdClothReader"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) @@ -93,21 +84,11 @@ __children["Outputs"]["outputs"]["output1"].addChild( Gaffer.StringPlug( "fileNa __children["Outputs"]["outputs"]["output1"].addChild( Gaffer.StringPlug( "type", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) __children["Outputs"]["outputs"]["output1"].addChild( Gaffer.StringPlug( "data", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) __children["Outputs"]["outputs"]["output1"].addChild( Gaffer.CompoundDataPlug( "parameters", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["Outputs"]["outputs"]["output1"]["parameters"].addChild( Gaffer.CompoundDataPlug.MemberPlug( "displayHost", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["Outputs"]["outputs"]["output1"]["parameters"]["displayHost"].addChild( Gaffer.StringPlug( "name", defaultValue = 'displayHost', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["Outputs"]["outputs"]["output1"]["parameters"]["displayHost"].addChild( Gaffer.StringPlug( "value", defaultValue = 'localhost', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["Outputs"]["outputs"]["output1"]["parameters"].addChild( Gaffer.CompoundDataPlug.MemberPlug( "quantize", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["Outputs"]["outputs"]["output1"]["parameters"]["quantize"].addChild( Gaffer.StringPlug( "name", defaultValue = 'quantize', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["Outputs"]["outputs"]["output1"]["parameters"]["quantize"].addChild( Gaffer.IntVectorDataPlug( "value", defaultValue = IECore.IntVectorData( [ 0, 0, 0, 0 ] ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["Outputs"]["outputs"]["output1"]["parameters"].addChild( Gaffer.CompoundDataPlug.MemberPlug( "driverType", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["Outputs"]["outputs"]["output1"]["parameters"]["driverType"].addChild( Gaffer.StringPlug( "name", defaultValue = 'driverType', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["Outputs"]["outputs"]["output1"]["parameters"]["driverType"].addChild( Gaffer.StringPlug( "value", defaultValue = 'ClientDisplayDriver', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["Outputs"]["outputs"]["output1"]["parameters"].addChild( Gaffer.CompoundDataPlug.MemberPlug( "displayPort", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["Outputs"]["outputs"]["output1"]["parameters"]["displayPort"].addChild( Gaffer.StringPlug( "name", defaultValue = 'displayPort', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["Outputs"]["outputs"]["output1"]["parameters"]["displayPort"].addChild( Gaffer.StringPlug( "value", defaultValue = '${image:catalogue:port}', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["Outputs"]["outputs"]["output1"]["parameters"].addChild( Gaffer.CompoundDataPlug.MemberPlug( "remoteDisplayType", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["Outputs"]["outputs"]["output1"]["parameters"]["remoteDisplayType"].addChild( Gaffer.StringPlug( "name", defaultValue = 'remoteDisplayType', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["Outputs"]["outputs"]["output1"]["parameters"]["remoteDisplayType"].addChild( Gaffer.StringPlug( "value", defaultValue = 'GafferImage::GafferDisplayDriver', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) +__children["Outputs"]["outputs"]["output1"]["parameters"].addChild( Gaffer.NameValuePlug( "displayHost", Gaffer.StringPlug( "value", defaultValue = 'localhost', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "displayHost", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) ) +__children["Outputs"]["outputs"]["output1"]["parameters"].addChild( Gaffer.NameValuePlug( "quantize", Gaffer.IntVectorDataPlug( "value", defaultValue = IECore.IntVectorData( [ 0, 0, 0, 0 ] ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "quantize", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) ) +__children["Outputs"]["outputs"]["output1"]["parameters"].addChild( Gaffer.NameValuePlug( "driverType", Gaffer.StringPlug( "value", defaultValue = 'ClientDisplayDriver', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "driverType", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) ) +__children["Outputs"]["outputs"]["output1"]["parameters"].addChild( Gaffer.NameValuePlug( "displayPort", Gaffer.StringPlug( "value", defaultValue = '${image:catalogue:port}', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "displayPort", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) ) +__children["Outputs"]["outputs"]["output1"]["parameters"].addChild( Gaffer.NameValuePlug( "remoteDisplayType", Gaffer.StringPlug( "value", defaultValue = 'GafferImage::GafferDisplayDriver', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), "remoteDisplayType", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) ) __children["Outputs"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) __children["InteractiveArnoldRender"] = GafferArnold.InteractiveArnoldRender( "InteractiveArnoldRender" ) parent.addChild( __children["InteractiveArnoldRender"] ) @@ -117,6 +98,7 @@ parent.addChild( __children["Catalogue"] ) __children["Catalogue"]["images"].addChild( GafferImage.Catalogue.Image( "Image", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) __children["Catalogue"]["images"].addChild( GafferImage.Catalogue.Image( "Image1", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) __children["Catalogue"]["images"].addChild( GafferImage.Catalogue.Image( "Image2", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) +__children["Catalogue"]["images"].addChild( GafferImage.Catalogue.Image( "Image3", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) __children["Catalogue"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) __children["ShaderAssignment2"] = GafferScene.ShaderAssignment( "ShaderAssignment2" ) parent.addChild( __children["ShaderAssignment2"] ) @@ -162,10 +144,7 @@ parent.addChild( __children["PathFilter4"] ) __children["PathFilter4"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) __children["AtomsMetadata"] = AtomsGaffer.AtomsMetadata( "AtomsMetadata" ) parent.addChild( __children["AtomsMetadata"] ) -__children["AtomsMetadata"]["metadata"].addChild( Gaffer.CompoundDataPlug.MemberPlug( "member1", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["AtomsMetadata"]["metadata"]["member1"].addChild( Gaffer.StringPlug( "name", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["AtomsMetadata"]["metadata"]["member1"].addChild( Gaffer.StringPlug( "value", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["AtomsMetadata"]["metadata"]["member1"].addChild( Gaffer.BoolPlug( "enabled", defaultValue = True, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) +__children["AtomsMetadata"]["metadata"].addChild( Gaffer.NameValuePlug( "", Gaffer.StringPlug( "value", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), True, "member1", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) ) __children["AtomsMetadata"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) __children["ShaderAssignment5"] = GafferScene.ShaderAssignment( "ShaderAssignment5" ) parent.addChild( __children["ShaderAssignment5"] ) @@ -183,10 +162,7 @@ __children["user_data_rgb"].loadShader( "user_data_rgb" ) __children["user_data_rgb"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) __children["AtomsMetadata1"] = AtomsGaffer.AtomsMetadata( "AtomsMetadata1" ) parent.addChild( __children["AtomsMetadata1"] ) -__children["AtomsMetadata1"]["metadata"].addChild( Gaffer.CompoundDataPlug.MemberPlug( "member1", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["AtomsMetadata1"]["metadata"]["member1"].addChild( Gaffer.StringPlug( "name", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["AtomsMetadata1"]["metadata"]["member1"].addChild( Gaffer.V3fPlug( "value", defaultValue = imath.V3f( 0, 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, interpretation = IECore.GeometricData.Interpretation.Point ) ) -__children["AtomsMetadata1"]["metadata"]["member1"].addChild( Gaffer.BoolPlug( "enabled", defaultValue = True, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) +__children["AtomsMetadata1"]["metadata"].addChild( Gaffer.NameValuePlug( "", Gaffer.V3fPlug( "value", defaultValue = imath.V3f( 0, 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, interpretation = IECore.GeometricData.Interpretation.Point ), True, "member1", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) ) __children["AtomsMetadata1"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) __children["DeleteObject"] = GafferScene.DeleteObject( "DeleteObject" ) parent.addChild( __children["DeleteObject"] ) @@ -196,24 +172,20 @@ parent.addChild( __children["PathFilter6"] ) __children["PathFilter6"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) __children["AtomsMetadata2"] = AtomsGaffer.AtomsMetadata( "AtomsMetadata2" ) parent.addChild( __children["AtomsMetadata2"] ) -__children["AtomsMetadata2"]["metadata"].addChild( Gaffer.CompoundDataPlug.MemberPlug( "member1", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["AtomsMetadata2"]["metadata"]["member1"].addChild( Gaffer.StringPlug( "name", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["AtomsMetadata2"]["metadata"]["member1"].addChild( Gaffer.V3fPlug( "value", defaultValue = imath.V3f( 0, 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, interpretation = IECore.GeometricData.Interpretation.Point ) ) -__children["AtomsMetadata2"]["metadata"]["member1"].addChild( Gaffer.BoolPlug( "enabled", defaultValue = True, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) +__children["AtomsMetadata2"]["metadata"].addChild( Gaffer.NameValuePlug( "", Gaffer.V3fPlug( "value", defaultValue = imath.V3f( 0, 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, interpretation = IECore.GeometricData.Interpretation.Point ), True, "member1", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) ) __children["AtomsMetadata2"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) __children["AtomsMetadata3"] = AtomsGaffer.AtomsMetadata( "AtomsMetadata3" ) parent.addChild( __children["AtomsMetadata3"] ) -__children["AtomsMetadata3"]["metadata"].addChild( Gaffer.CompoundDataPlug.MemberPlug( "member1", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["AtomsMetadata3"]["metadata"]["member1"].addChild( Gaffer.StringPlug( "name", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["AtomsMetadata3"]["metadata"]["member1"].addChild( Gaffer.FloatPlug( "value", defaultValue = 0.0, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["AtomsMetadata3"]["metadata"]["member1"].addChild( Gaffer.BoolPlug( "enabled", defaultValue = True, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["AtomsMetadata3"]["metadata"].addChild( Gaffer.CompoundDataPlug.MemberPlug( "member2", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["AtomsMetadata3"]["metadata"]["member2"].addChild( Gaffer.StringPlug( "name", defaultValue = '', flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["AtomsMetadata3"]["metadata"]["member2"].addChild( Gaffer.FloatPlug( "value", defaultValue = 0.0, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -__children["AtomsMetadata3"]["metadata"]["member2"].addChild( Gaffer.BoolPlug( "enabled", defaultValue = True, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) +__children["AtomsMetadata3"]["metadata"].addChild( Gaffer.NameValuePlug( "", Gaffer.FloatPlug( "value", defaultValue = 0.0, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), True, "member1", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) ) +__children["AtomsMetadata3"]["metadata"].addChild( Gaffer.NameValuePlug( "", Gaffer.FloatPlug( "value", defaultValue = 0.0, flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ), True, "member2", Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic ) ) __children["AtomsMetadata3"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) -parent["frame"].setValue( 3.0 ) -parent["variables"]["imageCataloguePort"]["value"].setValue( 40547 ) +__children["PathFilter7"] = GafferScene.PathFilter( "PathFilter7" ) +parent.addChild( __children["PathFilter7"] ) +__children["PathFilter7"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) +__children["AtomsCrowdGenerator1"] = AtomsGaffer.AtomsCrowdGenerator( "AtomsCrowdGenerator1" ) +parent.addChild( __children["AtomsCrowdGenerator1"] ) +__children["AtomsCrowdGenerator1"].addChild( Gaffer.V2fPlug( "__uiPosition", defaultValue = imath.V2f( 0, 0 ), flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) ) +parent["variables"]["imageCataloguePort"]["value"].setValue( 42973 ) Gaffer.Metadata.registerValue( parent["variables"]["imageCataloguePort"], 'readOnly', True ) Gaffer.Metadata.registerValue( parent["variables"]["projectName"]["name"], 'readOnly', True ) Gaffer.Metadata.registerValue( parent["variables"]["projectRootDirectory"]["name"], 'readOnly', True ) @@ -221,11 +193,6 @@ __children["AtomsVariationReader"]["atomsVariationFile"].setValue( '${ATOMS_GAFF __children["AtomsVariationReader"]["__uiPosition"].setValue( imath.V2f( 8.67286682, 121.501701 ) ) __children["AtomsCrowdReader"]["atomsSimFile"].setValue( '${ATOMS_GAFFER_ROOT}/examples/assets/atomsRobot/cache/test_sim.atoms' ) __children["AtomsCrowdReader"]["__uiPosition"].setValue( imath.V2f( -27.4776421, 11.9359703 ) ) -__children["AtomsCrowdGenerator"]["in"].setInput( __children["AtomsMetadata2"]["out"] ) -__children["AtomsCrowdGenerator"]["parent"].setValue( '/crowd' ) -__children["AtomsCrowdGenerator"]["variations"].setInput( __children["ShaderAssignment5"]["out"] ) -__children["AtomsCrowdGenerator"]["clothCache"].setInput( __children["AtomsCrowdClothReader"]["out"] ) -__children["AtomsCrowdGenerator"]["__uiPosition"].setValue( imath.V2f( 8.67286873, -29.3415184 ) ) __children["AtomsCrowdClothReader"]["in"].setInput( __children["AtomsCrowdReader"]["out"] ) __children["AtomsCrowdClothReader"]["atomsClothFile"].setValue( '${ATOMS_GAFFER_ROOT}/examples/assets/atomsRobot/cloth_cache/cloth_sim.clothcache' ) __children["AtomsCrowdClothReader"]["__uiPosition"].setValue( imath.V2f( 18.8750935, -15.4387569 ) ) @@ -234,9 +201,6 @@ __children["ShaderAssignment"]["filter"].setInput( __children["PathFilter"]["out __children["ShaderAssignment"]["shader"].setInput( __children["robot1_material"]["out"] ) __children["ShaderAssignment"]["__uiPosition"].setValue( imath.V2f( 8.66736221, 107.713287 ) ) __children["robot1_material"]["parameters"]["base_color"].setInput( __children["image"]["out"] ) -__children["robot1_material"]["parameters"]["base_color"]["r"].setInput( __children["image"]["out"]["r"] ) -__children["robot1_material"]["parameters"]["base_color"]["g"].setInput( __children["image"]["out"]["g"] ) -__children["robot1_material"]["parameters"]["base_color"]["b"].setInput( __children["image"]["out"]["b"] ) __children["robot1_material"]["__uiPosition"].setValue( imath.V2f( -8.01374531, 107.712708 ) ) __children["image"]["parameters"]["filename"].setValue( '${ATOMS_GAFFER_ROOT}/examples/assets/atomsRobot/preview/atomsRobot/robot1_material_diff.jpg' ) __children["image"]["__uiPosition"].setValue( imath.V2f( -21.0827217, 112.51236 ) ) @@ -247,17 +211,14 @@ __children["ShaderAssignment1"]["filter"].setInput( __children["PathFilter1"]["o __children["ShaderAssignment1"]["shader"].setInput( __children["robot2_material"]["out"] ) __children["ShaderAssignment1"]["__uiPosition"].setValue( imath.V2f( 8.65846252, 88.6374054 ) ) __children["robot2_material"]["parameters"]["base_color"].setInput( __children["image1"]["out"] ) -__children["robot2_material"]["parameters"]["base_color"]["r"].setInput( __children["image1"]["out"]["r"] ) -__children["robot2_material"]["parameters"]["base_color"]["g"].setInput( __children["image1"]["out"]["g"] ) -__children["robot2_material"]["parameters"]["base_color"]["b"].setInput( __children["image1"]["out"]["b"] ) __children["robot2_material"]["__uiPosition"].setValue( imath.V2f( -8.34950352, 88.6360016 ) ) __children["image1"]["parameters"]["filename"].setValue( '${ATOMS_GAFFER_ROOT}/examples/assets/atomsRobot/preview/atomsRobot/robot2_material_diff.jpg' ) __children["image1"]["__uiPosition"].setValue( imath.V2f( -21.7571201, 93.4352722 ) ) __children["PathFilter1"]["paths"].setValue( IECore.StringVectorData( [ '/atomsRobot/Robot2' ] ) ) __children["PathFilter1"]["__uiPosition"].setValue( imath.V2f( 23.2556305, 94.7194366 ) ) -__children["Group"]["in"]["in0"].setInput( __children["DeleteObject"]["out"] ) -__children["Group"]["in"]["in1"].setInput( __children["Camera"]["out"] ) -__children["Group"]["in"]["in2"].setInput( __children["skydome_light"]["out"] ) +__children["Group"]["in"][0].setInput( __children["DeleteObject"]["out"] ) +__children["Group"]["in"][1].setInput( __children["Camera"]["out"] ) +__children["Group"]["in"][2].setInput( __children["skydome_light"]["out"] ) __children["Group"]["__uiPosition"].setValue( imath.V2f( 35.2672348, -45.8375702 ) ) __children["Camera"]["transform"]["translate"].setValue( imath.V3f( 1164.69336, 0, 0 ) ) __children["Camera"]["transform"]["rotate"].setValue( imath.V3f( 0, 90, 0 ) ) @@ -282,18 +243,15 @@ Gaffer.Metadata.registerValue( __children["Catalogue"]["images"]["Image"], 'imag __children["Catalogue"]["images"]["Image"]["fileName"].setValue( '/home/alan/gaffer/projects/default/catalogues/atomsExampleScene/28336951b30291dde594110611c694d8.exr' ) __children["Catalogue"]["images"]["Image1"]["fileName"].setValue( '/home/alan/gaffer/projects/default/catalogues/atomsExampleScene/1b607f54d2a160bbfb28297e445ada2a.exr' ) __children["Catalogue"]["images"]["Image2"]["fileName"].setValue( '/home/alan/gaffer/projects/default/catalogues/atomsExampleScene/370b89806b02f72c3a398502419a82cd.exr' ) -__children["Catalogue"]["imageIndex"].setValue( 2 ) +__children["Catalogue"]["images"]["Image3"]["fileName"].setValue( '/home/alan/gaffer/projects/default/catalogues/atomsExampleScene/f90a006577b06ef65d7fa462832ac4c5.exr' ) +__children["Catalogue"]["imageIndex"].setValue( 3 ) __children["Catalogue"]["directory"].setValue( '${project:rootDirectory}/catalogues/${script:name}' ) -__children["Catalogue"]["__mapping"].setValue( IECore.CompoundData({'Image':IECore.IntData( 0 ),'Image2':IECore.IntData( 2 ),'Image1':IECore.IntData( 1 )}) ) __children["Catalogue"]["__uiPosition"].setValue( imath.V2f( 16.6360798, -56.9887085 ) ) __children["ShaderAssignment2"]["in"].setInput( __children["ShaderAssignment1"]["out"] ) __children["ShaderAssignment2"]["filter"].setInput( __children["PathFilter2"]["out"] ) __children["ShaderAssignment2"]["shader"].setInput( __children["purple_robot_material"]["out"] ) __children["ShaderAssignment2"]["__uiPosition"].setValue( imath.V2f( 8.65506649, 69.5639191 ) ) __children["purple_robot_material"]["parameters"]["base_color"].setInput( __children["image2"]["out"] ) -__children["purple_robot_material"]["parameters"]["base_color"]["r"].setInput( __children["image2"]["out"]["r"] ) -__children["purple_robot_material"]["parameters"]["base_color"]["g"].setInput( __children["image2"]["out"]["g"] ) -__children["purple_robot_material"]["parameters"]["base_color"]["b"].setInput( __children["image2"]["out"]["b"] ) __children["purple_robot_material"]["__uiPosition"].setValue( imath.V2f( -10.0755529, 69.5622787 ) ) __children["image2"]["parameters"]["filename"].setValue( '${ATOMS_GAFFER_ROOT}/examples/assets/atomsRobot/preview/atoms2Robot/purple_material_diff.jpg' ) __children["image2"]["__uiPosition"].setValue( imath.V2f( -25.205471, 74.3614502 ) ) @@ -304,9 +262,6 @@ __children["ShaderAssignment3"]["filter"].setInput( __children["PathFilter3"]["o __children["ShaderAssignment3"]["shader"].setInput( __children["red_robot_material"]["out"] ) __children["ShaderAssignment3"]["__uiPosition"].setValue( imath.V2f( 8.65846634, 50.493454 ) ) __children["red_robot_material"]["parameters"]["base_color"].setInput( __children["image3"]["out"] ) -__children["red_robot_material"]["parameters"]["base_color"]["r"].setInput( __children["image3"]["out"]["r"] ) -__children["red_robot_material"]["parameters"]["base_color"]["g"].setInput( __children["image3"]["out"]["g"] ) -__children["red_robot_material"]["parameters"]["base_color"]["b"].setInput( __children["image3"]["out"]["b"] ) __children["red_robot_material"]["__uiPosition"].setValue( imath.V2f( -9.18983364, 50.4922485 ) ) __children["image3"]["parameters"]["filename"].setValue( '${ATOMS_GAFFER_ROOT}/examples/assets/atomsRobot/preview/atoms2Robot/red_material_diff.jpg' ) __children["image3"]["__uiPosition"].setValue( imath.V2f( -23.4377823, 55.2916107 ) ) @@ -317,9 +272,6 @@ __children["ShaderAssignment4"]["filter"].setInput( __children["PathFilter4"]["o __children["ShaderAssignment4"]["shader"].setInput( __children["yellow_robot_material"]["out"] ) __children["ShaderAssignment4"]["__uiPosition"].setValue( imath.V2f( 8.66618633, 33.3921967 ) ) __children["yellow_robot_material"]["parameters"]["base_color"].setInput( __children["image4"]["out"] ) -__children["yellow_robot_material"]["parameters"]["base_color"]["r"].setInput( __children["image4"]["out"]["r"] ) -__children["yellow_robot_material"]["parameters"]["base_color"]["g"].setInput( __children["image4"]["out"]["g"] ) -__children["yellow_robot_material"]["parameters"]["base_color"]["b"].setInput( __children["image4"]["out"]["b"] ) __children["yellow_robot_material"]["__uiPosition"].setValue( imath.V2f( -10.1013918, 33.3922005 ) ) __children["image4"]["parameters"]["filename"].setValue( '${ATOMS_GAFFER_ROOT}/examples/assets/atomsRobot/preview/atoms2Robot/yellow_material_diff.jpg' ) __children["image4"]["__uiPosition"].setValue( imath.V2f( -25.27071, 38.1921616 ) ) @@ -335,9 +287,6 @@ __children["ShaderAssignment5"]["filter"].setInput( __children["PathFilter5"]["o __children["ShaderAssignment5"]["shader"].setInput( __children["flag_material"]["out"] ) __children["ShaderAssignment5"]["__uiPosition"].setValue( imath.V2f( 8.67286777, 16.8256397 ) ) __children["flag_material"]["parameters"]["base_color"].setInput( __children["user_data_rgb"]["out"] ) -__children["flag_material"]["parameters"]["base_color"]["r"].setInput( __children["user_data_rgb"]["out"]["r"] ) -__children["flag_material"]["parameters"]["base_color"]["g"].setInput( __children["user_data_rgb"]["out"]["g"] ) -__children["flag_material"]["parameters"]["base_color"]["b"].setInput( __children["user_data_rgb"]["out"]["b"] ) __children["flag_material"]["__uiPosition"].setValue( imath.V2f( -5.06980801, 16.8256397 ) ) __children["PathFilter5"]["paths"].setValue( IECore.StringVectorData( [ '/atomsRobot/Robot1/RobotSkin1/flag_group/pPlane1' ] ) ) __children["PathFilter5"]["__uiPosition"].setValue( imath.V2f( 29.1910629, 21.9280891 ) ) @@ -348,7 +297,7 @@ __children["AtomsMetadata1"]["in"].setInput( __children["AtomsMetadata3"]["out"] __children["AtomsMetadata1"]["metadata"]["member1"]["name"].setValue( 'flagColor' ) __children["AtomsMetadata1"]["metadata"]["member1"]["value"].setValue( imath.V3f( 1, 0, 0 ) ) __children["AtomsMetadata1"]["__uiPosition"].setValue( imath.V2f( -13.843298, -12.8485851 ) ) -__children["DeleteObject"]["in"].setInput( __children["AtomsCrowdGenerator"]["out"] ) +__children["DeleteObject"]["in"].setInput( __children["AtomsCrowdGenerator1"]["out"] ) __children["DeleteObject"]["filter"].setInput( __children["PathFilter6"]["out"] ) __children["DeleteObject"]["__uiPosition"].setValue( imath.V2f( 12.0950851, -37.6735458 ) ) __children["PathFilter6"]["paths"].setValue( IECore.StringVectorData( [ '/crowd' ] ) ) @@ -365,6 +314,13 @@ __children["AtomsMetadata3"]["metadata"]["member1"]["value"].setValue( 1.0 ) __children["AtomsMetadata3"]["metadata"]["member2"]["name"].setValue( 'atomsRobot_robot1_head_1' ) __children["AtomsMetadata3"]["metadata"]["member2"]["value"].setValue( 1.0 ) __children["AtomsMetadata3"]["__uiPosition"].setValue( imath.V2f( -20.3091068, -4.68452263 ) ) +__children["PathFilter7"]["paths"].setValue( IECore.StringVectorData( [ '/crowd' ] ) ) +__children["PathFilter7"]["__uiPosition"].setValue( imath.V2f( 24.9639721, -22.8593197 ) ) +__children["AtomsCrowdGenerator1"]["in"].setInput( __children["AtomsMetadata2"]["out"] ) +__children["AtomsCrowdGenerator1"]["filter"].setInput( __children["PathFilter7"]["out"] ) +__children["AtomsCrowdGenerator1"]["variations"].setInput( __children["ShaderAssignment5"]["out"] ) +__children["AtomsCrowdGenerator1"]["clothCache"].setInput( __children["AtomsCrowdClothReader"]["out"] ) +__children["AtomsCrowdGenerator1"]["__uiPosition"].setValue( imath.V2f( 5.53106594, -29.3415146 ) ) del __children diff --git a/include/AtomsGaffer/AtomsCrowdGenerator.h b/include/AtomsGaffer/AtomsCrowdGenerator.h index b9497e3..a7205c7 100644 --- a/include/AtomsGaffer/AtomsCrowdGenerator.h +++ b/include/AtomsGaffer/AtomsCrowdGenerator.h @@ -57,7 +57,7 @@ class AtomsCrowdGenerator : public GafferScene::BranchCreator AtomsCrowdGenerator( const std::string &name = defaultName() ); ~AtomsCrowdGenerator() = default; - IE_CORE_DECLARERUNTIMETYPEDEXTENSION( AtomsGaffer::AtomsCrowdGenerator, TypeId::AtomsCrowdGeneratorTypeId, GafferScene::BranchCreator ); + GAFFER_NODE_DECLARE_TYPE( AtomsGaffer::AtomsCrowdGenerator, TypeId::AtomsCrowdGeneratorTypeId, GafferScene::BranchCreator ); Gaffer::StringPlug *namePlug(); const Gaffer::StringPlug *namePlug() const; diff --git a/include/AtomsGaffer/AtomsMathTranaslator.h b/include/AtomsGaffer/AtomsMathTranaslator.h new file mode 100644 index 0000000..f287735 --- /dev/null +++ b/include/AtomsGaffer/AtomsMathTranaslator.h @@ -0,0 +1,192 @@ +////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2018, Toolchefs Ltd. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above +// copyright notice, this list of conditions and the following +// disclaimer. +// +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided with +// the distribution. +// +// * Neither the name of John Haddon nor the names of +// any other contributors to this software may be used to endorse or +// promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +////////////////////////////////////////////////////////////////////////// + +#ifndef ATOMSGAFFER_ATOMSMATHTRNASLATOR_H +#define ATOMSGAFFER_ATOMSMATHTRNASLATOR_H + +#include "AtomsCore/AtomsMath.h" + +#include "ImathVec.h" +#include "ImathQuat.h" +#include "ImathBox.h" +#include "ImathMatrix.h" + +template +inline void convertFromAtoms( T& out, const Y& in ) +{ + out = in; +} + +template<> +inline void convertFromAtoms( Imath::V2d& out, const AtomsCore::Vector2& in ) +{ + out.x = in.x; + out.y = in.y; +} + +template<> +inline void convertFromAtoms( Imath::V2f& out, const AtomsCore::Vector2f& in ) +{ + out.x = in.x; + out.y = in.y; +} + +template<> +inline void convertFromAtoms( Imath::V2f& out, const AtomsCore::Vector2& in ) +{ + out.x = static_cast( in.x ); + out.y = static_cast( in.y ); +} + +template<> +inline void convertFromAtoms( Imath::V3d& out, const AtomsCore::Vector3& in ) +{ + out.x = in.x; + out.y = in.y; + out.z = in.z; +} + +template<> +inline void convertFromAtoms( Imath::V3f& out, const AtomsCore::Vector3f& in ) +{ + out.x = in.x; + out.y = in.y; + out.z = in.z; +} + +template<> +inline void convertFromAtoms( Imath::V3f& out, const AtomsCore::Vector3& in ) +{ + out.x = static_cast( in.x ); + out.y = static_cast( in.y ); + out.z = static_cast( in.z ); +} + +template<> +inline void convertFromAtoms( Imath::Quatd& out, const AtomsCore::Quaternion& in ) +{ + convertFromAtoms(out.v, in.v); + out.r = in.r; +} + +template<> +inline void convertFromAtoms( Imath::Quatf& out, const AtomsCore::Quaternionf& in ) +{ + convertFromAtoms(out.v, in.v); + out.r = in.r; +} + +template<> +inline void convertFromAtoms( Imath::Quatf& out, const AtomsCore::Quaternion& in ) +{ + convertFromAtoms(out.v, in.v); + out.r = static_cast( in.r ); +} + +template<> +inline void convertFromAtoms( Imath::M44d& out, const AtomsCore::Matrix& in ) +{ + for ( unsigned short i = 0; i < 4; ++i ) + { + for ( unsigned short j = 0; j < 4; ++j ) + { + out[i][j] = in[i][j]; + } + } +} + +template<> +inline void convertFromAtoms( Imath::M44f& out, const AtomsCore::Matrixf& in ) +{ + for ( unsigned short i = 0; i < 4; ++i ) + { + for ( unsigned short j = 0; j < 4; ++j ) + { + out[i][j] = in[i][j]; + } + } +} + +template<> +inline void convertFromAtoms( Imath::M44f& out, const AtomsCore::Matrix& in ) +{ + for ( unsigned short i = 0; i < 4; ++i ) + { + for ( unsigned short j = 0; j < 4; ++j ) + { + out[i][j] = static_cast( in[i][j] ); + } + } +} + +template<> +inline void convertFromAtoms( Imath::Box3d& out, const AtomsCore::Box3& in ) +{ + convertFromAtoms(out.min, in.min); + convertFromAtoms(out.max, in.max); +} + +template<> +inline void convertFromAtoms( Imath::Box3f& out, const AtomsCore::Box3f& in ) +{ + convertFromAtoms(out.min, in.min); + convertFromAtoms(out.max, in.max); +} + +template<> +inline void convertFromAtoms( Imath::Box3f& out, const AtomsCore::Box3& in ) +{ + convertFromAtoms(out.min, in.min); + convertFromAtoms(out.max, in.max); +} + +/////////// +// vectors +/////////// + +template +inline void convertFromAtoms( std::vector& out, const std::vector& in ) +{ + size_t startIndex = out.size(); + out.resize( out.size() + in.size() ); + for ( size_t i = 0; i < in.size(); ++i) + { + convertFromAtoms( out[startIndex + i], in[i] ); + } +} + + +#endif //ATOMSGAFFER_ATOMSMATHTRNASLATOR_H diff --git a/src/AtomsGaffer/AtomsCrowdClothReader.cpp b/src/AtomsGaffer/AtomsCrowdClothReader.cpp index e4fe431..0672e30 100644 --- a/src/AtomsGaffer/AtomsCrowdClothReader.cpp +++ b/src/AtomsGaffer/AtomsCrowdClothReader.cpp @@ -35,6 +35,7 @@ ////////////////////////////////////////////////////////////////////////// #include "AtomsGaffer/AtomsCrowdClothReader.h" +#include "AtomsGaffer/AtomsMathTranaslator.h" #include "IECoreScene/PointsPrimitive.h" @@ -214,8 +215,15 @@ ConstObjectPtr AtomsCrowdClothReader::computeObject( const ScenePath &path, cons Box3dDataPtr bbox = new Box3dData; StringDataPtr stackOrder = new StringData; - cache.loadAgentClothMesh( frame, agentId, meshName, p->writable(), n->writable() ); - cache.loadAgentClothMeshBoundingBox( frame, agentId, meshName, bbox->writable() ); + std::vector clothPoints, clothNormals; + AtomsCore::Box3 clothBound; + cache.loadAgentClothMesh( frame, agentId, meshName, clothPoints, clothNormals ); + cache.loadAgentClothMeshBoundingBox( frame, agentId, meshName, clothBound ); + + convertFromAtoms( p->writable(), clothPoints ); + convertFromAtoms( n->writable(), clothNormals ); + convertFromAtoms( bbox->writable(), clothBound ); + stackOrder->writable() = cache.getAgentClothMeshStackOrder( frame, agentId, meshName ); meshData[ "P" ] = p; meshData[ "N" ] = n; diff --git a/src/AtomsGaffer/AtomsCrowdReader.cpp b/src/AtomsGaffer/AtomsCrowdReader.cpp index cd1e288..d7d531c 100644 --- a/src/AtomsGaffer/AtomsCrowdReader.cpp +++ b/src/AtomsGaffer/AtomsCrowdReader.cpp @@ -36,6 +36,7 @@ #include "AtomsGaffer/AtomsCrowdReader.h" #include "AtomsGaffer/AtomsMetadataTranslator.h" +#include "AtomsGaffer/AtomsMathTranaslator.h" #include "IECoreScene/PointsPrimitive.h" @@ -604,14 +605,15 @@ ConstObjectPtr AtomsCrowdReader::computeSource( const Gaffer::Context *context ) if ( !matrices.empty() ) { auto& pelvisMtx = matrices[0]; - positions[i] = pelvisMtx.translation(); - rootMatrix[i] = Imath::M44f( pelvisMtx ); - orientation[i] = Imath::extractQuat( pelvisMtx ); + auto pelvisPosition = pelvisMtx.translation(); + convertFromAtoms( positions[i], pelvisPosition ); + convertFromAtoms( rootMatrix[i], pelvisMtx ); + convertFromAtoms( orientation[i], AtomsMath::extractQuat( pelvisMtx ) ); } } else { - positions[i] = pose.jointPose( 0 ).translation; + convertFromAtoms( positions[i], pose.jointPose( 0 ).translation ); } } } @@ -662,7 +664,9 @@ IECore::ConstCompoundObjectPtr AtomsCrowdReader::computeAttributes( const SceneN auto& translator = AtomsMetadataTranslator::instance(); Box3dDataPtr cacheBox = new Box3dData; - atomsCache.loadBoundingBox( frame, cacheBox->writable() ); + AtomsCore::Box3 atomsCacheBox; + atomsCache.loadBoundingBox( frame, atomsCacheBox ); + convertFromAtoms( cacheBox->writable(), atomsCacheBox ); //members["atoms:boundingBox"] = cacheBox; IntVectorDataPtr agentIndices = new IntVectorData; @@ -708,7 +712,7 @@ IECore::ConstCompoundObjectPtr AtomsCrowdReader::computeAttributes( const SceneN auto& outMatrices = matricesData->writable(); auto& outNormalMatrices = normalMatricesData->writable(); - outMatrices = poser.getAllWorldMatrix( posePtr->get() ); + convertFromAtoms( outMatrices, poser.getAllWorldMatrix( posePtr->get() ) ); outNormalMatrices.resize( outMatrices.size() ); //update the position metadata @@ -730,16 +734,19 @@ IECore::ConstCompoundObjectPtr AtomsCrowdReader::computeAttributes( const SceneN // Store the matrices for the skinning for ( unsigned int j = 0; j < outMatrices.size(); j++ ) { - AtomsCore::Matrix &jMtx = outMatrices[j]; + auto &jMtx = outMatrices[j]; agentBBoxData.extendBy(jMtx.translation()); - jMtx = bindPosesInv[j] * jMtx; + Imath::M44d bindInverseMatrix; + convertFromAtoms( bindInverseMatrix, bindPosesInv[j] ); + jMtx = bindInverseMatrix * jMtx; outNormalMatrices[j] = jMtx.inverse().transpose(); } agentCompound["poseWorldMatrices"] = matricesData; agentCompound["poseNormalWorldMatrices"] = normalMatricesData; - M44dDataPtr rootMatrixData = new M44dData( rootMatrix ); + M44dDataPtr rootMatrixData = new M44dData( ); + convertFromAtoms( rootMatrixData->writable(), rootMatrix ); agentCompound["rootMatrix"] = rootMatrixData; // This is an hash of the agent pose in local space diff --git a/src/AtomsGaffer/AtomsMetadataTranslator.cpp b/src/AtomsGaffer/AtomsMetadataTranslator.cpp index 4be93cd..412c1a0 100644 --- a/src/AtomsGaffer/AtomsMetadataTranslator.cpp +++ b/src/AtomsGaffer/AtomsMetadataTranslator.cpp @@ -35,6 +35,7 @@ ////////////////////////////////////////////////////////////////////////// #include "AtomsGaffer/AtomsMetadataTranslator.h" +#include "AtomsGaffer/AtomsMathTranaslator.h" #include "IECore/TypedData.h" #include "IECore/SimpleTypedData.h" @@ -74,30 +75,57 @@ IECore::DataPtr metadataSimpleTranslator( const AtomsPtr>( metadata )->get(); typename TypedData::Ptr ieData = new TypedData(); - ieData->writable() = value; + convertFromAtoms( ieData->writable(), value ); return boost::static_pointer_cast( ieData ); } template <> -IECore::DataPtr metadataSimpleTranslator( const AtomsPtr& metadata ) +IECore::DataPtr metadataSimpleTranslator( const AtomsPtr& metadata ) { auto value = std::static_pointer_cast( metadata )->get(); typename TypedData::Ptr ieData = new TypedData(); auto& outVec = ieData->writable(); - outVec.x = static_cast( value.x ); - outVec.y = static_cast( value.y ); + convertFromAtoms( ieData->writable(), value ); return boost::static_pointer_cast( ieData ); } template <> -IECore::DataPtr metadataSimpleTranslator( const AtomsPtr& metadata ) +IECore::DataPtr metadataSimpleTranslator( const AtomsPtr& metadata ) { auto value = std::static_pointer_cast( metadata )->get(); typename TypedData::Ptr ieData = new TypedData(); auto& outVec = ieData->writable(); - outVec.x = static_cast( value.x ); - outVec.y = static_cast( value.y ); - outVec.z = static_cast( value.z ); + convertFromAtoms( ieData->writable(), value ); + return boost::static_pointer_cast( ieData ); +} + +template <> +IECore::DataPtr metadataSimpleTranslator( const AtomsPtr& metadata ) +{ + auto value = std::static_pointer_cast( metadata )->get(); + typename TypedData::Ptr ieData = new TypedData(); + auto& outVec = ieData->writable(); + convertFromAtoms( ieData->writable(), value ); + return boost::static_pointer_cast( ieData ); +} + +template <> +IECore::DataPtr metadataSimpleTranslator( const AtomsPtr& metadata ) +{ + auto value = std::static_pointer_cast( metadata )->get(); + typename TypedData::Ptr ieData = new TypedData(); + auto& outVec = ieData->writable(); + convertFromAtoms( ieData->writable(), value ); + return boost::static_pointer_cast( ieData ); +} + +template <> +IECore::DataPtr metadataSimpleTranslator( const AtomsPtr& metadata ) +{ + auto value = std::static_pointer_cast( metadata )->get(); + typename TypedData::Ptr ieData = new TypedData(); + auto& outVec = ieData->writable(); + convertFromAtoms( ieData->writable(), value ); return boost::static_pointer_cast( ieData ); } @@ -106,30 +134,27 @@ IECore::DataPtr metadataGeometricTranslator( const AtomsPtr>( metadata )->get(); typename GeometricTypedData::Ptr ieData = new GeometricTypedData(); - ieData->writable() = value; + convertFromAtoms( ieData->writable(), value ); return boost::static_pointer_cast( ieData ); } template <> -IECore::DataPtr metadataGeometricTranslator( const AtomsPtr& metadata ) +IECore::DataPtr metadataGeometricTranslator( const AtomsPtr& metadata ) { auto value = std::static_pointer_cast( metadata )->get(); typename GeometricTypedData::Ptr ieData = new GeometricTypedData(); auto& outVec = ieData->writable(); - outVec.x = static_cast( value.x ); - outVec.y = static_cast( value.y ); + convertFromAtoms( outVec, value ); return boost::static_pointer_cast( ieData ); } template <> -IECore::DataPtr metadataGeometricTranslator( const AtomsPtr& metadata ) +IECore::DataPtr metadataGeometricTranslator( const AtomsPtr& metadata ) { auto value = std::static_pointer_cast( metadata )->get(); typename GeometricTypedData::Ptr ieData = new GeometricTypedData(); auto& outVec = ieData->writable(); - outVec.x = static_cast( value.x ); - outVec.y = static_cast( value.y ); - outVec.z = static_cast( value.z ); + convertFromAtoms( outVec, value ); return boost::static_pointer_cast( ieData ); } @@ -152,13 +177,43 @@ IECore::DataPtr metadataArrayTranslator( const AtomsPtr( ieData ); } +template<> +IECore::DataPtr metadataArrayTranslator( const AtomsPtr& metadata ) +{ + auto &value = std::static_pointer_cast( metadata )->get(); + typename TypedData>::Ptr ieData = new TypedData>(); + auto& outVec = ieData->writable(); + convertFromAtoms( outVec, value ); + return boost::static_pointer_cast( ieData ); +} + template<> IECore::DataPtr metadataArrayTranslator( const AtomsPtr& metadata ) { auto &value = std::static_pointer_cast( metadata )->get(); typename TypedData>::Ptr ieData = new TypedData>(); auto& outVec = ieData->writable(); - outVec.insert( outVec.end(), value.begin(), value.end()); + convertFromAtoms( outVec, value ); + return boost::static_pointer_cast( ieData ); +} + +template<> +IECore::DataPtr metadataArrayTranslator( const AtomsPtr& metadata ) +{ + auto &value = std::static_pointer_cast( metadata )->get(); + typename TypedData>::Ptr ieData = new TypedData>(); + auto& outVec = ieData->writable(); + convertFromAtoms( outVec, value ); + return boost::static_pointer_cast( ieData ); +} + +template<> +IECore::DataPtr metadataArrayTranslator( const AtomsPtr& metadata ) +{ + auto &value = std::static_pointer_cast( metadata )->get(); + typename TypedData>::Ptr ieData = new TypedData>(); + auto& outVec = ieData->writable(); + convertFromAtoms( outVec, value ); return boost::static_pointer_cast( ieData ); } @@ -206,7 +261,7 @@ IECore::DataPtr poseMetadataTranslator( const AtomsPtrwritable()["matrices"] = matrices; diff --git a/src/AtomsGaffer/AtomsVariationReader.cpp b/src/AtomsGaffer/AtomsVariationReader.cpp index 0502651..52d4c55 100644 --- a/src/AtomsGaffer/AtomsVariationReader.cpp +++ b/src/AtomsGaffer/AtomsVariationReader.cpp @@ -36,6 +36,7 @@ #include "AtomsGaffer/AtomsVariationReader.h" #include "AtomsGaffer/AtomsMetadataTranslator.h" +#include "AtomsGaffer/AtomsMathTranaslator.h" #include "IECoreScene/MeshPrimitive.h" #include "IECore/NullObject.h" @@ -81,8 +82,7 @@ IECoreScene::PrimitiveVariable convertNormals( AtomsUtils::Mesh& mesh ) V3fVectorDataPtr normalsData = new V3fVectorData; normalsData->setInterpretation( GeometricData::Normal ); auto &normals = normalsData->writable(); - normals.reserve( inIndices.size() ); - normals.insert( normals.begin(), inNormals.begin(), inNormals.end() ); + convertFromAtoms( normals, inNormals ); return PrimitiveVariable( PrimitiveVariable::FaceVarying, normalsData ); } @@ -92,7 +92,7 @@ IECoreScene::PrimitiveVariable convertUvs( AtomsUtils::Mesh& mesh, AtomsUtils::M V2fVectorDataPtr uvData = new V2fVectorData; uvData->setInterpretation( GeometricData::UV ); - uvData->writable() = uvSet.uvs; + convertFromAtoms( uvData->writable(), uvSet.uvs ); IECore::IntVectorDataPtr uvIndicesData = new IECore::IntVectorData; auto &uvIndices = uvIndicesData->writable(); uvIndices.insert( uvIndices.end(), inIndices.begin(), inIndices.end() ); @@ -132,7 +132,7 @@ MeshPrimitivePtr convertAtomsMesh( AtomsPtr& geoMap, boo V3fVectorDataPtr p = new V3fVectorData; auto &outP = p->writable(); - outP = points; + convertFromAtoms( outP, points ); MeshPrimitivePtr meshPtr = new MeshPrimitive( verticesPerFace, vertexIds, "linear", p ); @@ -164,7 +164,7 @@ MeshPrimitivePtr convertAtomsMesh( AtomsPtr& geoMap, boo { V2fVectorDataPtr uvData = new V2fVectorData; uvData->setInterpretation( GeometricData::UV ); - uvData->writable() = mesh.uvs(); + convertFromAtoms( uvData->writable(), mesh.uvs() ); meshPtr->variables["uv"] = PrimitiveVariable( PrimitiveVariable::FaceVarying, uvData ); } @@ -191,7 +191,7 @@ MeshPrimitivePtr convertAtomsMesh( AtomsPtr& geoMap, boo normals.reserve( blendN.size() ); if ( blendN.size() == vertexIndices.size() ) { - normals.insert( normals.begin(), blendN.begin(), blendN.end() ); + convertFromAtoms( normals, blendN ); } else { @@ -199,7 +199,7 @@ MeshPrimitivePtr convertAtomsMesh( AtomsPtr& geoMap, boo normals.resize( vertexIndices.size() ); for ( size_t vId = 0; vId < std::min(vertexIndices.size(), blendN.size()); ++vId ) { - normals[vId] = blendN[vertexIndices[vId]]; + convertFromAtoms( normals[vId], blendN[vertexIndices[vId]] ); } } @@ -209,7 +209,7 @@ MeshPrimitivePtr convertAtomsMesh( AtomsPtr& geoMap, boo V3fVectorDataPtr blendPointsData = new V3fVectorData; auto &blendPts = blendPointsData->writable(); blendPts.reserve( blendP.size() ); - blendPts.insert( blendPts.begin(), blendP.begin(), blendP.end() ); + convertFromAtoms( blendPts, blendP ); meshPtr->variables["blendShape_" + std::to_string( blendId ) + "_P"] = PrimitiveVariable( PrimitiveVariable::Vertex, blendPointsData ); } @@ -1062,7 +1062,9 @@ Imath::Box3f AtomsVariationReader::computeBound( const ScenePath &path, const Ga auto bbox = geoCacheMeshIt->second->getTypedEntry( "boundingBox" ); if ( bbox ) { - return Imath::Box3f(bbox->get().min, bbox->get().max); + Imath::Box3f outBox; + convertFromAtoms( outBox, bbox->get() ); + return outBox; } else { @@ -1137,7 +1139,9 @@ Imath::M44f AtomsVariationReader::computeTransform( const ScenePath &path, const auto matrixPtr = data->getTypedEntry( "matrix" ); if ( matrixPtr ) { - return Imath::M44f( matrixPtr->get() ); + Imath::M44f outMatrix; + convertFromAtoms( outMatrix, matrixPtr->get() ); + return outMatrix; } } @@ -1767,7 +1771,7 @@ void AtomsVariationReader::mergeUvSets( AtomsUtils::Mesh& mesh, AtomsUtils::Mesh for ( size_t uvId = 0; uvId < fillUvsSize; ++uvId ) { uvData->uvIndices.push_back( uvData->uvs.size() ); - uvData->uvs.push_back( Imath::V2f( 0.0, 0.0 ) ); + uvData->uvs.push_back( AtomsCore::Vector2f( 0.0, 0.0 ) ); } } @@ -1788,7 +1792,7 @@ void AtomsVariationReader::mergeUvSets( AtomsUtils::Mesh& mesh, AtomsUtils::Mesh size_t fillUvsSize = mesh.normals().size() - uvSet.uvs.size(); for ( size_t uvId = 0; uvId < fillUvsSize; ++uvId ) { - uvSet.uvs.push_back( Imath::V2f( 0.0, 0.0 ) ); + uvSet.uvs.push_back( AtomsCore::Vector2f( 0.0, 0.0 ) ); uvSet.uvIndices.push_back( uvSet.uvs.size() ); } }