diff options
author | Kruti Shah | 2012-03-05 16:21:11 -0800 |
---|---|---|
committer | Kruti Shah | 2012-03-05 16:21:11 -0800 |
commit | e9f46776738343af427260190d0eddbd41fbbba3 (patch) | |
tree | 62f39fbe2707635121aa04aaa690b8ecebe98ad1 /js | |
parent | 11f39321cf1f2b5f3790ed819051f56411e98261 (diff) | |
download | ninja-e9f46776738343af427260190d0eddbd41fbbba3.tar.gz |
Timeline: Fixing the layer switching
Signed-off-by: Kruti Shah <kruti.shah@motorola.com>
Diffstat (limited to 'js')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 48181ae7..4e7c71d0 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -277,11 +277,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
277 | this.application.ninja.currentDocument.isTimelineInitialized = true; | 277 | this.application.ninja.currentDocument.isTimelineInitialized = true; |
278 | this.application.ninja.currentDocument.tlArrLayers = []; | 278 | this.application.ninja.currentDocument.tlArrLayers = []; |
279 | this.application.ninja.currentDocument.tlArrTracks = []; | 279 | this.application.ninja.currentDocument.tlArrTracks = []; |
280 | // this.application.ninja.currentDocument.layerNumber = 0; | ||
280 | 281 | ||
281 | 282 | ||
282 | // Loop through the DOM of the document to find layers and animations. | 283 | // Loop through the DOM of the document to find layers and animations. |
283 | // Fire off events as they are found. | 284 | // Fire off events as they are found. |
284 | _firstLayerDraw = false; | ||
285 | if(!this.application.ninja.documentController.creatingNewFile){ | 285 | if(!this.application.ninja.documentController.creatingNewFile){ |
286 | if(this.application.ninja.currentDocument.documentRoot.children[0]){ | 286 | if(this.application.ninja.currentDocument.documentRoot.children[0]){ |
287 | myIndex=0; | 287 | myIndex=0; |
@@ -301,11 +301,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
301 | this.selectLayer(0); | 301 | this.selectLayer(0); |
302 | 302 | ||
303 | } | 303 | } |
304 | _firstLayerDraw = true; | ||
305 | |||
306 | // After recreating the tracks and layers, store the result in the currentDocument. | 304 | // After recreating the tracks and layers, store the result in the currentDocument. |
307 | this.application.ninja.currentDocument.tlArrTracks = this.arrTracks; | 305 | this.application.ninja.currentDocument.tlArrTracks = this.arrTracks; |
308 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; | 306 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; |
307 | // this.application.ninja.currentDocument.layerNumber = this.layerNumber; | ||
308 | // console.log(this.application.ninja.currentDocument) | ||
309 | // console.log(this.application.ninja.currentDocument.tlArrLayers); | ||
309 | 310 | ||
310 | } else { | 311 | } else { |
311 | // we do have information stored. Use it. | 312 | // we do have information stored. Use it. |
@@ -314,6 +315,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
314 | this.arrTracks = []; | 315 | this.arrTracks = []; |
315 | this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; | 316 | this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; |
316 | this.arrTracks = this.application.ninja.currentDocument.tlArrTracks; | 317 | this.arrTracks = this.application.ninja.currentDocument.tlArrTracks; |
318 | // this.layerNumber = this.application.ninja.currentDocument.layerNumber; | ||
317 | this._boolCacheArrays = true; | 319 | this._boolCacheArrays = true; |
318 | } | 320 | } |
319 | 321 | ||
@@ -340,7 +342,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
340 | 342 | ||
341 | // Clear variables--including repetitions. | 343 | // Clear variables--including repetitions. |
342 | this.hashInstance = null; | 344 | this.hashInstance = null; |
343 | this.hashTrackInstance = null; | ||
344 | this.hashLayerNumber = null; | 345 | this.hashLayerNumber = null; |
345 | this.hashElementMapToLayer = null; | 346 | this.hashElementMapToLayer = null; |
346 | this.arrTracks = []; | 347 | this.arrTracks = []; |
@@ -481,22 +482,24 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
481 | }, | 482 | }, |
482 | 483 | ||
483 | LayerBinding:{ | 484 | LayerBinding:{ |
484 | value:function (node) { | 485 | value:function (node) { |
485 | var i = 0; | 486 | var i = 0; |
486 | 487 | ||
487 | if (this._firstTimeLoaded) { | 488 | if(typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined"){ |
488 | this._firstTimeLoaded = false; | 489 | if (this._firstTimeLoaded) { |
489 | } else { | 490 | this._firstTimeLoaded = false; |
490 | this.arrLayers.length = 0; | 491 | } else { |
491 | this.arrTracks.length = 0; | 492 | this.arrLayers.length = 0; |
492 | this._hashKey = node.uuid; | 493 | this.arrTracks.length = 0; |
494 | this._hashKey = node.uuid; | ||
493 | 495 | ||
494 | if (this.returnedObject = this.hashInstance.getItem(this._hashKey)) { | 496 | if (this.returnedObject = this.hashInstance.getItem(this._hashKey)) { |
495 | this._hashFind = true; | 497 | this._hashFind = true; |
498 | } | ||
499 | this.currentLayerNumber = 0; | ||
500 | this.createNewLayer(1); | ||
501 | this.selectLayer(0); | ||
496 | } | 502 | } |
497 | this.currentLayerNumber = 0; | ||
498 | this.createNewLayer(1); | ||
499 | this.selectLayer(0); | ||
500 | } | 503 | } |
501 | } | 504 | } |
502 | }, | 505 | }, |
@@ -547,6 +550,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
547 | var newLayerName = "", | 550 | var newLayerName = "", |
548 | thingToPush = {}, | 551 | thingToPush = {}, |
549 | myIndex = 0; | 552 | myIndex = 0; |
553 | // console.log(this.application.ninja.currentDocument.layerNumber); | ||
550 | 554 | ||
551 | this.currentLayerNumber = this.hashLayerNumber.getItem(this._hashKey); | 555 | this.currentLayerNumber = this.hashLayerNumber.getItem(this._hashKey); |
552 | if (this.currentLayerNumber === undefined) { | 556 | if (this.currentLayerNumber === undefined) { |
@@ -585,6 +589,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
585 | this.selectLayer(myIndex); | 589 | this.selectLayer(myIndex); |
586 | this.hashLayerNumber.setItem(this._hashKey, thingToPush); | 590 | this.hashLayerNumber.setItem(this._hashKey, thingToPush); |
587 | this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); | 591 | this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); |
592 | this.layerNumber = thingToPush.layerID; | ||
588 | 593 | ||
589 | } else { | 594 | } else { |
590 | this.arrLayers.splice(0, 0, thingToPush); | 595 | this.arrLayers.splice(0, 0, thingToPush); |
@@ -592,6 +597,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
592 | this._LayerUndoPosition = this.arrLayers.length - 1; | 597 | this._LayerUndoPosition = this.arrLayers.length - 1; |
593 | this.hashLayerNumber.setItem(this._hashKey, thingToPush); | 598 | this.hashLayerNumber.setItem(this._hashKey, thingToPush); |
594 | this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition); | 599 | this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition); |
600 | this.layerNumber = thingToPush.layerID; | ||
595 | this.selectLayer(0); | 601 | this.selectLayer(0); |
596 | 602 | ||
597 | } | 603 | } |
@@ -665,6 +671,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
665 | this.selectLayer(myIndex); | 671 | this.selectLayer(myIndex); |
666 | this.hashLayerNumber.setItem(this._hashKey, thingToPush); | 672 | this.hashLayerNumber.setItem(this._hashKey, thingToPush); |
667 | this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); | 673 | this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); |
674 | this.layerNumber = thingToPush.layerID; | ||
668 | 675 | ||
669 | } else { | 676 | } else { |
670 | this.arrLayers.splice(0, 0, thingToPush); | 677 | this.arrLayers.splice(0, 0, thingToPush); |
@@ -672,6 +679,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
672 | this._LayerUndoPosition = this.arrLayers.length - 1; | 679 | this._LayerUndoPosition = this.arrLayers.length - 1; |
673 | this.hashLayerNumber.setItem(this._hashKey, thingToPush); | 680 | this.hashLayerNumber.setItem(this._hashKey, thingToPush); |
674 | this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition); | 681 | this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition); |
682 | this.layerNumber = thingToPush.layerID; | ||
675 | this.selectLayer(0); | 683 | this.selectLayer(0); |
676 | 684 | ||
677 | } | 685 | } |