//-*****************************************************************************
void readDeepHierarchy( IObject parent, const int level, const IObject& orig )
{
    if ( level > DEPTH )
    {
        ICompoundProperty p = parent.getProperties();
        IInt32ArrayProperty iap( p, "intArrayProp" );
        std::string fullName = const_cast<std::string&>(
            iap.getObject().getFullName() );

        PATH_PAIR ret = PATHS.insert( fullName );

        Int32ArraySamplePtr sampPtr = iap.getValue();

        TESTING_ASSERT( sampPtr->get()[5] == 5 );
        TESTING_ASSERT( sampPtr->get()[99] == 99 );
        TESTING_ASSERT( sampPtr->size() == ( size_t ) HIGHVAL );

        TESTING_ASSERT( ret.second );

        TESTING_ASSERT( fullName == parent.getFullName() );

        // walk back up the tree until you find the first child object
        // under the top object, and check that it's the one we started
        // with.
        IObject _p = parent;
        while ( _p.getParent().getParent() )
        {
            _p = _p.getParent();
        }

        TESTING_ASSERT( _p.getFullName() == orig.getFullName() );

        return;
    }

    std::ostringstream strm;
    strm << level;
    std::string levelName = strm.str();
    readDeepHierarchy( IObject( parent, levelName ), level + 1, orig );
}
Exemple #2
0
void ApplyResources( IObject object, ProcArgs &args )
{
    std::string resourceName;
    
    //first check full name...
    resourceName = args.getResource( object.getFullName() );
    
    if ( resourceName.empty() )
    {
        //...and then base name
        resourceName = args.getResource( object.getName() );
    }
    
    if ( !resourceName.empty() )
    {
        RestoreResource(resourceName);
    }
}
//-*****************************************************************************
void visitObject( IObject iObj )
{
    std::string path = iObj.getFullName();

    const MetaData &md = iObj.getMetaData();

    if ( IPolyMeshSchema::matches( md ) || ISubDSchema::matches( md ) )
    {
        Box3d bnds = getBounds( iObj );
        std::cout << path << " " << bnds.min << " " << bnds.max << std::endl;
    }

    // now the child objects
    for ( size_t i = 0 ; i < iObj.getNumChildren() ; i++ )
    {
        visitObject( IObject( iObj, iObj.getChildHeader( i ).getName() ) );
    }
}
//-*****************************************************************************
int pushName( IObject &iObj )
{
    Abc::MetaData md = iObj.getMetaData();
    if ( IPolyMesh::matches( md ) ||
         IPoints::matches( md ) ||
         ICurves::matches( md ) ||
         INuPatch::matches( md ) ||
         ISubD::matches( md )
       )
    {
        OBJECT_MAP.push_back( iObj.getFullName() );
        glPushName( OBJECT_MAP.size() );
        //std::cout << OBJECT_MAP.size()
        //          << "\t"
        //          << iObj.getFullName()
        //          << std::endl;
        return OBJECT_MAP.size();
    } else {
        return -1;
    }
}
Exemple #5
0
//-*****************************************************************************
void visitObject( IObject iObj,
                  std::string iIndent )
{
    // Object has a name, a full name, some meta data,
    // and then it has a compound property full of properties.
    std::string path = iObj.getFullName();

    if ( path != "/" )
    {
        std::cout << "Object " << "name=" << path << std::endl;
    }

    // Get the properties.
    ICompoundProperty props = iObj.getProperties();
    visitProperties( props, iIndent );

    // now the child objects
    for ( size_t i = 0 ; i < iObj.getNumChildren() ; i++ )
    {
        visitObject( IObject( iObj, iObj.getChildHeader( i ).getName() ),
                     iIndent );
    }
}