aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js256
1 files changed, 32 insertions, 224 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 0ba49c44..bc474a46 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -68,6 +68,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
68 value:function () { 68 value:function () {
69 if (this._boolCacheArrays) { 69 if (this._boolCacheArrays) {
70 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; 70 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers;
71 this.application.ninja.currentDocument.tlCurrentSelectedContainer=this.application.ninja.currentSelectedContainer;
71 } 72 }
72 } 73 }
73 }, 74 },
@@ -101,32 +102,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
101 } 102 }
102 }, 103 },
103 104
104 // TODO - Remove hash tables
105 _hashKey:{
106 value:0
107 },
108
109 hashKey:{
110 get:function () {
111 return this._hashKey;
112 },
113 set:function (newVal) {
114 if (newVal !== this._hashKey) {
115 this._hashKey = newVal;
116 this._setHashKey();
117 }
118 }
119 },
120
121 _setHashKey:{
122 value:function () {
123 if (this._boolCacheArrays) {
124 this.application.ninja.currentDocument.hashKey = this.hashKey;
125 }
126 }
127 },
128
129
130 _currentLayerSelected:{ 105 _currentLayerSelected:{
131 value:null 106 value:null
132 }, 107 },
@@ -236,7 +211,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
236 set:function (value) { 211 set:function (value) {
237 if (this._breadCrumbContainer !== value) { 212 if (this._breadCrumbContainer !== value) {
238 this._breadCrumbContainer = value; 213 this._breadCrumbContainer = value;
239 this.LayerBinding(this.application.ninja.currentSelectedContainer); 214 this.LayerBinding();
240 } 215 }
241 } 216 }
242 }, 217 },
@@ -278,7 +253,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
278 willDraw:{ 253 willDraw:{
279 value:function () { 254 value:function () {
280 if (this._isLayer) { 255 if (this._isLayer) {
281 this.insertLayer(); 256 // this.createNewLayer();
282 this._isLayer = false; 257 this._isLayer = false;
283 } 258 }
284 } 259 }
@@ -408,21 +383,25 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
408 this.drawTimeMarkers(); 383 this.drawTimeMarkers();
409 // Document switching 384 // Document switching
410 // Check to see if we have saved timeline information in the currentDocument. 385 // Check to see if we have saved timeline information in the currentDocument.
411 if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { 386 if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined" || this.application.ninja.breadCrumbClick) {
412 // No, we have no information stored. Create it. 387 // No, we have no information stored. Create it.
413 this.application.ninja.currentDocument.isTimelineInitialized = true; 388 this.application.ninja.currentDocument.isTimelineInitialized = true;
414 this.application.ninja.currentDocument.tlArrLayers = []; 389 this.application.ninja.currentDocument.tlArrLayers = [];
415 this.application.ninja.currentDocument.tllayerNumber = 0; 390 this.application.ninja.currentDocument.tllayerNumber = 0;
391 this.application.ninja.currentDocument.tlCurrentSelectedContainer = null;
416 this.temparrLayers = []; 392 this.temparrLayers = [];
417 393
418 // TODO - Remove hash
419 this.application.ninja.currentDocument.tlLayerHashTable = [];
420 this.hashKey = this.application.ninja.currentSelectedContainer.uuid;
421
422 // Are we opening an existing doc? 394 // Are we opening an existing doc?
423 if (!this.application.ninja.documentController.creatingNewFile) { 395 if (!this.application.ninja.documentController.creatingNewFile) {
424 // Opening an existing document. Does it have any DOM elements? 396 // Opening an existing document. Does it have any DOM elements?
425 if (this.application.ninja.currentDocument.documentRoot.children[0]) { 397 if(this.application.ninja.breadCrumbClick){
398 var parentNode = this.application.ninja.currentSelectedContainer;
399 for (myIndex = 0; parentNode.children[myIndex]; myIndex++) {
400 this._openDoc = true;
401 this.restoreLayer(parentNode.children[myIndex]);
402 }
403
404 }else if (this.application.ninja.currentDocument.documentRoot.children[0]) {
426 // Yes, it has DOM elements. Loop through them and create a new object for each. 405 // Yes, it has DOM elements. Loop through them and create a new object for each.
427 for (myIndex = 0; this.application.ninja.currentDocument.documentRoot.children[myIndex]; myIndex++) { 406 for (myIndex = 0; this.application.ninja.currentDocument.documentRoot.children[myIndex]; myIndex++) {
428 this._openDoc = true; 407 this._openDoc = true;
@@ -436,11 +415,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
436 // After recreating the tracks and layers, store the result in the currentDocument. 415 // After recreating the tracks and layers, store the result in the currentDocument.
437 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; 416 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers;
438 this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; 417 this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber;
439 418 this.application.ninja.currentDocument.tlCurrentSelectedContainer=this.application.ninja.currentSelectedContainer;
440 // TODO - Remove both hashes?
441 this.application.ninja.currentDocument.tlLayerHashTable = this.hashInstance;
442 this.application.ninja.currentDocument.tlElementHashTable = this.hashElementMapToLayer;
443 this.application.ninja.currentDocument.hashKey = this.hashKey;
444 419
445 } else { 420 } else {
446 // we do have information stored. Use it. 421 // we do have information stored. Use it.
@@ -453,11 +428,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
453 this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; 428 this.arrLayers = this.application.ninja.currentDocument.tlArrLayers;
454 this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; 429 this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber;
455 this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected; 430 this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected;
431 this.application.ninja.currentSelectedContainer=this.application.ninja.currentDocument.tlCurrentSelectedContainer;
456 432
457 // TODO - remove hash
458 this.hashInstance = this.application.ninja.currentDocument.tlLayerHashTable;
459 this.hashElementMapToLayer = this.application.ninja.currentDocument.tlElementHashTable;
460 this.hashKey = this.application.ninja.currentDocument.hashKey;
461 } 433 }
462 } 434 }
463 }, 435 },
@@ -478,19 +450,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
478 this.application.ninja.timeline.updateTimeText(0.00); 450 this.application.ninja.timeline.updateTimeText(0.00);
479 this.timebar.style.width = "0px"; 451 this.timebar.style.width = "0px";
480 452
481 // Clear variables.
482 this.hashInstance = null; // TODO - remove hash
483 this.hashElementMapToLayer = null; // TODO - remove hash
484 this.currentLayerNumber = 0; 453 this.currentLayerNumber = 0;
485 this.currentLayerSelected = false; 454 this.currentLayerSelected = false;
486 this.selectedKeyframes = []; 455 this.selectedKeyframes = [];
487 this.selectedTweens = []; 456 this.selectedTweens = [];
488 this._captureSelection = false; 457 this._captureSelection = false;
489 this._openDoc = false; 458 this._openDoc = false;
490 this._firstTimeLoaded = true; 459// this._firstTimeLoaded = true;
491 this.end_hottext.value = 25; 460 this.end_hottext.value = 25;
492 this.updateTrackContainerWidth(); 461 this.updateTrackContainerWidth();
493 this.selectedLayerID = false;
494 462
495 // Clear the repetitions 463 // Clear the repetitions
496 if (this.arrLayers.length > 0) { 464 if (this.arrLayers.length > 0) {
@@ -510,14 +478,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
510 // Rebind the document events for the new document context 478 // Rebind the document events for the new document context
511 this._bindDocumentEvents(); 479 this._bindDocumentEvents();
512 480
513 // TODO - remove hash
514 this.hashInstance = this.createLayerHashTable();
515 this.hashElementMapToLayer = this.createElementMapToLayer();
516
517 // Reinitialize the timeline...but only if there are open documents. 481 // Reinitialize the timeline...but only if there are open documents.
518 if (this.application.ninja.documentController._documents.length > 0) { 482 if (this.application.ninja.documentController._documents.length > 0) {
519 this.enablePanel(true); 483 this.enablePanel(true);
520 this.initTimelineForDocument(); 484 this.initTimelineForDocument();
485
521 } else { 486 } else {
522 this.enablePanel(false); 487 this.enablePanel(false);
523 } 488 }
@@ -597,22 +562,19 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
597 value:function (node) { 562 value:function (node) {
598 var i = 0; 563 var i = 0;
599 564
600 if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { 565 if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined" || (this.application.ninja.breadCrumbClick)) {
601 if (this._firstTimeLoaded) { 566 if (this._firstTimeLoaded) {
602 this._firstTimeLoaded = false; 567 this._firstTimeLoaded = false;
603 } else { 568 } else {
604 this.arrLayers.length = 0; 569 this._boolCacheArrays = false;
605 570 this.clearTimelinePanel();
606 // TODO - remove hash 571 this._boolCacheArrays = true;
607 this.hashKey = node.uuid; 572 this._bindDocumentEvents();
608