Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'isTTY' of undefined #11

Closed
hamogu opened this issue Jun 23, 2016 · 9 comments
Closed

Cannot read property 'isTTY' of undefined #11

hamogu opened this issue Jun 23, 2016 · 9 comments

Comments

@hamogu
Copy link

hamogu commented Jun 23, 2016

melkor:/melkor/d1/guenther/projects/threejs/OBJ2GLTF> node bin/obj2gltf.js ../obj/test5.obj ../obj/test5.gltf

readline.js:74
    terminal = !!output.isTTY;
                       ^
TypeError: Cannot read property 'isTTY' of undefined
    at new Interface (readline.js:74:24)
    at Object.exports.createInterface (readline.js:40:10)
    at getObjInfo (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/lib/obj.js:310:27)
    at parseObj (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/lib/obj.js:17:5)
    at convert (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/lib/convert.js:36:5)
    at Object.<anonymous> (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/bin/obj2gltf.js:35:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
@lilleyse
Copy link
Contributor

Hi, I made some changes to the file reader, can you run the latest code and tell me if it works for you?

@hamogu
Copy link
Author

hamogu commented Jun 24, 2016

Now I get

melkor:/melkor/d1/guenther/projects/threejs/OBJ2GLTF> node bin/obj2gltf.js ../obj/test5.obj ../obj/test5.gltf

buffer.js:803
  this.parent.writeFloatLE(value, this.offset + offset, !!noAssert);
              ^
TypeError: value not a number
    at Buffer.writeFloatLE (buffer.js:803:15)
    at createGltf (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/lib/gltf.js:69:16)
    at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/lib/convert.js:37:9
    at LineStream.<anonymous> (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/lib/obj.js:224:9)
    at LineStream.emit (events.js:117:20)
    at _stream_readable.js:944:16
    at process._tickCallback (node.js:448:13)

@hamogu
Copy link
Author

hamogu commented Jun 24, 2016

I've tried a different OBJ file and found this:

/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/findAccessorMinMax.js:17
    var min = new Array(numberOfComponents).fill(Number.POSITIVE_INFINITY);
                                            ^
TypeError: Object  has no method 'fill'
    at findAccessorMinMax (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/findAccessorMinMax.js:17:45)
    at accessorDefaults (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/addDefaults.js:24:30)
    at addDefaults (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/addDefaults.js:561:5)
    at processJSONWithExtras (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/gltfPipeline.js:57:5)
    at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/gltfPipeline.js:115:9
    at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/loadGltfUris.js:36:9
    at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/async/lib/async.js:52:16
    at done (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/async/lib/async.js:246:17)
    at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/async/lib/async.js:44:16
    at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/loadGltfUris.js:119:17

I'll past the OBJ file here so you can try it out yourself:

mtllib /melkor/d1/guenther/projects/threejs/obj/test3.mtl

v 10 10 10
v 20 20 20
v 0 0 0 
v 0 -51.2692 269.668

g grp1
usemtl mtl1
l 1 2 3 4 
f 1
f 2
f 3
f 4

@hamogu
Copy link
Author

hamogu commented Jun 24, 2016

Thank you so much for your quick responses!

@lilleyse
Copy link
Contributor

For the example you posted we don't support line segments like l 1 2 3 4 right now. Rearranging your example a bit works, but it may not be exactly what you want:

mtllib /melkor/d1/guenther/projects/threejs/obj/test3.mtl

v 10 10 10
v 20 20 20
v 0 0 0 
v 0 -51.2692 269.668

g grp1
usemtl mtl1
f 1 2 3 4

Can you also send over your other obj?

/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/findAccessorMinMax.js:17
var min = new Array(numberOfComponents).fill(Number.POSITIVE_INFINITY);
^
TypeError: Object has no method 'fill'

What version of Node do you have installed? Updating may fix that problem.

@hamogu
Copy link
Author

hamogu commented Jun 24, 2016

The other file is a lot bigger (> 15 MB), and it also contains line line segments, so that's probably a related error.
I'm visualizing a ray-trace simulation for a scientific instrument and rays are lines, so I cannot really do without lines. I'll try to work directly with the OBJ format for now, but I'll keep your converter in mind and come back to it later if I have the opportunity!

melkor:/melkor/d1/guenther/projects/threejs/OBJ2GLTF> node --version
v0.10.42
(I'm using CentOS and that's the version I get through my package manager.)

@hamogu hamogu closed this as completed Jun 24, 2016
@lilleyse
Copy link
Contributor

Ok, thanks for all the info. Adding support for line segments shouldn't be too bad and I'll update this issue when it's ready.

@zhanfenghai
Copy link

@lilleyse hi,i got the same error. i tried to read a file like xx.html.
here is my code
image

@lilleyse
Copy link
Contributor

lilleyse commented Jan 9, 2017

obj2gltf isn't using the readline package anymore, you should investigate with them instead. You could also check out the byline package which seems to be very solid so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants