ThatOpen / engine_components

MIT License
349 stars 134 forks source link

"UIManager hasn't been initialised" in 1.1.7 version #194

Closed TristanLecallier closed 11 months ago

TristanLecallier commented 12 months ago

Describe the bug ๐Ÿ“

since I updated OBC from 1.1.5 to 1.1.7., I have the following error "UIManager hasn't been initialised". It happens when I create LengthMeasurement components. Yet I disabled ui (because I'm using my own) with : this.components.uiEnabled = false;

After a deeper investigation, it seems that the issue raises inside VertexPicker Class in setupEvents function (here : https://github.com/IFCjs/components/blob/main/src/utils/VertexPicker/index.ts#L164 )

Reproduction โ–ถ๏ธ

No response

Steps to reproduce ๐Ÿ”ข

` this.components = new OBC.Components(); const sceneComponent = new OBC.SimpleScene(this.components); const scene = sceneComponent.get();

this.components.scene = sceneComponent;
this.postProdRenderer = new OBC.PostproductionRenderer(
  this.components,
  container
);
this.components.renderer = this.postProdRenderer;
this.components.uiEnabled = false;

this.cameraComponent = new OBC.OrthoPerspectiveCamera(this.components);
this.components.camera = this.cameraComponent;
this.components.raycaster = new OBC.SimpleRaycaster(this.components);
this.components.init();

this.lengthDimension = new OBC.LengthMeasurement(this.components);
this.lengthDimension.snapDistance = 1; `

System Info ๐Ÿ’ป

`"openbim-components": "^1.1.7"`

Used Package Manager ๐Ÿ“ฆ

npm

Error Trace/Logs ๐Ÿ“ƒ

No response

Validations โœ…

HoyosJuan commented 12 months ago

Hi @TristanLecallier!

Could you please update to 1.1.9 and tell us if the error continues?

TristanLecallier commented 12 months ago

Hi @HoyosJuan ! After the update, I still have the error...

HoyosJuan commented 12 months ago

Ok @TristanLecallier! Got you covered ๐Ÿ™‚ will let you know when it's fixed.

HoyosJuan commented 11 months ago

Hey @TristanLecallier! I just solved this in PR https://github.com/IFCjs/components/pull/199. We need to wait until this gets published as a new patch in NPM along with other bugs I'm solving. Thanks!

TristanLecallier commented 11 months ago

Hi @HoyosJuan I think there was an oversight in the PR : the viewer container is still taken from the UI Manager in LengthMeasurement component, here : https://github.com/IFCjs/components/blob/a8472b228f955fd03a9c1e16d05d46106f496466/src/measurement/LengthMeasurement/index.ts#L304C4-L304C64

TristanLecallier commented 11 months ago

Also with FragmentPlans component : https://github.com/IFCjs/components/blob/a8472b228f955fd03a9c1e16d05d46106f496466/src/fragments/FragmentPlans/index.ts#L165

The "add" method will create a ui.Button whereas ui is disabled.

tb-viktor commented 10 months ago

@HoyosJuan

This also happens now with the FragmentIfcLoader. We don't have the UI declared anywhere, but still get a crash.

image

The line it crashes on is: const ifcLoader = new OBC.FragmentIfcLoader(newComponents);

In 1.1.0 it worked fine.

TristanLecallier commented 10 months ago

@tb-viktor have you put newComponents.uiEnabled = false; ? before calling const ifcLoader = new OBC.FragmentIfcLoader(newComponents);

tb-viktor commented 10 months ago

@tb-viktor have you put newComponents.uiEnabled = false; ? before calling const ifcLoader = new OBC.FragmentIfcLoader(newComponents);

That solves it, thank you ๐Ÿ‘