Loading...
Searching...
No Matches
IGeomBase.h
Go to the documentation of this file.
//-*****************************************************************************
//
// Copyright (c) 2009-2011,
// Sony Pictures Imageworks, Inc. and
// Industrial Light & Magic, a division of Lucasfilm Entertainment Company 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 Sony Pictures Imageworks, nor
// Industrial Light & Magic nor the names of their contributors 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 Alembic_AbcGeom_IGeometrySchema_h
#define Alembic_AbcGeom_IGeometrySchema_h
#include <Alembic/Abc/ISchema.h>
#include <Alembic/AbcGeom/Foundation.h>
#include <Alembic/AbcGeom/IGeomParam.h>
#include <Alembic/AbcGeom/SchemaInfoDeclarations.h>
namespace Alembic {
namespace AbcGeom {
namespace ALEMBIC_VERSION_NS {
template <class INFO>
class IGeomBaseSchema : public Abc::ISchema<INFO>
{
public:
//-*************************************************************************
// TYPEDEFS AND IDENTIFIERS
//-*************************************************************************
typedef INFO info_type;
//-*************************************************************************
// Constructors that pass through to ISchema
//-*************************************************************************
//
IGeomBaseSchema() {}
IGeomBaseSchema( const ICompoundProperty & iParent,
const std::string &iName,
const Argument &iArg0 = Argument(),
const Argument &iArg1 = Argument() )
: Abc::ISchema<info_type>( iParent, iName, iArg0, iArg1 )
{
init( iArg0, iArg1 );
}
IGeomBaseSchema( const ICompoundProperty & iProp,
const Abc::Argument &iArg0 = Abc::Argument(),
const Abc::Argument &iArg1 = Abc::Argument() )
: Abc::ISchema<info_type>( iProp, iArg0, iArg1 )
{
init( iArg0, iArg1 );
}
// Deprecated in favor of the constructor above
IGeomBaseSchema( const ICompoundProperty & iProp,
Abc::WrapExistingFlag iFlag,
const Abc::Argument &iArg0 = Abc::Argument(),
const Abc::Argument &iArg1 = Abc::Argument() )
: Abc::ISchema<info_type>( iProp, iArg0, iArg1 )
{
init( iArg0, iArg1 );
}
IGeomBaseSchema( const IGeomBaseSchema& iCopy )
: Abc::ISchema<info_type>()
{
*this = iCopy;
}
void init( const Abc::Argument &iArg0, const Abc::Argument &iArg1 )
{
ALEMBIC_ABC_SAFE_CALL_BEGIN( "IGeomBaseSchema::init()" );
Abc::Arguments args;
iArg0.setInto( args );
iArg1.setInto( args );
AbcA::CompoundPropertyReaderPtr _this = this->getPtr();
m_selfBoundsProperty = Abc::IBox3dProperty( _this, ".selfBnds",
iArg0, iArg1 );
if ( this->getPropertyHeader( ".childBnds" ) != NULL )
{
m_childBoundsProperty = Abc::IBox3dProperty( _this,
".childBnds", iArg0, iArg1 );
}
if ( this->getPropertyHeader( ".arbGeomParams" ) != NULL )
{
m_arbGeomParams = Abc::ICompoundProperty( _this, ".arbGeomParams",
args.getErrorHandlerPolicy() );
}
if ( this->getPropertyHeader( ".userProperties" ) != NULL )
{
m_userProperties = Abc::ICompoundProperty( _this, ".userProperties",
args.getErrorHandlerPolicy() );
}
ALEMBIC_ABC_SAFE_CALL_END();
}
virtual void reset ()
{
m_selfBoundsProperty.reset();
m_childBoundsProperty.reset();
m_arbGeomParams.reset();
m_userProperties.reset();
Abc::ISchema<info_type>::reset();
}
virtual bool valid() const
{
// Only selfBounds is required, all others are optional
return ( Abc::ISchema<info_type>::valid() &&
m_selfBoundsProperty.valid() );
}
Abc::IBox3dProperty getSelfBoundsProperty() const
{
return m_selfBoundsProperty;
}
Abc::IBox3dProperty getChildBoundsProperty() const
{
return m_childBoundsProperty;
}
// compound property to use as parent for any arbitrary GeomParams
// underneath it
ICompoundProperty getArbGeomParams() const { return m_arbGeomParams; }
// compound property to use as parent for any user workflow specific
// properties
ICompoundProperty getUserProperties() const { return m_userProperties; }
protected:
// Only selfBounds is required, all others are optional
Abc::IBox3dProperty m_selfBoundsProperty;
Abc::IBox3dProperty m_childBoundsProperty;
Abc::ICompoundProperty m_arbGeomParams;
Abc::ICompoundProperty m_userProperties;
};
//-*****************************************************************************
class IGeomBase : public IGeomBaseSchema<GeomBaseSchemaInfo>
{
public:
typedef IGeomBase this_type;
class Sample
{
public:
typedef Sample this_type;
// Users don't ever create this data directly.
Sample() { reset(); }
Abc::Box3d getSelfBounds() const { return m_selfBounds; }
void reset()
{
m_selfBounds.makeEmpty();
}
protected:
friend class IGeomBase;
Abc::Box3d m_selfBounds;
};
public:
//-*************************************************************************
// CONSTRUCTION, DESTRUCTION, ASSIGNMENT
//-*************************************************************************
IGeomBase() {}
IGeomBase( const ICompoundProperty &iParent,
const std::string &iName,
const Abc::Argument &iArg0 = Abc::Argument(),
const Abc::Argument &iArg1 = Abc::Argument() )
// We don't want strict matching of the title because the real schema
// is going to be something like "AbcGeom_<type>_vX"
: IGeomBaseSchema<GeomBaseSchemaInfo>( iParent, iName, kNoMatching )
{
init( iArg0, iArg1 );
}
IGeomBase( const ICompoundProperty & iThis,
const Abc::Argument &iArg0 = Abc::Argument(),
const Abc::Argument &iArg1 = Abc::Argument() )
// We don't want strict matching of the title because the real schema
// is going to be something like "AbcGeom_<type>_vX"
: IGeomBaseSchema<GeomBaseSchemaInfo>( iThis, kNoMatching )
{
init( iArg0, iArg1 );
}
IGeomBase( const ICompoundProperty & iThis,
Abc::WrapExistingFlag iFlag,
const Abc::Argument &iArg0 = Abc::Argument(),
const Abc::Argument &iArg1 = Abc::Argument() )
: IGeomBaseSchema<GeomBaseSchemaInfo>( iThis, kNoMatching )
{
init( iArg0, iArg1 );
}
IGeomBase(const IGeomBase & iCopy)
: IGeomBaseSchema<GeomBaseSchemaInfo>()
{
*this = iCopy;
}
//-*************************************************************************
// SCALAR PROPERTY READER FUNCTIONALITY
//-*************************************************************************
size_t getNumSamples() const
{ return m_selfBoundsProperty.getNumSamples(); }
bool isConstant() const
{ return m_selfBoundsProperty.isConstant(); }
AbcA::TimeSamplingPtr getTimeSampling() const
{
if ( m_selfBoundsProperty.valid() )
{
return m_selfBoundsProperty.getTimeSampling();
}
else
{
return getObject().getArchive().getTimeSampling( 0 );
}
}
//-*************************************************************************
void get( Sample &oSample,
const Abc::ISampleSelector &iSS = Abc::ISampleSelector() ) const
{
ALEMBIC_ABC_SAFE_CALL_BEGIN( "IGeomBase::get()" );
m_selfBoundsProperty.get( oSample.m_selfBounds, iSS );
ALEMBIC_ABC_SAFE_CALL_END();
}
//-*************************************************************************
Sample getValue( const Abc::ISampleSelector &iSS = Abc::ISampleSelector() ) const
{
Sample smp;
get( smp, iSS );
return smp;
}
//-*************************************************************************
Abc::ICompoundProperty getArbGeomParams() const { return m_arbGeomParams; }
//-*************************************************************************
Abc::ICompoundProperty getUserProperties() const { return m_userProperties; }
//-*************************************************************************
void reset()
{
IGeomBaseSchema<GeomBaseSchemaInfo>::reset();
}
//-*************************************************************************
bool valid() const
{
return ( IGeomBaseSchema<GeomBaseSchemaInfo>::valid() );
}
//-*************************************************************************
ALEMBIC_OVERRIDE_OPERATOR_BOOL( IGeomBase::valid() );
//-*************************************************************************
static bool matches( const AbcA::MetaData &iMetaData,
SchemaInterpMatching iMatching = kStrictMatching )
{
if ( iMatching == kNoMatching )
{ return true; }
if ( iMatching == kStrictMatching || iMatching == kSchemaTitleMatching )
{
return iMetaData.get( "schemaBaseType" ) ==
GeomBaseSchemaInfo::title();
}
return false;
}
//-*************************************************************************
static bool matches( const AbcA::PropertyHeader &iHeader,
SchemaInterpMatching iMatching = kStrictMatching )
{
return matches( iHeader.getMetaData(), iMatching );
}
};
//-*****************************************************************************
typedef Abc::ISchemaObject<IGeomBase> IGeomBaseObject;
} // End namespace ALEMBIC_VERSION_NS
using namespace ALEMBIC_VERSION_NS;
} // End namespace AbcGeom
} // End namespace Alembic
#endif
Foundation.h
SchemaInfoDeclarations.h
ALEMBIC_ABC_SAFE_CALL_END
#define ALEMBIC_ABC_SAFE_CALL_END()
Definition ErrorHandler.h:198
ALEMBIC_ABC_SAFE_CALL_BEGIN
#define ALEMBIC_ABC_SAFE_CALL_BEGIN(CONTEXT)
Definition ErrorHandler.h:172
IGeomParam.h
ISchema.h
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::IGeomBaseSchema
IGeomBaseSchema(const ICompoundProperty &iParent, const std::string &iName, const Argument &iArg0=Argument(), const Argument &iArg1=Argument())
Definition IGeomBase.h:80
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::IGeomBaseSchema
IGeomBaseSchema(const IGeomBaseSchema &iCopy)
Copy constructor.
Definition IGeomBase.h:109
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::IGeomBaseSchema
IGeomBaseSchema(const ICompoundProperty &iProp, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Wrap an existing schema object.
Definition IGeomBase.h:90
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::getSelfBoundsProperty
Abc::IBox3dProperty getSelfBoundsProperty() const
Definition IGeomBase.h:163
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::init
void init(const Abc::Argument &iArg0, const Abc::Argument &iArg1)
Definition IGeomBase.h:115
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::m_arbGeomParams
Abc::ICompoundProperty m_arbGeomParams
Definition IGeomBase.h:186
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::reset
virtual void reset()
Definition IGeomBase.h:147
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::m_selfBoundsProperty
Abc::IBox3dProperty m_selfBoundsProperty
Definition IGeomBase.h:183
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::m_userProperties
Abc::ICompoundProperty m_userProperties
Definition IGeomBase.h:187
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::getArbGeomParams
ICompoundProperty getArbGeomParams() const
Definition IGeomBase.h:175
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::getChildBoundsProperty
Abc::IBox3dProperty getChildBoundsProperty() const
Definition IGeomBase.h:168
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::IGeomBaseSchema
IGeomBaseSchema(const ICompoundProperty &iProp, Abc::WrapExistingFlag iFlag, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition IGeomBase.h:99
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::valid
virtual bool valid() const
Definition IGeomBase.h:156
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::getUserProperties
ICompoundProperty getUserProperties() const
Definition IGeomBase.h:179
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::m_childBoundsProperty
Abc::IBox3dProperty m_childBoundsProperty
Definition IGeomBase.h:184
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::info_type
INFO info_type
Definition IGeomBase.h:67
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::IGeomBaseSchema
IGeomBaseSchema()
Definition IGeomBase.h:76
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::Sample
Definition IGeomBase.h:212
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::Sample::this_type
Sample this_type
Definition IGeomBase.h:214
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::Sample::m_selfBounds
Abc::Box3d m_selfBounds
Definition IGeomBase.h:228
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::Sample::reset
void reset()
Definition IGeomBase.h:221
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::Sample::getSelfBounds
Abc::Box3d getSelfBounds() const
Definition IGeomBase.h:219
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::Sample::IGeomBase
friend class IGeomBase
Definition IGeomBase.h:227
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::Sample::Sample
Sample()
Definition IGeomBase.h:217
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::getNumSamples
size_t getNumSamples() const
Default assignment operator used.
Definition IGeomBase.h:290
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::IGeomBase
IGeomBase(const ICompoundProperty &iParent, const std::string &iName, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition IGeomBase.h:242
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::ALEMBIC_OVERRIDE_OPERATOR_BOOL
ALEMBIC_OVERRIDE_OPERATOR_BOOL(IGeomBase::valid())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::IGeomBase
IGeomBase()
The default constructor creates an empty GeomBase.
Definition IGeomBase.h:240
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::getArbGeomParams
Abc::ICompoundProperty getArbGeomParams() const
Definition IGeomBase.h:332
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::matches
static bool matches(const AbcA::MetaData &iMetaData, SchemaInterpMatching iMatching=kStrictMatching)
Definition IGeomBase.h:362
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::IGeomBase
IGeomBase(const ICompoundProperty &iThis, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition IGeomBase.h:254
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::matches
static bool matches(const AbcA::PropertyHeader &iHeader, SchemaInterpMatching iMatching=kStrictMatching)
Definition IGeomBase.h:381
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::get
void get(Sample &oSample, const Abc::ISampleSelector &iSS=Abc::ISampleSelector()) const
Definition IGeomBase.h:313
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::IGeomBase
IGeomBase(const ICompoundProperty &iThis, Abc::WrapExistingFlag iFlag, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition IGeomBase.h:264
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::valid
bool valid() const
Definition IGeomBase.h:348
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::getUserProperties
Abc::ICompoundProperty getUserProperties() const
Definition IGeomBase.h:335
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::IGeomBase
IGeomBase(const IGeomBase &iCopy)
Copy constructor.
Definition IGeomBase.h:274
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::getValue
Sample getValue(const Abc::ISampleSelector &iSS=Abc::ISampleSelector()) const
Definition IGeomBase.h:324
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::getTimeSampling
AbcA::TimeSamplingPtr getTimeSampling() const
Definition IGeomBase.h:300
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::this_type
IGeomBase this_type
Definition IGeomBase.h:209
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::reset
void reset()
Definition IGeomBase.h:340
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::isConstant
bool isConstant() const
Definition IGeomBase.h:295
Alembic::Abc::ALEMBIC_VERSION_NS::Argument
Definition Argument.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::Argument::setInto
void setInto(Arguments &iArgs) const
Definition Argument.h:149
Alembic::Abc::ALEMBIC_VERSION_NS::Arguments
Definition Argument.h:49
Alembic::Abc::ALEMBIC_VERSION_NS::Arguments::getErrorHandlerPolicy
ErrorHandler::Policy getErrorHandlerPolicy() const
Definition Argument.h:83
Alembic::Abc::ALEMBIC_VERSION_NS::IArchive::getTimeSampling
AbcA::TimeSamplingPtr getTimeSampling(uint32_t iIndex)
Returns the TimeSampling at a given index.
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT< AbcA::CompoundPropertyReaderPtr >::getObject
IObject getObject() const
Definition IBaseProperty.h:207
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT< AbcA::CompoundPropertyReaderPtr >::getPtr
AbcA::CompoundPropertyReaderPtr getPtr() const
Definition IBaseProperty.h:156
Alembic::Abc::ALEMBIC_VERSION_NS::ICompoundProperty
Definition ICompoundProperty.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::ICompoundProperty::getPropertyHeader
const AbcA::PropertyHeader & getPropertyHeader(size_t i) const
Alembic::Abc::ALEMBIC_VERSION_NS::IObject::getArchive
IArchive getArchive() const
Alembic::Abc::ALEMBIC_VERSION_NS::ISampleSelector
Definition ISampleSelector.h:49
Alembic::Abc::ALEMBIC_VERSION_NS::ISchemaObject
Definition ISchemaObject.h:56
Alembic::Abc::ALEMBIC_VERSION_NS::ISchema
Definition ISchema.h:58
Alembic::Abc::ALEMBIC_VERSION_NS::ISchema::ISchema
ISchema()
Definition ISchema.h:112
Alembic::AbcGeom::ALEMBIC_VERSION_NS
Definition ArchiveBounds.h:45
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseObject
Abc::ISchemaObject< IGeomBase > IGeomBaseObject
Definition IGeomBase.h:390
Alembic::AbcGeom
Definition ArchiveBounds.h:44
Alembic::Abc::ALEMBIC_VERSION_NS::SchemaInterpMatching
SchemaInterpMatching
Definition Foundation.h:77
Alembic::Abc::ALEMBIC_VERSION_NS::kSchemaTitleMatching
@ kSchemaTitleMatching
Definition Foundation.h:80
Alembic::Abc::ALEMBIC_VERSION_NS::kNoMatching
@ kNoMatching
Definition Foundation.h:79
Alembic::Abc::ALEMBIC_VERSION_NS::kStrictMatching
@ kStrictMatching
Definition Foundation.h:78
Alembic::Abc::ALEMBIC_VERSION_NS::WrapExistingFlag
WrapExistingFlag
Definition Foundation.h:94
Alembic::Abc::ALEMBIC_VERSION_NS::IBox3dProperty
ITypedScalarProperty< Box3dTPTraits > IBox3dProperty
Definition ITypedScalarProperty.h:257
Alembic::Abc
Definition ArchiveInfo.h:47
Alembic
Alembic namespace ...
Definition ArchiveInfo.h:46