Skip to content

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

@Hudi304

Description

@Hudi304
  • three version: ^0.167.1
  • @types/three version - : @types/three@0.167.2
  • three-stdlib version: three-stdlib@2.35.14

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) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions