three-stdlib icon indicating copy to clipboard operation
three-stdlib copied to clipboard

ObjExporter throws Error for any THREE.Line<BufferGeometry> passed to it.

Open Hudi304 opened this issue 8 months ago • 0 comments

Problem description:

I was trying to export some THREE.Line<BufferGeometry> objects and the exporter throws THREE.OBJExporter: Geometry is not of type THREE.BufferGeometry. I checked and rechecked my code it looks absolutely fine (works fine with meshes, didn't try points).

Relevant code:

https://github.com/pmndrs/three-stdlib/blob/main/src/exporters/OBJExporter.ts

  private parseLine(line: Line): void {
    let nbVertex = 0

    const geometry = line.geometry
    const type = line.type

    if (geometry.isBufferGeometry) {
      throw new Error('THREE.OBJExporter: Geometry is not of type THREE.BufferGeometry.')
    }
...
}

Suggested solution:

I believe this condition needs to be negated.

  if (geometry.isBufferGeometry) 

Hudi304 avatar Mar 13 '25 09:03 Hudi304