aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Materials
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-06-27 17:28:06 -0700
committerNivesh Rajbhandari2012-06-27 17:28:06 -0700
commit2da05a4c71bfe9b136384d9e94fbfbef19f24550 (patch)
treebfa21e77da8722f71fd8d32dc2f768f08a7a7183 /js/panels/Materials
parent978b9049d057d2a0995758275f68da8641193201 (diff)
downloadninja-2da05a4c71bfe9b136384d9e94fbfbef19f24550.tar.gz
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 <mqg734@motorola.com>
Diffstat (limited to 'js/panels/Materials')
-rwxr-xr-xjs/panels/Materials/materials-library-panel.reel/materials-library-panel.js2
-rwxr-xr-xjs/panels/Materials/materials-popup.reel/materials-popup.js51
2 files changed, 28 insertions, 25 deletions
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, {
129 enumerable: false, 129 enumerable: false,
130 value: function (event) { 130 value: function (event) {
131 if(this._materialPopup){ 131 if(this._materialPopup){
132// console.log("hiding material popup");
133 this._materialInfo.destroy();
132 this._materialPopup.hide(); 134 this._materialPopup.hide();
133 } 135 }
134 } 136 }
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, {
69 switch(event._currentTarget.label) 69 switch(event._currentTarget.label)
70 { 70 {
71 case "Cancel": 71 case "Cancel":
72 console.log("Cancel material edit"); 72// console.log("Cancel material edit");
73 this.revertToOriginalValues(); 73 this.revertToOriginalValues();
74 break; 74 break;
75 case "OK": 75 case "OK":
76 console.log("Committing material with the following values:"); 76// console.log("Committing material with the following values:");
77 for(var i=0, len=this.materialsProperties.childComponents.length; i< len; i++) 77 for(var i=0, len=this.materialsProperties.childComponents.length; i< len; i++)
78 { 78 {
79 var childControl = this.materialsProperties.childComponents[i]; 79 var childControl = this.materialsProperties.childComponents[i];
@@ -109,7 +109,7 @@ exports.MaterialsPopup = Montage.create(Component, {
109 { 109 {
110 value: function() 110 value: function()
111 { 111 {
112 console.log("Save As..."); 112// console.log("Save As...");
113 var materialCopy = prompt("Save material as", this._materialName + "_Copy"); 113 var materialCopy = prompt("Save material as", this._materialName + "_Copy");
114 114
115 if (materialCopy) 115 if (materialCopy)
@@ -123,7 +123,7 @@ exports.MaterialsPopup = Montage.create(Component, {
123 { 123 {
124 value: function() 124 value: function()
125 { 125 {
126 console.log("Reset"); 126// console.log("Reset");
127 } 127 }
128 }, 128 },
129 129
@@ -186,15 +186,15 @@ exports.MaterialsPopup = Montage.create(Component, {
186 { 186 {
187 value: function(event) 187 value: function(event)
188 { 188 {
189 if(typeof event.propertyValue === "object") 189// if(typeof event.propertyValue === "object")
190 { 190// {
191 console.log(event.propertyLabel + " changing to "); 191// console.log(event.propertyLabel + " changing to ");
192 console.dir(event.propertyValue); 192// console.dir(event.propertyValue);
193 } 193// }
194 else 194// else
195 { 195// {
196 console.log(event.propertyLabel + " changing to " + event.propertyValue); 196// console.log(event.propertyLabel + " changing to " + event.propertyValue);
197 } 197// }
198 198
199 if (event.propertyLabel && event.propertyValue) 199 if (event.propertyLabel && event.propertyValue)
200 this.applyProperty( event.propertyLabel, event.propertyValue ); 200 this.applyProperty( event.propertyLabel, event.propertyValue );
@@ -206,15 +206,15 @@ exports.MaterialsPopup = Montage.create(Component, {
206 value: function(theEvent) 206 value: function(theEvent)
207 { 207 {
208 var event = theEvent._event; 208 var event = theEvent._event;
209 if(typeof event.propertyValue === "object") 209// if(typeof event.propertyValue === "object")
210 { 210// {
211 console.log(event.propertyLabel + " changed to "); 211// console.log(event.propertyLabel + " changed to ");
212 console.dir(event.propertyValue); 212// console.dir(event.propertyValue);
213 } 213// }
214 else 214// else
215 { 215// {
216 console.log(event.propertyLabel + " changed to " + event.propertyValue); 216// console.log(event.propertyLabel + " changed to " + event.propertyValue);
217 } 217// }
218 218
219 if (event.propertyLabel) 219 if (event.propertyLabel)
220 this.applyProperty( event.propertyLabel, event.propertyValue ); 220 this.applyProperty( event.propertyLabel, event.propertyValue );
@@ -253,7 +253,7 @@ exports.MaterialsPopup = Montage.create(Component, {
253 var obj, matArray, matTypeArray, nMats, iMat, world; 253 var obj, matArray, matTypeArray, nMats, iMat, world;
254 if (this._useSelection) 254 if (this._useSelection)
255 { 255 {
256 console.log( "apply to selection" ); 256// console.log( "apply to selection" );
257 257
258 var selection = this.application.ninja.selectedElements; 258 var selection = this.application.ninja.selectedElements;
259 if (selection && (selection.length > 0)) 259 if (selection && (selection.length > 0))
@@ -385,7 +385,7 @@ exports.MaterialsPopup = Montage.create(Component, {
385 385
386 this.previewShape.setFillMaterial(this._material); 386 this.previewShape.setFillMaterial(this._material);
387 this.previewShape.buildBuffers(); 387 this.previewShape.buildBuffers();
388 world.render(); 388 world.restartRenderLoop();
389 } 389 }
390 }, 390 },
391 391
@@ -393,7 +393,8 @@ exports.MaterialsPopup = Montage.create(Component, {
393 destroy: { 393 destroy: {
394 enumerable: false, 394 enumerable: false,
395 value: function() { 395 value: function() {
396 // add cleanup routines here 396// console.log("cleanup routines here");
397 this.previewShape.getWorld().stop();
397 } 398 }
398 }, 399 },
399 400