Alembic 1.8.11

Loading...
Searching...
No Matches
IXform.h
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_IXform_h
38#define Alembic_AbcGeom_IXform_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
50//-*****************************************************************************
51 class ALEMBIC_EXPORT IXformSchema : public Abc::ISchema<XformSchemaInfo>
52{
53 //-*************************************************************************
54 // XFORM SCHEMA
55 //-*************************************************************************
56 public:
57
60 typedef Abc::ISchema<XformSchemaInfo> super_type;
61 typedef IXformSchema this_type;
62 typedef XformSample sample_type;
63
64 //-*************************************************************************
65 // CONSTRUCTION, DESTRUCTION, ASSIGNMENT
66 //-*************************************************************************
67
70 IXformSchema()
71 {
72 m_useArrayProp = false;
73 m_isConstant = true;
74 m_isConstantIdentity = true;
75 }
76
83 IXformSchema( const ICompoundProperty &iParent,
84 const std::string &iName,
85 const Abc::Argument &iArg0 = Abc::Argument(),
86 const Abc::Argument &iArg1 = Abc::Argument() )
87 : Abc::ISchema<XformSchemaInfo>( iParent, iName, iArg0, iArg1 )
88 {
89 // Meta data and error handling are eaten up by
90 // the super type, so all that's left is SchemaInterpMatching.
91 init( iArg0, iArg1 );
92 }
93
98 IXformSchema( const ICompoundProperty &iProp,
99 const Abc::Argument &iArg0 = Abc::Argument(),
100 const Abc::Argument &iArg1 = Abc::Argument() )
101 : Abc::ISchema<XformSchemaInfo>( iProp, iArg0, iArg1 )
102 {
103 init( iArg0, iArg1 );
104 }
105
106 AbcA::TimeSamplingPtr getTimeSampling() const;
107
108 bool isConstant() const { return m_isConstant; }
109
111 bool isConstantIdentity() const { return m_isConstantIdentity; }
112
113 size_t getNumSamples() const;
114
116 void get( XformSample &oSamp,
117 const Abc::ISampleSelector &iSS = Abc::ISampleSelector() ) const;
118
119 XformSample getValue( const Abc::ISampleSelector &iSS =
120 Abc::ISampleSelector() ) const;
121
122 Abc::IBox3dProperty getChildBoundsProperty() const
123 {
124 return m_childBoundsProperty;
125 }
126
127 // lightweight get to avoid constructing a sample
128 // see XformSample.h for explanation of this property
129 bool getInheritsXforms( const Abc::ISampleSelector &iSS =
130 Abc::ISampleSelector() ) const;
131
132 size_t getNumOps() const { return m_sample.getNumOps(); }
133
136 void reset()
137 {
138 m_childBoundsProperty.reset();
139 m_sample = XformSample();
140 m_inheritsProperty.reset();
141 m_isConstant = true;
142 m_isConstantIdentity = true;
143
144 m_arbGeomParams.reset();
145 m_userProperties.reset();
146
147 super_type::reset();
148 }
149
151 bool valid() const
152 {
153 return ( super_type::valid() );
154 }
155
156 ICompoundProperty getArbGeomParams() const { return m_arbGeomParams; }
157
158 ICompoundProperty getUserProperties() const { return m_userProperties; }
159
162 ALEMBIC_OVERRIDE_OPERATOR_BOOL( this_type::valid() );
163
164
165 protected:
166 Abc::IBox3dProperty m_childBoundsProperty;
167
168 AbcA::BasePropertyReaderPtr m_valsProperty;
169
170 Abc::IBoolProperty m_inheritsProperty;
171
172 Abc::ICompoundProperty m_arbGeomParams;
173 Abc::ICompoundProperty m_userProperties;
174
175 bool m_isConstant;
176
177 bool m_isConstantIdentity;
178
179 XformSample m_sample;
180
181 private:
182 void init( const Abc::Argument &iArg0, const Abc::Argument &iArg1 );
183
184 // is m_vals an ArrayProperty, or a ScalarProperty?
185 bool m_useArrayProp;
186
187 // fills m_valVec with data
188 void getChannelValues( const AbcA::index_t iSampleIndex,
189 XformSample & oSamp ) const;
190};
191
192//-*****************************************************************************
193// SCHEMA OBJECT
194//-*****************************************************************************
195 typedef Abc::ISchemaObject<IXformSchema> IXform;
196
197 typedef Util::shared_ptr< IXform > IXformPtr;
198
199} // End namespace ALEMBIC_VERSION_NS
200
201 using namespace ALEMBIC_VERSION_NS;
202
203} // End namespace AbcGeom
204} // End namespace Alembic
205
206#endif
Alembic::Abc::ALEMBIC_VERSION_NS::Argument
Definition Argument.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::ICompoundProperty
Definition ICompoundProperty.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::ISampleSelector
Definition ISampleSelector.h:49
Alembic::Abc::ALEMBIC_VERSION_NS::ISchema
Definition ISchema.h:58
Alembic::Abc::ALEMBIC_VERSION_NS::ISchema< XformSchemaInfo >::ISchema
ISchema()
Definition ISchema.h:112
Alembic::Abc::ALEMBIC_VERSION_NS::ISchemaObject
Definition ISchemaObject.h:56
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IXformSchema::ALEMBIC_OVERRIDE_OPERATOR_BOOL
ALEMBIC_OVERRIDE_OPERATOR_BOOL(this_type::valid())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IXformSchema::isConstantIdentity
bool isConstantIdentity() const
is this xform both constant and identity?
Definition IXform.h:111
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IXformSchema::IXformSchema
IXformSchema(const ICompoundProperty &iParent, const std::string &iName, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition IXform.h:83
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IXformSchema::valid
bool valid() const
Valid returns whether this function set is valid.
Definition IXform.h:151
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IXformSchema::super_type
Abc::ISchema< XformSchemaInfo > super_type
Definition IXform.h:60
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IXformSchema::IXformSchema
IXformSchema(const ICompoundProperty &iProp, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition IXform.h:98
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IXformSchema::IXformSchema
IXformSchema()
Definition IXform.h:70
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IXformSchema::reset
void reset()
Definition IXform.h:136
Alembic::AbcGeom::ALEMBIC_VERSION_NS::XformSample
Definition XformSample.h:51
Alembic
Alembic namespace ...
Definition ArchiveInfo.cpp:39