Alembic Version 1.1
Loading...
Searching...
No Matches
OGeomBase.h
Go to the documentation of this file.
1//-*****************************************************************************
2//
3// Copyright (c) 2009-2012,
4// Sony Pictures Imageworks, Inc. and
5// Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
6//
7// All rights reserved.
8//
9// Redistribution and use in source and binary forms, with or without
10// modification, are permitted provided that the following conditions are
11// met:
12// * Redistributions of source code must retain the above copyright
13// notice, this list of conditions and the following disclaimer.
14// * Redistributions in binary form must reproduce the above
15// copyright notice, this list of conditions and the following disclaimer
16// in the documentation and/or other materials provided with the
17// distribution.
18// * Neither the name of Sony Pictures Imageworks, nor
19// Industrial Light & Magic nor the names of their contributors may be used
20// to endorse or promote products derived from this software without specific
21// prior written permission.
22//
23// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34//
35//-*****************************************************************************
36
37#ifndef Alembic_AbcGeom_OGeometrySchema_h
38#define Alembic_AbcGeom_OGeometrySchema_h
39
40#include <Alembic/Abc/OSchema.h>
43
44namespace Alembic {
45namespace AbcGeom {
46namespace ALEMBIC_VERSION_NS {
47
48
57template <class INFO>
58class OGeomBaseSchema : public Abc::OSchema<INFO>
59{
60public:
61 //-*************************************************************************
62 // TYPEDEFS AND IDENTIFIERS
63 //-*************************************************************************
64
65 typedef INFO info_type;
66
67
68 //-*************************************************************************
69 // Constructors that pass through to OSchema
70 //-*************************************************************************
71 //
75
79 const std::string &iName,
80 const Argument &iArg0 = Argument(),
81 const Argument &iArg1 = Argument(),
82 const Argument &iArg2 = Argument(),
83 const Argument &iArg3 = Argument() )
84 : Abc::OSchema<info_type>( iParent, iName, iArg0, iArg1, iArg2, iArg3 )
85 {
87 Abc::GetTimeSampling( iArg0, iArg1, iArg2, iArg3 );
88 uint32_t tsIndex =
89 Abc::GetTimeSamplingIndex( iArg0, iArg1, iArg2, iArg3 );
90
91 // if we specified a valid TimeSamplingPtr, use it to determine the
92 // index otherwise use the default index of 0 - uniform.
93 if ( tsPtr )
94 {
95 tsIndex = iParent->getObject()->getArchive()->addTimeSampling(
96 *tsPtr );
97 }
98
99 // Create our always present property
100 init( tsIndex, Abc::IsSparse( iArg0, iArg1, iArg2, iArg3 ) );
101 }
102
105 : Abc::OSchema<info_type>()
106 {
107 *this = iCopy;
108 }
109
118
119 virtual bool valid() const
120 {
122 }
123
125 {
126 // Accessing the ArbGeomParams will create its compound
127 // property if needed.
128 ALEMBIC_ABC_SAFE_CALL_BEGIN( "OGeomBaseSchema::getArbGeomParams()" );
129
130 if ( ! m_arbGeomParams )
131 {
133 ".arbGeomParams" );
134 }
135
136 return m_arbGeomParams;
137
139
141 return ret;
142 }
143
145 {
146 // Accessing UserProperties will create its compound
147 // property if needed.
148 ALEMBIC_ABC_SAFE_CALL_BEGIN( "OGeomBaseSchema::getUserProperties()" );
149
150 if ( ! m_userProperties )
151 {
153 ".userProperties" );
154 }
155
156 return m_userProperties;
157
159
161 return ret;
162 }
163
165 {
166 // Accessing Child Bounds Property will create it if needed
168 "OGeomBaseSchema::getChildBoundsProperty()" );
169
170 if ( ! m_childBoundsProperty )
171 {
173
174 // for now, use the self bounds time sampling, this
175 // can and should be changed depending on how the children
176 // are sampled
178 ".childBnds", m_selfBoundsProperty.getTimeSampling() );
179
180 }
181
184 }
185
186protected:
187
188 void init( uint32_t iTsIndex, bool isSparse)
189 {
190 ALEMBIC_ABC_SAFE_CALL_BEGIN( "OGeomBaseSchema::init()" );
191
192 if( !isSparse )
193 {
194 createSelfBoundsProperty(iTsIndex, 0);
195 }
196
198 }
199
201 void createSelfBoundsProperty(uint32_t iTsIndex, size_t iNumSamples)
202 {
203 ALEMBIC_ABC_SAFE_CALL_BEGIN( "OGeomBaseSchema::createSelfBoundsProperty()" );
204
206 {
207 return;
208 }
209
210 m_selfBoundsProperty = Abc::OBox3dProperty( this->getPtr(), ".selfBnds",
211 iTsIndex );
212
213 Abc::Box3d bnds;
214 for ( size_t i = 0; i < iNumSamples; ++i )
215 {
217 }
219 }
220
221 // Only selfBounds is required, all others are optional
224
227
228};
229
230
231} // End namespace ALEMBIC_VERSION_NS
232
233using namespace ALEMBIC_VERSION_NS;
234
235} // End namespace AbcGeom
236} // End namespace Alembic
237
238#endif
#define ALEMBIC_ABC_SAFE_CALL_END()
#define ALEMBIC_ABC_SAFE_CALL_BEGIN(CONTEXT)
#define ALEMBIC_ABC_SAFE_CALL_END_RESET()
#define ALEMBIC_VERSION_NS
Definition Foundation.h:105
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
void createSelfBoundsProperty(uint32_t iTsIndex, size_t iNumSamples)
Creates the self bounds.
Definition OGeomBase.h:201
OGeomBaseSchema(const OGeomBaseSchema &iCopy)
Copy constructor.
Definition OGeomBase.h:104
void init(uint32_t iTsIndex, bool isSparse)
Definition OGeomBase.h:188
AbcA::TimeSamplingPtr getTimeSampling() const
Alembic::Util::shared_ptr< CompoundPropertyWriter > CompoundPropertyWriterPtr
Alembic::Util::shared_ptr< TimeSampling > TimeSamplingPtr
OTypedScalarProperty< Box3dTPTraits > OBox3dProperty
AbcA::TimeSamplingPtr GetTimeSampling(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition Argument.h:288
uint32_t GetTimeSamplingIndex(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition Argument.h:303
bool IsSparse(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition Argument.h:333
Alembic namespace ...
Definition ArchiveInfo.h:46