Importing CSV does not work correctly after exporting


If you want the cost, I will definitely pay for your effort.
This is really urgent.
As you can see here, importing CSV works correctly.
But after once exporting, it imports broken pose from the parameters of CSV.
Only pose 0 CSV works correctly. Maybe, it was used a default mesh.

This is my exporting function.

document.getElementById(“export-btn”).addEventListener(“click”, function () {
scene.traverse(function (object) {
if (!object.isSkinnedMesh) return;
if (object.geometry.isBufferGeometry !== true) throw new error(‘only buffergeometry supported.’);
if (object.geometry.morphAttributes && Object.keys(object.geometry.morphAttributes).length > 0) {
}

    let filtered_blends = initialBlends.filter(blend => object.name === blend.name);
    if (filtered_blends.length > 0) {
      let influences = filtered_blends[0].value;
      for (let i = 0; i < influences.length; i++) {
        object.morphTargetInfluences[i] = influences[i];
      }
    }

    object.skeleton.bones.forEach(bone => {
      let filtered = initialRotations.filter(rot => {
        return rot.name == bone.name
      })
      if (filtered.length > 0) {
        console.log(bone.name)
        console.log(bone.rotation)
        console.log(filtered[0])
        bone.rotation.x = filtered[0].rx;
        bone.rotation.y = filtered[0].ry;
        bone.rotation.z = filtered[0].rz;
        bone.position.x = filtered[0].px;
        bone.position.y = filtered[0].py;
        bone.position.z = filtered[0].pz;         
      }
      else {
        bone.rotation.set(0, 0, 0)
      }
    });

    var positionattribute = object.geometry.getAttribute('position');
    var normalattribute = object.geometry.getAttribute('normal');
    var v1 = new Vector3();
    for (var j = 0; j < positionattribute.count; j++) {
      object.boneTransform(j, v1);
      // object.getVertexPosition(j, v1);
      positionattribute.setXYZ(j, v1.x, v1.y, v1.z);
      getBoneNormalTransform.call(object, j, v1);
      normalattribute.setXYZ(j, v1.x, v1.y, v1.z);
    }
    positionattribute.needsUpdate = true;
    normalattribute.needsUpdate = true;
  });

  // Create a new OBJExporter
  var exporter = new OBJExporter();

  // Export the updated scene
  const result = exporter.parse(scene);
  const blob = new Blob([result], { type: "text/plain" });
  const link = document.createElement("a");
  link.href = URL.createObjectURL(blob);
  link.download = "exported_model.obj";
  link.click();      
});

Sincerely hope your help.

I don’t think OBJ format supports morph targets?
You might want to export as GLTF instead?