najadojo / gltf-import-export Goto Github PK
View Code? Open in Web Editor NEWConvert between GLB and GLTF files.
License: MIT License
Convert between GLB and GLTF files.
License: MIT License
Hi
I was trying this exporter out, but it seems that it doesn't have typings module for Typescript. When I did npm install --save-dev @types/gltf-import-export
I got a 404 not found.
Are there any plans on making one available?
Thanks in advance.
Kind regards
Whenever I use this model : tree.zip
The material on it isn't converted and does not show up in the gltf file. Using an online service to convert the glb to gltf, i noticed that the file uses two extensions :
"extensionsUsed": [
"KHR_materials_volume",
"FB_ngon_encoding"
],
And the material shows up correctly
"materials": [
{
"name": "material"
}
],
Any idea why ? :D
I am a noob. Can someone help me with this?
First: the script is named ZZZZZZZZZZZZZ.js, so I can find it more easily.
When I do:
node .\ZZZZZZZZZZZZZZZZ.js
I get:
SyntaxError: Cannot use import statement outside a module
(node:13604) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
D:\HASHLIPS NFT NFT NFT NFT\Hbargutangs XXXXXXX - Beta prkt\gltf-import-export-master\ZZZZZZZZZZZZZZZZ.js:3
import { ConvertGLBtoGltf, ConvertGltfToGLB, ConvertToGLB} from 'gltf-import-export';
^^^^^^
using .mjs on index.js
doesn't change anything. Doing "type":"module" in .json is not relevant. What to do?
when i used this tools in nodejs +vuejs ,it has accured a mistake ,it show that fs.readFileSync is not a function
when i find the problem in the code file exportProvider.js, the fs modules has not installed.
could u give me some sugestion
First off: Thanks for making this available!
I am able to clone the repo and build the project using "npm i" and then "npm run build", which produces a dist folder full of js and map files, but I don't see how to generate and/or run the command line tool. Do you have any hints on how to proceed?
Hi @najadojo, hope you're doing well! Here's a suggestion from @rawnsley and Mozilla Hubs.
During GLB to GLTF conversion, it might be good to preserve the mimeType
field, at least for types that are unknown to the guessFileExtension
function. This would enable RGBE environment maps that Hubs has an extension for. Even if these files got a .bin
extension, they would have a MIME type applied.
You describe the 2 functions in the readme, but I think you mixed up the function names that begin the 2 paragraphs.
Issue KhronosGroup/glTF-Blender-IO#61 talks about Blender exporting GLBs with base64-encoded data URIs in the JSON part. This doesn't strike me as the ideal way to structure a GLB, but, it looks like the glTF ecosystem may have some number of these in the wild already.
It looks like the GLB importer here fails to load these, producing an empty .bin
file and "byteLength": 0
in the resulting glTF.
Sample model from that issue: glb_cubes.zip (use _io_2_79_cube.glb
)
Converting some GLTF file to GLB results in an error.
The GLTF file is the output of COLLADA2GLTF.
The original DAE file is the output of Maya.
See below:
D:\projectDir> COLLADA2GLTF-bin.exe -i "D:\projectDir\coco-low-sofa-ottoman.dae" -o "D:\projectDir\coco-low-sofa-ottoman.gltf" -v 2.0
Converting D:\projectDir\coco-low-sofa-ottoman.dae -> D:\projectDir\coco-low-sofa-ottoman.gltf
Time: 87 ms
D:\projectDir> gltf-import-export D:\projectDir\coco-low-sofa-ottoman.gltf
D:\projectDir\node_modules\gltf-import-export\dist\exportProvider.js:130
for (; bufferIndex < gltf.buffers.length; bufferIndex++) {
^
TypeError: Cannot read property 'length' of undefined
at ConvertToGLB (D:\projectDir\node_modules\gltf-import-export\dist\exportProvider.js:130:39)
at Object.ConvertGltfToGLB (D:\projectDir\node_modules\gltf-import-export\dist\exportProvider.js:109:5)
at Object.<anonymous> (D:\projectDir\node_modules\gltf-import-export\dist\tool.js:31:13)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
D:\projectDir>
Versions:
Hi @najadojo, looks like the glTF 2-cylinder engine sample model got accidentally published with the last npm release.
The npm 1.0.18 release was 52kb, and the npm 1.0.19 release is 1.89 MB. The size difference is a new file "2c.glb" that looks to be one of the sample models.
Not a big deal, but would be nice to recover the space in a future version.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.