浏览代码

Fix error with multi views when main canvas was hidden

David Catuhe 5 年之前
父节点
当前提交
9a7ee8ed89

+ 3 - 2
dist/preview release/babylon.d.ts

@@ -37527,12 +37527,13 @@ declare module BABYLON {
          */
         createRootMesh(): Mesh;
         /**
-         * Merge animations from this asset container into a scene
+         * Merge animations (direct and animation groups) from this asset container into a scene
          * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)
          * @param animatables set of animatables to retarget to a node from the scene
          * @param targetConverter defines a function used to convert animation targets from the asset container to the scene (default: search node by name)
+         * @returns an array of the new AnimationGroup added to the scene (empty array if none)
          */
-        mergeAnimationsTo(scene: Scene | null | undefined, animatables: Animatable[], targetConverter?: Nullable<(target: any) => Nullable<Node>>): void;
+        mergeAnimationsTo(scene: Scene | null | undefined, animatables: Animatable[], targetConverter?: Nullable<(target: any) => Nullable<Node>>): AnimationGroup[];
     }
 }
 declare module BABYLON {

文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/babylon.js


+ 6 - 3
dist/preview release/babylon.max.js

@@ -179840,17 +179840,18 @@ var AssetContainer = /** @class */ (function (_super) {
         return rootMesh;
     };
     /**
-     * Merge animations from this asset container into a scene
+     * Merge animations (direct and animation groups) from this asset container into a scene
      * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)
      * @param animatables set of animatables to retarget to a node from the scene
      * @param targetConverter defines a function used to convert animation targets from the asset container to the scene (default: search node by name)
+     * @returns an array of the new AnimationGroup added to the scene (empty array if none)
      */
     AssetContainer.prototype.mergeAnimationsTo = function (scene, animatables, targetConverter) {
         if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__["EngineStore"].LastCreatedScene; }
         if (targetConverter === void 0) { targetConverter = null; }
         if (!scene) {
             _Misc_logger__WEBPACK_IMPORTED_MODULE_3__["Logger"].Error("No scene available to merge animations to");
-            return;
+            return [];
         }
         var _targetConverter = targetConverter ? targetConverter : function (target) {
             var node = null;
@@ -179904,10 +179905,11 @@ var AssetContainer = /** @class */ (function (_super) {
                 nodeInScene.animations = nodeInScene.animations.concat(nodeInAC.animations);
             }
         });
+        var newAnimationGroups = new Array();
         // Copy new animation groups
         this.animationGroups.slice().forEach(function (animationGroupInAC) {
             // Clone the animation group and all its animatables
-            animationGroupInAC.clone(animationGroupInAC.name, _targetConverter);
+            newAnimationGroups.push(animationGroupInAC.clone(animationGroupInAC.name, _targetConverter));
             // Remove animatables related to the asset container
             animationGroupInAC.animatables.forEach(function (animatable) {
                 animatable.stop();
@@ -179923,6 +179925,7 @@ var AssetContainer = /** @class */ (function (_super) {
                 scene.stopAnimation(animatable.target);
             }
         });
+        return newAnimationGroups;
     };
     return AssetContainer;
 }(_abstractScene__WEBPACK_IMPORTED_MODULE_1__["AbstractScene"]));

文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/babylon.max.js.map


+ 6 - 4
dist/preview release/babylon.module.d.ts

@@ -38644,12 +38644,13 @@ declare module "babylonjs/assetContainer" {
          */
         createRootMesh(): Mesh;
         /**
-         * Merge animations from this asset container into a scene
+         * Merge animations (direct and animation groups) from this asset container into a scene
          * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)
          * @param animatables set of animatables to retarget to a node from the scene
          * @param targetConverter defines a function used to convert animation targets from the asset container to the scene (default: search node by name)
+         * @returns an array of the new AnimationGroup added to the scene (empty array if none)
          */
-        mergeAnimationsTo(scene: Scene | null | undefined, animatables: Animatable[], targetConverter?: Nullable<(target: any) => Nullable<Node>>): void;
+        mergeAnimationsTo(scene: Scene | null | undefined, animatables: Animatable[], targetConverter?: Nullable<(target: any) => Nullable<Node>>): AnimationGroup[];
     }
 }
 declare module "babylonjs/abstractScene" {
@@ -112074,12 +112075,13 @@ declare module BABYLON {
          */
         createRootMesh(): Mesh;
         /**
-         * Merge animations from this asset container into a scene
+         * Merge animations (direct and animation groups) from this asset container into a scene
          * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)
          * @param animatables set of animatables to retarget to a node from the scene
          * @param targetConverter defines a function used to convert animation targets from the asset container to the scene (default: search node by name)
+         * @returns an array of the new AnimationGroup added to the scene (empty array if none)
          */
-        mergeAnimationsTo(scene: Scene | null | undefined, animatables: Animatable[], targetConverter?: Nullable<(target: any) => Nullable<Node>>): void;
+        mergeAnimationsTo(scene: Scene | null | undefined, animatables: Animatable[], targetConverter?: Nullable<(target: any) => Nullable<Node>>): AnimationGroup[];
     }
 }
 declare module BABYLON {

+ 3 - 2
dist/preview release/documentation.d.ts

@@ -37527,12 +37527,13 @@ declare module BABYLON {
          */
         createRootMesh(): Mesh;
         /**
-         * Merge animations from this asset container into a scene
+         * Merge animations (direct and animation groups) from this asset container into a scene
          * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)
          * @param animatables set of animatables to retarget to a node from the scene
          * @param targetConverter defines a function used to convert animation targets from the asset container to the scene (default: search node by name)
+         * @returns an array of the new AnimationGroup added to the scene (empty array if none)
          */
-        mergeAnimationsTo(scene: Scene | null | undefined, animatables: Animatable[], targetConverter?: Nullable<(target: any) => Nullable<Node>>): void;
+        mergeAnimationsTo(scene: Scene | null | undefined, animatables: Animatable[], targetConverter?: Nullable<(target: any) => Nullable<Node>>): AnimationGroup[];
     }
 }
 declare module BABYLON {

+ 6 - 4
dist/preview release/viewer/babylon.module.d.ts

@@ -38644,12 +38644,13 @@ declare module "babylonjs/assetContainer" {
          */
         createRootMesh(): Mesh;
         /**
-         * Merge animations from this asset container into a scene
+         * Merge animations (direct and animation groups) from this asset container into a scene
          * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)
          * @param animatables set of animatables to retarget to a node from the scene
          * @param targetConverter defines a function used to convert animation targets from the asset container to the scene (default: search node by name)
+         * @returns an array of the new AnimationGroup added to the scene (empty array if none)
          */
-        mergeAnimationsTo(scene: Scene | null | undefined, animatables: Animatable[], targetConverter?: Nullable<(target: any) => Nullable<Node>>): void;
+        mergeAnimationsTo(scene: Scene | null | undefined, animatables: Animatable[], targetConverter?: Nullable<(target: any) => Nullable<Node>>): AnimationGroup[];
     }
 }
 declare module "babylonjs/abstractScene" {
@@ -112074,12 +112075,13 @@ declare module BABYLON {
          */
         createRootMesh(): Mesh;
         /**
-         * Merge animations from this asset container into a scene
+         * Merge animations (direct and animation groups) from this asset container into a scene
          * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)
          * @param animatables set of animatables to retarget to a node from the scene
          * @param targetConverter defines a function used to convert animation targets from the asset container to the scene (default: search node by name)
+         * @returns an array of the new AnimationGroup added to the scene (empty array if none)
          */
-        mergeAnimationsTo(scene: Scene | null | undefined, animatables: Animatable[], targetConverter?: Nullable<(target: any) => Nullable<Node>>): void;
+        mergeAnimationsTo(scene: Scene | null | undefined, animatables: Animatable[], targetConverter?: Nullable<(target: any) => Nullable<Node>>): AnimationGroup[];
     }
 }
 declare module BABYLON {

文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/viewer/babylon.viewer.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 1 - 0
gui/src/2D/advancedDynamicTexture.ts

@@ -504,6 +504,7 @@ export class AdvancedDynamicTexture extends DynamicTexture {
         var textureSize = this.getSize();
         var renderWidth = engine.getRenderWidth() * this._renderScale;
         var renderHeight = engine.getRenderHeight() * this._renderScale;
+
         if (this._renderAtIdealSize) {
             if (this._idealWidth) {
                 renderHeight = (renderHeight * this._idealWidth) / renderWidth;

+ 5 - 0
src/Engines/Extensions/engine.views.ts

@@ -139,6 +139,11 @@ Engine.prototype._renderViews = function() {
             canvas.height = canvas.clientHeight;
             parent.width = canvas.clientWidth;
             parent.height = canvas.clientHeight;
+            this.resize();
+        }
+
+        if (!parent.width || !parent.height) {
+            return false;
         }
 
         // Render the frame

+ 2 - 2
src/Engines/thinEngine.ts

@@ -1213,8 +1213,8 @@ export class ThinEngine {
         let height: number;
 
         if (DomManagement.IsWindowObjectExist()) {
-            width = this._renderingCanvas ? this._renderingCanvas.clientWidth : window.innerWidth;
-            height = this._renderingCanvas ? this._renderingCanvas.clientHeight : window.innerHeight;
+            width = this._renderingCanvas ? (this._renderingCanvas.clientWidth || this._renderingCanvas.width) : window.innerWidth;
+            height = this._renderingCanvas ? (this._renderingCanvas.clientHeight || this._renderingCanvas.height) : window.innerHeight;
         } else {
             width = this._renderingCanvas ? this._renderingCanvas.width : 100;
             height = this._renderingCanvas ? this._renderingCanvas.height : 100;