Esempio n. 1
0
 void ConfigFile::addSection(const Ogre::String& section, const Ogre::NameValuePairList& settings)
 {
     // Create new section
     mSettings[section] = OGRE_NEW_T(SettingsMultiMap, MEMCATEGORY_GENERAL);
     // Insert values from the settings list
     mSettings[section]->insert(settings.begin(), settings.end());
 }
Esempio n. 2
0
void ApplicationContext::reconfigure(const Ogre::String &renderer, Ogre::NameValuePairList &options)
{
    mNextRenderer = renderer;
    Ogre::RenderSystem* rs = mRoot->getRenderSystemByName(renderer);

    // set all given render system options
    for (Ogre::NameValuePairList::iterator it = options.begin(); it != options.end(); it++)
    {
        rs->setConfigOption(it->first, it->second);

#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
        // Change the viewport orientation on the fly if requested
        if(it->first == "Orientation")
        {
            if (it->second == "Landscape Left")
                mWindow->getViewport(0)->setOrientationMode(Ogre::OR_LANDSCAPELEFT, true);
            else if (it->second == "Landscape Right")
                mWindow->getViewport(0)->setOrientationMode(Ogre::OR_LANDSCAPERIGHT, true);
            else if (it->second == "Portrait")
                mWindow->getViewport(0)->setOrientationMode(Ogre::OR_PORTRAIT, true);
        }
#endif
    }

#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
    // Need to save the config on iOS to make sure that changes are kept on disk
    mRoot->saveConfig();
#endif
    mRoot->queueEndRendering();   // break from render loop
}
/** Utility function for creating and inserting layer properties
@param layer Spacescape layer
@param insertAfter Property to insert after
@param minimize Minimize this layer
@return The created / inserted property
*/
QtProperty* QtSpacescapeMainWindow::insertLayerProperties(Ogre::SpacescapeLayer* layer, QtProperty *insertAfter, bool minimize)
{
    // turn refreshing flag on so we don't process valueChanged events
    mRefreshing = true;

    // get layer params
    Ogre::NameValuePairList params = layer->getParams();

    // create the layer properties object
    QtProperty *layerProperties = mPropertyManager->addProperty(
                QtVariantPropertyManager::groupTypeId(),
                QLatin1String(layer->getName().c_str())
    );

    // insert it into the property tree early so we can minize items inside
    ui->layerProperties->insertProperty(layerProperties, insertAfter);

    // minimize the layer - speeds things up!
    if(minimize) {
        ui->layerProperties->setExpanded(ui->layerProperties->topLevelItem(layerProperties), false);
    }

    // add the common layer params to the subproperties first
    layerProperties->addSubProperty(createProperty( "name", layer->getName()));
    layerProperties->addSubProperty(createProperty( "type", layer->getLayerTypeName()));
    layerProperties->addSubProperty(createProperty( "visible", "true"));
    layerProperties->addSubProperty(createProperty( "seed", params["seed"]));

    // now add all the remaining layer params to the subproperties
    Ogre::NameValuePairList::iterator pl;
    for(pl = params.begin(); pl != params.end(); pl++) {
        // skip common params that come first
        if(pl->first == "name" || pl->first == "type" || 
            pl->first == "visible" || pl->first == "seed") {
            continue;
        }

        // create the sub property
        QtVariantProperty* subProperty = createProperty(pl->first, pl->second);
        if(!subProperty) {
            continue;
        }

        // add this sub property parameter
        layerProperties->addSubProperty(subProperty);

        // special auto hide for color types
        if(getPropertyType(pl->first) == QVariant::Color) {
            QList<QtBrowserItem *> bi = ui->layerProperties->items(subProperty);
            ui->layerProperties->setExpanded(bi.first(),false);
        }
    }

    // done adding properties
    mRefreshing = false;

    return layerProperties;
}