void ColladaScene::ExportAnimations(ColladaAnimation * colladaAnimation, FCDSceneNode * currentNode, float32 anStart, float32 anEnd) { ColladaSceneNode * node = rootNode->FindNode(currentNode->GetDaeId()); if (node) { //printf("- founded equal node: %s", currentNode->GetDaeId().c_str()); SceneNodeAnimation * anim = ColladaSceneNode::ExportNodeAnimation(currentNode, anStart, anEnd, 30.0f); if (anim) colladaAnimation->animations[node] = anim; } for (int i = 0; i < (int)currentNode->GetChildrenCount(); i++) { FCDSceneNode * childNode = currentNode->GetChild(i); ExportAnimations(colladaAnimation, childNode, anStart, anEnd); } }
static void ExportMeshLod(ExportContext& Context, const CBaseMeshLod& Lod, const CMeshVertex* Verts, FArchive& Ar, FArchive& Ar2) { guard(ExportMeshLod); // Opening brace Ar.Printf("{\n"); // Asset Ar.Printf( " \"asset\" : {\n" " \"generator\" : \"UE Viewer (umodel) build %s\",\n" " \"version\" : \"2.0\"\n" " },\n", STR(GIT_REVISION)); // Scene Ar.Printf( " \"scene\" : 0,\n" " \"scenes\" : [\n" " {\n" " \"nodes\" : [ 0 ]\n" " }\n" " ],\n" ); // Nodes if (!Context.IsSkeletal()) { Ar.Printf( " \"nodes\" : [\n" " {\n" " \"name\" : \"%s\",\n" " \"mesh\" : 0\n" " }\n" " ],\n", Context.MeshName ); } else { ExportSkinData(Context, static_cast<const CSkelMeshLod&>(Lod), Ar); } // Materials Ar.Printf(" \"materials\" : [\n"); for (int i = 0; i < Lod.Sections.Num(); i++) { ExportMaterial(Lod.Sections[i].Material, Ar, i, i == Lod.Sections.Num() - 1); } Ar.Printf(" ],\n"); // Meshes Ar.Printf( " \"meshes\" : [\n" " {\n" " \"primitives\" : [\n" ); for (int i = 0; i < Lod.Sections.Num(); i++) { ExportSection(Context, Lod, Verts, i, Ar); } Ar.Printf( " ],\n" " \"name\" : \"%s\"\n" " }\n" " ],\n", Context.MeshName ); // Write animations if (Context.IsSkeletal() && Context.SkelMesh->Anim) { ExportAnimations(Context, Ar); } // Write buffers int bufferLength = 0; for (int i = 0; i < Context.Data.Num(); i++) { bufferLength += Context.Data[i].DataSize; } Ar.Printf( " \"buffers\" : [\n" " {\n" " \"uri\" : \"%s.bin\",\n" " \"byteLength\" : %d\n" " }\n" " ],\n", Context.MeshName, bufferLength ); // Write bufferViews Ar.Printf( " \"bufferViews\" : [\n" ); int bufferOffset = 0; for (int i = 0; i < Context.Data.Num(); i++) { const BufferData& B = Context.Data[i]; Ar.Printf( " {\n" " \"buffer\" : 0,\n" " \"byteOffset\" : %d,\n" " \"byteLength\" : %d\n" " }%s\n", bufferOffset, B.DataSize, i == (Context.Data.Num()-1) ? "" : "," ); bufferOffset += B.DataSize; } Ar.Printf( " ],\n" ); // Write accessors Ar.Printf( " \"accessors\" : [\n" ); for (int i = 0; i < Context.Data.Num(); i++) { const BufferData& B = Context.Data[i]; Ar.Printf( " {\n" " \"bufferView\" : %d,\n", i ); if (B.bNormalized) { Ar.Printf(" \"normalized\" : true,\n"); } if (B.BoundsMin.Len()) { Ar.Printf( " \"min\" : %s,\n" " \"max\" : %s,\n", *B.BoundsMin, *B.BoundsMax ); } Ar.Printf( " \"componentType\" : %d,\n" " \"count\" : %d,\n" " \"type\" : \"%s\"\n" " }%s\n", B.ComponentType, B.Count, B.Type, i == (Context.Data.Num()-1) ? "" : "," ); } Ar.Printf( " ]\n" ); // Write binary data guard(WriteBIN); for (int i = 0; i < Context.Data.Num(); i++) { const BufferData& B = Context.Data[i]; #if MAX_DEBUG assert(B.FillCount == B.Count); #endif Ar2.Serialize(B.Data, B.DataSize); } unguard; // Closing brace Ar.Printf("}\n"); unguard; }
void EET::ExportAnimations(void) const { ExportAnimations(animations, ""); ExportAnimations(displacement_animations, "_DISPLACEMENT"); }