瀏覽代碼

Fix issue with linktoMesh with gui

David Catuhe 8 年之前
父節點
當前提交
7735ff13a7

文件差異過大導致無法顯示
+ 5219 - 5219
dist/preview release/babylon.d.ts


文件差異過大導致無法顯示
+ 5219 - 5219
dist/preview release/babylon.module.d.ts


文件差異過大導致無法顯示
+ 2466 - 2466
dist/preview release/customConfigurations/minimalViewer/babylon.d.ts


文件差異過大導致無法顯示
+ 2466 - 2466
dist/preview release/customConfigurations/minimalViewer/babylon.module.d.ts


+ 1 - 0
dist/preview release/gui/babylon.gui.js

@@ -1067,6 +1067,7 @@ var BABYLON;
                     return;
                 }
                 if (this._host._linkedControls.indexOf(this) !== -1) {
+                    this._linkedMesh = mesh;
                     return;
                 }
                 this.horizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;

文件差異過大導致無法顯示
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


文件差異過大導致無法顯示
+ 3 - 3
dist/preview release/inspector/babylon.inspector.bundle.js


+ 1 - 1
dist/preview release/inspector/babylon.inspector.css

@@ -277,7 +277,7 @@
   .insp-wrapper .insp-details {
     background-color: #242424;
     overflow-y: auto;
-    overflow-x: hidden;
+    overflow-x: auto;
     color: #ccc;
     font-family: "Inconsolata", sans-serif; }
     .insp-wrapper .insp-details .base-row, .insp-wrapper .insp-details .row, .insp-wrapper .insp-details .header-row {

+ 54 - 2
dist/preview release/inspector/babylon.inspector.js

@@ -3095,7 +3095,7 @@ var INSPECTOR;
             _this._panel = INSPECTOR.Helpers.CreateDiv('tab-panel');
             // Build the treepanel
             _this._treePanel = INSPECTOR.Helpers.CreateDiv('insp-tree', _this._panel);
-            _this._imagePanel = INSPECTOR.Helpers.CreateDiv('image-panel', _this._panel);
+            _this._imagePanel = INSPECTOR.Helpers.CreateDiv('insp-details', _this._panel);
             Split([_this._treePanel, _this._imagePanel], {
                 blockDrag: _this._inspector.popupMode,
                 direction: 'vertical'
@@ -3148,6 +3148,11 @@ var INSPECTOR;
             // Get the texture object
             var texture = item.adapter.object;
             var img = INSPECTOR.Helpers.CreateElement('img', 'texture-image', this._imagePanel);
+            var img1 = INSPECTOR.Helpers.CreateElement('img', 'texture-image', this._imagePanel);
+            var img2 = INSPECTOR.Helpers.CreateElement('img', 'texture-image', this._imagePanel);
+            var img3 = INSPECTOR.Helpers.CreateElement('img', 'texture-image', this._imagePanel);
+            var img4 = INSPECTOR.Helpers.CreateElement('img', 'texture-image', this._imagePanel);
+            var img5 = INSPECTOR.Helpers.CreateElement('img', 'texture-image', this._imagePanel);
             if (texture instanceof BABYLON.MapTexture) {
                 // instance of Map texture
                 texture.bindTextureForPosSize(new BABYLON.Vector2(0, 0), new BABYLON.Size(texture.getSize().width, texture.getSize().height), false);
@@ -3156,7 +3161,54 @@ var INSPECTOR;
             }
             else if (texture instanceof BABYLON.RenderTargetTexture) {
                 // RenderTarget textures
-                BABYLON.Tools.CreateScreenshotUsingRenderTarget(this._inspector.scene.getEngine(), texture.activeCamera, { precision: 1 }, function (data) { return img.src = data; });
+                if (texture.activeCamera) {
+                    BABYLON.Tools.CreateScreenshotUsingRenderTarget(this._inspector.scene.getEngine(), texture.activeCamera, { precision: 1 }, function (data) { return img.src = data; });
+                }
+                else {
+                    var scene = this._inspector.scene;
+                    var engine_1 = scene.getEngine();
+                    var size_1 = texture.getSize();
+                    // Clone the texture
+                    var screenShotTexture = texture.clone();
+                    screenShotTexture.activeCamera = texture.activeCamera;
+                    screenShotTexture.onBeforeRender = texture.onBeforeRender;
+                    screenShotTexture.onAfterRender = texture.onAfterRender;
+                    screenShotTexture.onBeforeRenderObservable = texture.onBeforeRenderObservable;
+                    screenShotTexture.onAfterUnbindObservable = texture.onAfterUnbindObservable;
+                    // To display the texture after rendering
+                    screenShotTexture.onAfterRenderObservable.add(function (faceIndex) {
+                        var targetImg;
+                        switch (faceIndex) {
+                            case 0:
+                                targetImg = img;
+                                break;
+                            case 1:
+                                targetImg = img1;
+                                break;
+                            case 2:
+                                targetImg = img2;
+                                break;
+                            case 3:
+                                targetImg = img3;
+                                break;
+                            case 4:
+                                targetImg = img4;
+                                break;
+                            case 5:
+                                targetImg = img5;
+                                break;
+                            default:
+                                targetImg = img;
+                                break;
+                        }
+                        BABYLON.Tools.DumpFramebuffer(size_1.width, size_1.height, engine_1, function (data) { return targetImg.src = data; }, "image/png");
+                    });
+                    // Render the texture
+                    scene.incrementRenderId();
+                    scene.resetCachedMaterial();
+                    screenShotTexture.render(true);
+                    screenShotTexture.dispose();
+                }
             }
             else if (texture.url) {
                 // If an url is present, the texture is an image

文件差異過大導致無法顯示
+ 2 - 2
dist/preview release/inspector/babylon.inspector.min.js


+ 1 - 1
gui/src/controls/control.ts

@@ -442,10 +442,10 @@ module BABYLON.GUI {
             }
 
             if (this._host._linkedControls.indexOf(this) !== -1) {
+                this._linkedMesh = mesh;
                 return;
             }
 
-
             this.horizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
             this.verticalAlignment = BABYLON.GUI.Control.VERTICAL_ALIGNMENT_TOP;
             this._linkedMesh = mesh;