|
@@ -11358,7 +11358,7 @@ var BABYLON;
|
|
|
});
|
|
|
Object.defineProperty(Engine, "Version", {
|
|
|
get: function () {
|
|
|
- return "3.2.0-beta.2";
|
|
|
+ return "3.2.0-beta.3";
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
@@ -23847,7 +23847,6 @@ var BABYLON;
|
|
|
}
|
|
|
return index;
|
|
|
};
|
|
|
- ;
|
|
|
Scene.prototype.removeAnimation = function (toRemove) {
|
|
|
var index = this.animations.indexOf(toRemove);
|
|
|
if (index !== -1) {
|
|
@@ -23855,7 +23854,18 @@ var BABYLON;
|
|
|
}
|
|
|
return index;
|
|
|
};
|
|
|
- ;
|
|
|
+ /**
|
|
|
+ * Removes the given animation group from this scene.
|
|
|
+ * @param toRemove The animation group to remove
|
|
|
+ * @returns The index of the removed animation group
|
|
|
+ */
|
|
|
+ Scene.prototype.removeAnimationGroup = function (toRemove) {
|
|
|
+ var index = this.animationGroups.indexOf(toRemove);
|
|
|
+ if (index !== -1) {
|
|
|
+ this.animationGroups.splice(index, 1);
|
|
|
+ }
|
|
|
+ return index;
|
|
|
+ };
|
|
|
Scene.prototype.removeMultiMaterial = function (toRemove) {
|
|
|
var index = this.multiMaterials.indexOf(toRemove);
|
|
|
if (index !== -1) {
|
|
@@ -23863,7 +23873,6 @@ var BABYLON;
|
|
|
}
|
|
|
return index;
|
|
|
};
|
|
|
- ;
|
|
|
Scene.prototype.removeMaterial = function (toRemove) {
|
|
|
var index = this.materials.indexOf(toRemove);
|
|
|
if (index !== -1) {
|
|
@@ -23871,7 +23880,6 @@ var BABYLON;
|
|
|
}
|
|
|
return index;
|
|
|
};
|
|
|
- ;
|
|
|
Scene.prototype.removeLensFlareSystem = function (toRemove) {
|
|
|
var index = this.lensFlareSystems.indexOf(toRemove);
|
|
|
if (index !== -1) {
|
|
@@ -23879,7 +23887,6 @@ var BABYLON;
|
|
|
}
|
|
|
return index;
|
|
|
};
|
|
|
- ;
|
|
|
Scene.prototype.removeActionManager = function (toRemove) {
|
|
|
var index = this._actionManagers.indexOf(toRemove);
|
|
|
if (index !== -1) {
|
|
@@ -23887,7 +23894,18 @@ var BABYLON;
|
|
|
}
|
|
|
return index;
|
|
|
};
|
|
|
- ;
|
|
|
+ /**
|
|
|
+ * Removes the given texture from this scene.
|
|
|
+ * @param toRemove The texture to remove
|
|
|
+ * @returns The index of the removed texture
|
|
|
+ */
|
|
|
+ Scene.prototype.removeTexture = function (toRemove) {
|
|
|
+ var index = this.textures.indexOf(toRemove);
|
|
|
+ if (index !== -1) {
|
|
|
+ this.textures.splice(index, 1);
|
|
|
+ }
|
|
|
+ return index;
|
|
|
+ };
|
|
|
Scene.prototype.addLight = function (newLight) {
|
|
|
this.lights.push(newLight);
|
|
|
this.sortLightsByPriority();
|
|
@@ -23919,6 +23937,13 @@ var BABYLON;
|
|
|
Scene.prototype.addAnimation = function (newAnimation) {
|
|
|
this.animations.push(newAnimation);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Adds the given animation group to this scene.
|
|
|
+ * @param newAnimationGroup The animation group to add
|
|
|
+ */
|
|
|
+ Scene.prototype.addAnimationGroup = function (newAnimationGroup) {
|
|
|
+ this.animationGroups.push(newAnimationGroup);
|
|
|
+ };
|
|
|
Scene.prototype.addMultiMaterial = function (newMultiMaterial) {
|
|
|
this.multiMaterials.push(newMultiMaterial);
|
|
|
};
|
|
@@ -23938,6 +23963,13 @@ var BABYLON;
|
|
|
this._actionManagers.push(newActionManager);
|
|
|
};
|
|
|
/**
|
|
|
+ * Adds the given texture to this scene.
|
|
|
+ * @param newTexture The texture to add
|
|
|
+ */
|
|
|
+ Scene.prototype.addTexture = function (newTexture) {
|
|
|
+ this.textures.push(newTexture);
|
|
|
+ };
|
|
|
+ /**
|
|
|
* Switch active camera
|
|
|
* @param {Camera} newCamera - new active camera
|
|
|
* @param {boolean} attachControl - call attachControl for the new active camera (default: true)
|
|
@@ -26091,6 +26123,10 @@ var BABYLON;
|
|
|
*/
|
|
|
this.animations = new Array();
|
|
|
/**
|
|
|
+ * AnimationGroups to keep.
|
|
|
+ */
|
|
|
+ this.animationGroups = new Array();
|
|
|
+ /**
|
|
|
* MultiMaterials to keep.
|
|
|
*/
|
|
|
this.multiMaterials = new Array();
|
|
@@ -26126,6 +26162,10 @@ var BABYLON;
|
|
|
* Sounds to keep.
|
|
|
*/
|
|
|
this.sounds = new Array();
|
|
|
+ /**
|
|
|
+ * Textures to keep.
|
|
|
+ */
|
|
|
+ this.textures = new Array();
|
|
|
}
|
|
|
return KeepAssets;
|
|
|
}());
|
|
@@ -26165,6 +26205,10 @@ var BABYLON;
|
|
|
*/
|
|
|
this.animations = new Array();
|
|
|
/**
|
|
|
+ * AnimationGroups populated in the container.
|
|
|
+ */
|
|
|
+ this.animationGroups = new Array();
|
|
|
+ /**
|
|
|
* MultiMaterials populated in the container.
|
|
|
*/
|
|
|
this.multiMaterials = new Array();
|
|
@@ -26200,6 +26244,10 @@ var BABYLON;
|
|
|
* Sounds populated in the container.
|
|
|
*/
|
|
|
this.sounds = new Array();
|
|
|
+ /**
|
|
|
+ * Textures populated in the container.
|
|
|
+ */
|
|
|
+ this.textures = new Array();
|
|
|
this.scene = scene;
|
|
|
}
|
|
|
/**
|
|
@@ -26225,6 +26273,9 @@ var BABYLON;
|
|
|
this.animations.forEach(function (o) {
|
|
|
_this.scene.addAnimation(o);
|
|
|
});
|
|
|
+ this.animationGroups.forEach(function (o) {
|
|
|
+ _this.scene.addAnimationGroup(o);
|
|
|
+ });
|
|
|
this.multiMaterials.forEach(function (o) {
|
|
|
_this.scene.addMultiMaterial(o);
|
|
|
});
|
|
@@ -26251,6 +26302,9 @@ var BABYLON;
|
|
|
o.autoplay = true;
|
|
|
_this.scene.mainSoundTrack.AddSound(o);
|
|
|
});
|
|
|
+ this.textures.forEach(function (o) {
|
|
|
+ _this.scene.addTexture;
|
|
|
+ });
|
|
|
};
|
|
|
/**
|
|
|
* Removes all the assets in the container from the scene
|
|
@@ -26275,6 +26329,9 @@ var BABYLON;
|
|
|
this.animations.forEach(function (o) {
|
|
|
_this.scene.removeAnimation(o);
|
|
|
});
|
|
|
+ this.animationGroups.forEach(function (o) {
|
|
|
+ _this.scene.removeAnimationGroup(o);
|
|
|
+ });
|
|
|
this.multiMaterials.forEach(function (o) {
|
|
|
_this.scene.removeMultiMaterial(o);
|
|
|
});
|
|
@@ -26301,6 +26358,9 @@ var BABYLON;
|
|
|
o.autoplay = false;
|
|
|
_this.scene.mainSoundTrack.RemoveSound(o);
|
|
|
});
|
|
|
+ this.textures.forEach(function (o) {
|
|
|
+ _this.scene.removeTexture(o);
|
|
|
+ });
|
|
|
};
|
|
|
AssetContainer.prototype._moveAssets = function (sourceAssets, targetAssets, keepAssets) {
|
|
|
for (var _i = 0, sourceAssets_1 = sourceAssets; _i < sourceAssets_1.length; _i++) {
|
|
@@ -26332,6 +26392,7 @@ var BABYLON;
|
|
|
this._moveAssets(this.scene.materials, this.materials, keepAssets.materials);
|
|
|
this._moveAssets(this.scene._actionManagers, this.actionManagers, keepAssets.actionManagers);
|
|
|
this._moveAssets(this.scene.animations, this.animations, keepAssets.animations);
|
|
|
+ this._moveAssets(this.scene.animationGroups, this.animationGroups, keepAssets.animationGroups);
|
|
|
this._moveAssets(this.scene.lensFlareSystems, this.lensFlareSystems, keepAssets.lensFlareSystems);
|
|
|
this._moveAssets(this.scene.lights, this.lights, keepAssets.lights);
|
|
|
this._moveAssets(this.scene.morphTargetManagers, this.morphTargetManagers, keepAssets.morphTargetManagers);
|
|
@@ -26340,6 +26401,7 @@ var BABYLON;
|
|
|
this._moveAssets(this.scene.particleSystems, this.particleSystems, keepAssets.particleSystems);
|
|
|
this._moveAssets(this.scene.mainSoundTrack.soundCollection, this.sounds, keepAssets.sounds);
|
|
|
this._moveAssets(this.scene.transformNodes, this.transformNodes, keepAssets.transformNodes);
|
|
|
+ this._moveAssets(this.scene.textures, this.textures, keepAssets.textures);
|
|
|
this.removeAllFromScene();
|
|
|
};
|
|
|
return AssetContainer;
|
|
@@ -63277,11 +63339,11 @@ var BABYLON;
|
|
|
errorHandler("Error in onProgress callback", e);
|
|
|
}
|
|
|
} : undefined;
|
|
|
- var successHandler = function (meshes, particleSystems, skeletons) {
|
|
|
+ var successHandler = function (meshes, particleSystems, skeletons, animationGroups) {
|
|
|
scene.importedMeshesFiles.push(rootUrl + sceneFilename);
|
|
|
if (onSuccess) {
|
|
|
try {
|
|
|
- onSuccess(meshes, particleSystems, skeletons);
|
|
|
+ onSuccess(meshes, particleSystems, skeletons, animationGroups);
|
|
|
}
|
|
|
catch (e) {
|
|
|
errorHandler("Error in onSuccess callback", e);
|
|
@@ -63307,13 +63369,13 @@ var BABYLON;
|
|
|
return;
|
|
|
}
|
|
|
scene.loadingPluginName = plugin.name;
|
|
|
- successHandler(meshes, particleSystems, skeletons);
|
|
|
+ successHandler(meshes, particleSystems, skeletons, []);
|
|
|
}
|
|
|
else {
|
|
|
var asyncedPlugin = plugin;
|
|
|
asyncedPlugin.importMeshAsync(meshNames, scene, data, rootUrl, progressHandler).then(function (result) {
|
|
|
scene.loadingPluginName = plugin.name;
|
|
|
- successHandler(result.meshes, result.particleSystems, result.skeletons);
|
|
|
+ successHandler(result.meshes, result.particleSystems, result.skeletons, result.animationGroups);
|
|
|
}).catch(function (error) {
|
|
|
errorHandler(error.message, error);
|
|
|
});
|
|
@@ -63328,17 +63390,18 @@ var BABYLON;
|
|
|
* @param scene the instance of BABYLON.Scene to append to
|
|
|
* @param onProgress a callback with a progress event for each file being loaded
|
|
|
* @param pluginExtension the extension used to determine the plugin
|
|
|
- * @returns The loaded list of imported meshes, particleSystems, and skeletons
|
|
|
+ * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups
|
|
|
*/
|
|
|
SceneLoader.ImportMeshAsync = function (meshNames, rootUrl, sceneFilename, scene, onProgress, pluginExtension) {
|
|
|
if (onProgress === void 0) { onProgress = null; }
|
|
|
if (pluginExtension === void 0) { pluginExtension = null; }
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
- SceneLoader.ImportMesh(meshNames, rootUrl, sceneFilename, scene, function (meshes, particleSystems, skeletons) {
|
|
|
+ SceneLoader.ImportMesh(meshNames, rootUrl, sceneFilename, scene, function (meshes, particleSystems, skeletons, animationGroups) {
|
|
|
resolve({
|
|
|
meshes: meshes,
|
|
|
particleSystems: particleSystems,
|
|
|
- skeletons: skeletons
|
|
|
+ skeletons: skeletons,
|
|
|
+ animationGroups: animationGroups
|
|
|
});
|
|
|
}, onProgress, function (scene, message, exception) {
|
|
|
reject(exception || new Error(message));
|
|
@@ -94401,13 +94464,17 @@ var ModelLoader = (function () {
|
|
|
var filename = babylonjs_1.Tools.GetFilename(modelConfiguration.url) || modelConfiguration.url;
|
|
|
var base = modelConfiguration.root || babylonjs_1.Tools.GetFolderPath(modelConfiguration.url);
|
|
|
var plugin = modelConfiguration.loader;
|
|
|
- model.loader = babylonjs_1.SceneLoader.ImportMesh(undefined, base, filename, this._viewer.scene, function (meshes, particleSystems, skeletons) {
|
|
|
+ model.loader = babylonjs_1.SceneLoader.ImportMesh(undefined, base, filename, this._viewer.scene, function (meshes, particleSystems, skeletons, animationGroups) {
|
|
|
meshes.forEach(function (mesh) {
|
|
|
babylonjs_1.Tags.AddTagsTo(mesh, "viewerMesh");
|
|
|
});
|
|
|
model.meshes = meshes;
|
|
|
model.particleSystems = particleSystems;
|
|
|
model.skeletons = skeletons;
|
|
|
+ for (var _i = 0, animationGroups_1 = animationGroups; _i < animationGroups_1.length; _i++) {
|
|
|
+ var animationGroup = animationGroups_1[_i];
|
|
|
+ model.addAnimationGroup(animationGroup);
|
|
|
+ }
|
|
|
model.initAnimations();
|
|
|
model.onLoadedObservable.notifyObserversWithPromise(model);
|
|
|
}, function (progressEvent) {
|
|
@@ -94419,10 +94486,7 @@ var ModelLoader = (function () {
|
|
|
}, plugin);
|
|
|
if (model.loader.name === "gltf") {
|
|
|
var gltfLoader = model.loader;
|
|
|
- gltfLoader.animationStartMode = 0;
|
|
|
- gltfLoader.onAnimationGroupLoaded = function (ag) {
|
|
|
- model.addAnimationGroup(ag);
|
|
|
- };
|
|
|
+ gltfLoader.animationStartMode = BABYLON.GLTFLoaderAnimationStartMode.NONE;
|
|
|
}
|
|
|
model.loadId = this._loadId++;
|
|
|
this._loaders.push(model.loader);
|
|
@@ -96743,10 +96807,6 @@ var BABYLON;
|
|
|
*/
|
|
|
this.onMaterialLoadedObservable = new BABYLON.Observable();
|
|
|
/**
|
|
|
- * Raised when the loader creates an animation group after parsing the glTF properties of the animation.
|
|
|
- */
|
|
|
- this.onAnimationGroupLoadedObservable = new BABYLON.Observable();
|
|
|
- /**
|
|
|
* Raised when the asset is completely loaded, immediately before the loader is disposed.
|
|
|
* For assets with LODs, raised when all of the LODs are complete.
|
|
|
* For assets without LODs, raised when the model is complete, immediately after onSuccess.
|
|
@@ -96809,16 +96869,6 @@ var BABYLON;
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
- Object.defineProperty(GLTFFileLoader.prototype, "onAnimationGroupLoaded", {
|
|
|
- set: function (callback) {
|
|
|
- if (this._onAnimationGroupLoadedObserver) {
|
|
|
- this.onAnimationGroupLoadedObservable.remove(this._onAnimationGroupLoadedObserver);
|
|
|
- }
|
|
|
- this._onAnimationGroupLoadedObserver = this.onAnimationGroupLoadedObservable.add(callback);
|
|
|
- },
|
|
|
- enumerable: true,
|
|
|
- configurable: true
|
|
|
- });
|
|
|
Object.defineProperty(GLTFFileLoader.prototype, "onComplete", {
|
|
|
set: function (callback) {
|
|
|
if (this._onCompleteObserver) {
|
|
@@ -96911,6 +96961,7 @@ var BABYLON;
|
|
|
Array.prototype.push.apply(container.meshes, result.meshes);
|
|
|
Array.prototype.push.apply(container.particleSystems, result.particleSystems);
|
|
|
Array.prototype.push.apply(container.skeletons, result.skeletons);
|
|
|
+ Array.prototype.push.apply(container.animationGroups, result.animationGroups);
|
|
|
container.removeAllFromScene();
|
|
|
return container;
|
|
|
});
|
|
@@ -96972,7 +97023,6 @@ var BABYLON;
|
|
|
loader.onTextureLoadedObservable.add(function (texture) { return _this.onTextureLoadedObservable.notifyObservers(texture); });
|
|
|
loader.onMaterialLoadedObservable.add(function (material) { return _this.onMaterialLoadedObservable.notifyObservers(material); });
|
|
|
loader.onExtensionLoadedObservable.add(function (extension) { return _this.onExtensionLoadedObservable.notifyObservers(extension); });
|
|
|
- loader.onAnimationGroupLoadedObservable.add(function (animationGroup) { return _this.onAnimationGroupLoadedObservable.notifyObservers(animationGroup); });
|
|
|
loader.onCompleteObservable.add(function () {
|
|
|
_this.onMeshLoadedObservable.clear();
|
|
|
_this.onTextureLoadedObservable.clear();
|
|
@@ -98537,7 +98587,6 @@ var BABYLON;
|
|
|
this.onMeshLoadedObservable = new BABYLON.Observable();
|
|
|
this.onTextureLoadedObservable = new BABYLON.Observable();
|
|
|
this.onMaterialLoadedObservable = new BABYLON.Observable();
|
|
|
- this.onAnimationGroupLoadedObservable = new BABYLON.Observable();
|
|
|
this.onCompleteObservable = new BABYLON.Observable();
|
|
|
this.onExtensionLoadedObservable = new BABYLON.Observable();
|
|
|
this.state = null;
|
|
@@ -98592,12 +98641,12 @@ var BABYLON;
|
|
|
importMaterials(gltfRuntime);
|
|
|
postLoad(gltfRuntime);
|
|
|
if (!BABYLON.GLTFFileLoader.IncrementalLoading && onSuccess) {
|
|
|
- onSuccess(meshes, [], skeletons);
|
|
|
+ onSuccess(meshes, skeletons);
|
|
|
}
|
|
|
});
|
|
|
}, onProgress);
|
|
|
if (BABYLON.GLTFFileLoader.IncrementalLoading && onSuccess) {
|
|
|
- onSuccess(meshes, [], skeletons);
|
|
|
+ onSuccess(meshes, skeletons);
|
|
|
}
|
|
|
}, onError);
|
|
|
return true;
|
|
@@ -98605,11 +98654,12 @@ var BABYLON;
|
|
|
GLTFLoader.prototype.importMeshAsync = function (meshesNames, scene, data, rootUrl, onProgress) {
|
|
|
var _this = this;
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
- _this._importMeshAsync(meshesNames, scene, data, rootUrl, function (meshes, particleSystems, skeletons) {
|
|
|
+ _this._importMeshAsync(meshesNames, scene, data, rootUrl, function (meshes, skeletons) {
|
|
|
resolve({
|
|
|
meshes: meshes,
|
|
|
- particleSystems: particleSystems,
|
|
|
- skeletons: skeletons
|
|
|
+ particleSystems: [],
|
|
|
+ skeletons: skeletons,
|
|
|
+ animationGroups: []
|
|
|
});
|
|
|
}, onProgress, function (message) {
|
|
|
reject(new Error(message));
|
|
@@ -99341,6 +99391,53 @@ var BABYLON;
|
|
|
return ArrayItem;
|
|
|
}());
|
|
|
GLTF2.ArrayItem = ArrayItem;
|
|
|
+ var AnimationMultiTarget = /** @class */ (function () {
|
|
|
+ function AnimationMultiTarget() {
|
|
|
+ this.subTargets = new Array();
|
|
|
+ }
|
|
|
+ Object.defineProperty(AnimationMultiTarget.prototype, "position", {
|
|
|
+ set: function (value) {
|
|
|
+ for (var _i = 0, _a = this.subTargets; _i < _a.length; _i++) {
|
|
|
+ var subTarget = _a[_i];
|
|
|
+ subTarget.position = value;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
+ Object.defineProperty(AnimationMultiTarget.prototype, "rotationQuaternion", {
|
|
|
+ set: function (value) {
|
|
|
+ for (var _i = 0, _a = this.subTargets; _i < _a.length; _i++) {
|
|
|
+ var subTarget = _a[_i];
|
|
|
+ subTarget.rotationQuaternion = value;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
+ Object.defineProperty(AnimationMultiTarget.prototype, "scaling", {
|
|
|
+ set: function (value) {
|
|
|
+ for (var _i = 0, _a = this.subTargets; _i < _a.length; _i++) {
|
|
|
+ var subTarget = _a[_i];
|
|
|
+ subTarget.scaling = value;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
+ Object.defineProperty(AnimationMultiTarget.prototype, "influence", {
|
|
|
+ set: function (value) {
|
|
|
+ for (var _i = 0, _a = this.subTargets; _i < _a.length; _i++) {
|
|
|
+ var subTarget = _a[_i];
|
|
|
+ subTarget.influence = value;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
+ return AnimationMultiTarget;
|
|
|
+ }());
|
|
|
+ GLTF2.AnimationMultiTarget = AnimationMultiTarget;
|
|
|
})(GLTF2 = BABYLON.GLTF2 || (BABYLON.GLTF2 = {}));
|
|
|
})(BABYLON || (BABYLON = {}));
|
|
|
|
|
@@ -99376,7 +99473,6 @@ var BABYLON;
|
|
|
this.onMeshLoadedObservable = new BABYLON.Observable();
|
|
|
this.onTextureLoadedObservable = new BABYLON.Observable();
|
|
|
this.onMaterialLoadedObservable = new BABYLON.Observable();
|
|
|
- this.onAnimationGroupLoadedObservable = new BABYLON.Observable();
|
|
|
this.onExtensionLoadedObservable = new BABYLON.Observable();
|
|
|
this.onCompleteObservable = new BABYLON.Observable();
|
|
|
}
|
|
@@ -99433,6 +99529,7 @@ var BABYLON;
|
|
|
meshes: _this._getMeshes(),
|
|
|
particleSystems: [],
|
|
|
skeletons: _this._getSkeletons(),
|
|
|
+ animationGroups: _this._getAnimationGroups()
|
|
|
};
|
|
|
});
|
|
|
});
|
|
@@ -99653,25 +99750,37 @@ var BABYLON;
|
|
|
}
|
|
|
return skeletons;
|
|
|
};
|
|
|
- GLTFLoader.prototype._startAnimations = function () {
|
|
|
+ GLTFLoader.prototype._getAnimationGroups = function () {
|
|
|
+ var animationGroups = new Array();
|
|
|
var animations = this._gltf.animations;
|
|
|
- if (!animations) {
|
|
|
- return;
|
|
|
+ if (animations) {
|
|
|
+ for (var _i = 0, animations_1 = animations; _i < animations_1.length; _i++) {
|
|
|
+ var animation = animations_1[_i];
|
|
|
+ if (animation._babylonAnimationGroup) {
|
|
|
+ animationGroups.push(animation._babylonAnimationGroup);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ return animationGroups;
|
|
|
+ };
|
|
|
+ GLTFLoader.prototype._startAnimations = function () {
|
|
|
switch (this.animationStartMode) {
|
|
|
case BABYLON.GLTFLoaderAnimationStartMode.NONE: {
|
|
|
// do nothing
|
|
|
break;
|
|
|
}
|
|
|
case BABYLON.GLTFLoaderAnimationStartMode.FIRST: {
|
|
|
- var animation = animations[0];
|
|
|
- animation._babylonAnimationGroup.start(true);
|
|
|
+ var babylonAnimationGroups = this._getAnimationGroups();
|
|
|
+ if (babylonAnimationGroups.length !== 0) {
|
|
|
+ babylonAnimationGroups[0].start(true);
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
case BABYLON.GLTFLoaderAnimationStartMode.ALL: {
|
|
|
- for (var _i = 0, animations_1 = animations; _i < animations_1.length; _i++) {
|
|
|
- var animation = animations_1[_i];
|
|
|
- animation._babylonAnimationGroup.start(true);
|
|
|
+ var babylonAnimationGroups = this._getAnimationGroups();
|
|
|
+ for (var _i = 0, babylonAnimationGroups_1 = babylonAnimationGroups; _i < babylonAnimationGroups_1.length; _i++) {
|
|
|
+ var babylonAnimationGroup = babylonAnimationGroups_1[_i];
|
|
|
+ babylonAnimationGroup.start(true);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -99961,6 +100070,8 @@ var BABYLON;
|
|
|
_this._forEachPrimitive(node, function (babylonMesh) {
|
|
|
babylonMesh.skeleton = skin._babylonSkeleton;
|
|
|
});
|
|
|
+ // Ignore the TRS of skinned nodes.
|
|
|
+ // See https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins (second implementation note)
|
|
|
node._babylonMesh.parent = _this._rootBabylonMesh;
|
|
|
node._babylonMesh.position = BABYLON.Vector3.Zero();
|
|
|
node._babylonMesh.rotationQuaternion = BABYLON.Quaternion.Identity();
|
|
@@ -100050,7 +100161,6 @@ var BABYLON;
|
|
|
var channel = _a[_i];
|
|
|
promises.push(this._loadAnimationChannelAsync(context + "/channels/" + channel._index, context, animation, channel, babylonAnimationGroup));
|
|
|
}
|
|
|
- this.onAnimationGroupLoadedObservable.notifyObservers(babylonAnimationGroup);
|
|
|
return Promise.all(promises).then(function () {
|
|
|
babylonAnimationGroup.normalize();
|
|
|
});
|
|
@@ -100058,7 +100168,12 @@ var BABYLON;
|
|
|
GLTFLoader.prototype._loadAnimationChannelAsync = function (context, animationContext, animation, channel, babylonAnimationGroup) {
|
|
|
var _this = this;
|
|
|
var targetNode = GLTFLoader._GetProperty(context + "/target/node", this._gltf.nodes, channel.target.node);
|
|
|
- if (!targetNode._babylonMesh || targetNode.skin != undefined) {
|
|
|
+ if (!targetNode._babylonMesh) {
|
|
|
+ return Promise.resolve();
|
|
|
+ }
|
|
|
+ // Ignore animations targeting TRS of skinned nodes.
|
|
|
+ // See https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins (second implementation note)
|
|
|
+ if (targetNode.skin != undefined && channel.target.path !== "weights" /* WEIGHTS */) {
|
|
|
return Promise.resolve();
|
|
|
}
|
|
|
var sampler = GLTFLoader._GetProperty(context + "/sampler", animation.samplers, channel.sampler);
|
|
@@ -100169,10 +100284,12 @@ var BABYLON;
|
|
|
value: key.value[targetIndex],
|
|
|
outTangent: key.outTangent ? key.outTangent[targetIndex] : undefined
|
|
|
}); }));
|
|
|
+ var multiTarget = new GLTF2.AnimationMultiTarget();
|
|
|
_this._forEachPrimitive(targetNode, function (babylonMesh) {
|
|
|
var morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);
|
|
|
- babylonAnimationGroup.addTargetedAnimation(babylonAnimation, morphTarget);
|
|
|
+ multiTarget.subTargets.push(morphTarget);
|
|
|
});
|
|
|
+ babylonAnimationGroup.addTargetedAnimation(babylonAnimation, multiTarget);
|
|
|
};
|
|
|
for (var targetIndex = 0; targetIndex < targetNode._numMorphTargets; targetIndex++) {
|
|
|
_loop_1(targetIndex);
|
|
@@ -100183,10 +100300,12 @@ var BABYLON;
|
|
|
var babylonAnimation = new BABYLON.Animation(animationName, targetPath, 1, animationType);
|
|
|
babylonAnimation.setKeys(keys);
|
|
|
if (targetNode._babylonAnimationTargets) {
|
|
|
+ var multiTarget = new GLTF2.AnimationMultiTarget();
|
|
|
for (var _i = 0, _a = targetNode._babylonAnimationTargets; _i < _a.length; _i++) {
|
|
|
var target = _a[_i];
|
|
|
- babylonAnimationGroup.addTargetedAnimation(babylonAnimation, target);
|
|
|
+ multiTarget.subTargets.push(target);
|
|
|
}
|
|
|
+ babylonAnimationGroup.addTargetedAnimation(babylonAnimation, multiTarget);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -101239,12 +101358,7 @@ var BABYLON;
|
|
|
//# sourceMappingURL=KHR_lights.js.map
|
|
|
|
|
|
|
|
|
-//backwards compatibility
|
|
|
-if(typeof earcut !== 'undefined') {
|
|
|
- globalObject["Earcut"] = {
|
|
|
- earcut: earcut
|
|
|
- };
|
|
|
-}
|
|
|
+
|
|
|
return BABYLON;
|
|
|
});
|
|
|
|