I feel like there are some interrelated issues that are currently blocking a really solid workflow. I can reproduce these pretty consistently, so I want to capture the process here on how to reproduce these. I would have posted sooner, but it takes some time to really type all this out with clear steps.
What seems to work
One thing that is puzzling offhand is related to the conventional way the editor would expect you to save a project. I can select Save Project As, and I can see the scene.editorproject
one level higher than the conventionally-named āsceneā
I close the editor, and I reopen the editor by double-clicking the scene.editorproject
file. So far so good. I can make a change, such a load a new material in the scene
First by dragging the textures in
Now assigning the material
I can save this, and reopen. Make changes. Save, reopen and so on. And this actually works.
What seems to not work
Now for the puzzling part. Recall earlier the scene was saved a level higher? if I choose Scene > Export Final scene and assets, the structure changes
Now the project file is in the same folder. Should I attempt to reopen this, as I did before, now I get
Error while loading project
Cannot read property forEach of undefined
In this case, I saved and opened the project I had been working on, but any project will do this that has been saved in this way.
If I click reload I get these things in the console:
Error while loading plugin "material-viewer" TypeError: Cannot read property 'on' of undefined
at MaterialsViewer.eval (viewer.ts:144)
at step (viewer.js:45)
at Object.eval [as next] (viewer.js:26)
at eval (viewer.js:20)
at new Promise (<anonymous>)
at __awaiter (viewer.js:16)
at MaterialsViewer.create (viewer.ts:103)
at Editor.eval (editor.ts:412)
at step (editor.js:32)
at Object.eval [as next] (editor.js:13)
This is the trace:
(anonymous) @ editor.ts:420
step @ editor.js:32
(anonymous) @ editor.js:13
rejected @ editor.js:5
Promise.then (async)
step @ editor.js:6
fulfilled @ editor.js:4
Promise.then (async)
step @ editor.js:6
(anonymous) @ editor.js:7
__awaiter @ editor.js:3
Editor.addEditPanelPlugin @ editor.ts:368
(anonymous) @ editor.ts:461
step @ editor.js:32
(anonymous) @ editor.js:13
fulfilled @ editor.js:4
Promise.then (async)
step @ editor.js:6
(anonymous) @ editor.js:7
__awaiter @ editor.js:3
Editor.restartPlugins @ editor.ts:454
(anonymous) @ scene-loader.ts:257
step @ scene-loader.js:32
(anonymous) @ scene-loader.js:13
fulfilled @ scene-loader.js:4
Promise.then (async)
step @ scene-loader.js:6
rejected @ scene-loader.js:5
Promise.then (async)
step @ scene-loader.js:6
fulfilled @ scene-loader.js:4
Promise.then (async)
step @ scene-loader.js:6
fulfilled @ scene-loader.js:4
Promise.then (async)
step @ scene-loader.js:6
(anonymous) @ scene-loader.js:7
__awaiter @ scene-loader.js:3
SceneLoader._OnSceneLoaded @ scene-loader.ts:159
(anonymous) @ scene-loader.ts:128
successHandler @ sceneLoader.ts:759
(anonymous) @ sceneLoader.ts:777
dataCallback @ sceneLoader.ts:388
reader.onload @ tools.ts:1113
load (async)
./Misc/tools.ts.Tools.ReadFile @ tools.ts:1111
./Loading/sceneLoader.ts.SceneLoader._loadData @ sceneLoader.ts:453
./Loading/sceneLoader.ts.SceneLoader.Append @ sceneLoader.ts:769
./Loading/sceneLoader.ts.SceneLoader.Load @ sceneLoader.ts:679
(anonymous) @ scene-loader.ts:124
step @ scene-loader.js:32
(anonymous) @ scene-loader.js:13
fulfilled @ scene-loader.js:4
Promise.then (async)
step @ scene-loader.js:6
fulfilled @ scene-loader.js:4
Promise.then (async)
step @ scene-loader.js:6
fulfilled @ scene-loader.js:4
Promise.then (async)
step @ scene-loader.js:6
fulfilled @ scene-loader.js:4
Promise.then (async)
step @ scene-loader.js:6
fulfilled @ scene-loader.js:4
Promise.then (async)
step @ scene-loader.js:6
fulfilled @ scene-loader.js:4
Promise.then (async)
step @ scene-loader.js:6
(anonymous) @ scene-loader.js:7
__awaiter @ scene-loader.js:3
SceneLoader._Prepare @ scene-loader.ts:80
SceneLoader.OnReloadingScene @ scene-loader.ts:69
(anonymous) @ editor.ts:819
./Misc/filesInput.ts.FilesInput._processReload @ filesInput.ts:248
./Misc/filesInput.ts.FilesInput.loadFiles @ filesInput.ts:229
(anonymous) @ scene-importer.ts:121
step @ scene-importer.js:32
(anonymous) @ scene-importer.js:13
fulfilled @ scene-importer.js:4
Promise.then (async)
step @ scene-importer.js:6
fulfilled @ scene-importer.js:4
Promise.then (async)
step @ scene-importer.js:6
fulfilled @ scene-importer.js:4
Promise.then (async)
step @ scene-importer.js:6
fulfilled @ scene-importer.js:4
Promise.then (async)
step @ scene-importer.js:6
(anonymous) @ scene-importer.js:7
__awaiter @ scene-importer.js:3
SceneImporter.LoadProjectFromFile @ scene-importer.ts:49
(anonymous) @ scene-importer.ts:39
step @ scene-importer.js:32
(anonymous) @ scene-importer.js:13
fulfilled @ scene-importer.js:4
Promise.then (async)
step @ scene-importer.js:6
fulfilled @ scene-importer.js:4
Promise.then (async)
step @ scene-importer.js:6
(anonymous) @ scene-importer.js:7
__awaiter @ scene-importer.js:3
SceneImporter.CheckOpenedFile @ scene-importer.ts:27
(anonymous) @ editor.ts:485
step @ editor.js:32
(anonymous) @ editor.js:13
(anonymous) @ editor.js:7
__awaiter @ editor.js:3
Editor.checkOpenedFile @ editor.ts:484
(anonymous) @ toolbar.ts:179
(anonymous) @ dialog.ts:28
(anonymous) @ w2ui.js:8623
dispatch @ jquery.js:5237
elemData.handle @ jquery.js:5044
I can see that the break is here
// Add existing textures in list
this.createList();
// Events
this.layout.element.on({ execute: 'after', type: 'resize' }, () => this.preview.engine.resize()); //HERE
this._bindEvents();
// Selected object?
this.selectedObject(this.targetObject);
Also breaks Here in the toolbar.ts file
TypeError: Cannot read property 'disable' of undefined
/**
* Sets an item enabled or disabled
* @param id the id of the item
* @param enabled if the item is enabled or not
*/
public enable (id: string, enabled: boolean): void {
if (enabled)
this.element.enable(id);
else
this.element.disable(id); //HERE
}
Also:
[.WebGL-000001FA5009E770]GL ERROR :GL_INVALID_OPERATION : glDrawArrays: bound to target 0x8893 : no buffer
2index-debug.html:1 [.WebGL-000001FA5137DAA0]RENDER WARNING: there is no texture bound to the unit 0
index-debug.html:1 WebGL: too many errors, no more errors will be reported to the console for this context.
Also this hangs:
Interestingly I can still use the editor, but if I make further changes they will not always be persisted. Sometimes yes, sometimes no.
Now another workflow, here Iām trying to export the template. Like the Scene export, the editor file is inside a folder that was conventionally named scene. This is a little different though because with `Export Final Scene and assets it dumps the whole lot in the actual folder you selected.
So this is really a third way that the editor saves things. The fact there were so many options in these menus was confusing to me. Should it be nested? will it dump all in a folder? make a subfolder conventionally named āsceneā? Apparently āit dependsā what you pick.
Ok so with this special kind of export, you can run this as a standalone web appā¦
I can use yarn install && yarn build && yarn run webserver
This works:
However, I can see that there is a build that is a little different than I would expect. There are no assets in here. This is a build, but it is not truly a production build, I assume. The typescript is compiled but I would have expected a build folder with scenes in it, so that I could deploy only the build folder to gh-pages. In order to make this a production build can I simply ācopyā the index and the scene folders over?
Regardless, the same problem here as beforeā¦ if I close the project and reopen it, I get:
Also if I try to use 'export final scene and assetsā¦ sometimes it works, but sometimes I get something like:"
here the app is hung upā¦
I get two errors in the console:
Uncaught (in promise) TypeError: Cannot read property 'name' of null
at preview.html:101
Also this:
Uncaught (in promise) TypeError: Converting circular structure to JSON
at JSON.stringify (<anonymous>)
at Function.SceneExporter.CreateFiles (build/src/editor/scene/scene-exporter.js:38)
at Function.eval (build/src/editor/project/project-exporter.js:87)
at step (build/src/editor/project/project-exporter.js:32)
at Object.eval [as next] (build/src/editor/project/project-exporter.js:13)
at eval (build/src/editor/project/project-exporter.js:7)
at new Promise (<anonymous>)
at __awaiter (build/src/editor/project/project-exporter.js:3)
at Window.window.onButtonClick (build/src/editor/project/project-exporter.js:74)
at HTMLButtonElement.eval (build/src/editor/gui/window.js:109)
This is on this line in the scene-exporter.ts
file:
this._ClearMetadatas(serializedScene.sounds);
this._ClearMetadatas([serializedScene]);
// Scene "File"
if (format === 'babylon') {
///HERE
editor.sceneFile = Tools.CreateFile(Tools.ConvertStringToUInt8Array(JSON.stringify(serializedScene)), 'scene' + this._LastRandomId + '.babylon');
FilesInputStore.FilesToLoad[editor.sceneFile.name] = editor.sceneFile;
}
// Gui
editor.guiFiles = [];
editor.core.uiTextures.forEach(ut => {
const serializedGui = ut.serialize();
if I try to avoid this approach, and like use the other thing that works in tandem with the templated exportā¦ I get different results:
Iāll start with a fresh templated project. Now I know in this situation, because its nested one level deep, my ONE scene must be called scene
and the editor file sits one level higher.
so first I template:
And then I save project as, I select the root because I will override the scene folder.
I delete the previous editor project, because Iām relying on the one a level up now but I get:
Error while loading project
Cannot read property 'parentId' of null
Now if I try to save anything it does not keep my changes, it reverts back to the default project.