Alembic Version 1.1

Loading...
Searching...
No Matches
OXform.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_OXform_h
38#define Alembic_AbcGeom_OXform_h
39
40#include <Alembic/Util/Export.h>
41#include <Alembic/AbcGeom/Foundation.h>
42#include <Alembic/AbcGeom/SchemaInfoDeclarations.h>
43
44#include <Alembic/AbcGeom/XformSample.h>
45
46 namespace Alembic {
47 namespace AbcGeom {
48 namespace ALEMBIC_VERSION_NS {
49
52 static ALEMBIC_EXPORT_CONST double kXFORM_DELTA_TOLERANCE = 1.0e-12;
53
54//-*****************************************************************************
55 class ALEMBIC_EXPORT OXformSchema : public Abc::OSchema<XformSchemaInfo>
56{
57 //-*************************************************************************
58 // XFORM SCHEMA
59 //-*************************************************************************
60 public:
61
64 typedef Abc::OSchema<XformSchemaInfo> super_type;
65 typedef OXformSchema this_type;
66 typedef XformSample sample_type;
67
68 //-*************************************************************************
69 // CONSTRUCTION, DESTRUCTION, ASSIGNMENT
70 //-*************************************************************************
71
74 OXformSchema()
75 {
76 m_numChannels = 0;
77 m_numOps = 0;
78 m_useArrayProp = false;
79 m_isIdentity = true;
80 }
81
88 OXformSchema( AbcA::CompoundPropertyWriterPtr iParent,
89 const std::string &iName,
90 const Abc::Argument &iArg0 = Abc::Argument(),
91 const Abc::Argument &iArg1 = Abc::Argument(),
92 const Abc::Argument &iArg2 = Abc::Argument(),
93 const Abc::Argument &iArg3 = Abc::Argument() );
94
101 OXformSchema( Abc::OCompoundProperty iParent,
102 const std::string &iName,
103 const Abc::Argument &iArg0 = Abc::Argument(),
104 const Abc::Argument &iArg1 = Abc::Argument(),
105 const Abc::Argument &iArg2 = Abc::Argument() );
106
108 OXformSchema( const OXformSchema &iCopy )
109 : Abc::OSchema<XformSchemaInfo>()
110 { *this = iCopy; }
111
113
114 //-*************************************************************************
115 // SCHEMA STUFF
116 //-*************************************************************************
117
118 AbcA::TimeSamplingPtr getTimeSampling() const;
119
120 //-*************************************************************************
121 // SAMPLE STUFF
122 //-*************************************************************************
123
126 size_t getNumSamples() const;
127
130 void set( XformSample &ioSamp );
131
133 void setFromPrevious();
134
135 void setTimeSampling( uint32_t iIndex );
136 void setTimeSampling( AbcA::TimeSamplingPtr iTime );
137
138 Abc::OCompoundProperty getArbGeomParams();
139 Abc::OCompoundProperty getUserProperties();
140 Abc::OBox3dProperty getChildBoundsProperty();
141
142 //-*************************************************************************
143 // ABC BASE MECHANISMS
144 // These functions are used by Abc to deal with errors, validity,
145 // and so on.
146 //-*************************************************************************
147
150 void reset()
151 {
152 m_childBoundsProperty.reset();
153 m_inheritsProperty.reset();
154 m_opsPWPtr.reset();
155 m_valsPWPtr.reset();
156 m_protoSample.reset();
157 m_data.reset();
158
159 m_arbGeomParams.reset();
160 m_userProperties.reset();
161
162 super_type::reset();
163 }
164
166 bool valid() const
167 {
168 return ( super_type::valid() );
169 }
170
173 ALEMBIC_OVERRIDE_OPERATOR_BOOL( this_type::valid() );
174
175
176 private:
177 void init( const AbcA::index_t iTSIndex );
178
179 // not technically needed as the m_protoSample can return this info
180 std::size_t m_numChannels;
181 std::size_t m_numOps;
182
183 // should we store are channel values in an ArrayProperty,
184 // or in a ScalarProperty with some Dimension > 0 and < MAX_SCALAR_CHANS
185 bool m_useArrayProp;
186
187 AbcA::DataType m_arrayValuesDataType;
188 Alembic::Util::Dimensions m_arraySampleDimensions;
189
190 void setChannelValues( const std::vector<double> &iVals );
191
192 protected:
193
194 Abc::OBox3dProperty m_childBoundsProperty;
195
196 AbcA::ScalarPropertyWriterPtr m_opsPWPtr;
197
198 AbcA::BasePropertyWriterPtr m_valsPWPtr;
199
200 Abc::OBoolProperty m_inheritsProperty;
201
202 Abc::OBoolProperty m_isNotConstantIdentityProperty;
203
204 // ensure that our sample's topology is unchanging between
205 // calls to set; see usage in OXformSchema::set()
206 XformSample m_protoSample;
207
208 bool m_isIdentity;
209
210 Abc::OCompoundProperty m_arbGeomParams;
211
212 Abc::OCompoundProperty m_userProperties;
213
214 class Data;
215
216 // shared and not scoped because we want this to be shared across copies
217 Util::shared_ptr< Data > m_data;
218};
219
220//-*****************************************************************************
221// SCHEMA OBJECT
222//-*****************************************************************************
223 typedef Abc::OSchemaObject<OXformSchema> OXform;
224
225 typedef Util::shared_ptr< OXform > OXformPtr;
226
227} // End namespace ALEMBIC_VERSION_NS
228
229 using namespace ALEMBIC_VERSION_NS;
230
231} // End namespace AbcGeom
232} // End namespace Alembic
233
234#endif
Foundation.h
SchemaInfoDeclarations.h
Export.h
ALEMBIC_EXPORT_CONST
#define ALEMBIC_EXPORT_CONST
Definition Export.h:53
ALEMBIC_EXPORT
#define ALEMBIC_EXPORT
Definition Export.h:51
XformSample.h
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::setTimeSampling
void setTimeSampling(uint32_t iIndex)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::set
void set(XformSample &ioSamp)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::this_type
OXformSchema this_type
Definition OXform.h:65
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::OXformSchema
OXformSchema(AbcA::CompoundPropertyWriterPtr iParent, const std::string &iName, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument(), const Abc::Argument &iArg2=Abc::Argument(), const Abc::Argument &iArg3=Abc::Argument())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::setTimeSampling
void setTimeSampling(AbcA::TimeSamplingPtr iTime)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::m_isIdentity
bool m_isIdentity
Definition OXform.h:208
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::getUserProperties
Abc::OCompoundProperty getUserProperties()
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::m_protoSample
XformSample m_protoSample
Definition OXform.h:206
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::m_inheritsProperty
Abc::OBoolProperty m_inheritsProperty
Definition OXform.h:200
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::OXformSchema
OXformSchema(const OXformSchema &iCopy)
Explicit copy constructor to work around MSVC bug.
Definition OXform.h:108
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::OXformSchema
OXformSchema(Abc::OCompoundProperty iParent, const std::string &iName, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument(), const Abc::Argument &iArg2=Abc::Argument())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::getTimeSampling
AbcA::TimeSamplingPtr getTimeSampling() const
Default assignment operator used.
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::getNumSamples
size_t getNumSamples() const
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::valid
bool valid() const
Valid returns whether this function set is valid.
Definition OXform.h:166
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::m_opsPWPtr
AbcA::ScalarPropertyWriterPtr m_opsPWPtr
Definition OXform.h:196
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::super_type
Abc::OSchema< XformSchemaInfo > super_type
Definition OXform.h:64
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::setFromPrevious
void setFromPrevious()
Set from previous sample. Will hold the animated channels.
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::m_isNotConstantIdentityProperty
Abc::OBoolProperty m_isNotConstantIdentityProperty
Definition OXform.h:202
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::m_childBoundsProperty
Abc::OBox3dProperty m_childBoundsProperty
Definition OXform.h:194
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::getChildBoundsProperty
Abc::OBox3dProperty getChildBoundsProperty()
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::m_data
Util::shared_ptr< Data > m_data
Definition OXform.h:217
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::getArbGeomParams
Abc::OCompoundProperty getArbGeomParams()
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::OXformSchema
OXformSchema()
Definition OXform.h:74
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::m_valsPWPtr
AbcA::BasePropertyWriterPtr m_valsPWPtr
Definition OXform.h:198
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::ALEMBIC_OVERRIDE_OPERATOR_BOOL
ALEMBIC_OVERRIDE_OPERATOR_BOOL(this_type::valid())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::m_arbGeomParams
Abc::OCompoundProperty m_arbGeomParams
Definition OXform.h:210
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::reset
void reset()
Definition OXform.h:150
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::m_userProperties
Abc::OCompoundProperty m_userProperties
Definition OXform.h:212
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::sample_type
XformSample sample_type
Definition OXform.h:66
Alembic::AbcGeom::ALEMBIC_VERSION_NS::XformSample
Definition XformSample.h:51
Alembic::Abc::ALEMBIC_VERSION_NS::Argument
Definition Argument.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::Base::valid
bool valid() const
Definition Base.h:65
Alembic::Abc::ALEMBIC_VERSION_NS::Base::reset
void reset()
Definition Base.h:70
Alembic::Abc::ALEMBIC_VERSION_NS::OCompoundProperty
Definition OCompoundProperty.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::OSchemaObject
Definition OSchemaObject.h:54
Alembic::Abc::ALEMBIC_VERSION_NS::OSchema
Definition OSchema.h:119
Alembic::Abc::ALEMBIC_VERSION_NS::OSchema< XformSchemaInfo >::OSchema
OSchema()
Definition OSchema.h:191
Alembic::AbcGeom::ALEMBIC_VERSION_NS
Definition ArchiveBounds.h:45
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformPtr
Util::shared_ptr< OXform > OXformPtr
Definition OXform.h:225
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXform
Abc::OSchemaObject< OXformSchema > OXform
Definition OXform.h:223
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kXFORM_DELTA_TOLERANCE
static ALEMBIC_EXPORT_CONST double kXFORM_DELTA_TOLERANCE
Definition OXform.h:52
Alembic::AbcGeom
Definition ArchiveBounds.h:44
Alembic::Abc::ALEMBIC_VERSION_NS::OBox3dProperty
OTypedScalarProperty< Box3dTPTraits > OBox3dProperty
Definition OTypedScalarProperty.h:273
Alembic::Abc::ALEMBIC_VERSION_NS::OBoolProperty
OTypedScalarProperty< BooleanTPTraits > OBoolProperty
Definition OTypedScalarProperty.h:230
Alembic::Abc
Definition ArchiveInfo.h:47
Alembic::Util::ALEMBIC_VERSION_NS::Dimensions
BaseDimensions< Alembic::Util::uint64_t > Dimensions
Definition Dimensions.h:189
Alembic
Alembic namespace ...
Definition ArchiveInfo.h:46