From 58a72d93026b924ba9f23b5d65b01da8e9627bbd Mon Sep 17 00:00:00 2001 From: Madrich Date: Fri, 1 May 2015 22:19:40 +0200 Subject: [PATCH] Fix Warnings Add Time in Step File --- code/ProcessHelper.cpp | 2 +- code/StepExporter.cpp | 13 +++++++------ code/XFileExporter.cpp | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/code/ProcessHelper.cpp b/code/ProcessHelper.cpp index a3c0cad09..0bde4be93 100644 --- a/code/ProcessHelper.cpp +++ b/code/ProcessHelper.cpp @@ -99,7 +99,7 @@ void FindSceneCenter (aiScene* scene, aiVector3D& out, aiVector3D& min, aiVector { if (scene->mNumMeshes == 0) return; FindMeshCenter(scene->mMeshes[0], out, min, max); - for (int i = 1; i < scene->mNumMeshes; ++i) + for (unsigned int i = 1; i < scene->mNumMeshes; ++i) { aiVector3D tout, tmin, tmax; FindMeshCenter(scene->mMeshes[i], tout, tmin, tmax); diff --git a/code/StepExporter.cpp b/code/StepExporter.cpp index fa970d4f7..e609ae821 100644 --- a/code/StepExporter.cpp +++ b/code/StepExporter.cpp @@ -150,8 +150,6 @@ StepExporter::StepExporter(const aiScene* pScene, IOSystem* pIOSystem, const std // make sure that all formatting happens using the standard, C locale and not the user's current locale mOutput.imbue( std::locale("C") ); - mFile = std::string(file); - mPath = std::string(path); mScene = pScene; mSceneOwned = false; @@ -182,9 +180,7 @@ void StepExporter::WriteFile() // note, that all realnumber values must be comma separated in x files mOutput.setf(std::ios::fixed); mOutput.precision(16); // precission for double - - aiMatrix4x4 baseTransform = mScene->mRootNode->mTransformation; - + int ind = 100; // the start index to be used int faceEntryLen = 30; // number of entries for a triangle/face // prepare unique (count triangles and vertices) @@ -212,11 +208,16 @@ void StepExporter::WriteFile() } } + static const unsigned int date_nb_chars = 20; + char date_str[date_nb_chars]; + std::time_t date = std::time(NULL); + std::strftime(date_str, date_nb_chars, "%Y-%m-%dT%H:%M:%S", std::localtime(&date)); + // write the header mOutput << "ISO-10303-21" << endstr; mOutput << "HEADER" << endstr; mOutput << "FILE_DESCRIPTION(('STEP AP214'),'1')" << endstr; - mOutput << "FILE_NAME('" << mFile << ".stp','2015-04-23T09:26:41',(' '),(' '),'Spatial InterOp 3D',' ',' ')" << endstr; + mOutput << "FILE_NAME('" << mFile << ".stp','" << date_str << "',(' '),(' '),'Spatial InterOp 3D',' ',' ')" << endstr; mOutput << "FILE_SCHEMA(('automotive_design'))" << endstr; mOutput << "ENDSEC" << endstr; diff --git a/code/XFileExporter.cpp b/code/XFileExporter.cpp index a4ab68746..002f5a8df 100644 --- a/code/XFileExporter.cpp +++ b/code/XFileExporter.cpp @@ -111,7 +111,7 @@ XFileExporter::XFileExporter(const aiScene* pScene, IOSystem* pIOSystem, const s mSceneOwned = false; // set up strings - endstr = "\n"; + endstr = "\n"; // start writing WriteFile(); @@ -509,7 +509,7 @@ std::string XFileExporter::toXFileString(aiString &name) { std::string pref = "NN_"; // node name prefix to prevent unexpected start of string std::string str = pref + std::string(name.C_Str()); - for (int i=0; i= 48 && str[i] <= 57) || // 0-9 (str[i] >= 65 && str[i] <= 90) || // A-Z