Skip to content

Commit

Permalink
Merge pull request #50 from andrewkaufman/pie3
Browse files Browse the repository at this point in the history
Python 3 Support
  • Loading branch information
andrewkaufman authored Sep 23, 2021
2 parents 6366847 + 2a62e65 commit 422537b
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 30 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ 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 _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 SYSTEM PRIVATE ${DEPENDENCY_INCLUDE_PATHS} ${PYTHON_ROOT}/include/python${PYTHON_VERSION} )
target_include_directories( AtomsGafferModule PRIVATE include )
target_link_libraries( AtomsGafferModule GafferBindings )
install( TARGETS AtomsGafferModule DESTINATION python/AtomsGaffer )
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ The Tool Chefs have open-sourced their [Atoms Crowd](https://atoms.toolchefs.com
setenv GAFFER_ROOT <gaffer install path>
setenv ATOMS_ROOT <atoms install path>
setenv ATOMSGAFFER_INSTALL_PREFIX <your desired install path>
setenv PYTHON_VERSION 2.7
cd atomsGaffer
cmake -DGAFFER_ROOT=$GAFFER_ROOT -DATOMS_ROOT=$ATOMS_ROOT -DCMAKE_CXX_FLAGS='-std=c++14' -DCMAKE_INSTALL_PREFIX=$ATOMSGAFFER_INSTALL_PREFIX .
cmake -DGAFFER_ROOT=$GAFFER_ROOT -DATOMS_ROOT=$ATOMS_ROOT -DCMAKE_CXX_FLAGS='-std=c++14' -DPYTHON_VERSION=$PYTHON_VERSION -DCMAKE_INSTALL_PREFIX=$ATOMSGAFFER_INSTALL_PREFIX .
make install -j <num cores>)
```

Expand Down
2 changes: 1 addition & 1 deletion python/AtomsGaffer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
__import__( "Gaffer" )
__import__( "GafferScene" )

from _AtomsGaffer import *
from ._AtomsGaffer import *

__import__( "IECore" ).loadConfig( "GAFFER_STARTUP_PATHS", subdirectory = "AtomsGaffer" )
2 changes: 1 addition & 1 deletion python/AtomsGafferTest/AtomsAttributesTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def testConstruct( self ) :
@unittest.expectedFailure
def testCompute( self ) :

raise RuntimeError, "Write tests for AtomsAttributes"
raise RuntimeError("Write tests for AtomsAttributes")

if __name__ == "__main__":
unittest.main()
2 changes: 1 addition & 1 deletion python/AtomsGafferTest/AtomsCrowdGeneratorTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

import AtomsGaffer

from AtomsTestData import buildCrowdTest, buildVariationTest
from .AtomsTestData import buildCrowdTest, buildVariationTest

class AtomsCrowdGeneratorTest( GafferSceneTest.SceneTestCase ) :

Expand Down
11 changes: 7 additions & 4 deletions python/AtomsGafferTest/AtomsCrowdReaderTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import GafferSceneTest

import AtomsGaffer
from six.moves import range

class AtomsCrowdReaderTest( GafferSceneTest.SceneTestCase ) :

Expand Down Expand Up @@ -228,6 +229,7 @@ def testCompute( self ) :
self.assertTrue( "atoms:agents" in attributes )
self.assertTrue( attributes["atoms:agents"].typeName(), IECore.BlindDataHolder.staticTypeName() )
blind_data = attributes["atoms:agents"].blindData()

for i in range( 25 ):
self.assertTrue( str( i ) in blind_data )
agent_data = blind_data[str( i )]
Expand All @@ -240,11 +242,12 @@ def testCompute( self ) :

self.assertTrue( "poseNormalWorldMatrices" in agent_data )
self.assertEqual( len(agent_data["poseNormalWorldMatrices"]), 68 )
self.assertAlmostEqual( agent_data["poseNormalWorldMatrices"][2], pose_normal_matrix_data[i] )

self.assertTrue( "poseWorldMatrices" in agent_data )
self.assertEqual( len(agent_data["poseWorldMatrices"]), 68 )
self.assertAlmostEqual( agent_data["poseWorldMatrices"][2], pose_matrix_data[i] )
for j in range( 4 ) :
for k in range( 4 ) :
self.assertAlmostEqual( agent_data["poseNormalWorldMatrices"][2][j][k], pose_normal_matrix_data[i][j][k] )
self.assertAlmostEqual( agent_data["poseWorldMatrices"][2][j][k], pose_matrix_data[i][j][k] )

self.assertTrue( "boundingBox" in agent_data )

Expand All @@ -267,7 +270,7 @@ def testAffects( self ) :
for sss in ss :
if sss[0].isSame( a["out"] ) :
found = True
self.failUnless( found )
self.assertTrue( found )

def testEnabled( self ) :

Expand Down
2 changes: 1 addition & 1 deletion python/AtomsGafferTest/AtomsMetadataTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

import AtomsGaffer

from AtomsTestData import buildCrowdTest
from .AtomsTestData import buildCrowdTest

class AtomsMetadataTest( GafferSceneTest.SceneTestCase ) :

Expand Down
12 changes: 6 additions & 6 deletions python/AtomsGafferTest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
#
##########################################################################

from AtomsCrowdReaderTest import AtomsCrowdReaderTest
from AtomsVariationReaderTest import AtomsVariationReaderTest
from AtomsCrowdClothReaderTest import AtomsCrowdClothReaderTest
from AtomsCrowdGeneratorTest import AtomsCrowdGeneratorTest
from AtomsAttributesTest import AtomsAttributesTest
from AtomsMetadataTest import AtomsMetadataTest
from .AtomsCrowdReaderTest import AtomsCrowdReaderTest
from .AtomsVariationReaderTest import AtomsVariationReaderTest
from .AtomsCrowdClothReaderTest import AtomsCrowdClothReaderTest
from .AtomsCrowdGeneratorTest import AtomsCrowdGeneratorTest
from .AtomsAttributesTest import AtomsAttributesTest
from .AtomsMetadataTest import AtomsMetadataTest

if __name__ == "__main__":
import unittest
Expand Down
2 changes: 1 addition & 1 deletion python/AtomsGafferUI/AtomsAttributesUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import Gaffer
import AtomsGaffer

import DocumentationAlgo
from . import DocumentationAlgo

Gaffer.Metadata.registerNode(

Expand Down
2 changes: 1 addition & 1 deletion python/AtomsGafferUI/AtomsCrowdClothReaderUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

import AtomsGaffer

import DocumentationAlgo
from . import DocumentationAlgo

Gaffer.Metadata.registerNode(

Expand Down
2 changes: 1 addition & 1 deletion python/AtomsGafferUI/AtomsCrowdGeneratorUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

import AtomsGaffer

import DocumentationAlgo
from . import DocumentationAlgo

Gaffer.Metadata.registerNode(

Expand Down
2 changes: 1 addition & 1 deletion python/AtomsGafferUI/AtomsCrowdReaderUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

import AtomsGaffer

import DocumentationAlgo
from . import DocumentationAlgo

Gaffer.Metadata.registerNode(

Expand Down
2 changes: 1 addition & 1 deletion python/AtomsGafferUI/AtomsMetadataUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import Gaffer
import AtomsGaffer

import DocumentationAlgo
from . import DocumentationAlgo

Gaffer.Metadata.registerNode(

Expand Down
2 changes: 1 addition & 1 deletion python/AtomsGafferUI/AtomsVariationReaderUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import Gaffer
import AtomsGaffer

import DocumentationAlgo
from . import DocumentationAlgo

Gaffer.Metadata.registerNode(

Expand Down
14 changes: 7 additions & 7 deletions python/AtomsGafferUI/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@

__import__( "AtomsGaffer" )

import DocumentationAlgo
from . import DocumentationAlgo

import AtomsCrowdReaderUI
import AtomsVariationReaderUI
import AtomsCrowdGeneratorUI
import AtomsAttributesUI
import AtomsMetadataUI
import AtomsCrowdClothReaderUI
from . import AtomsCrowdReaderUI
from . import AtomsVariationReaderUI
from . import AtomsCrowdGeneratorUI
from . import AtomsAttributesUI
from . import AtomsMetadataUI
from . import AtomsCrowdClothReaderUI
2 changes: 1 addition & 1 deletion python/AtomsGafferUITest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#
##########################################################################

from DocumentationTest import DocumentationTest
from .DocumentationTest import DocumentationTest

if __name__ == "__main__":
unittest.main()

0 comments on commit 422537b

Please sign in to comment.