pmndrs / pmndrs/three-stdlib

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

Open
#412 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
858
Forks
144
PR merge metrics
No merged PRs in 30d

Description

  • 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) 

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/exporters/OBJExporter.ts at parseLine and reproduce the error with a THREE.Line. Check the geometry-type guard against the reported behavior, then confirm that exporting the line completes without throwing.

Written by the indexing model from the issue text.

Assessment

Tech stack
three.js, typescript
Domain
computer-graphics
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.