Sfoglia il codice sorgente

Merge pull request #7942 from BabylonJS/master

Nightly
mergify[bot] 5 anni fa
parent
commit
4b2ddd4ffa

+ 1 - 1
contributing.md

@@ -45,7 +45,7 @@ You can use Gitpod (A free online VS Code like IDE) for contributing online. Wit
 
 so that you can start straight away.
 
-[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/)
+[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/BabylonJS/Babylon.js)
 
 ## Pull requests
 

+ 6 - 0
dist/preview release/babylon.d.ts

@@ -36985,6 +36985,12 @@ declare module BABYLON {
          */
         getMorphTargetById(id: string): Nullable<MorphTarget>;
         /**
+         * Gets a morph target using a given name (if many are found, this function will pick the first one)
+         * @param name defines the name to search for
+         * @return the found morph target or null if not found at all.
+         */
+        getMorphTargetByName(name: string): Nullable<MorphTarget>;
+        /**
          * Gets a boolean indicating if the given mesh is active
          * @param mesh defines the mesh to look for
          * @returns true if the mesh is in the active list

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/babylon.js


File diff suppressed because it is too large
+ 94 - 48
dist/preview release/babylon.max.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/babylon.max.js.map


+ 13 - 0
dist/preview release/babylon.module.d.ts

@@ -32055,6 +32055,7 @@ declare module "babylonjs/Materials/Textures/videoTexture" {
     import { Scene } from "babylonjs/scene";
     import { Texture } from "babylonjs/Materials/Textures/texture";
     import "babylonjs/Engines/Extensions/engine.videoTexture";
+    import "babylonjs/Engines/Extensions/engine.dynamicTexture";
     /**
      * Settings for finer control over video usage
      */
@@ -38077,6 +38078,12 @@ declare module "babylonjs/scene" {
          */
         getMorphTargetById(id: string): Nullable<MorphTarget>;
         /**
+         * Gets a morph target using a given name (if many are found, this function will pick the first one)
+         * @param name defines the name to search for
+         * @return the found morph target or null if not found at all.
+         */
+        getMorphTargetByName(name: string): Nullable<MorphTarget>;
+        /**
          * Gets a boolean indicating if the given mesh is active
          * @param mesh defines the mesh to look for
          * @returns true if the mesh is in the active list
@@ -111271,6 +111278,12 @@ declare module BABYLON {
          */
         getMorphTargetById(id: string): Nullable<MorphTarget>;
         /**
+         * Gets a morph target using a given name (if many are found, this function will pick the first one)
+         * @param name defines the name to search for
+         * @return the found morph target or null if not found at all.
+         */
+        getMorphTargetByName(name: string): Nullable<MorphTarget>;
+        /**
          * Gets a boolean indicating if the given mesh is active
          * @param mesh defines the mesh to look for
          * @returns true if the mesh is in the active list

+ 6 - 0
dist/preview release/documentation.d.ts

@@ -36985,6 +36985,12 @@ declare module BABYLON {
          */
         getMorphTargetById(id: string): Nullable<MorphTarget>;
         /**
+         * Gets a morph target using a given name (if many are found, this function will pick the first one)
+         * @param name defines the name to search for
+         * @return the found morph target or null if not found at all.
+         */
+        getMorphTargetByName(name: string): Nullable<MorphTarget>;
+        /**
          * Gets a boolean indicating if the given mesh is active
          * @param mesh defines the mesh to look for
          * @returns true if the mesh is in the active list

+ 1 - 1
dist/preview release/packagesSizeBaseLine.json

@@ -1 +1 @@
-{"thinEngineOnly":114747,"engineOnly":151405,"sceneOnly":508871,"minGridMaterial":641103,"minStandardMaterial":782284}
+{"thinEngineOnly":114747,"engineOnly":151405,"sceneOnly":509096,"minGridMaterial":641404,"minStandardMaterial":782585}

+ 13 - 0
dist/preview release/viewer/babylon.module.d.ts

@@ -32055,6 +32055,7 @@ declare module "babylonjs/Materials/Textures/videoTexture" {
     import { Scene } from "babylonjs/scene";
     import { Texture } from "babylonjs/Materials/Textures/texture";
     import "babylonjs/Engines/Extensions/engine.videoTexture";
+    import "babylonjs/Engines/Extensions/engine.dynamicTexture";
     /**
      * Settings for finer control over video usage
      */
@@ -38077,6 +38078,12 @@ declare module "babylonjs/scene" {
          */
         getMorphTargetById(id: string): Nullable<MorphTarget>;
         /**
+         * Gets a morph target using a given name (if many are found, this function will pick the first one)
+         * @param name defines the name to search for
+         * @return the found morph target or null if not found at all.
+         */
+        getMorphTargetByName(name: string): Nullable<MorphTarget>;
+        /**
          * Gets a boolean indicating if the given mesh is active
          * @param mesh defines the mesh to look for
          * @returns true if the mesh is in the active list
@@ -111271,6 +111278,12 @@ declare module BABYLON {
          */
         getMorphTargetById(id: string): Nullable<MorphTarget>;
         /**
+         * Gets a morph target using a given name (if many are found, this function will pick the first one)
+         * @param name defines the name to search for
+         * @return the found morph target or null if not found at all.
+         */
+        getMorphTargetByName(name: string): Nullable<MorphTarget>;
+        /**
          * Gets a boolean indicating if the given mesh is active
          * @param mesh defines the mesh to look for
          * @returns true if the mesh is in the active list

File diff suppressed because it is too large
+ 9 - 9
dist/preview release/viewer/babylon.viewer.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 3 - 0
dist/preview release/what's new.md

@@ -45,6 +45,7 @@
 
 - Added support for glTF mesh instancing extension ([#7521](https://github.com/BabylonJS/Babylon.js/issues/7521)) ([drigax](https://github.com/Drigax))
 - Get the list of cameras retrieved from a gLTF file when loaded through the asset container ([Popov72](https://github.com/Popov72))
+- Fixed SceneLoader.ImportAnimations. Now targets nodes based on "targetProperty" ([#7931](https://github.com/BabylonJS/Babylon.js/issues/7931)) ([phenry20](https://github.com/phenry20))
 
 ### Navigation
 
@@ -105,6 +106,8 @@
 - Fix mesh winding order inversion when merging meshes with overridden side orientation ([drigax](https://github.com/Drigax))
 - Fixed a rendering issue with GearVR in WebXR mode ([RaananW](https://github.com/RaananW))
 - Fixed error when downloading async createScene function in playground ([#7926](https://github.com/BabylonJS/Babylon.js/issues/7926)) ([RaananW](https://github.com/RaananW))
+- Fix issue where ThinEngine.prototype.createDynamicEngine is undefined when using VideoTexture with es6 packages ([rvadhavk](https://github.com/rvadhavk))
+- Fix [issue](https://forum.babylonjs.com/t/virtualjoystick-needs-to-set-style-touch-action-none-explicitly/9562) that canvas for `VirtualJoystick` does not have `touch-action: "none"` set by default ([joergplewe](https://github.com/joergplewe))
 
 ## Breaking changes
 

+ 1 - 0
src/Materials/Textures/videoTexture.ts

@@ -7,6 +7,7 @@ import { Engine } from "../../Engines/engine";
 import { Texture } from "../../Materials/Textures/texture";
 
 import "../../Engines/Extensions/engine.videoTexture";
+import "../../Engines/Extensions/engine.dynamicTexture";
 
 /**
  * Settings for finer control over video usage

+ 3 - 2
src/Meshes/abstractMesh.ts

@@ -785,7 +785,7 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
         var isIn = light.isEnabled() && light.canAffectMesh(this);
 
         var index = this._lightSources.indexOf(light);
-
+        var removed = false;
         if (index === -1) {
             if (!isIn) {
                 return;
@@ -795,10 +795,11 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
             if (isIn) {
                 return;
             }
+            removed = true;
             this._lightSources.splice(index, 1);
         }
 
-        this._markSubMeshesAsLightDirty();
+        this._markSubMeshesAsLightDirty(removed);
     }
 
     /** @hidden */

+ 1 - 0
src/Misc/virtualJoystick.ts

@@ -124,6 +124,7 @@ export class VirtualJoystick {
             VirtualJoystick.Canvas.style.left = "0px";
             VirtualJoystick.Canvas.style.zIndex = "5";
             VirtualJoystick.Canvas.style.msTouchAction = "none";
+            VirtualJoystick.Canvas.style.touchAction = "none";  // fix https://forum.babylonjs.com/t/virtualjoystick-needs-to-set-style-touch-action-none-explicitly/9562
             // Support for jQuery PEP polyfill
             VirtualJoystick.Canvas.setAttribute("touch-action", "none");
             let context = VirtualJoystick.Canvas.getContext('2d');

+ 28 - 1
src/assetContainer.ts

@@ -485,7 +485,34 @@ export class AssetContainer extends AbstractScene {
             return;
         }
 
-        let _targetConverter = targetConverter ? targetConverter : (target: any) => { return scene.getBoneByName(target.name) || scene.getNodeByName(target.name); };
+        let _targetConverter = targetConverter ? targetConverter : (target: any) => {
+            let node = null;
+
+            const targetProperty = target.animations.length ? target.animations[0].targetProperty : "";
+            /*
+                BabylonJS adds special naming to targets that are children of nodes.
+                This name attempts to remove that special naming to get the parent nodes name in case the target
+                can't be found in the node tree
+
+                Ex: Torso_primitive0 likely points to a Mesh primitive. We take away primitive0 and are left with "Torso" which is the name
+                of the primitive's parent.
+            */
+            const name = target.name.split(".").join("").split("_primitive")[0];
+
+            switch (targetProperty) {
+                case "position":
+                case "rotationQuaternion":
+                    node = scene.getTransformNodeByName(target.name) || scene.getTransformNodeByName(name);
+                    break;
+                case "influence":
+                    node = scene.getMorphTargetByName(target.name) || scene.getMorphTargetByName(name);
+                    break;
+                default:
+                    node = scene.getNodeByName(target.name) || scene.getNodeByName(name);
+            }
+
+            return node;
+        };
 
         // Copy new node animations
         let nodesInAC = this.getNodes();

+ 18 - 0
src/scene.ts

@@ -3204,6 +3204,24 @@ export class Scene extends AbstractScene implements IAnimatable {
     }
 
     /**
+     * Gets a morph target using a given name (if many are found, this function will pick the first one)
+     * @param name defines the name to search for
+     * @return the found morph target or null if not found at all.
+     */
+    public getMorphTargetByName(name: string): Nullable<MorphTarget> {
+        for (let managerIndex = 0; managerIndex < this.morphTargetManagers.length; ++managerIndex) {
+            const morphTargetManager = this.morphTargetManagers[managerIndex];
+            for (let index = 0; index < morphTargetManager.numTargets; ++index) {
+                const target = morphTargetManager.getTarget(index);
+                if (target.name === name) {
+                    return target;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
      * Gets a boolean indicating if the given mesh is active
      * @param mesh defines the mesh to look for
      * @returns true if the mesh is in the active list