/** * \brief This function is used by android to store the gamestate when minimizing * \param pointer Output for the memory location * \param size Output for the memory size */ void saveToMemory(void* &pointer, size_t &size) const { size = sizeof(CGameState::EGameStates); tinyxml2::XMLPrinter xmlprinter; m_XMLDoc.Accept(&xmlprinter); Ogre::String xmltext = xmlprinter.CStr(); size += xmltext.size(); pointer = malloc(size); memcpy(pointer, &m_eCurrentGameState, sizeof(CGameState::EGameStates)); memcpy(static_cast<CGameState::EGameStates*>(pointer) + 1, xmltext.c_str(), xmltext.size()); }
float ParseKeyFrameTime( const float length, const Ogre::String& string ) { float res = 0; if( string.at( string.size() - 1 ) == '%' ) { res = length * Ogre::StringConverter::parseReal( string.substr( 0, string.size() - 1 ) ) / 100; } else { res = Ogre::StringConverter::parseReal( string ); } return res; }
bool fnmatch (Ogre::String pattern, Ogre::String name, int dummy) { if (pattern == "*") { return true; } if (pattern.substr(0,2) == "*.") { Ogre::StringUtil::toLowerCase(pattern); Ogre::StringUtil::toLowerCase(name); Ogre::String extToFind = pattern.substr(2, pattern.size() - 2); if ((name.size() > extToFind.size()) &&(extToFind == name.substr(name.size() - extToFind.size(), extToFind.size()))) { return 0; // match } else { return 1; // don't match } } return false; }
void ParsePersent( float& value_percent, float& value, const Ogre::String& string ) { if( string.at( string.size() - 1 ) == '%' ) { value_percent = Ogre::StringConverter::parseReal( string.substr( 0, string.size() - 1 ) ); value = 0; } else { Ogre::StringVector param = Ogre::StringUtil::split( string, "%" ); if( param.size() > 1 ) { value_percent = Ogre::StringConverter::parseReal( param[ 0 ] ); value = Ogre::StringConverter::parseReal( param[ 1 ] ); } else { value_percent = 0; value = Ogre::StringConverter::parseReal( string ); } } }
//------------------------------------------------------------------------------------- void EntitySimple::setupAnimations() { if(modelName_ == "ogrehead.mesh") return; Ogre::AnimationStateSet* aniStetes = mBodyEnt->getAllAnimationStates(); if(aniStetes != NULL) { // populate our animation list for (int i = 0; i < SIMPLE_NUM_ANIMS; i++) { if(aniStetes->hasAnimationState(animNames[i])) { mAnims[i] = mBodyEnt->getAnimationState(animNames[i]); mAnims[i]->setLoop(true); } else { char c = animNames[i].c_str()[animNames[i].size() - 1]; if(c > '1' && c <= '9') { Ogre::String name = animNames[i]; name.erase(name.size() - 1, 1); name += "1"; mAnims[i] = mBodyEnt->getAnimationState(name); mAnims[i]->setLoop(true); } else mAnims[i] = NULL; } } } else { for (int i = 0; i < SIMPLE_NUM_ANIMS; i++) { mAnims[i] = NULL; } } if(mState != 1) playAnimation("Idle"); else playAnimation("Die"); }
// same as: return preg_replace("/[^A-Za-z0-9-_.]/", "_", $s); Ogre::String stripNonASCII(Ogre::String s) { char filename[9046] = ""; sprintf(filename, "%s", s.c_str()); for(size_t i=0;i<s.size(); i++) { bool replace = true; if (filename[i] >= 48 && filename[i] <= 57) replace = false; // 0-9 else if(filename[i] >= 65 && filename[i] <= 90) replace = false; // A-Z else if(filename[i] >= 97 && filename[i] <= 122) replace = false; // a-z else if(filename[i] == 45 || filename[i] == 95 || filename[i] == 46) replace = false; // -_. if(replace) filename[i]='_'; } return Ogre::String(filename); }
//------------------------------------------------------------------------------------- void SpaceLogin::createScene(void) { g_accountName = kbe_getLastAccountName(); if(g_accountName.size() == 0) g_accountName = KBEngine::StringConv::val2str(KBEngine::genUUID64()); mTrayMgr->createButton(OgreBites::TL_CENTER, "login", "fast login", 120); Ogre::StringVector values; values.push_back(g_accountName); mTrayMgr->createParamsPanel(OgreBites::TL_CENTER, "accountName", 300, values); mTrayMgr->showCursor(); mTrayMgr->hideFrameStats(); mTrayMgr->hideLogo(); mTrayMgr->hideBackdrop(); mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC); // Create the camera mActiveCamera = mSceneMgr->createCamera("PlayerCam"); // Position it at 500 in Z direction mActiveCamera->setPosition(Ogre::Vector3(0,0,80)); // Look back along -Z mActiveCamera->lookAt(Ogre::Vector3(0,0,-300)); mActiveCamera->setNearClipDistance(5); mCameraMan = new OgreBites::SdkCameraMan(mActiveCamera); // create a default camera controller mCameraMan->setTopSpeed(7.0f); OgreApplication::getSingleton().setCurrCameraMan(mCameraMan); // Create one viewport, entire window Ogre::Viewport* vp = mWindow->addViewport(mActiveCamera); vp->setBackgroundColour(Ogre::ColourValue(0,0,0)); // Alter the camera aspect ratio to match the viewport mActiveCamera->setAspectRatio( Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight())); }
void ScriptLexer::setToken(const Ogre::String &lexeme, Ogre::uint32 line, const String &source, Ogre::ScriptTokenList *tokens) { #if OGRE_WCHAR_T_STRINGS const wchar_t openBracket = L'{', closeBracket = L'}', colon = L':', quote = L'\"', var = L'$'; #else const char openBracket = '{', closeBracket = '}', colon = ':', quote = '\"', var = '$'; #endif ScriptTokenPtr token(OGRE_NEW_T(ScriptToken, MEMCATEGORY_GENERAL)(), SPFM_DELETE_T); token->lexeme = lexeme; token->line = line; token->file = source; bool ignore = false; // Check the user token map first if(lexeme.size() == 1 && isNewline(lexeme[0])) { token->type = TID_NEWLINE; if(!tokens->empty() && tokens->back()->type == TID_NEWLINE) ignore = true; } else if(lexeme.size() == 1 && lexeme[0] == openBracket) token->type = TID_LBRACKET; else if(lexeme.size() == 1 && lexeme[0] == closeBracket) token->type = TID_RBRACKET; else if(lexeme.size() == 1 && lexeme[0] == colon) token->type = TID_COLON; else if(lexeme[0] == var) token->type = TID_VARIABLE; else { // This is either a non-zero length phrase or quoted phrase if(lexeme.size() >= 2 && lexeme[0] == quote && lexeme[lexeme.size() - 1] == quote) { token->type = TID_QUOTE; } else { token->type = TID_WORD; } } if(!ignore) tokens->push_back(token); }
Tag TagManager::toTag(const Ogre::String &tag) { if(0 == tag.size()) return INVALID_TAG; auto it = mTagsMap.find(tag); Tag returnedValue = INVALID_TAG; if(mTagsMap.end() == it) { mTagsMap[tag] = returnedValue = mNextTag; mInverseTagsMap[mNextTag] = tag; ++mNextTag; SignalManager::instance().emit(newTagCreatedSignal()); } else { returnedValue = it->second; } return returnedValue; }
void TestContext::setupDirectories(Ogre::String batchName) { // ensure there's a root directory for visual tests mOutputDir = mFSLayer->getWritablePath("VisualTests/"); static_cast<Ogre::FileSystemLayer*>(mFSLayer)->createDirectory(mOutputDir); // make sure there's a directory for the test set mOutputDir += mTestSetName + "/"; static_cast<Ogre::FileSystemLayer*>(mFSLayer)->createDirectory(mOutputDir); // add a directory for the render system Ogre::String rsysName = Ogre::Root::getSingleton().getRenderSystem()->getName(); // strip spaces from render system name for (unsigned int i = 0;i < rsysName.size(); ++i) if (rsysName[i] != ' ') mOutputDir += rsysName[i]; mOutputDir += "/"; static_cast<Ogre::FileSystemLayer*>(mFSLayer)->createDirectory(mOutputDir); // and finally a directory for the test batch itself static_cast<Ogre::FileSystemLayer*>(mFSLayer)->createDirectory(mOutputDir + batchName + "/"); }
void CLASS::LoadText() { m_vehicle_title->setMaxTextLength(33); m_vehicle_title->setCaptionWithReplacing(currTruck->getTruckName()); Ogre::UTFString txt; std::vector<authorinfo_t> file_authors = currTruck->getAuthors(); if (!file_authors.empty()) { Ogre::String authors = ""; for (std::vector<authorinfo_t>::iterator it = file_authors.begin(); it != file_authors.end(); ++it) { authors += "* " + (*it).name + " \n"; } txt = txt + _L("Authors: \n") + authors; } else txt = txt + _L("(no author information available) "); std::vector<std::string> description = currTruck->getDescription(); for (unsigned int i = 1; i < 3; i++) { if (i < description.size()) { txt = txt + _L("\nDescription: \n"); txt = txt + (ANSI_TO_UTF(description[i])) + "\n"; } } txt = txt + _L("\nCommands: \n"); int filledCommands = 0; for (int i = 1; i < MAX_COMMANDS && filledCommands < COMMANDS_VISIBLE; i += 2) { if (currTruck->commandkey[i].beams.empty() || currTruck->commandkey[i].description == "hide") continue; filledCommands++; char commandID[256] = {}; Ogre::String keyStr = ""; sprintf(commandID, "COMMANDS_%02d", i); int eventID = RoR::Application::GetInputEngine()->resolveEventName(Ogre::String(commandID)); Ogre::String keya = RoR::Application::GetInputEngine()->getEventCommand(eventID); sprintf(commandID, "COMMANDS_%02d", i + 1); eventID = RoR::Application::GetInputEngine()->resolveEventName(Ogre::String(commandID)); Ogre::String keyb = RoR::Application::GetInputEngine()->getEventCommand(eventID); // cut off expl if (keya.size() > 6 && keya.substr(0, 5) == "EXPL+") keya = keya.substr(5); if (keyb.size() > 6 && keyb.substr(0, 5) == "EXPL+") keyb = keyb.substr(5); keyStr = keya + "/" + keyb; if (currTruck->commandkey[i].description.empty()) { txt = txt + "* " + keyStr + ": " + _L("unknown function"); } else { txt = txt + "* " + keyStr + ": " + currTruck->commandkey[i].description; } txt = txt + "\n"; } m_vehicle_desc->setCaption(Ogre::String(txt)); }
//----------------------------------------------------------------------------- int COFSSceneSerializer::Export(bool SaveAs, Ogre::String exportfile) { OgitorsRoot *ogRoot = OgitorsRoot::getSingletonPtr(); OgitorsSystem *mSystem = OgitorsSystem::getSingletonPtr(); OFS::OfsPtr& mFile = ogRoot->GetProjectFile(); PROJECTOPTIONS *pOpt = ogRoot->GetProjectOptions(); bool forceSave = false; Ogre::String fileLocation = ogRoot->GetProjectFile()->getFileSystemName(); Ogre::String fileName = ""; if (!exportfile.empty()) { // Save location was passed, so use this filename fileLocation = exportfile; } if (SaveAs) { // Saving at a different location UTFStringVector extlist; if( mFile->getFileSystemType() == OFS::OFS_PACKED ) { extlist.push_back(OTR("Ogitor File System File")); extlist.push_back("*.ofs"); } else { extlist.push_back(OTR("Ogitor Scene File")); extlist.push_back("*" + Globals::OGSCENE_FORMAT_EXTENSION); } Ogre::String newfileLocation = mSystem->DisplaySaveDialog(OTR("Save As"), extlist, fileLocation); if(newfileLocation == "") return SCF_CANCEL; mSystem->SetSetting("system", "oldOpenPath", newfileLocation); if(Ogre::StringUtil::match(newfileLocation, fileLocation, false)) { SaveAs = false; } else { forceSave = true; fileLocation = newfileLocation; } } Ogre::String filePath = OgitorsUtils::ExtractFilePath(fileLocation); fileName = OgitorsUtils::ExtractFileName(fileLocation); // Change the project directory to the new path pOpt->ProjectDir = filePath; if(fileName.substr(fileName.size() - 4, 4) != ".ofs") fileLocation = filePath; int dotpos = fileName.find_last_of("."); if (dotpos > 0) { fileName.erase(dotpos, fileName.length() - dotpos); } if (SaveAs && mFile->moveFileSystemTo(fileLocation.c_str()) != OFS::OFS_OK) { return SCF_ERRFILE; } if (SaveAs) { mFile->deleteFile((pOpt->ProjectName + Globals::OGSCENE_FORMAT_EXTENSION).c_str()); pOpt->ProjectName = fileName; } if (_writeFile(fileName + Globals::OGSCENE_FORMAT_EXTENSION, forceSave) != SCF_OK) { return SCF_ERRFILE; } return SCF_OK; }
/** Event handler for when the options dialog is interacted with */ CStatus OgreMeshExportOptions_PPGEvent( const CRef& io_Ctx ) { // This callback is called when events happen in the user interface // This is where you implement the "logic" code. Application app ; static bool hasSkel = false; PPGEventContext ctx( io_Ctx ) ; PPGEventContext::PPGEvent eventID = ctx.GetEventID() ; CustomProperty prop = ctx.GetSource() ; Parameter objectNameParam = prop.GetParameters().GetItem( L"objectName" ) ; // On open dialog if ( eventID == PPGEventContext::siOnInit ) { CString theObjectName; // Pre-populate object with currently selected item(s) Selection sel(app.GetSelection()); if (sel.GetCount() > 0) { CString val; for (int i = 0; i < sel.GetCount(); ++i) { CString thisName = SIObject(sel[i]).GetName(); val += thisName; theObjectName += thisName; if (i < sel.GetCount() - 1) { val += L", "; theObjectName += L"_"; } } prop.PutParameterValue(L"objectName", val); } else { // no selection, assume entire scene prop.PutParameterValue(L"objectName", CString(L"[Entire Scene]")); } // Make the selection read-only objectNameParam.PutCapabilityFlag( siReadOnly, true ); // Default mesh name if (prop.GetParameterValue(L"targetMeshFileName") == L"") { // default name prop.PutParameterValue(L"targetMeshFileName", theObjectName + L".mesh"); } // Default material name if (prop.GetParameterValue(L"targetMaterialFileName") == L"") { // default name prop.PutParameterValue(L"targetMaterialFileName", theObjectName + L".material"); } // default the frame rate to that selected in animation panel prop.PutParameterValue(L"fps", CTime().GetFrameRate()); // enable / disable the skeleton export based on envelopes if (!hasSkeleton(sel, true)) { prop.PutParameterValue(L"exportSkeleton", false); Parameter param = prop.GetParameters().GetItem(L"exportSkeleton"); param.PutCapabilityFlag(siReadOnly, true); param = prop.GetParameters().GetItem(L"targetSkeletonFileName"); param.PutCapabilityFlag(siReadOnly, true); hasSkel = false; } else { prop.PutParameterValue(L"exportSkeleton", true); Parameter param = prop.GetParameters().GetItem(L"exportSkeleton"); param.PutCapabilityFlag(siReadOnly, false); param = prop.GetParameters().GetItem(L"targetSkeletonFileName"); param.PutCapabilityFlag(siReadOnly, false); if (prop.GetParameterValue(L"targetSkeletonFileName") == L"") { // default name prop.PutParameterValue(L"targetSkeletonFileName", theObjectName + L".skeleton"); } hasSkel = true; } // value of param is a griddata object // initialise it with all detected animations if it's empty Parameter param = prop.GetParameters().GetItem(L"animationList"); GridData gd(param.GetValue()); if (gd.GetRowCount() == 0 || gd.GetCell(0,0) == L"No data has been set") { populateAnimationsList(gd); } } // On clicking a button else if ( eventID == PPGEventContext::siButtonClicked ) { CValue buttonPressed = ctx.GetAttribute( L"Button" ); // Clicked the refresh animation button if ( buttonPressed.GetAsText() == L"refreshAnimation" ) { LONG btn; CStatus ret = app.GetUIToolkit().MsgBox( L"Are you sure you want to lose the current contents " L"of the animations list and to refresh it from mixers?", siMsgYesNo, L"Confirm", btn); if (btn == 6) { Parameter param = prop.GetParameters().GetItem(L"animationList"); GridData gd(param.GetValue()); populateAnimationsList(gd); } } else if( buttonPressed.GetAsText() == L"addAnimation" ) { Parameter param = prop.GetParameters().GetItem(L"animationList"); GridData gd(param.GetValue()); gd.PutRowCount(gd.GetRowCount() + 1); // default export to true and sample rate gd.PutCell(ANIMATION_LIST_EXPORT_COL, gd.GetRowCount()-1, true); gd.PutCell(ANIMATION_LIST_IKFREQ_COL, gd.GetRowCount()-1, (LONG)5); } else if( buttonPressed.GetAsText() == L"removeAnimation" ) { Parameter param = prop.GetParameters().GetItem(L"animationList"); GridData gd(param.GetValue()); GridWidget gw = gd.GetGridWidget(); // cell-level selection, so have to search for selection in every cell long selRow = -1; for (long row = 0; row < gd.GetRowCount() && selRow == -1; ++row) { for (long col = 0; col < gd.GetColumnCount() && selRow == -1; ++col) { if (gw.IsCellSelected(col, row)) { selRow = row; } } } if (selRow != -1) { LONG btn; CStatus ret = app.GetUIToolkit().MsgBox( L"Are you sure you want to remove this animation entry?", siMsgYesNo, L"Confirm", btn); if (btn == 6) { // Move all the contents up one for (long row = selRow; row < gd.GetRowCount(); ++row) { for (long col = 0; col < gd.GetColumnCount(); ++col) { gd.PutCell(col, row, gd.GetCell(col, row+1)); } } // remove last row gd.PutRowCount(gd.GetRowCount() - 1); } } } } // Changed a parameter else if ( eventID == PPGEventContext::siParameterChange ) { Parameter changed = ctx.GetSource() ; CustomProperty prop = changed.GetParent() ; CString paramName = changed.GetScriptName() ; // Check paramName against parameter names, perform custom onChanged event if (paramName == L"targetMeshFileName") { // Default skeleton & material name Ogre::String meshName = XSItoOgre(XSI::CString(changed.GetValue())); if (hasSkel) { Ogre::String skelName = meshName; if (Ogre::StringUtil::endsWith(skelName, ".mesh")) { skelName = skelName.substr(0, skelName.size() - 5) + ".skeleton"; } CString xsiSkelName = OgretoXSI(skelName); prop.PutParameterValue(L"targetSkeletonFileName", xsiSkelName); } // default material script name Ogre::String matName = meshName; if (Ogre::StringUtil::endsWith(matName, ".mesh")) { matName = matName.substr(0, matName.size() - 5) + ".material"; } CString xsiMatName = OgretoXSI(matName); prop.PutParameterValue(L"targetMaterialFileName", xsiMatName); } } return CStatus::OK; }
/** Callback event when clicking the export menu option. Adds an instance of the options dialog as a property, then uses the InspectObj XSI command to pop it up in a modal dialog. If it wasn't cancelled, performs an export. */ XSI::CStatus OnOgreMeshExportMenu( XSI::CRef& in_ref ) { Ogre::LogManager logMgr; logMgr.createLog("OgreXSIExporter.log", true); CString msg(L"OGRE Exporter Version "); msg += OGRE_XSI_EXPORTER_VERSION; LogOgreAndXSI(msg); Application app; CStatus st(CStatus::OK); Property prop = app.GetActiveSceneRoot().GetProperties().GetItem(exportPropertyDialogName); if (prop.IsValid()) { // Check version number CString currVersion(prop.GetParameterValue(L"version")); if (!currVersion.IsEqualNoCase(OGRE_XSI_EXPORTER_VERSION)) { DeleteObj(exportPropertyDialogName); prop.ResetObject(); } } if (!prop.IsValid()) { prop = app.GetActiveSceneRoot().AddProperty(exportPropertyDialogName); prop.PutParameterValue(L"version", CString(OGRE_XSI_EXPORTER_VERSION)); } try { // Popup Returns true if the command was cancelled otherwise it returns false. CStatus ret = Popup(exportPropertyDialogName,CValue(),L"OGRE Mesh / Skeleton Export",((LONG)siModal),true); if (ret == CStatus::OK) { Ogre::XsiMeshExporter meshExporter; Ogre::XsiSkeletonExporter skelExporter; // retrieve the parameters Parameter param = prop.GetParameters().GetItem(L"objectName"); CString objectName = param.GetValue(); param = prop.GetParameters().GetItem( L"targetMeshFileName" ); Ogre::String meshFileName = XSItoOgre(XSI::CString(param.GetValue())); if (meshFileName.empty()) { OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "You must supply a mesh file name", "OGRE Exporter"); } // fix any omission of '.mesh' if (!Ogre::StringUtil::endsWith(meshFileName, ".mesh")) { meshFileName += ".mesh"; } param = prop.GetParameters().GetItem( L"mergeSubmeshes" ); bool mergeSubmeshes = param.GetValue(); param = prop.GetParameters().GetItem( L"exportChildren" ); bool exportChildren = param.GetValue(); param = prop.GetParameters().GetItem( L"calculateEdgeLists" ); bool edgeLists = param.GetValue(); param = prop.GetParameters().GetItem( L"calculateTangents" ); bool tangents = param.GetValue(); param = prop.GetParameters().GetItem( L"tangentSemantic" ); CString tangentSemStr = param.GetValue(); Ogre::VertexElementSemantic tangentSemantic = (tangentSemStr == L"t")? Ogre::VES_TANGENT : Ogre::VES_TEXTURE_COORDINATES; param = prop.GetParameters().GetItem( L"tangentsSplitMirrored" ); bool tangentsSplitMirrored = param.GetValue(); param = prop.GetParameters().GetItem( L"tangentsSplitRotated" ); bool tangentsSplitRotated = param.GetValue(); param = prop.GetParameters().GetItem( L"tangentsUseParity" ); bool tangentsUseParity = param.GetValue(); param = prop.GetParameters().GetItem( L"numLodLevels" ); long numlods = (LONG)param.GetValue(); Ogre::XsiMeshExporter::LodData* lodData = 0; if (numlods > 0) { param = prop.GetParameters().GetItem( L"lodDistanceIncrement" ); float distanceInc = param.GetValue(); param = prop.GetParameters().GetItem(L"lodQuota"); CString quota = param.GetValue(); param = prop.GetParameters().GetItem(L"lodReduction"); float reduction = param.GetValue(); lodData = new Ogre::XsiMeshExporter::LodData; float currentInc = distanceInc; for (int l = 0; l < numlods; ++l) { lodData->distances.push_back(currentInc); currentInc += distanceInc; } lodData->quota = (quota == L"p") ? Ogre::ProgressiveMesh::VRQ_PROPORTIONAL : Ogre::ProgressiveMesh::VRQ_CONSTANT; if (lodData->quota == Ogre::ProgressiveMesh::VRQ_PROPORTIONAL) lodData->reductionValue = reduction * 0.01; else lodData->reductionValue = reduction; } param = prop.GetParameters().GetItem( L"exportSkeleton" ); bool exportSkeleton = param.GetValue(); param = prop.GetParameters().GetItem( L"exportVertexAnimation" ); bool exportVertexAnimation = param.GetValue(); param = prop.GetParameters().GetItem( L"exportMaterials" ); bool exportMaterials = param.GetValue(); param = prop.GetParameters().GetItem( L"copyTextures" ); bool copyTextures = param.GetValue(); // create singletons Ogre::ResourceGroupManager rgm; Ogre::MeshManager meshMgr; Ogre::SkeletonManager skelMgr; Ogre::MaterialManager matMgr; Ogre::DefaultHardwareBufferManager hardwareBufMgr; // determine number of exportsteps size_t numSteps = 3 + OGRE_XSI_NUM_MESH_STEPS; if (numlods > 0) numSteps++; if (edgeLists) numSteps++; if (tangents) numSteps++; if (exportSkeleton) numSteps += 3; Ogre::ProgressManager progressMgr(numSteps); // Any material prefix? We need that for mesh linking too param = prop.GetParameters().GetItem( L"materialPrefix" ); Ogre::String materialPrefix = XSItoOgre(XSI::CString(param.GetValue())); param = prop.GetParameters().GetItem( L"fps" ); float fps = param.GetValue(); if (fps == 0.0f) { OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "You must supply a valid value for 'FPS'", "OGRE Export"); } Ogre::AnimationList selAnimList; if (exportSkeleton || exportVertexAnimation) { param = prop.GetParameters().GetItem( L"animationList" ); GridData gd(param.GetValue()); for (int a = 0; a < gd.GetRowCount(); ++a) { if (gd.GetCell(ANIMATION_LIST_EXPORT_COL, a) == true) { Ogre::AnimationEntry ae; ae.animationName = XSItoOgre(XSI::CString(gd.GetCell(ANIMATION_LIST_NAME_COL, a))); ae.ikSampleInterval = gd.GetCell(ANIMATION_LIST_IKFREQ_COL, a); ae.startFrame = (LONG)gd.GetCell(ANIMATION_LIST_START_COL, a); ae.endFrame = (LONG)gd.GetCell(ANIMATION_LIST_END_COL, a); selAnimList.push_back(ae); } } } if (exportSkeleton) { param = prop.GetParameters().GetItem( L"targetSkeletonFileName" ); Ogre::String skeletonFileName = XSItoOgre(XSI::CString(param.GetValue())); if (skeletonFileName.empty()) { OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "You must supply a skeleton file name", "OGRE Exporter"); } // fix any omission of '.skeleton' if (!Ogre::StringUtil::endsWith(skeletonFileName, ".skeleton")) { skeletonFileName += ".skeleton"; } // Truncate the skeleton filename to just the name (no path) Ogre::String skelName = skeletonFileName; int pos = skeletonFileName.find_last_of("\\"); if (pos == Ogre::String::npos) { pos = skeletonFileName.find_last_of("/"); } if (pos != Ogre::String::npos) { skelName = skelName.substr(pos+1, skelName.size() - pos - 1); } // Do the mesh Ogre::DeformerMap& deformers = meshExporter.buildMeshForExport(mergeSubmeshes, exportChildren, edgeLists, tangents, tangentSemantic, tangentsSplitMirrored, tangentsSplitRotated, tangentsUseParity, exportVertexAnimation, selAnimList, fps, materialPrefix, lodData, skelName); // do the skeleton const Ogre::AxisAlignedBox& skelAABB = skelExporter.exportSkeleton(skeletonFileName, deformers, fps, selAnimList); // Do final mesh export meshExporter.exportMesh(meshFileName, skelAABB); } else { Ogre::AxisAlignedBox nullbb; // No skeleton meshExporter.buildMeshForExport(mergeSubmeshes, exportChildren, edgeLists, tangents, tangentSemantic, tangentsSplitMirrored, tangentsSplitRotated, tangentsUseParity, exportVertexAnimation, selAnimList, fps, materialPrefix, lodData); meshExporter.exportMesh(meshFileName, nullbb); } delete lodData; // Do we want to export materials too? if (exportMaterials) { param = prop.GetParameters().GetItem( L"targetMaterialFileName" ); Ogre::String materialFileName = XSItoOgre(XSI::CString(param.GetValue())); // fix any omission of '.material' if (!Ogre::StringUtil::endsWith(materialFileName, ".material")) { materialFileName += ".material"; } Ogre::XsiMaterialExporter matExporter; try { matExporter.exportMaterials(meshExporter.getMaterials(), meshExporter.getTextureProjectionMap(), materialFileName, copyTextures); } catch (Ogre::Exception& e) { // ignore, non-fatal and will be in log } } } } catch (Ogre::Exception& e) { // Will already have been logged to the Ogre log manager // Tell XSI app.LogMessage(OgretoXSI(e.getDescription()), XSI::siFatalMsg); app.LogMessage(OgretoXSI(e.getFullDescription()), XSI::siInfoMsg); } //DeleteObj( L"OgreMeshExportOptions" ); return st; }