Skip to content

Commit

Permalink
FIX : rename with get prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldresser-ie committed Apr 17, 2024
1 parent f1a5e11 commit eb0b2ca
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 41 deletions.
6 changes: 3 additions & 3 deletions include/IECoreScene/MeshPrimitive.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ class IECORESCENE_API MeshPrimitive : public Primitive
/////////////////////////////////////////////////////////////////////////////
//@{

const IECore::InternedString &interpolateBoundary() const;
const IECore::InternedString &getInterpolateBoundary() const;
void setInterpolateBoundary( const IECore::InternedString &interpolateBoundary );

static const IECore::InternedString interpolateBoundaryNone;
static const IECore::InternedString interpolateBoundaryEdgeOnly;
static const IECore::InternedString interpolateBoundaryEdgeAndCorner;

const IECore::InternedString &faceVaryingLinearInterpolation() const;
const IECore::InternedString &getFaceVaryingLinearInterpolation() const;
void setFaceVaryingLinearInterpolation( const IECore::InternedString &faceVaryingLinearInterpolation );

static const IECore::InternedString faceVaryingLinearInterpolationNone;
Expand All @@ -143,7 +143,7 @@ class IECORESCENE_API MeshPrimitive : public Primitive
static const IECore::InternedString faceVaryingLinearInterpolationBoundaries;
static const IECore::InternedString faceVaryingLinearInterpolationAll;

const IECore::InternedString &triangleSubdivisionRule() const;
const IECore::InternedString &getTriangleSubdivisionRule() const;
void setTriangleSubdivisionRule( const IECore::InternedString &triangleSubdivisionRule );

static const IECore::InternedString triangleSubdivisionRuleCatmullClark;
Expand Down
30 changes: 15 additions & 15 deletions src/IECoreScene/MeshPrimitive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ void MeshPrimitive::removeCreases()
m_creaseSharpnesses = emptyFloatVectorData();
}

const IECore::InternedString &MeshPrimitive::interpolateBoundary() const
const IECore::InternedString &MeshPrimitive::getInterpolateBoundary() const
{
return (*g_classData)[ this ].interpolateBoundary;
}
Expand All @@ -392,7 +392,7 @@ void MeshPrimitive::setInterpolateBoundary( const IECore::InternedString &interp
(*g_classData)[ this ].interpolateBoundary = interpolateBoundary;
}

const IECore::InternedString &MeshPrimitive::faceVaryingLinearInterpolation() const
const IECore::InternedString &MeshPrimitive::getFaceVaryingLinearInterpolation() const
{
return (*g_classData)[ this ].faceVaryingLinearInterpolation;
}
Expand All @@ -402,7 +402,7 @@ void MeshPrimitive::setFaceVaryingLinearInterpolation( const IECore::InternedStr
(*g_classData)[ this ].faceVaryingLinearInterpolation = faceVaryingLinearInterpolation;
}

const IECore::InternedString &MeshPrimitive::triangleSubdivisionRule() const
const IECore::InternedString &MeshPrimitive::getTriangleSubdivisionRule() const
{
return (*g_classData)[ this ].triangleSubdivisionRule;
}
Expand Down Expand Up @@ -457,9 +457,9 @@ void MeshPrimitive::copyFrom( const Object *other, IECore::Object::CopyContext *
m_creaseLengths = tOther->m_creaseLengths;
m_creaseIds = tOther->m_creaseIds;
m_creaseSharpnesses = tOther->m_creaseSharpnesses;
setInterpolateBoundary( tOther->interpolateBoundary() );
setFaceVaryingLinearInterpolation( tOther->faceVaryingLinearInterpolation() );
setTriangleSubdivisionRule( tOther->triangleSubdivisionRule() );
setInterpolateBoundary( tOther->getInterpolateBoundary() );
setFaceVaryingLinearInterpolation( tOther->getFaceVaryingLinearInterpolation() );
setTriangleSubdivisionRule( tOther->getTriangleSubdivisionRule() );
}

void MeshPrimitive::save( IECore::Object::SaveContext *context ) const
Expand Down Expand Up @@ -489,9 +489,9 @@ void MeshPrimitive::save( IECore::Object::SaveContext *context ) const
context->save( m_creaseSharpnesses.get(), container.get(), g_creaseSharpnessesEntry );
}

container->write( g_interpolateBoundaryEntry, interpolateBoundary().string() );
container->write( g_faceVaryingLinearInterpolationEntry, faceVaryingLinearInterpolation().string() );
container->write( g_triangleSubdivisionRuleEntry, triangleSubdivisionRule().string() );
container->write( g_interpolateBoundaryEntry, getInterpolateBoundary().string() );
container->write( g_faceVaryingLinearInterpolationEntry, getFaceVaryingLinearInterpolation().string() );
container->write( g_triangleSubdivisionRuleEntry, getTriangleSubdivisionRule().string() );
}

void MeshPrimitive::load( IECore::Object::LoadContextPtr context )
Expand Down Expand Up @@ -594,15 +594,15 @@ bool MeshPrimitive::isEqualTo( const Object *other ) const
{
return false;
}
if( interpolateBoundary() != tOther->interpolateBoundary() )
if( getInterpolateBoundary() != tOther->getInterpolateBoundary() )
{
return false;
}
if( faceVaryingLinearInterpolation() != tOther->faceVaryingLinearInterpolation() )
if( getFaceVaryingLinearInterpolation() != tOther->getFaceVaryingLinearInterpolation() )
{
return false;
}
if( triangleSubdivisionRule() != tOther->triangleSubdivisionRule() )
if( getTriangleSubdivisionRule() != tOther->getTriangleSubdivisionRule() )
{
return false;
}
Expand Down Expand Up @@ -637,9 +637,9 @@ void MeshPrimitive::topologyHash( MurmurHash &h ) const
m_verticesPerFace->hash( h );
m_vertexIds->hash( h );
h.append( m_interpolation );
h.append( interpolateBoundary() );
h.append( faceVaryingLinearInterpolation() );
h.append( triangleSubdivisionRule() );
h.append( getInterpolateBoundary() );
h.append( getFaceVaryingLinearInterpolation() );
h.append( getTriangleSubdivisionRule() );
}

MeshPrimitivePtr MeshPrimitive::createBox( const Box3f &b )
Expand Down
18 changes: 9 additions & 9 deletions src/IECoreScene/bindings/MeshPrimitiveBinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ MeshPrimitivePtr createSphereWrapper( float radius, float zMin, float zMax, floa
return MeshPrimitive::createSphere( radius, zMin, zMax, thetaMax, divisions, canceller );
}

InternedString interpolateBoundaryWrapper( const MeshPrimitive &p )
InternedString getInterpolateBoundaryWrapper( const MeshPrimitive &p )
{
return p.interpolateBoundary();
return p.getInterpolateBoundary();
}

InternedString faceVaryingLinearInterpolationWrapper( const MeshPrimitive &p )
InternedString getFaceVaryingLinearInterpolationWrapper( const MeshPrimitive &p )
{
return p.faceVaryingLinearInterpolation();
return p.getFaceVaryingLinearInterpolation();
}

InternedString triangleSubdivisionRuleWrapper( const MeshPrimitive &p )
InternedString getTriangleSubdivisionRuleWrapper( const MeshPrimitive &p )
{
return p.triangleSubdivisionRule();
return p.getTriangleSubdivisionRule();
}

} // namespace
Expand Down Expand Up @@ -140,11 +140,11 @@ void IECoreSceneModule::bindMeshPrimitive()

// Note these are bound as functions, not properties - this is inconsistent with how interpolation is
// bound, but we hope to switch interpolation at some point, see todo above.
.def( "interpolateBoundary", &interpolateBoundaryWrapper )
.def( "getInterpolateBoundary", &getInterpolateBoundaryWrapper )
.def( "setInterpolateBoundary", &MeshPrimitive::setInterpolateBoundary )
.def( "faceVaryingLinearInterpolation", &faceVaryingLinearInterpolationWrapper )
.def( "getFaceVaryingLinearInterpolation", &getFaceVaryingLinearInterpolationWrapper )
.def( "setFaceVaryingLinearInterpolation", &MeshPrimitive::setFaceVaryingLinearInterpolation )
.def( "triangleSubdivisionRule", &triangleSubdivisionRuleWrapper )
.def( "getTriangleSubdivisionRule", &getTriangleSubdivisionRuleWrapper )
.def( "setTriangleSubdivisionRule", &MeshPrimitive::setTriangleSubdivisionRule )
.def_readonly( "interpolationLinear", MeshPrimitive::interpolationLinear )
.def_readonly( "interpolationCatmullClark", MeshPrimitive::interpolationCatmullClark )
Expand Down
28 changes: 14 additions & 14 deletions test/IECoreScene/MeshPrimitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ def test( self ) :
self.assertEqual( m.verticesPerFace, IECore.IntVectorData() )
self.assertEqual( m.vertexIds, IECore.IntVectorData() )
self.assertEqual( m.interpolation, "linear" )
self.assertEqual( m.interpolateBoundary(), IECoreScene.MeshPrimitive.interpolateBoundaryEdgeAndCorner )
self.assertEqual( m.faceVaryingLinearInterpolation(), IECoreScene.MeshPrimitive.faceVaryingLinearInterpolationCornersPlus1 )
self.assertEqual( m.triangleSubdivisionRule(), IECoreScene.MeshPrimitive.triangleSubdivisionRuleCatmullClark )
self.assertEqual( m.getInterpolateBoundary(), IECoreScene.MeshPrimitive.interpolateBoundaryEdgeAndCorner )
self.assertEqual( m.getFaceVaryingLinearInterpolation(), IECoreScene.MeshPrimitive.faceVaryingLinearInterpolationCornersPlus1 )
self.assertEqual( m.getTriangleSubdivisionRule(), IECoreScene.MeshPrimitive.triangleSubdivisionRuleCatmullClark )
self.assertEqual( m, m.copy() )
self.assertEqual( m.maxVerticesPerFace(), 0 )

Expand Down Expand Up @@ -553,46 +553,46 @@ def testSubdivOptions( self ) :

default = IECoreScene.MeshPrimitive.createPlane( imath.Box2f( imath.V2f( 0 ), imath.V2f( 1 ) ) )
m = IECoreScene.MeshPrimitive.createPlane( imath.Box2f( imath.V2f( 0 ), imath.V2f( 1 ) ) )
self.assertEqual( m.interpolateBoundary(), IECoreScene.MeshPrimitive.interpolateBoundaryEdgeAndCorner )
self.assertEqual( m.faceVaryingLinearInterpolation(), IECoreScene.MeshPrimitive.faceVaryingLinearInterpolationCornersPlus1 )
self.assertEqual( m.triangleSubdivisionRule(), IECoreScene.MeshPrimitive.triangleSubdivisionRuleCatmullClark )
self.assertEqual( m.getInterpolateBoundary(), IECoreScene.MeshPrimitive.interpolateBoundaryEdgeAndCorner )
self.assertEqual( m.getFaceVaryingLinearInterpolation(), IECoreScene.MeshPrimitive.faceVaryingLinearInterpolationCornersPlus1 )
self.assertEqual( m.getTriangleSubdivisionRule(), IECoreScene.MeshPrimitive.triangleSubdivisionRuleCatmullClark )
self.assertEqual( m, default )
self.assertEqual( m.hash(), default.hash() )

m.setInterpolateBoundary( IECoreScene.MeshPrimitive.interpolateBoundaryEdgeOnly )
self.assertNotEqual( m, default )
self.assertNotEqual( m.hash(), default.hash() )
self.assertEqual( m.interpolateBoundary(), IECoreScene.MeshPrimitive.interpolateBoundaryEdgeOnly )
self.assertEqual( m.getInterpolateBoundary(), IECoreScene.MeshPrimitive.interpolateBoundaryEdgeOnly )
m.setInterpolateBoundary( IECoreScene.MeshPrimitive.interpolateBoundaryEdgeAndCorner )
self.assertEqual( m, default )
self.assertEqual( m.hash(), default.hash() )
m.setFaceVaryingLinearInterpolation( IECoreScene.MeshPrimitive.faceVaryingLinearInterpolationCornersPlus2 )
self.assertEqual( m.faceVaryingLinearInterpolation(), IECoreScene.MeshPrimitive.faceVaryingLinearInterpolationCornersPlus2 )
self.assertEqual( m.getFaceVaryingLinearInterpolation(), IECoreScene.MeshPrimitive.faceVaryingLinearInterpolationCornersPlus2 )
self.assertNotEqual( m, default )
self.assertNotEqual( m.hash(), default.hash() )
m.setFaceVaryingLinearInterpolation( IECoreScene.MeshPrimitive.faceVaryingLinearInterpolationCornersPlus1 )
self.assertEqual( m, default )
self.assertEqual( m.hash(), default.hash() )
m.setTriangleSubdivisionRule( IECoreScene.MeshPrimitive.triangleSubdivisionRuleSmooth )
self.assertEqual( m.triangleSubdivisionRule(), IECoreScene.MeshPrimitive.triangleSubdivisionRuleSmooth )
self.assertEqual( m.getTriangleSubdivisionRule(), IECoreScene.MeshPrimitive.triangleSubdivisionRuleSmooth )
self.assertNotEqual( m, default )
self.assertNotEqual( m.hash(), default.hash() )

m.setInterpolateBoundary( IECoreScene.MeshPrimitive.interpolateBoundaryEdgeOnly )
m.setFaceVaryingLinearInterpolation( IECoreScene.MeshPrimitive.faceVaryingLinearInterpolationCornersPlus2 )

mCopy = m.copy()
self.assertEqual( mCopy.interpolateBoundary(), IECoreScene.MeshPrimitive.interpolateBoundaryEdgeOnly )
self.assertEqual( mCopy.faceVaryingLinearInterpolation(), IECoreScene.MeshPrimitive.faceVaryingLinearInterpolationCornersPlus2 )
self.assertEqual( mCopy.getInterpolateBoundary(), IECoreScene.MeshPrimitive.interpolateBoundaryEdgeOnly )
self.assertEqual( mCopy.getFaceVaryingLinearInterpolation(), IECoreScene.MeshPrimitive.faceVaryingLinearInterpolationCornersPlus2 )
self.assertEqual( m, mCopy )

io = IECore.MemoryIndexedIO( IECore.CharVectorData(), [], IECore.IndexedIO.OpenMode.Append )

m.save( io, "test" )
m2 = IECore.Object.load( io, "test" )
self.assertEqual( m2.interpolateBoundary(), IECoreScene.MeshPrimitive.interpolateBoundaryEdgeOnly )
self.assertEqual( m2.faceVaryingLinearInterpolation(), IECoreScene.MeshPrimitive.faceVaryingLinearInterpolationCornersPlus2 )
self.assertEqual( m.triangleSubdivisionRule(), IECoreScene.MeshPrimitive.triangleSubdivisionRuleSmooth )
self.assertEqual( m2.getInterpolateBoundary(), IECoreScene.MeshPrimitive.interpolateBoundaryEdgeOnly )
self.assertEqual( m2.getFaceVaryingLinearInterpolation(), IECoreScene.MeshPrimitive.faceVaryingLinearInterpolationCornersPlus2 )
self.assertEqual( m.getTriangleSubdivisionRule(), IECoreScene.MeshPrimitive.triangleSubdivisionRuleSmooth )
self.assertEqual( m, m2 )

def tearDown( self ) :
Expand Down

0 comments on commit eb0b2ca

Please sign in to comment.