activeView for multi canvas should be set regardless of camera

activeView is always null when its camera is undefined

Expected

view.camera should not affect activeView, and is set accordingly in onBeforeRender, runRenderLoop, onAfterRender

Reproduction

Multiple Canvas Multiple Scene | Babylon.js Playground (babylonjs.com)

Suggestion

this.activeView = view should be out side of if (camera) condition

abstractEngine.views.ts#L186

    if (camera) {
        scene = Array.isArray(camera) ? camera[0].getScene() : camera.getScene();

        previewCamera = scene.activeCamera;
        previewCameras = scene.activeCameras;

-       this.activeView = view;

        if (Array.isArray(camera)) {
            scene.activeCameras = camera;
        } else {
            scene.activeCamera = camera;
            scene.activeCameras = null;
        }
    }
+   this.activeView = view;
1 Like

I agree! wanna do a PR?

1 Like

set activeView regardless of view.camera by zb-sj · Pull Request #15331 · BabylonJS/Babylon.js (github.com)

how does this look?

1 Like

Already approved:)

2 Likes

that was quick!

confirmed its works as intended :grin:

Multiple Canvas Multiple Scene | Babylon.js Playground (babylonjs.com)

2 Likes