diff --git a/source/collada/DLL.h b/source/collada/DLL.h index 3b01b067f3..63eafe717b 100644 --- a/source/collada/DLL.h +++ b/source/collada/DLL.h @@ -22,7 +22,9 @@ typedef void (*LogFn) (int severity, const char* text); typedef void (*OutputFn) (void* cb_data, const char* data, unsigned int length); -#define COLLADA_CONVERTER_VERSION 1 +/* This version number should be bumped whenever incompatible changes + * are made, to invalidate old caches. */ +#define COLLADA_CONVERTER_VERSION 2 EXPORT void set_logger(LogFn logger); EXPORT int set_skeleton_definitions(const char* xml, int length); diff --git a/source/collada/PMDConvert.cpp b/source/collada/PMDConvert.cpp index f89f3fff8c..2833f15eeb 100644 --- a/source/collada/PMDConvert.cpp +++ b/source/collada/PMDConvert.cpp @@ -104,6 +104,7 @@ public: std::vector boneWeights; std::vector boneTransforms; std::vector propPoints; + AddDefaultPropPoints(propPoints); WritePMD(output, indicesCombined, indicesCombinedCount, dataPosition, dataNormal, dataTexcoord, vertexCount, boneWeights, boneTransforms, propPoints); } @@ -244,6 +245,7 @@ public: // standard bone, and whose name begins with "prop-". std::vector propPoints; + AddDefaultPropPoints(propPoints); for (size_t i = 0; i < jointCount; ++i) { @@ -328,6 +330,20 @@ public: } + /** + * Adds the default "root" prop-point. + */ + static void AddDefaultPropPoints(std::vector& propPoints) + { + PropPoint root; + root.name = "root"; + root.translation[0] = root.translation[1] = root.translation[2] = 0.0f; + root.orientation[0] = root.orientation[1] = root.orientation[2] = 0.0f; + root.orientation[3] = 1.0f; + root.bone = 0xFF; + propPoints.push_back(root); + } + /** * Writes the model data in the PMD format. */ diff --git a/source/graphics/ObjectEntry.cpp b/source/graphics/ObjectEntry.cpp index 1b2959320c..0e3f54e6eb 100644 --- a/source/graphics/ObjectEntry.cpp +++ b/source/graphics/ObjectEntry.cpp @@ -156,7 +156,7 @@ bool CObjectEntry::BuildVariation(const std::vector >& selections m_AmmunitionModel = oe->m_Model; m_AmmunitionPoint = modeldef->FindPropPoint((const char*)ppn ); if (! m_AmmunitionPoint) - LOG(CLogger::Error, LOG_CATEGORY, "Failed to find matching prop point called \"%s\" in model \"%s\" on actor \"%s\"", (const char*)ppn, (const char*)m_ModelName, (const char*)prop.m_ModelName); + LOG(CLogger::Error, LOG_CATEGORY, "Failed to find matching prop point called \"%s\" in model \"%s\" for actor \"%s\"", (const char*)ppn, (const char*)m_ModelName, (const char*)m_Base->m_Name); } else { @@ -168,7 +168,7 @@ bool CObjectEntry::BuildVariation(const std::vector >& selections propmodel->SetAnimation(oe->GetRandomAnimation("idle")); } else - LOG(CLogger::Error, LOG_CATEGORY, "Failed to find matching prop point called \"%s\" in model \"%s\" on actor \"%s\"", (const char*)prop.m_PropPointName, (const char*)m_ModelName, (const char*)prop.m_ModelName); + LOG(CLogger::Error, LOG_CATEGORY, "Failed to find matching prop point called \"%s\" in model \"%s\" for actor \"%s\"", (const char*)prop.m_PropPointName, (const char*)m_ModelName, (const char*)m_Base->m_Name); } }