Adding html elements to PlayGround

I need to add an html input type file element to a playground I need for demonstrative purposes, actually a question of mine in this forum, for people that want to help me with my question.

I need to import a model file from my computer to the PG scene. For this I need an html input file element in PG. How can I add one?

This gives the basics Babylon.js Playground

2 Likes

Need insight in how to add files from my computer to PG. I have added an inout type file. I am using BABYLON.SceneLoader.AppendAsync in input handler with the event.target.files[0] and “” as rootUrl but it makes an http request and naturally gets an http 404.
What am I missing?

Need CORs compliant https Using External Assets - Babylon.js Documentation

By the way unless an issue is very specific to your file you can load models directly available to the PG Available Meshes to Import - Babylon.js Documentation

1 Like

Since this PG setup for another question of mine about animations lost in exporting I need some animated models.

So no local files in PG, actually I can use the existing ones, just outof curiosity?

True - no local files

There are animated files available eg https://www.babylonjs-playground.com/#J62R3F#1

On the available meshes page scroll down and click on an eye to see which animate

Actually ı have created a PG with one of th eanimated files, Alien. However I have exported it, downloaded, and imported in the application I am building and it is no more animating again.
Is an extra funciton necessary to activate the animations or they are lost altogether.?
Or do I need to pass an extra option to the gltf exporter to preserve the animations?
In my local app I do not see the Animation groups list I see in my PG.

Sorry this one is beyond my skill level perhaps you would be better off asking this in the thread you started about this issue Animations lost when exported with GLTF2Export.GLBAsync and ping bghgary.

When you say you exported and downloaded the alien file I am not sure how you did that, you can find the full alien folder here Babylon.js/Playground/scenes at master · BabylonJS/Babylon.js · GitHub

If you downloaded from here and you checked all the relevant files were saved it wasn’t working then I go back to my first suggestion.

PG

I have used the GLTF2Export.GLTFAsync(scene, "alien-animated"). It is in my PG above.

Does it match with the original on the github playground link I posted? If it does then I do not know how to solve it.

Yes. I got it from github, then imported into above mentioned PG and exported it with the code above. Then imported to another BJS scene which is my app, but animations are gone this time. Also when I download and import the github models to my BSJ scene they also work. Something happens when I run export methods. Animation groups in scene explorer is also lost.

To repro a PG for local files were necessary for that. But I think I can puıt up it into my github and import from there too.
I am moving those discussions to the original post on this issue.
Thanks a lot for your answer and other help.