void IconManager::render(Icon& icon, Eris::TypeInfo& erisType) { //we need to get the model mapping definition for this type //once we have that, we will check for the first action of the first case of the first match (since that's guaranteed to be a show-model action Eris::Connection* conn = EmberServices::getSingleton().getServerService().getConnection(); if (conn) { Eris::TypeService* typeService = conn->getTypeService(); if (typeService) { DummyEntity dummyEntity("-1", &erisType, typeService); std::string modelName; Mapping::ModelActionCreator actionCreator(dummyEntity, [&](std::string newModelName){ modelName = newModelName; }, [&](std::string partName){ //Ignore parts }); std::unique_ptr<EntityMapping::EntityMapping> modelMapping(Mapping::EmberEntityMappingManager::getSingleton().getManager().createMapping(dummyEntity, actionCreator, &EmberOgre::getSingleton().getWorld()->getView())); if (modelMapping) { modelMapping->initialize(); } //if there's no model defined for this use the placeholder model if (modelName.empty()) { modelName = "common/primitives/placeholder.modeldef"; } //update the model preview window // Model::Model* model = Model::Model::createModel(mIconRenderer.getRenderContext()->getSceneManager(), modelName); render(icon, modelName); // mIconRenderer.getRenderContext()->getSceneManager()->destroyMovableObject(model); dummyEntity.shutdown(); } } }
void IconManager::render(Icon& icon, Eris::TypeInfo& erisType) { //we need to get the model mapping definition for this type //once we have that, we will check for the first action of the first case of the first match (since that's guaranteed to be a show-model action Eris::Connection* conn = EmberServices::getSingleton().getServerService().getConnection(); if (conn) { Eris::TypeService* typeService = conn->getTypeService(); if (typeService) { DummyEntity dummyEntity("-1", &erisType, typeService); IconActionCreator actionCreator(dummyEntity); std::auto_ptr<EntityMapping::EntityMapping> modelMapping(Mapping::EmberEntityMappingManager::getSingleton().getManager().createMapping(dummyEntity, &actionCreator, Application::getSingleton().getMainView())); std::string modelName; if (modelMapping.get()) { modelMapping->initialize(); modelName = actionCreator.getModelName(); } //if there's no model defined for this use the placeholder model if (modelName == "") { modelName = "placeholder"; } //update the model preview window // Model::Model* model = Model::Model::createModel(mIconRenderer.getRenderContext()->getSceneManager(), modelName); render(icon, modelName); // mIconRenderer.getRenderContext()->getSceneManager()->destroyMovableObject(model); dummyEntity.shutdown(); } } }