1
0
forked from 0ad/0ad

Added automatic "root" prop-point to meshes from the Collada converter.

Fixed reported actor name in prop-not-found error messages.

This was SVN commit r6352.
This commit is contained in:
Ykkrosh 2008-09-09 22:30:14 +00:00
parent 4a54a2ab78
commit 4425489c12
3 changed files with 21 additions and 3 deletions

View File

@ -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);

View File

@ -104,6 +104,7 @@ public:
std::vector<VertexBlend> boneWeights;
std::vector<BoneTransform> boneTransforms;
std::vector<PropPoint> 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<PropPoint> 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<PropPoint>& 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.
*/

View File

@ -156,7 +156,7 @@ bool CObjectEntry::BuildVariation(const std::vector<std::set<CStr> >& 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<std::set<CStr> >& 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);
}
}