Loading...
Searching...
No Matches
OGeomBase.h
Go to the documentation of this file.
//-*****************************************************************************
//
// Copyright (c) 2009-2012,
// 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_OGeometrySchema_h
#define Alembic_AbcGeom_OGeometrySchema_h
#include <Alembic/Abc/OSchema.h>
#include <Alembic/AbcGeom/Foundation.h>
#include <Alembic/AbcGeom/OGeomParam.h>
namespace Alembic {
namespace AbcGeom {
namespace ALEMBIC_VERSION_NS {
template <class INFO>
class OGeomBaseSchema : public Abc::OSchema<INFO>
{
public:
//-*************************************************************************
// TYPEDEFS AND IDENTIFIERS
//-*************************************************************************
typedef INFO info_type;
//-*************************************************************************
// Constructors that pass through to OSchema
//-*************************************************************************
//
OGeomBaseSchema() {}
OGeomBaseSchema( AbcA::CompoundPropertyWriterPtr iParent,
const std::string &iName,
const Argument &iArg0 = Argument(),
const Argument &iArg1 = Argument(),
const Argument &iArg2 = Argument(),
const Argument &iArg3 = Argument() )
: Abc::OSchema<info_type>( iParent, iName, iArg0, iArg1, iArg2, iArg3 )
{
AbcA::TimeSamplingPtr tsPtr =
Abc::GetTimeSampling( iArg0, iArg1, iArg2, iArg3 );
uint32_t tsIndex =
Abc::GetTimeSamplingIndex( iArg0, iArg1, iArg2, iArg3 );
// if we specified a valid TimeSamplingPtr, use it to determine the
// index otherwise use the default index of 0 - uniform.
if ( tsPtr )
{
tsIndex = iParent->getObject()->getArchive()->addTimeSampling(
*tsPtr );
}
// Create our always present property
init( tsIndex, Abc::IsSparse( iArg0, iArg1, iArg2, iArg3 ) );
}
OGeomBaseSchema( const OGeomBaseSchema& iCopy )
: Abc::OSchema<info_type>()
{
*this = iCopy;
}
virtual void reset ()
{
m_selfBoundsProperty.reset();
m_childBoundsProperty.reset();
m_arbGeomParams.reset();
m_userProperties.reset();
Abc::OSchema<info_type>::reset();
}
virtual bool valid() const
{
return ( Abc::OSchema<info_type>::valid() );
}
Abc::OCompoundProperty getArbGeomParams()
{
// Accessing the ArbGeomParams will create its compound
// property if needed.
ALEMBIC_ABC_SAFE_CALL_BEGIN( "OGeomBaseSchema::getArbGeomParams()" );
if ( ! m_arbGeomParams )
{
m_arbGeomParams = Abc::OCompoundProperty( this->getPtr(),
".arbGeomParams" );
}
return m_arbGeomParams;
ALEMBIC_ABC_SAFE_CALL_END();
Abc::OCompoundProperty ret;
return ret;
}
Abc::OCompoundProperty getUserProperties()
{
// Accessing UserProperties will create its compound
// property if needed.
ALEMBIC_ABC_SAFE_CALL_BEGIN( "OGeomBaseSchema::getUserProperties()" );
if ( ! m_userProperties )
{
m_userProperties = Abc::OCompoundProperty( this->getPtr(),
".userProperties" );
}
return m_userProperties;
ALEMBIC_ABC_SAFE_CALL_END();
Abc::OCompoundProperty ret;
return ret;
}
Abc::OBox3dProperty getChildBoundsProperty()
{
// Accessing Child Bounds Property will create it if needed
ALEMBIC_ABC_SAFE_CALL_BEGIN(
"OGeomBaseSchema::getChildBoundsProperty()" );
if ( ! m_childBoundsProperty )
{
AbcA::CompoundPropertyWriterPtr _this = this->getPtr();
// for now, use the self bounds time sampling, this
// can and should be changed depending on how the children
// are sampled
m_childBoundsProperty = Abc::OBox3dProperty( _this,
".childBnds", m_selfBoundsProperty.getTimeSampling() );
}
ALEMBIC_ABC_SAFE_CALL_END();
return m_childBoundsProperty;
}
protected:
void init( uint32_t iTsIndex, bool isSparse)
{
ALEMBIC_ABC_SAFE_CALL_BEGIN( "OGeomBaseSchema::init()" );
if( !isSparse )
{
createSelfBoundsProperty(iTsIndex, 0);
}
ALEMBIC_ABC_SAFE_CALL_END_RESET();
}
void createSelfBoundsProperty(uint32_t iTsIndex, size_t iNumSamples)
{
ALEMBIC_ABC_SAFE_CALL_BEGIN( "OGeomBaseSchema::createSelfBoundsProperty()" );
if ( m_selfBoundsProperty.valid() )
{
return;
}
m_selfBoundsProperty = Abc::OBox3dProperty( this->getPtr(), ".selfBnds",
iTsIndex );
Abc::Box3d bnds;
for ( size_t i = 0; i < iNumSamples; ++i )
{
m_selfBoundsProperty.set( bnds );
}
ALEMBIC_ABC_SAFE_CALL_END();
}
// Only selfBounds is required, all others are optional
Abc::OBox3dProperty m_selfBoundsProperty;
Abc::OBox3dProperty m_childBoundsProperty;
Abc::OCompoundProperty m_arbGeomParams;
Abc::OCompoundProperty m_userProperties;
};
} // End namespace ALEMBIC_VERSION_NS
using namespace ALEMBIC_VERSION_NS;
} // End namespace AbcGeom
} // End namespace Alembic
#endif
Foundation.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
ALEMBIC_ABC_SAFE_CALL_END_RESET
#define ALEMBIC_ABC_SAFE_CALL_END_RESET()
Definition ErrorHandler.h:181
OGeomParam.h
OSchema.h
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::getChildBoundsProperty
Abc::OBox3dProperty getChildBoundsProperty()
Definition OGeomBase.h:164
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::OGeomBaseSchema
OGeomBaseSchema()
Definition OGeomBase.h:74
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::OGeomBaseSchema
OGeomBaseSchema(AbcA::CompoundPropertyWriterPtr iParent, const std::string &iName, const Argument &iArg0=Argument(), const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition OGeomBase.h:78
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::info_type
INFO info_type
Definition OGeomBase.h:65
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::m_arbGeomParams
Abc::OCompoundProperty m_arbGeomParams
Definition OGeomBase.h:225
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::reset
virtual void reset()
Definition OGeomBase.h:110
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::createSelfBoundsProperty
void createSelfBoundsProperty(uint32_t iTsIndex, size_t iNumSamples)
Creates the self bounds.
Definition OGeomBase.h:201
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::valid
virtual bool valid() const
Definition OGeomBase.h:119
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::getUserProperties
Abc::OCompoundProperty getUserProperties()
Definition OGeomBase.h:144
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::m_childBoundsProperty
Abc::OBox3dProperty m_childBoundsProperty
Definition OGeomBase.h:223
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::OGeomBaseSchema
OGeomBaseSchema(const OGeomBaseSchema &iCopy)
Copy constructor.
Definition OGeomBase.h:104
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::m_selfBoundsProperty
Abc::OBox3dProperty m_selfBoundsProperty
Definition OGeomBase.h:222
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::m_userProperties
Abc::OCompoundProperty m_userProperties
Definition OGeomBase.h:226
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::getArbGeomParams
Abc::OCompoundProperty getArbGeomParams()
Definition OGeomBase.h:124
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::init
void init(uint32_t iTsIndex, bool isSparse)
Definition OGeomBase.h:188
Alembic::Abc::ALEMBIC_VERSION_NS::Argument
Definition Argument.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT< AbcA::CompoundPropertyWriterPtr >::getPtr
AbcA::CompoundPropertyWriterPtr getPtr() const
Definition OBaseProperty.h:162
Alembic::Abc::ALEMBIC_VERSION_NS::OCompoundProperty
Definition OCompoundProperty.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::OSchema
Definition OSchema.h:119
Alembic::Abc::ALEMBIC_VERSION_NS::OSchema::OSchema
OSchema()
Definition OSchema.h:191
Alembic::AbcGeom::ALEMBIC_VERSION_NS
Definition ArchiveBounds.h:45
Alembic::AbcGeom
Definition ArchiveBounds.h:44
Alembic::Abc::ALEMBIC_VERSION_NS::OBox3dProperty
OTypedScalarProperty< Box3dTPTraits > OBox3dProperty
Definition OTypedScalarProperty.h:273
Alembic::Abc::ALEMBIC_VERSION_NS::GetTimeSampling
AbcA::TimeSamplingPtr GetTimeSampling(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition Argument.h:288
Alembic::Abc::ALEMBIC_VERSION_NS::GetTimeSamplingIndex
uint32_t GetTimeSamplingIndex(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition Argument.h:303
Alembic::Abc::ALEMBIC_VERSION_NS::IsSparse
bool IsSparse(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition Argument.h:333
Alembic::Abc
Definition ArchiveInfo.h:47
Alembic
Alembic namespace ...
Definition ArchiveInfo.h:46