//-***************************************************************************** void IArrayProperty::init( AbcA::CompoundPropertyReaderPtr iParent, const std::string &iName, ErrorHandler::Policy iParentPolicy, const Argument &iArg0, const Argument &iArg1 ) { Arguments args( iParentPolicy ); iArg0.setInto( args ); iArg1.setInto( args ); getErrorHandler().setPolicy( args.getErrorHandlerPolicy() ); ALEMBIC_ABC_SAFE_CALL_BEGIN( "IArrayProperty::init()" ); const AbcA::PropertyHeader *pheader = iParent->getPropertyHeader( iName ); ABCA_ASSERT( pheader != NULL, "Nonexistent array property: " << iName ); m_property = iParent->getArrayProperty( iName ); ALEMBIC_ABC_SAFE_CALL_END_RESET(); }
//-***************************************************************************** void IXformSchema::init( const Abc::Argument &iArg0, const Abc::Argument &iArg1 ) { ALEMBIC_ABC_SAFE_CALL_BEGIN( "IXformSchema::init()" ); Abc::Arguments args; iArg0.setInto( args ); iArg1.setInto( args ); AbcA::CompoundPropertyReaderPtr ptr = this->getPtr(); if ( ptr->getPropertyHeader( ".childBnds" ) ) { m_childBoundsProperty = Abc::IBox3dProperty( ptr, ".childBnds", iArg0, iArg1 ); } if ( ptr->getPropertyHeader( ".inherits" ) ) { m_inheritsProperty = Abc::IBoolProperty( ptr, ".inherits", iArg0, iArg1 ); } AbcA::ScalarPropertyReaderPtr ops = ptr->getScalarProperty( ".ops" ); m_useArrayProp = false; const AbcA::PropertyHeader *valsPH = ptr->getPropertyHeader( ".vals" ); if ( valsPH != NULL ) { if ( valsPH->isScalar() ) { m_valsProperty = ptr->getScalarProperty( valsPH->getName() ); } else { m_useArrayProp = true; m_valsProperty = ptr->getArrayProperty( valsPH->getName() ); } } m_isConstantIdentity = true; if ( ptr->getPropertyHeader( "isNotConstantIdentity" ) ) { // that it's here at all means we're not constant identity. m_isConstantIdentity = false; } m_isConstant = true; if ( m_valsProperty ) { if ( m_useArrayProp ) { m_isConstant = m_valsProperty->asArrayPtr()->isConstant(); } else { m_isConstant = m_valsProperty->asScalarPtr()->isConstant(); } } m_isConstant = m_isConstant && ( !m_inheritsProperty || m_inheritsProperty.isConstant() ); std::set < Alembic::Util::uint32_t > animChannels; if ( ptr->getPropertyHeader( ".animChans" ) ) { Abc::IUInt32ArrayProperty p( ptr, ".animChans" ); if ( p.getNumSamples() > 0 ) { Abc::UInt32ArraySamplePtr animSamp; p.get( animSamp, p.getNumSamples() - 1 ); for ( std::size_t i = 0; i < animSamp->size(); ++i ) { animChannels.insert( (*animSamp)[i] ); } } } if ( ops && ops->getNumSamples() > 0 ) { std::size_t numOps = ops->getHeader().getDataType().getExtent(); std::vector<Alembic::Util::uint8_t> opVec( numOps ); ops->getSample( 0, &(opVec.front()) ); for ( std::size_t i = 0; i < numOps; ++i ) { XformOp op( opVec[i] ); m_sample.addOp( op ); } std::set < Alembic::Util::uint32_t >::iterator it, itEnd; std::vector< XformOp >::iterator op = m_sample.m_ops.begin(); std::vector< XformOp >::iterator opEnd = m_sample.m_ops.end(); std::size_t curChan = 0; std::size_t chanPos = 0; for ( it = animChannels.begin(), itEnd = animChannels.end(); it != itEnd; ++it ) { Alembic::Util::uint32_t animChan = *it; while ( op != opEnd ) { std::size_t numChans = op->getNumChannels(); bool foundChan = false; while ( curChan < numChans ) { if ( animChan == chanPos ) { op->m_animChannels.insert( curChan ); foundChan = true; break; } ++curChan; ++chanPos; } // move on to the next animChan, because we found the current one if ( foundChan == true ) { ++curChan; ++chanPos; break; } ++op; curChan = 0; } } } if ( ptr->getPropertyHeader( ".arbGeomParams" ) != NULL ) { m_arbGeomParams = Abc::ICompoundProperty( ptr, ".arbGeomParams", args.getErrorHandlerPolicy() ); } if ( ptr->getPropertyHeader( ".userProperties" ) != NULL ) { m_userProperties = Abc::ICompoundProperty( ptr, ".userProperties", args.getErrorHandlerPolicy() ); } ALEMBIC_ABC_SAFE_CALL_END_RESET(); }