コード例 #1
0
ファイル: IPoints.cpp プロジェクト: AWhetter/alembic
//-*****************************************************************************
void IPointsSchema::init( const Abc::Argument &iArg0,
                          const Abc::Argument &iArg1 )
{
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "IPointsSchema::init()" );

    Abc::Arguments args;
    iArg0.setInto( args );
    iArg1.setInto( args );

    AbcA::CompoundPropertyReaderPtr _this = this->getPtr();

    // no matching so we pick up old assets written as V3f
    m_positionsProperty = Abc::IP3fArrayProperty( _this, "P", kNoMatching,
        args.getErrorHandlerPolicy() );

    m_idsProperty = Abc::IUInt64ArrayProperty( _this, ".pointIds",
                                               iArg0, iArg1 );

    if ( _this->getPropertyHeader( ".velocities" ) != NULL )
    {
        m_velocitiesProperty = Abc::IV3fArrayProperty( _this, ".velocities",
                                                       iArg0, iArg1 );
    }

    if ( _this->getPropertyHeader( ".widths" ) != NULL )
    {
        m_widthsParam = IFloatGeomParam( _this, ".widths", iArg0, iArg1 );
    }

    ALEMBIC_ABC_SAFE_CALL_END_RESET();
}
コード例 #2
0
ファイル: IPolyMesh.cpp プロジェクト: EgoIncarnate/appleseed
//-*****************************************************************************
void IPolyMeshSchema::init( const Abc::Argument &iArg0,
                            const Abc::Argument &iArg1 )
{
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "IPolyMeshSchema::init()" );

    Abc::Arguments args;
    iArg0.setInto( args );
    iArg1.setInto( args );

    AbcA::CompoundPropertyReaderPtr _this = this->getPtr();

    // no matching so we pick up old assets written as V3f
    m_positionsProperty = Abc::IP3fArrayProperty( _this, "P", kNoMatching );

    m_indicesProperty = Abc::IInt32ArrayProperty( _this, ".faceIndices",
                                        args.getSchemaInterpMatching() );
    m_countsProperty = Abc::IInt32ArrayProperty( _this, ".faceCounts",
                                       args.getSchemaInterpMatching() );

    // none of the things below here are guaranteed to exist
    if ( this->getPropertyHeader( "uv" ) != NULL )
    {
        m_uvsParam = IV2fGeomParam( _this, "uv", iArg0, iArg1 );
    }

    if ( this->getPropertyHeader( "N" ) != NULL )
    {
        m_normalsParam = IN3fGeomParam( _this, "N", iArg0, iArg1 );
    }


    IObject _thisObject = this->getParent().getObject();
    size_t numChildren = _thisObject.getNumChildren();
    for ( size_t childIndex = 0 ; childIndex < numChildren; childIndex++ )
    {
        ObjectHeader const & header = _thisObject.getChildHeader (childIndex);
        if ( IFaceSet::matches( header ) )
        {
            // start out with an empty (invalid IFaceSet)
            // accessor later on will create real IFaceSet object.
            m_faceSets [header.getName ()] = IFaceSet ();
        }
    }

    m_faceSetsLoaded = false;

    ALEMBIC_ABC_SAFE_CALL_END_RESET();
}
コード例 #3
0
ファイル: ICurves.cpp プロジェクト: aovi/UnrealEngine4
//-*****************************************************************************
void ICurvesSchema::init( const Abc::Argument &iArg0,
                          const Abc::Argument &iArg1 )
{
    // Only callable by ctors (mt-safety)
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "ICurvesSchema::init()" );

    Abc::Arguments args;
    iArg0.setInto( args );
    iArg1.setInto( args );

    AbcA::CompoundPropertyReaderPtr _this = this->getPtr();

    // no matching so we pick up old assets written as V3f
    m_positionsProperty = Abc::IP3fArrayProperty( _this, "P", kNoMatching,
        args.getErrorHandlerPolicy() );

    m_nVerticesProperty = Abc::IInt32ArrayProperty( _this, "nVertices",
                                                    iArg0, iArg1 );


    m_basisAndTypeProperty = Abc::IScalarProperty( _this, "curveBasisAndType",
        args.getErrorHandlerPolicy());

    // none of the things below here are guaranteed to exist
    if ( this->getPropertyHeader( "uv" ) != NULL )
    {
        m_uvsParam = IV2fGeomParam( _this, "uv", iArg0, iArg1 );
    }

    if ( this->getPropertyHeader( "N" ) != NULL )
    {
        m_normalsParam = IN3fGeomParam( _this, "N", iArg0, iArg1 );
    }

    if ( this->getPropertyHeader( "width" ) != NULL )
    {
        m_widthsParam = IFloatGeomParam( _this, "width", iArg0, iArg1 );
    }

    if ( this->getPropertyHeader( ".velocities" ) != NULL )
    {
        m_velocitiesProperty = Abc::IV3fArrayProperty( _this, ".velocities",
                                               iArg0, iArg1 );
    }

    ALEMBIC_ABC_SAFE_CALL_END_RESET();
}
コード例 #4
0
ファイル: ISubD.cpp プロジェクト: jonntd/ExocortexCrate
//-*****************************************************************************
void ISubDSchema::init( const Abc::Argument &iArg0,
                        const Abc::Argument &iArg1 )
{
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "ISubDSchema::init()" );

    AbcA::CompoundPropertyReaderPtr _this = this->getPtr();

    Abc::Arguments args;
    iArg0.setInto( args );
    iArg1.setInto( args );

    // no matching so we pick up old assets written as V3f
    m_positionsProperty = Abc::IP3fArrayProperty( _this, "P", kNoMatching,
        args.getErrorHandlerPolicy() );

    m_faceIndicesProperty = Abc::IInt32ArrayProperty( _this, ".faceIndices",
                                                      iArg0, iArg1 );
    m_faceCountsProperty = Abc::IInt32ArrayProperty( _this, ".faceCounts",
                                                     iArg0, iArg1 );

    if ( this->getPropertyHeader(".faceVaryingInterpolateBoundary") != NULL )
    {
        m_faceVaryingInterpolateBoundaryProperty =
            Abc::IInt32Property( _this, ".faceVaryingInterpolateBoundary",
                                 iArg0, iArg1 );
    }

    if ( this->getPropertyHeader(".faceVaryingPropagateCorners") != NULL )
    {
        m_faceVaryingPropagateCornersProperty =
            Abc::IInt32Property( _this, ".faceVaryingPropagateCorners",
                                 iArg0, iArg1 );
    }

    if ( this->getPropertyHeader(".interpolateBoundary") != NULL )
    {
        m_interpolateBoundaryProperty =
            Abc::IInt32Property( _this, ".interpolateBoundary", iArg0, iArg1 );
    }

    // creases, corners, and holes optionally exist
    if ( this->getPropertyHeader(".creaseIndices") != NULL)
    {
        m_creaseIndicesProperty = Abc::IInt32ArrayProperty( _this,
            ".creaseIndices", iArg0, iArg1 );
    }

    if ( this->getPropertyHeader(".creaseLengths") != NULL)
    {
        m_creaseLengthsProperty = Abc::IInt32ArrayProperty( _this,
            ".creaseLengths", iArg0, iArg1 );
    }

    if ( this->getPropertyHeader(".creaseSharpnesses") != NULL)
    {
        m_creaseSharpnessesProperty =
             Abc::IFloatArrayProperty( _this,
                                       ".creaseSharpnesses", iArg0, iArg1 );
    }

    if ( this->getPropertyHeader(".cornerIndices") != NULL)
    {
        m_cornerIndicesProperty =
            Abc::IInt32ArrayProperty( _this, ".cornerIndices", iArg0, iArg1 );
    }

    if ( this->getPropertyHeader(".cornerSharpnesses") != NULL)
    {
        m_cornerSharpnessesProperty =
            Abc::IFloatArrayProperty( _this, ".cornerSharpnesses",
                                      iArg0, iArg1 );
    }

    if ( this->getPropertyHeader(".holes") != NULL)
    {
        m_holesProperty =
            Abc::IInt32ArrayProperty( _this, ".holes", iArg0, iArg1 );
    }

    if ( this->getPropertyHeader(".scheme") != NULL)
    {
        m_subdSchemeProperty = Abc::IStringProperty( _this, ".scheme",
                                                     iArg0, iArg1 );
    }

    // none of the things below here are guaranteed to exist
    if ( this->getPropertyHeader( "uv" ) != NULL )
    {
        m_uvsParam = IV2fGeomParam( _this, "uv", iArg0, iArg1 );
    }

    if ( this->getPropertyHeader( ".velocities" ) != NULL )
    {
        m_velocitiesProperty = Abc::IV3fArrayProperty( _this, ".velocities",
                                                       iArg0, iArg1 );
    }

    m_faceSetsLoaded = false;

    ALEMBIC_ABC_SAFE_CALL_END_RESET();
}
コード例 #5
0
//-*****************************************************************************
void INuPatchSchema::init( const Abc::Argument &iArg0,
                           const Abc::Argument &iArg1 )
{
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "INuPatchSchema::init()" );

    Abc::Arguments args;
    iArg0.setInto( args );
    iArg1.setInto( args );

    m_hasTrimCurve = false;

    AbcA::CompoundPropertyReaderPtr _this = this->getPtr();

    // required properties

    // no matching so we pick up old assets written as V3f
    m_positionsProperty = Abc::IP3fArrayProperty( _this, "P", kNoMatching,
        args.getErrorHandlerPolicy() );

    m_numUProperty = Abc::IInt32Property( _this, "nu", iArg0, iArg1 );

    m_numVProperty = Abc::IInt32Property( _this, "nv", iArg0, iArg1 );

    m_uOrderProperty = Abc::IInt32Property( _this, "uOrder", iArg0, iArg1 );

    m_vOrderProperty = Abc::IInt32Property( _this, "vOrder", iArg0, iArg1 );

    m_uKnotProperty = Abc::IFloatArrayProperty( _this, "uKnot", iArg0, iArg1 );

    m_vKnotProperty = Abc::IFloatArrayProperty( _this, "vKnot", iArg0, iArg1 );

    // optional properties
    // none of the things below here are guaranteed to exist

    if ( this->getPropertyHeader( "w" ) != NULL )
    {
        m_positionWeightsProperty = Abc::IFloatArrayProperty( _this, "w",
            iArg0, iArg1 );
    }

    if ( this->getPropertyHeader( ".velocities" ) != NULL )
    {
        m_velocitiesProperty = Abc::IV3fArrayProperty( _this, ".velocities",
            iArg0, iArg1 );
    }

    if ( this->getPropertyHeader( "N" ) != NULL )
    {
        m_normalsParam = IN3fGeomParam( _this, "N", iArg0, iArg1 );
    }

    if ( this->getPropertyHeader( "uv" ) != NULL )
    {
        m_uvsParam = IV2fGeomParam( _this, "uv", iArg0, iArg1 );
    }

    if ( this->hasTrimProps() )
    {
        m_trimNumLoopsProperty = Abc::IInt32Property( _this, "trim_nloops",
                                                      iArg0, iArg1 );
        m_trimNumCurvesProperty = Abc::IInt32ArrayProperty(
            _this, "trim_ncurves", iArg0, iArg1 );
        m_trimNumVerticesProperty = Abc::IInt32ArrayProperty(
            _this, "trim_n", iArg0, iArg1 );
        m_trimOrderProperty = Abc::IInt32ArrayProperty( _this, "trim_order",
                                                        iArg0, iArg1 );
        m_trimKnotProperty = Abc::IFloatArrayProperty( _this, "trim_knot",
                                                       iArg0, iArg1 );
        m_trimMinProperty = Abc::IFloatArrayProperty( _this, "trim_min",
                                                      iArg0, iArg1 );
        m_trimMaxProperty = Abc::IFloatArrayProperty( _this, "trim_max",
                                                      iArg0, iArg1 );
        m_trimUProperty = Abc::IFloatArrayProperty( _this, "trim_u",
                                                    iArg0, iArg1 );
        m_trimVProperty = Abc::IFloatArrayProperty( _this, "trim_v",
                                                    iArg0, iArg1 );
        m_trimWProperty = Abc::IFloatArrayProperty( _this, "trim_w",
                                                    iArg0, iArg1 );

        m_hasTrimCurve = m_trimNumLoopsProperty.getNumSamples() > 0;
    }

    ALEMBIC_ABC_SAFE_CALL_END_RESET();
}
コード例 #6
0
ファイル: IXform.cpp プロジェクト: AWhetter/alembic
//-*****************************************************************************
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();
}
コード例 #7
0
ファイル: ICamera.cpp プロジェクト: AWhetter/alembic
//-*****************************************************************************
void ICameraSchema::init( const Abc::Argument &iArg0,
                          const Abc::Argument &iArg1 )
{
    ALEMBIC_ABC_SAFE_CALL_BEGIN( "ICameraSchema::init()" );

    AbcA::CompoundPropertyReaderPtr _this = this->getPtr();

    Abc::Arguments args;
    iArg0.setInto( args );
    iArg1.setInto( args );


    m_coreProperties = Abc::IScalarProperty( _this, ".core",
        args.getErrorHandlerPolicy() );

    // none of the things below here are guaranteed to exist

    if ( this->getPropertyHeader( ".childBnds" ) != NULL )
    {
        m_childBoundsProperty = Abc::IBox3dProperty( _this, ".childBnds",
            iArg0, iArg1 );
    }

    if ( this->getPropertyHeader( ".arbGeomParams" ) != NULL )
    {
        m_arbGeomParams = Abc::ICompoundProperty( _this, ".arbGeomParams",
            args.getErrorHandlerPolicy() );
    }

    if ( this->getPropertyHeader( ".userProperties" ) != NULL )
    {
        m_userProperties = Abc::ICompoundProperty( _this, ".userProperties",
            args.getErrorHandlerPolicy() );
    }

    // read the film back operations
    const AbcA::PropertyHeader * header =
        this->getPropertyHeader(".filmBackOps");

    // read it from the scalar property
    if ( header != NULL && header->isScalar() )
    {
        Abc::IScalarProperty opsProp( _this, ".filmBackOps",
            args.getErrorHandlerPolicy() );

        size_t numOps = opsProp.getDataType().getExtent();

        std::vector < std::string > ops( numOps );
        opsProp.get( &ops.front() );
        m_ops.resize( ops.size() );


        for ( size_t i = 0; i < numOps; ++i )
        {
            m_ops[i] = FilmBackXformOp( ops[i] );
        }

    }
    // read it from the array property
    else if ( header != NULL && header->isArray() )
    {
        Abc::IStringArrayProperty opsProp( _this, ".filmBackOps",
            iArg0, iArg1 );

        Abc::StringArraySamplePtr ops;
        opsProp.get( ops );
        size_t numOps = ops->size();
        m_ops.resize( numOps );


        for ( size_t i = 0; i < numOps; ++i )
        {
            m_ops[i] = FilmBackXformOp( (*ops)[i] );
        }
    }

    header = this->getPropertyHeader( ".filmBackChannels" );

    if ( header != NULL && header->isScalar() )
    {
        m_smallFilmBackChannels = Abc::IScalarProperty( _this,
            ".filmBackChannels", args.getErrorHandlerPolicy() );
    }
    else if ( header != NULL && header->isArray() )
    {
        m_largeFilmBackChannels = Abc::IDoubleArrayProperty( _this,
            ".filmBackChannels", iArg0, iArg1 );
    }

    ALEMBIC_ABC_SAFE_CALL_END_RESET();
}