diff options
Diffstat (limited to 'js/panels/Timeline')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 115 |
1 files changed, 76 insertions, 39 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 4e7c71d0..3c3e0651 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -49,6 +49,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
49 | value: function() { | 49 | value: function() { |
50 | if (this._boolCacheArrays) { | 50 | if (this._boolCacheArrays) { |
51 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; | 51 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; |
52 | |||
52 | } | 53 | } |
53 | } | 54 | } |
54 | }, | 55 | }, |
@@ -69,6 +70,39 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
69 | set:function (newVal) { | 70 | set:function (newVal) { |
70 | if (newVal !== this._currentLayerNumber) { | 71 | if (newVal !== this._currentLayerNumber) { |
71 | this._currentLayerNumber = newVal; | 72 | this._currentLayerNumber = newVal; |
73 | this._setCurrentLayerNumber(); | ||
74 | } | ||
75 | } | ||
76 | }, | ||
77 | |||
78 | _setCurrentLayerNumber:{ | ||
79 | value:function(){ | ||
80 | if (this._boolCacheArrays) { | ||
81 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; | ||
82 | } | ||
83 | } | ||
84 | }, | ||
85 | |||
86 | _hashKey:{ | ||
87 | value:0 | ||
88 | }, | ||
89 | |||
90 | hashKey:{ | ||
91 | get:function () { | ||
92 | return this._hashKey; | ||
93 | }, | ||
94 | set:function (newVal) { | ||
95 | if (newVal !== this._hashKey) { | ||
96 | this._hashKey = newVal; | ||
97 | this._setHashKey(); | ||
98 | } | ||
99 | } | ||
100 | }, | ||
101 | |||
102 | _setHashKey:{ | ||
103 | value:function(){ | ||
104 | if (this._boolCacheArrays) { | ||
105 | this.application.ninja.currentDocument.hashKey = this.hashKey; | ||
72 | } | 106 | } |
73 | } | 107 | } |
74 | }, | 108 | }, |
@@ -220,11 +254,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
220 | value: function(boolUnbind) { | 254 | value: function(boolUnbind) { |
221 | var arrEvents = ["deleteLayerClick", | 255 | var arrEvents = ["deleteLayerClick", |
222 | "newLayer", | 256 | "newLayer", |
223 | "deleteLayer", | 257 | "deleteLayer", |
224 | "layerBinding", | ||
225 | "elementAdded", | 258 | "elementAdded", |
226 | "elementDeleted", | 259 | "elementDeleted", |
227 | "deleteSelection", | ||
228 | "selectionChange"], | 260 | "selectionChange"], |
229 | i, | 261 | i, |
230 | arrEventsLength = arrEvents.length; | 262 | arrEventsLength = arrEvents.length; |
@@ -268,7 +300,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
268 | value:function () { | 300 | value:function () { |
269 | var myIndex; | 301 | var myIndex; |
270 | this.drawTimeMarkers(); | 302 | this.drawTimeMarkers(); |
271 | this._hashKey = this.application.ninja.currentSelectedContainer.uuid; | 303 | |
272 | // Document switching | 304 | // Document switching |
273 | // Check to see if we have saved timeline information in the currentDocument. | 305 | // Check to see if we have saved timeline information in the currentDocument. |
274 | if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { | 306 | if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { |
@@ -277,9 +309,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
277 | this.application.ninja.currentDocument.isTimelineInitialized = true; | 309 | this.application.ninja.currentDocument.isTimelineInitialized = true; |
278 | this.application.ninja.currentDocument.tlArrLayers = []; | 310 | this.application.ninja.currentDocument.tlArrLayers = []; |
279 | this.application.ninja.currentDocument.tlArrTracks = []; | 311 | this.application.ninja.currentDocument.tlArrTracks = []; |
280 | // this.application.ninja.currentDocument.layerNumber = 0; | 312 | this.application.ninja.currentDocument.tllayerNumber = 0; |
281 | 313 | this.application.ninja.currentDocument.tlLayerHashTable=[]; | |
282 | 314 | this.hashKey = this.application.ninja.currentSelectedContainer.uuid; | |
315 | |||
283 | // Loop through the DOM of the document to find layers and animations. | 316 | // Loop through the DOM of the document to find layers and animations. |
284 | // Fire off events as they are found. | 317 | // Fire off events as they are found. |
285 | if(!this.application.ninja.documentController.creatingNewFile){ | 318 | if(!this.application.ninja.documentController.creatingNewFile){ |
@@ -304,9 +337,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
304 | // After recreating the tracks and layers, store the result in the currentDocument. | 337 | // After recreating the tracks and layers, store the result in the currentDocument. |
305 | this.application.ninja.currentDocument.tlArrTracks = this.arrTracks; | 338 | this.application.ninja.currentDocument.tlArrTracks = this.arrTracks; |
306 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; | 339 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; |
307 | // this.application.ninja.currentDocument.layerNumber = this.layerNumber; | 340 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; |
308 | // console.log(this.application.ninja.currentDocument) | 341 | this.application.ninja.currentDocument.tlLayerHashTable = this.hashInstance; |
309 | // console.log(this.application.ninja.currentDocument.tlArrLayers); | 342 | this.application.ninja.currentDocument.hashKey=this.hashKey; |
343 | |||
344 | |||
310 | 345 | ||
311 | } else { | 346 | } else { |
312 | // we do have information stored. Use it. | 347 | // we do have information stored. Use it. |
@@ -315,8 +350,13 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
315 | this.arrTracks = []; | 350 | this.arrTracks = []; |
316 | this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; | 351 | this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; |
317 | this.arrTracks = this.application.ninja.currentDocument.tlArrTracks; | 352 | this.arrTracks = this.application.ninja.currentDocument.tlArrTracks; |
318 | // this.layerNumber = this.application.ninja.currentDocument.layerNumber; | 353 | this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; |
354 | this.hashInstance = this.application.ninja.currentDocument.tlLayerHashTable; | ||
355 | this.hashKey = this.application.ninja.currentDocument.hashKey; | ||
356 | this.selectLayer(0); | ||
319 | this._boolCacheArrays = true; | 357 | this._boolCacheArrays = true; |
358 | |||
359 | |||
320 | } | 360 | } |
321 | 361 | ||
322 | // Redraw all the things | 362 | // Redraw all the things |
@@ -491,9 +531,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
491 | } else { | 531 | } else { |
492 | this.arrLayers.length = 0; | 532 | this.arrLayers.length = 0; |
493 | this.arrTracks.length = 0; | 533 | this.arrTracks.length = 0; |
494 | this._hashKey = node.uuid; | 534 | this.hashKey = node.uuid; |
495 | 535 | ||
496 | if (this.returnedObject = this.hashInstance.getItem(this._hashKey)) { | 536 | if (this.returnedObject = this.hashInstance.getItem(this.hashKey)) { |
497 | this._hashFind = true; | 537 | this._hashFind = true; |
498 | } | 538 | } |
499 | this.currentLayerNumber = 0; | 539 | this.currentLayerNumber = 0; |
@@ -550,12 +590,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
550 | var newLayerName = "", | 590 | var newLayerName = "", |
551 | thingToPush = {}, | 591 | thingToPush = {}, |
552 | myIndex = 0; | 592 | myIndex = 0; |
553 | // console.log(this.application.ninja.currentDocument.layerNumber); | ||
554 | 593 | ||
555 | this.currentLayerNumber = this.hashLayerNumber.getItem(this._hashKey); | 594 | // this.currentLayerNumber = this.hashLayerNumber.getItem(this._hashKey); |
556 | if (this.currentLayerNumber === undefined) { | 595 | // if (this.currentLayerNumber === undefined) { |
557 | this.currentLayerNumber = 0; | 596 | // this.currentLayerNumber = 0; |
558 | } | 597 | // } |
559 | 598 | ||
560 | this.currentLayerNumber = this.currentLayerNumber + 1; | 599 | this.currentLayerNumber = this.currentLayerNumber + 1; |
561 | newLayerName = "Layer " + this.currentLayerNumber; | 600 | newLayerName = "Layer " + this.currentLayerNumber; |
@@ -576,7 +615,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
576 | thingToPush.arrStyleTracks = []; | 615 | thingToPush.arrStyleTracks = []; |
577 | thingToPush.tweens = []; | 616 | thingToPush.tweens = []; |
578 | 617 | ||
579 | thingToPush.parentElementUUID = this._hashKey; | 618 | thingToPush.parentElementUUID = this.hashKey; |
580 | thingToPush.parentElement = this.application.ninja.currentSelectedContainer; | 619 | thingToPush.parentElement = this.application.ninja.currentSelectedContainer; |
581 | 620 | ||
582 | if (!!this.layerRepetition.selectedIndexes) { | 621 | if (!!this.layerRepetition.selectedIndexes) { |
@@ -587,17 +626,16 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
587 | this.arrLayers.splice(myIndex, 0, thingToPush); | 626 | this.arrLayers.splice(myIndex, 0, thingToPush); |
588 | this._LayerUndoPosition = myIndex; | 627 | this._LayerUndoPosition = myIndex; |
589 | this.selectLayer(myIndex); | 628 | this.selectLayer(myIndex); |
590 | this.hashLayerNumber.setItem(this._hashKey, thingToPush); | 629 | this.hashLayerNumber.setItem(this.hashKey, thingToPush); |
591 | this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); | 630 | this.hashInstance.setItem(this.hashKey, thingToPush, myIndex); |
592 | this.layerNumber = thingToPush.layerID; | 631 | |
593 | 632 | ||
594 | } else { | 633 | } else { |
595 | this.arrLayers.splice(0, 0, thingToPush); | 634 | this.arrLayers.splice(0, 0, thingToPush); |
596 | thingToPush.layerPosition = this.arrLayers.length - 1; | 635 | thingToPush.layerPosition = this.arrLayers.length - 1; |
597 | this._LayerUndoPosition = this.arrLayers.length - 1; | 636 | this._LayerUndoPosition = this.arrLayers.length - 1; |
598 | this.hashLayerNumber.setItem(this._hashKey, thingToPush); | 637 | this.hashLayerNumber.setItem(this.hashKey, thingToPush); |
599 | this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition); | 638 | this.hashInstance.setItem(this.hashKey, thingToPush, thingToPush.layerPosition); |
600 | this.layerNumber = thingToPush.layerID; | ||
601 | this.selectLayer(0); | 639 | this.selectLayer(0); |
602 | 640 | ||
603 | } | 641 | } |
@@ -629,10 +667,10 @@ var TimelinePanel = exports.TimelinePanel = Montage. |