Index: lib/Alembic/AbcGeom/OXform.cpp |
=================================================================== |
--- a/lib/Alembic/AbcGeom/OXform.cpp |
+++ b/lib/Alembic/AbcGeom/OXform.cpp |
@@ -49,10 +49,11 @@ |
if ( m_useArrayProp ) |
{ |
+ Alembic::Util::Dimensions dims(m_numChannels); |
m_vals->asArrayPtr()->setSample( |
AbcA::ArraySample( &(iVals.front()), |
- m_arrayValuesDataType, |
- m_arraySampleDimensions ) |
+ AbcA::DataType( Alembic::Util::kFloat64POD, 1 ), |
+ dims ) |
); |
} |
else |
@@ -66,8 +67,6 @@ |
{ |
ALEMBIC_ABC_SAFE_CALL_BEGIN( "OXformSchema::set()" ); |
- m_opVec = ioSamp.getOpsArray(); |
- |
// do we need to create child bounds? |
if ( ioSamp.getChildBounds().hasVolume() && !m_childBounds ) |
{ |
@@ -105,13 +104,14 @@ |
{ |
m_ops = this->getPtr()->createScalarProperty( |
".ops", AbcA::MetaData(), |
- AbcA::DataType( Alembic::Util::kUint8POD, m_numOps ), |
- m_timeSamplingIndex |
+ AbcA::DataType( Alembic::Util::kUint8POD, m_numOps ), 0 |
); |
} |
if ( m_numChannels > 0 ) |
{ |
+ uint32_t tsIndex = getObject().getArchive().addTimeSampling( |
+ *(m_inherits.getTimeSampling()) ); |
if ( m_numChannels <= MAX_SCALAR_CHANS ) |
{ |
m_useArrayProp = false; |
@@ -119,23 +119,20 @@ |
m_vals = this->getPtr()->createScalarProperty( |
".vals", AbcA::MetaData(), |
AbcA::DataType( Alembic::Util::kFloat64POD, m_numChannels ), |
- m_timeSamplingIndex |
+ tsIndex |
); |
} |
else |
{ |
m_useArrayProp = true; |
- m_arraySampleDimensions = Alembic::Util::Dimensions( |
- m_numChannels ); |
- |
m_vals = this->getPtr()->createArrayProperty( |
".vals", AbcA::MetaData(), |
// the DataType for an ArrayProperty describes not how big |
// each Sample is, but how many values constitute a single |
// "element". What is here is the same as creating an |
// Abc::ODoubleArrayProperty. |
- m_arrayValuesDataType, m_timeSamplingIndex |
+ AbcA::DataType( Alembic::Util::kFloat64POD, 1 ), tsIndex |
); |
} |
} |
@@ -143,7 +140,7 @@ |
} |
else |
{ |
- ABCA_ASSERT( m_protoSample.getOpsArray() == ioSamp.getOpsArray(), |
+ ABCA_ASSERT( m_protoSample.isTopologyEqual(ioSamp), |
"Invalid sample topology!" ); |
} |
@@ -164,8 +161,6 @@ |
{ |
const XformOp &op = ioSamp[i]; |
- const Alembic::Util::uint8_t &openc = m_opVec[i]; |
- |
const XformOp &protop = m_protoSample[i]; |
for ( size_t j = 0 ; j < op.getNumChannels() ; ++j ) |
@@ -197,9 +192,21 @@ |
this->setChannelValues( chanvals ); |
- if ( m_ops ) |
+ if ( m_ops && m_ops->getNumSamples() == 0 ) |
{ |
- m_ops->setSample( &(m_opVec.front()) ); |
+ std::vector < Alembic::Util::uint8_t > opVec( |
+ m_protoSample.getNumOps() ); |
+ |
+ for ( std::size_t i = 0; i < opVec.size(); ++i ) |
+ { |
+ opVec[i] = m_protoSample[i].getOpEncoding(); |
+ } |
+ |
+ m_ops->setSample( &(opVec.front()) ); |
+ } |
+ else if ( m_ops ) |
+ { |
+ m_ops->setFromPreviousSample(); |
} |
if ( !m_isNotConstantIdentity && !m_isIdentity ) |
@@ -256,10 +263,66 @@ |
m_numOps = 0; |
m_numChannels = 0; |
- m_arrayValuesDataType = AbcA::DataType( Alembic::Util::kFloat64POD, 1 ); |
- m_arraySampleDimensions = Alembic::Util::Dimensions( 1 ); |
+ ALEMBIC_ABC_SAFE_CALL_END_RESET(); |
+} |
- ALEMBIC_ABC_SAFE_CALL_END_RESET(); |
+//-***************************************************************************** |
+Abc::OCompoundProperty OXformSchema::getArbGeomParams() |
+{ |
+ ALEMBIC_ABC_SAFE_CALL_BEGIN( "OXformSchema::getArbGeomParams()" ); |
+ |
+ if ( ! m_arbGeomParams ) |
+ { |
+ m_arbGeomParams = Abc::OCompoundProperty( this->getPtr(), |
+ ".arbGeomParams" ); |
+ } |
+ |
+ return m_arbGeomParams; |
+ |
+ ALEMBIC_ABC_SAFE_CALL_END(); |
+ |
+ Abc::OCompoundProperty ret; |
+ return ret; |
+} |
+ |
+//-***************************************************************************** |
+void OXformSchema::setTimeSampling( uint32_t iIndex ) |
+{ |
+ ALEMBIC_ABC_SAFE_CALL_BEGIN( |
+ "OXformSchema::setTimeSampling( uint32_t )" ); |
+ |
+ m_animChannels.setTimeSampling( iIndex ); |
+ m_inherits.setTimeSampling( iIndex ); |
+ |
+ if ( m_vals ) |
+ { |
+ if ( m_useArrayProp ) |
+ { m_vals->asArrayPtr()->setTimeSamplingIndex( iIndex ); } |
+ else |
+ { m_vals->asScalarPtr()->setTimeSamplingIndex( iIndex ); } |
+ } |
+ |
+ if ( m_childBounds ) |
+ { |
+ m_childBounds.setTimeSampling( iIndex ); |
+ } |
+ |
+ ALEMBIC_ABC_SAFE_CALL_END(); |
+} |
+ |
+//-***************************************************************************** |
+void OXformSchema::setTimeSampling( AbcA::TimeSamplingPtr iTime ) |
+{ |
+ ALEMBIC_ABC_SAFE_CALL_BEGIN( |
+ "OXformSchema::setTimeSampling( TimeSamplingPtr )" ); |
+ |
+ if ( iTime ) |
+ { |
+ uint32_t tsIndex = getObject().getArchive().addTimeSampling( *iTime ); |
+ setTimeSampling( tsIndex ); |
+ } |
+ |
+ ALEMBIC_ABC_SAFE_CALL_END(); |
} |
} // End namespace AbcGeom |