aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js210
1 files changed, 94 insertions, 116 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 9c782787..54c40676 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -284,12 +284,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
284 value:function () { 284 value:function () {
285 var myIndex; 285 var myIndex;
286 this.drawTimeMarkers(); 286 this.drawTimeMarkers();
287
288 // Document switching 287 // Document switching
289 // Check to see if we have saved timeline information in the currentDocument. 288 // Check to see if we have saved timeline information in the currentDocument.
290 if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { 289 if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") {
291 // No, we have no information stored. Create it. 290 // No, we have no information stored. Create it.
292 this.log('newfile ' + this.application.ninja.currentDocument.name)
293 this.application.ninja.currentDocument.isTimelineInitialized = true; 291 this.application.ninja.currentDocument.isTimelineInitialized = true;
294 this.application.ninja.currentDocument.tlArrLayers = []; 292 this.application.ninja.currentDocument.tlArrLayers = [];
295 this.application.ninja.currentDocument.tlArrTracks = []; 293 this.application.ninja.currentDocument.tlArrTracks = [];
@@ -324,29 +322,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
324 this.application.ninja.currentDocument.tlLayerHashTable = this.hashInstance; 322 this.application.ninja.currentDocument.tlLayerHashTable = this.hashInstance;
325 this.application.ninja.currentDocument.tlElementHashTable = this.hashElementMapToLayer; 323 this.application.ninja.currentDocument.tlElementHashTable = this.hashElementMapToLayer;
326 this.application.ninja.currentDocument.hashKey=this.hashKey; 324 this.application.ninja.currentDocument.hashKey=this.hashKey;
327
328
329
330 } else { 325 } else {
331 // we do have information stored. Use it. 326 // we do have information stored. Use it.
332 this._boolCacheArrays = false; 327 this._boolCacheArrays = false;
333 //this.arrLayers = [];
334 this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; 328 this.arrLayers = this.application.ninja.currentDocument.tlArrLayers;
335 this.arrTracks = this.application.ninja.currentDocument.tlArrTracks;
336 this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; 329 this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber;
337 this.hashInstance = this.application.ninja.currentDocument.tlLayerHashTable; 330 this.hashInstance = this.application.ninja.currentDocument.tlLayerHashTable;
338 this.hashElementMapToLayer = this.application.ninja.currentDocument.tlElementHashTable; 331 this.hashElementMapToLayer = this.application.ninja.currentDocument.tlElementHashTable;
339 this.hashKey = this.application.ninja.currentDocument.hashKey; 332 this.hashKey = this.application.ninja.currentDocument.hashKey;
340 this.selectLayer(0); 333 this.selectLayer(0);
341 this._boolCacheArrays = true; 334 this._boolCacheArrays = true;
342
343
344 } 335 }
345
346 // Redraw all the things
347 //this.layerRepetition.needsDraw = true;
348 //this.trackRepetition.needsDraw = true;
349 //this.needsDraw = true;
350 } 336 }
351 }, 337 },
352 338
@@ -390,7 +376,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
390 this._bindDocumentEvents(); 376 this._bindDocumentEvents();
391 377
392 this.hashInstance = this.createLayerHashTable(); 378 this.hashInstance = this.createLayerHashTable();
393 this.hashLayerNumber = this.createLayerNumberHash(); 379 //this.hashLayerNumber = this.createLayerNumberHash();
394 this.hashElementMapToLayer = this.createElementMapToLayer(); 380 this.hashElementMapToLayer = this.createElementMapToLayer();
395 this.initTimelineForDocument(); 381 this.initTimelineForDocument();
396 } 382 }
@@ -545,8 +531,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
545 if (object._el.parentElementUUID !== this.application.ninja.currentSelectedContainer.uuid) { 531 if (object._el.parentElementUUID !== this.application.ninja.currentSelectedContainer.uuid) {
546 dLayer = this.hashInstance.getItem(object._el.parentElementUUID); 532 dLayer = this.hashInstance.getItem(object._el.parentElementUUID);
547 while (dLayer[hashVariable]) { 533 while (dLayer[hashVariable]) {
548 if (dLayer[hashVariable]._layerID === object._el._layerID) { 534 if (dLayer[hashVariable].layerData._layerID === object._el._layerID) {
549 dLayer[hashVariable].deleted = false; 535 dLayer[hashVariable].layerData.deleted = false;
550 parentNode = dLayer[hashVariable].parentElement; 536 parentNode = dLayer[hashVariable].parentElement;
551 break; 537 break;
552 } 538 }
@@ -556,9 +542,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
556 this.LayerBinding(parentNode); 542 this.LayerBinding(parentNode);
557 } else { 543 } else {
558 dLayer = this.hashInstance.getItem(object._el.parentElementUUID); 544 dLayer = this.hashInstance.getItem(object._el.parentElementUUID);
559 while (dLayer[hashVariable]) { 545 while (dLayer[hashVariable].layerData) {
560 if (dLayer[hashVariable]._layerID === object._el._layerID) { 546 if (dLayer[hashVariable].layerData._layerID === object._el._layerID) {
561 dLayer[hashVariable].deleted = false; 547 dLayer[hashVariable].layerData.deleted = false;
562 548
563 this.arrLayers.splice(object._layerPosition, 0, object._el); 549 this.arrLayers.splice(object._layerPosition, 0, object._el);
564 this.selectLayer(object._layerPosition); 550 this.selectLayer(object._layerPosition);
@@ -573,58 +559,55 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
573 var newLayerName = "", 559 var newLayerName = "",
574 thingToPush = {}, 560 thingToPush = {},
575 myIndex = 0; 561 myIndex = 0;
562 thingToPush.layerData = {};
576 563
577// this.currentLayerNumber = this.hashLayerNumber.getItem(this._hashKey);
578// if (this.currentLayerNumber === undefined) {
579// this.currentLayerNumber = 0;
580// }
581 564
582 this.currentLayerNumber = this.currentLayerNumber + 1; 565 this.currentLayerNumber = this.currentLayerNumber + 1;
583 newLayerName = "Layer " + this.currentLayerNumber; 566 newLayerName = "Layer " + this.currentLayerNumber;
584 thingToPush.layerName = newLayerName; 567 thingToPush.layerData.layerName = newLayerName;
585 thingToPush.layerID = this.currentLayerNumber; 568 thingToPush.layerData.layerID = this.currentLayerNumber;
586 thingToPush.isMainCollapsed = true; 569 thingToPush.layerData.isMainCollapsed = true;
587 thingToPush.isPositionCollapsed = true; 570 thingToPush.layerData.isPositionCollapsed = true;
588 thingToPush.isTransformCollapsed = true; 571 thingToPush.layerData.isTransformCollapsed = true;
589 thingToPush.isStyleCollapsed = true; 572 thingToPush.layerData.isStyleCollapsed = true;
590 thingToPush.arrLayerStyles = []; 573 thingToPush.layerData.arrLayerStyles = [];
591 thingToPush.elementsList = []; 574 thingToPush.layerData.elementsList = [];
592 thingToPush.deleted = false; 575 thingToPush.layerData.deleted = false;
593 thingToPush.isSelected = false; 576 thingToPush.layerData.isSelected = false;
594 thingToPush.created=false; 577 thingToPush.layerData.created=false;
595 thingToPush.isTrackAnimated = false; 578 thingToPush.layerData.isTrackAnimated = false;
596 thingToPush.currentKeyframeRule = null; 579 thingToPush.layerData.currentKeyframeRule = null;
597 thingToPush.trackPosition = 0; 580 thingToPush.layerData.trackPosition = 0;
598 thingToPush.arrStyleTracks = []; 581 thingToPush.layerData.arrStyleTracks = [];
599 thingToPush.tweens = []; 582 thingToPush.layerData.tweens = [];
600 583
601 thingToPush.parentElementUUID = this.hashKey; 584 thingToPush.parentElementUUID = this.hashKey;
602 thingToPush.parentElement = this.application.ninja.currentSelectedContainer; 585 thingToPush.parentElement = this.application.ninja.currentSelectedContainer;
603 586
604 if (!!this.layerRepetition.selectedIndexes) { 587 if (!!this.layerRepetition.selectedIndexes) {
605 myIndex = this.layerRepetition.selectedIndexes[0]; 588 myIndex = this.layerRepetition.selectedIndexes[0];
606 thingToPush.layerPosition = myIndex; 589 thingToPush.layerData.layerPosition = myIndex;
607 thingToPush.isSelected = true; 590 thingToPush.layerData.isSelected = true;
608 thingToPush.trackPosition = myIndex; 591 thingToPush.layerData.trackPosition = myIndex;
609 this.arrLayers.splice(myIndex, 0, thingToPush); 592 this.arrLayers.splice(myIndex, 0, thingToPush);
610 this._LayerUndoPosition = myIndex; 593 this._LayerUndoPosition = myIndex;
611 this.selectLayer(myIndex); 594 this.selectLayer(myIndex);
612 this.hashLayerNumber.setItem(this.hashKey, thingToPush); 595 //this.hashLayerNumber.setItem(this.hashKey, thingToPush.layerData);
613 this.hashInstance.setItem(this.hashKey, thingToPush, myIndex); 596 this.hashInstance.setItem(this.hashKey, thingToPush.layerData, myIndex);
614 597
615 598
616 } else { 599 } else {
617 this.arrLayers.splice(0, 0, thingToPush); 600 this.arrLayers.splice(0, 0, thingToPush);
618 thingToPush.layerPosition = this.arrLayers.length - 1; 601 thingToPush.layerData.layerPosition = this.arrLayers.length - 1;
619 this._LayerUndoPosition = this.arrLayers.length - 1; 602 this._LayerUndoPosition = this.arrLayers.length - 1;
620 this.hashLayerNumber.setItem(this.hashKey, thingToPush); 603 //this.hashLayerNumber.setItem(this.hashKey, thingToPush.layerData);
621 this.hashInstance.setItem(this.hashKey, thingToPush, thingToPush.layerPosition); 604 this.hashInstance.setItem(this.hashKey, thingToPush.layerData, thingToPush.layerData.layerPosition);
622 this.selectLayer(0); 605 this.selectLayer(0);
623 606
624 } 607 }
625 608
626 this._LayerUndoObject = thingToPush; 609 this._LayerUndoObject = thingToPush;
627 this._LayerUndoIndex = thingToPush.layerID; 610 this._LayerUndoIndex = thingToPush.layerData.layerID;
628 this._LayerUndoStatus = true; 611 this._LayerUndoStatus = true;
629 } 612 }
630 613
@@ -633,84 +616,79 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
633 616
634 restoreLayer:{ 617 restoreLayer:{
635 value:function (ele) { 618 value:function (ele) {