From 2da05a4c71bfe9b136384d9e94fbfbef19f24550 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 27 Jun 2012 17:28:06 -0700 Subject: Performance fix for WebGL materials playing even when the dialog/file is no longer in view. Also pausing videos when switching documents. Signed-off-by: Nivesh Rajbhandari --- .../materials-library-panel.js | 2 + .../materials-popup.reel/materials-popup.js | 51 +++++++++++----------- 2 files changed, 28 insertions(+), 25 deletions(-) (limited to 'js/panels') diff --git a/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js index cd933ea6..8c1aa1dc 100755 --- a/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js +++ b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js @@ -129,6 +129,8 @@ exports.MaterialsLibraryPanel = Montage.create(Component, { enumerable: false, value: function (event) { if(this._materialPopup){ +// console.log("hiding material popup"); + this._materialInfo.destroy(); this._materialPopup.hide(); } } diff --git a/js/panels/Materials/materials-popup.reel/materials-popup.js b/js/panels/Materials/materials-popup.reel/materials-popup.js index 3f702459..9b7b031b 100755 --- a/js/panels/Materials/materials-popup.reel/materials-popup.js +++ b/js/panels/Materials/materials-popup.reel/materials-popup.js @@ -69,11 +69,11 @@ exports.MaterialsPopup = Montage.create(Component, { switch(event._currentTarget.label) { case "Cancel": - console.log("Cancel material edit"); +// console.log("Cancel material edit"); this.revertToOriginalValues(); break; case "OK": - console.log("Committing material with the following values:"); +// console.log("Committing material with the following values:"); for(var i=0, len=this.materialsProperties.childComponents.length; i< len; i++) { var childControl = this.materialsProperties.childComponents[i]; @@ -109,7 +109,7 @@ exports.MaterialsPopup = Montage.create(Component, { { value: function() { - console.log("Save As..."); +// console.log("Save As..."); var materialCopy = prompt("Save material as", this._materialName + "_Copy"); if (materialCopy) @@ -123,7 +123,7 @@ exports.MaterialsPopup = Montage.create(Component, { { value: function() { - console.log("Reset"); +// console.log("Reset"); } }, @@ -186,15 +186,15 @@ exports.MaterialsPopup = Montage.create(Component, { { value: function(event) { - if(typeof event.propertyValue === "object") - { - console.log(event.propertyLabel + " changing to "); - console.dir(event.propertyValue); - } - else - { - console.log(event.propertyLabel + " changing to " + event.propertyValue); - } +// if(typeof event.propertyValue === "object") +// { +// console.log(event.propertyLabel + " changing to "); +// console.dir(event.propertyValue); +// } +// else +// { +// console.log(event.propertyLabel + " changing to " + event.propertyValue); +// } if (event.propertyLabel && event.propertyValue) this.applyProperty( event.propertyLabel, event.propertyValue ); @@ -206,15 +206,15 @@ exports.MaterialsPopup = Montage.create(Component, { value: function(theEvent) { var event = theEvent._event; - if(typeof event.propertyValue === "object") - { - console.log(event.propertyLabel + " changed to "); - console.dir(event.propertyValue); - } - else - { - console.log(event.propertyLabel + " changed to " + event.propertyValue); - } +// if(typeof event.propertyValue === "object") +// { +// console.log(event.propertyLabel + " changed to "); +// console.dir(event.propertyValue); +// } +// else +// { +// console.log(event.propertyLabel + " changed to " + event.propertyValue); +// } if (event.propertyLabel) this.applyProperty( event.propertyLabel, event.propertyValue ); @@ -253,7 +253,7 @@ exports.MaterialsPopup = Montage.create(Component, { var obj, matArray, matTypeArray, nMats, iMat, world; if (this._useSelection) { - console.log( "apply to selection" ); +// console.log( "apply to selection" ); var selection = this.application.ninja.selectedElements; if (selection && (selection.length > 0)) @@ -385,7 +385,7 @@ exports.MaterialsPopup = Montage.create(Component, { this.previewShape.setFillMaterial(this._material); this.previewShape.buildBuffers(); - world.render(); + world.restartRenderLoop(); } }, @@ -393,7 +393,8 @@ exports.MaterialsPopup = Montage.create(Component, { destroy: { enumerable: false, value: function() { - // add cleanup routines here +// console.log("cleanup routines here"); + this.previewShape.getWorld().stop(); } }, -- cgit v1.2.3