|
@@ -102943,6 +102943,9 @@ var BABYLON;
|
|
|
this.utilityLayerScene.detachControl();
|
|
|
if (handleEvents) {
|
|
|
this._originalPointerObserver = originalScene.onPrePointerObservable.add(function (prePointerInfo, eventState) {
|
|
|
+ if (!_this.utilityLayerScene.activeCamera) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (!_this.processAllEvents) {
|
|
|
if (prePointerInfo.type !== BABYLON.PointerEventTypes.POINTERMOVE
|
|
|
&& prePointerInfo.type !== BABYLON.PointerEventTypes.POINTERUP
|
|
@@ -103124,7 +103127,12 @@ var BABYLON;
|
|
|
this.utilityLayerScene.dispose();
|
|
|
};
|
|
|
UtilityLayerRenderer.prototype._updateCamera = function () {
|
|
|
- this.utilityLayerScene.activeCamera = this.originalScene.activeCamera;
|
|
|
+ if (this.originalScene.activeCameras.length > 1) {
|
|
|
+ this.utilityLayerScene.activeCamera = this.originalScene.activeCameras[0];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.utilityLayerScene.activeCamera = this.originalScene.activeCamera;
|
|
|
+ }
|
|
|
};
|
|
|
UtilityLayerRenderer._DefaultUtilityLayer = null;
|
|
|
UtilityLayerRenderer._DefaultKeepDepthUtilityLayer = null;
|
|
@@ -105468,7 +105476,7 @@ var BABYLON;
|
|
|
rotateSpheres[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
|
|
|
rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(BABYLON.Vector3.Forward(), rotateSpheres[index].position.normalizeToNew()).normalizeToNew().add(rotateSpheres[index].position));
|
|
|
}
|
|
|
- if (this.fixedDragMeshScreenSize) {
|
|
|
+ if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
|
|
|
rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);
|
|
|
var distanceFromCamera = this.rotationSphereSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;
|
|
|
rotateSpheres[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);
|
|
@@ -105489,7 +105497,7 @@ var BABYLON;
|
|
|
if (scaleBoxes[index]) {
|
|
|
scaleBoxes[index].position.set(this._boundingDimensions.x * i, this._boundingDimensions.y * j, this._boundingDimensions.z * k);
|
|
|
scaleBoxes[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
|
|
|
- if (this.fixedDragMeshScreenSize) {
|
|
|
+ if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
|
|
|
scaleBoxes[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);
|
|
|
var distanceFromCamera = this.scaleBoxSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;
|
|
|
scaleBoxes[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);
|
|
@@ -105555,13 +105563,6 @@ var BABYLON;
|
|
|
var box = BABYLON.MeshBuilder.CreateBox("box", { size: 1 }, mesh.getScene());
|
|
|
var boundingMinMax = mesh.getHierarchyBoundingVectors();
|
|
|
boundingMinMax.max.subtractToRef(boundingMinMax.min, box.scaling);
|
|
|
- box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);
|
|
|
- // Restore original positions
|
|
|
- mesh.addChild(box);
|
|
|
- mesh.rotationQuaternion.copyFrom(oldRot);
|
|
|
- mesh.position.copyFrom(oldPos);
|
|
|
- // Reverse parenting
|
|
|
- mesh.removeChild(box);
|
|
|
// Adjust scale to avoid undefined behavior when adding child
|
|
|
if (box.scaling.y === 0) {
|
|
|
box.scaling.y = BABYLON.Epsilon;
|
|
@@ -105572,6 +105573,13 @@ var BABYLON;
|
|
|
if (box.scaling.z === 0) {
|
|
|
box.scaling.z = BABYLON.Epsilon;
|
|
|
}
|
|
|
+ box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);
|
|
|
+ // Restore original positions
|
|
|
+ mesh.addChild(box);
|
|
|
+ mesh.rotationQuaternion.copyFrom(oldRot);
|
|
|
+ mesh.position.copyFrom(oldPos);
|
|
|
+ // Reverse parenting
|
|
|
+ mesh.removeChild(box);
|
|
|
box.addChild(mesh);
|
|
|
box.visibility = 0;
|
|
|
return box;
|