BabylonJS / Editor

Community managed visual editor for Babylon.js
http://editor.babylonjs.com/
815 stars 232 forks source link

Run in Editor is not the same as Run in Integrated Browser #373

Open eherozhao opened 2 years ago

eherozhao commented 2 years ago

I found the animation in the script added into the asset didn't work well when running in Editor but it worked well in Integrated Browser and even Run In My Browser (HTTP). I didn't find differences between these run after diving deep into the codebase. Is there anything I missed?

eherozhao commented 2 years ago

Meanwhile, after building the project, the imported assets was not fully copied/pasted into scenes/_assets path. All animation file were not pasted. Is this intended? How should I make it work programmatically? Thank you!

julien-moreau commented 2 years ago

Hi @eherozhao ! This not intended ! What is the format of the animation file? JSON?

eherozhao commented 2 years ago

@julien-moreau Nope. glb. The asset we used is this one. I was hosting the scene by uploading the scenes, dist and index.html file to remote server and the result is the same as Run in Editor which the animation was failing to work.

julien-moreau commented 2 years ago

@eherozhao if I understand correctly, you'd like to have all files available in the assets folder available in the _assets folder. Do you confirm?

eherozhao commented 2 years ago

@julien-moreau Yes! I am not sure why Run in Integrated Browser works well but Run in Editor fails with the broken link to assets path.

julien-moreau commented 2 years ago

It works in editor because the browsed assets folder is the assets folder at the root instead of the scenes/_assets. I'm working on a solution right now

eherozhao commented 2 years ago

If I upload the whole project with the assets folder into remote server, the animation works well. However, based on my understanding, the smallest scope of making a scene work in a server is only scenes, dist and index.html so if I can only upload these folders and file and make it work, that will be the most efficient way.

julien-moreau commented 2 years ago

I agree, the goal is to keep the assets folder only in the development project

eherozhao commented 2 years ago

Yep! Do you have any idea about how to optimize the process? Probably need to do some changes to the asset management?

julien-moreau commented 2 years ago

Exact, but the philosophy here was to not copy the entire assets folder, only assets that are used in the project and only re-usable assets like textures, sounds, etc.

We should find a way to say "I want this asset to be available as-is in my project"

eherozhao commented 2 years ago

You are right! That's what I am thinking about. How should we let Editor know which assets are available? Using a cache once saving?

eherozhao commented 2 years ago

It works in editor because the browsed assets folder is the assets folder at the root instead of the scenes/_assets. I'm working on a solution right now

To clarify, what issue was this solution aimed at? The Run in Editor is not the same as Run in Integrated Browser one? Will this solution include any fix about only assets that are used in the project and only re-usable assets like textures, sounds, etc. you mentioned?

julien-moreau commented 1 year ago

@eherozhao all gltf/glb files are now copied in the assets output folder. I still have to add a way to tag assets "I want it to be copied"