aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js99
1 files changed, 68 insertions, 31 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 81415951..67ff3c02 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -28,7 +28,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
28 }, 28 },
29 set:function (newVal) { 29 set:function (newVal) {
30 this._arrLayers = newVal; 30 this._arrLayers = newVal;
31 this.application.ninja.currentDocument.tlArrLayers = newVal; 31 this.updateLayers();
32 } 32 }
33 }, 33 },
34 34
@@ -44,6 +44,18 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
44 this._layerRepetition = newVal; 44 this._layerRepetition = newVal;
45 } 45 }
46 }, 46 },
47 updateLayers : {
48 value: function() {
49 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers;
50 // this.application.ninja.currentDocument.tlArrTracks = this.arrTracks;
51 console.log('inside of updateLayers ');
52 console.log(this.application.ninja.currentDocument.tlArrTracks);
53
54 }
55 },
56 boolUpdateLayers : {
57 value: true
58 },
47 59
48 _currentLayerNumber:{ 60 _currentLayerNumber:{
49 value:0 61 value:0
@@ -100,7 +112,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
100 }, 112 },
101 set:function (newVal) { 113 set:function (newVal) {
102 this._arrTracks = newVal; 114 this._arrTracks = newVal;
103 this.application.ninja.currentDocument.tlArrTracks = newVal; 115 this.updateLayers();
104 } 116 }
105 }, 117 },
106 118
@@ -182,7 +194,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
182 194
183 handleOnOpenDocument:{ 195 handleOnOpenDocument:{
184 value:function(){ 196 value:function(){
197 this.boolUpdateLayers = false;
185 this.clearTimelinePanel(); 198 this.clearTimelinePanel();
199 this.boolUpdateLayers = true;
186 this.eventManager.addEventListener("deleteLayerClick", this, false); 200 this.eventManager.addEventListener("deleteLayerClick", this, false);
187 this.eventManager.addEventListener("newLayer", this, false); 201 this.eventManager.addEventListener("newLayer", this, false);
188 this.eventManager.addEventListener("deleteLayer", this, false); 202 this.eventManager.addEventListener("deleteLayer", this, false);
@@ -204,6 +218,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
204 handleCloseDocument: { 218 handleCloseDocument: {
205 value: function(event) { 219 value: function(event) {
206 this.clearTimelinePanel(); 220 this.clearTimelinePanel();
221 this.arrTracks = [];
222 this.arrLayers = [];
207 } 223 }
208 }, 224 },
209 225
@@ -245,32 +261,55 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
245 initTimelineView:{ 261 initTimelineView:{
246 value:function () { 262 value:function () {
247 var myIndex; 263 var myIndex;
248
249 this.drawTimeMarkers(); 264 this.drawTimeMarkers();
265 this._hashKey = "123";
266
267
268 // Document switching
269 // Check to see if we have saved timeline information in the currentDocument.
270 if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") {
271 // No, we have no information stored. Create it.
272 console.log('newfile!')
273 this.application.ninja.currentDocument.isTimelineInitialized = true;
274 this.application.ninja.currentDocument.tlArrLayers = [];
275 this.application.ninja.currentDocument.tlArrTracks = [];
276 _firstLayerDraw = false;
277 if(!this.application.ninja.documentController.creatingNewFile){
278 if(this.application.ninja.currentDocument.documentRoot.children[0]){
279 myIndex=0;
280 while(this.application.ninja.currentDocument.documentRoot.children[myIndex])
281 {
282 this._openDoc=true;
283 NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]})
284 myIndex++;
285 }
286 }
287 else{
288 NJevent('newLayer', this._hashKey);
289 this.selectLayer(0);
290 }
291 }else{
292 NJevent('newLayer', this._hashKey);
293 this.selectLayer(0);
294
295 }
296 _firstLayerDraw = true;
297 this.application.ninja.currentDocument.tlArrTracks = this.arrTracks;
298 } else {
299 // we do have information stored. Use it.
300 console.log('oldfile!')
301 console.log("tlArrLayers: " , this.application.ninja.currentDocument.tlArrLayers);
302 console.log("tlArrTracks: " , this.application.ninja.currentDocument.tlArrTracks);
303 this.arrLayers = this.application.ninja.currentDocument.tlArrLayers;
304 this.arrTracks = this.application.ninja.currentDocument.tlArrTracks;
305 }
306
307 // Redraw all the things
308 this.layerRepetition.needsDraw = true;
309 this.trackRepetition.needsDraw = true;
310 this.needsDraw = true;
250 311
251 this._hashKey = "123";
252 _firstLayerDraw = false;
253 if(!this.application.ninja.documentController.creatingNewFile){
254 if(this.application.ninja.currentDocument.documentRoot.children[0]){
255 myIndex=0;
256 while(this.application.ninja.currentDocument.documentRoot.children[myIndex])
257 {
258 this._openDoc=true;
259 this._captureSelection=true;
260 NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]})
261 myIndex++;
262 }
263 }
264 else{
265 NJevent('newLayer', this._hashKey);
266 this.selectLayer(0);
267 }
268 }else{
269 NJevent('newLayer', this._hashKey);
270 this.selectLayer(0);
271 312
272 }
273 _firstLayerDraw = true;
274 } 313 }
275 }, 314 },
276 315
@@ -300,8 +339,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
300 this.hashTrackInstance = null; 339 this.hashTrackInstance = null;
301 this.hashLayerNumber = null; 340 this.hashLayerNumber = null;
302 this.hashElementMapToLayer = null; 341 this.hashElementMapToLayer = null;
303 this.arrTracks = []; 342 if (!this.boolUpdateLayers) {
304 this.arrLayers = []; 343
344 }
345
305 this.currentLayerNumber = 0; 346 this.currentLayerNumber = 0;
306 this.currentLayerSelected = false; 347 this.currentLayerSelected = false;
307 this.currentTrackSelected = false; 348 this.currentTrackSelected = false;
@@ -312,10 +353,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
312 this.end_hottext.value = 25; 353 this.end_hottext.value = 25;
313 this.updateTrackContainerWidth(); 354 this.updateTrackContainerWidth();
314 355
315 // Redraw all the things
316 this.layerRepetition.needsDraw = true;
317 this.trackRepetition.needsDraw = true;
318 this.needsDraw = true;
319 } 356 }
320 }, 357 },
321 358