void recursivelyReadChildren( IObject& parent )
{
    unsigned int numChildren = parent.getNumChildren();
    std::cout << " has " << numChildren << " children"
              << std::endl;

    for (unsigned int ii=0; ii<numChildren; ii++)
    {
        IObject child = parent.getChild(ii);
        std::cout << "  " << child.getName();

        unsigned int expectedChildren = 2;
        if (child.getName().substr(6,1) == "2")
            // bottom of the hierarchy
            expectedChildren = 0;

        unsigned int children = child.getNumChildren();
        ABCA_ASSERT( children == expectedChildren,
                     "Expected " << expectedChildren << " children " <<
                     "but found " << children );

        recursivelyReadChildren( child );
    }

    return;
}
示例#2
0
bool Chain::parseFeature (TiXmlElement *element) {

	int n_features = 0;
	element->QueryIntAttribute ("size", &n_features);

	ssi_msg (SSI_LOG_LEVEL_DETAIL, "found %u feature", n_features); 

	if (n_features > 0) {
		_n_features = n_features;
		_features = new IFeature *[_n_features];
		for (ssi_size_t i = 0; i < _n_features; i++) {
			_features[i] = 0;
		}
		TiXmlElement *item = 0;
		for (ssi_size_t i = 0; i < _n_features; i++) {
			if (i == 0) {
				item = element->FirstChildElement ("item");	
			} else {
				item = item->NextSiblingElement ("item");
			}
			if (!item) {
				ssi_wrn ("feature: failed parsing '%u'th <item> tag", i);
				return false;
			}
			IObject *object = _xmlpipe->parseObject (item, false);
			if (!object) {
				ssi_wrn ("filter: class not found");
				return false;
			}
			if (object->getType () != SSI_FEATURE) {
				ssi_wrn ("feature: class is not a feature");
				return false;
			}
			IFeature *feature = ssi_pcast (IFeature, object);
			if (!feature) {
				ssi_wrn ("feature: failed loading feature object");
				return false;
			}

			ssi_msg (SSI_LOG_LEVEL_DETAIL, "load %u. feature '%s'", i+1, object->getName ()); 

			_features[i] = feature;
		}
	}

	return true;
}
示例#3
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);
    }
}
bool getNamedCamera( IObject iObjTop, const std::string &iName, ICamera &iCam )
{
	// Return true if found

	const Alembic::AbcGeom::MetaData &md = iObjTop.getMetaData();
	if ( (iObjTop.getName() == iName) && (ICamera::matches( md )) )
	{
		iCam = ICamera(iObjTop, kWrapExisting );
		return true;
	}

	// now the child objects
	for ( size_t i = 0 ; i < iObjTop.getNumChildren() ; i++ )
	{
		if (getNamedCamera(IObject( iObjTop, iObjTop.getChildHeader( i ).getName() ), iName, iCam ))
			return true;
	}

	return false;

}