Hello. Thanks for the reply!
Sorry if I wasn't clear enough. We have a working importer already, but the requirement to import skeletal meshes from C4D files is a new one. I'm certain that most of the code in the importer is good already, since it's not a new thing and only skeletal meshes are causing us trouble. Also, we always check for the presence of caches. That's why I went straight to something that looked odd to me.
I was comparing everything (bind pose matrices, keyframes, etc.) to our FBX importer which has always supported skeletal meshes. After we convert the C4D data to our own coordinate spaces, the values read from the FBX and the C4D files are almost identical. Bind pose matrices and final keyframe transforms match closely. The only thing that appears to be significantly different is the vertex data.
I don't think I can share the complex models, but I have a simpler one that we made just for testing. Please excuse the programmer "art" , but it's simple and still shows what I mean. We imported an FBX to C4D and exported the file again. Both as an FBX and as a C4D file. I'm attaching the C4D file.
Spike_new.c4d
I've also saved the vertices right after import to OBJ files. These are pre-converted to our own coordinate spaces, but, other than some axis flips or swaps, there should be no additional transforms on top of this vertex data. I'm attaching those OBJs as well.
obj_vertices.zip
As you can see, with the FBX import, I get the vertices in the bind pose. With the C4D import, I get an already deformed object.
To read the vertices, we use a function that overrides PolygonObjectData::Execute()
. Inside it, we just access the vertex data through these functions (after a bunch of asserts and checks):
PolygonObject *op = static_cast<PolygonObject*>(bo);
const Vector *vertices = op->GetPointR();
Int32 vertexCount = op->GetPointCount();
const CPolygon *polygonIndices = op->GetPolygonR();
Int32 polygonCount = op->GetPolygonCount();
The rest is just regular vertex data reading, followed by some coordinate space changes. I'm not seeing any transforms being applied on our end.
Any ideas how to solve this would be greatly appreciated! Thanks!