diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 171 |
1 files changed, 87 insertions, 84 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 350c7311..0490aa49 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -19,15 +19,18 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
19 | 19 | ||
20 | /* === BEGIN: Models === */ | 20 | /* === BEGIN: Models === */ |
21 | _arrLayers:{ | 21 | _arrLayers:{ |
22 | serializable: true, | ||
22 | value:[] | 23 | value:[] |
23 | }, | 24 | }, |
24 | 25 | ||
25 | arrLayers:{ | 26 | arrLayers:{ |
27 | serializable: true, | ||
26 | get:function () { | 28 | get:function () { |
27 | return this._arrLayers; | 29 | return this._arrLayers; |
28 | }, | 30 | }, |
29 | set:function (newVal) { | 31 | set:function (newVal) { |
30 | this._arrLayers = newVal; | 32 | this._arrLayers = newVal; |
33 | this.needsDraw = true; | ||
31 | this._cacheArrays(); | 34 | this._cacheArrays(); |
32 | } | 35 | } |
33 | }, | 36 | }, |
@@ -47,10 +50,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
47 | 50 | ||
48 | 51 | ||
49 | _layerRepetition:{ | 52 | _layerRepetition:{ |
53 | serializable: true, | ||
50 | value:null | 54 | value:null |
51 | }, | 55 | }, |
52 | 56 | ||
53 | layerRepetition:{ | 57 | layerRepetition:{ |
58 | serializable: true, | ||
54 | get:function () { | 59 | get:function () { |
55 | return this._layerRepetition; | 60 | return this._layerRepetition; |
56 | }, | 61 | }, |
@@ -248,6 +253,33 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
248 | }, | 253 | }, |
249 | /* === END: Draw cycle === */ | 254 | /* === END: Draw cycle === */ |
250 | /* === BEGIN: Controllers === */ | 255 | /* === BEGIN: Controllers === */ |
256 | // Create an empty layer template object with minimal defaults and return it for use | ||
257 | createLayerTemplate : { | ||
258 | value : function() { | ||
259 | var returnObj = {}; | ||
260 | returnObj.layerData = {}; | ||
261 | returnObj.layerData.layerName = null; | ||
262 | returnObj.layerData.layerID = null; | ||
263 | returnObj.layerData.isMainCollapsed = true; | ||
264 | returnObj.layerData.isPositionCollapsed = true; | ||
265 | returnObj.layerData.isTransformCollapsed = true; | ||
266 | returnObj.layerData.isStyleCollapsed = true; | ||
267 | returnObj.layerData.arrLayerStyles = []; | ||
268 | returnObj.layerData.elementsList = []; | ||
269 | returnObj.layerData.deleted = false; | ||
270 | returnObj.layerData.isSelected = false; | ||
271 | returnObj.layerData.layerPosition = null; | ||
272 | returnObj.layerData.created=false; | ||
273 | returnObj.layerData.isTrackAnimated = false; | ||
274 | returnObj.layerData.currentKeyframeRule = null; | ||
275 | returnObj.layerData.trackPosition = 0; | ||
276 | returnObj.layerData.arrStyleTracks = []; | ||
277 | returnObj.layerData.tweens = []; | ||
278 | returnObj.parentElementUUID = null; | ||
279 | returnObj.parentElement = null; | ||
280 | return returnObj; | ||
281 | } | ||
282 | }, | ||
251 | // Bind all document-specific events (pass in true to unbind) | 283 | // Bind all document-specific events (pass in true to unbind) |
252 | _bindDocumentEvents : { | 284 | _bindDocumentEvents : { |
253 | value: function(boolUnbind) { | 285 | value: function(boolUnbind) { |
@@ -309,27 +341,27 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
309 | this.application.ninja.currentDocument.tlArrLayers = []; | 341 | this.application.ninja.currentDocument.tlArrLayers = []; |
310 | this.application.ninja.currentDocument.tllayerNumber = 0; | 342 | this.application.ninja.currentDocument.tllayerNumber = 0; |
311 | this.application.ninja.currentDocument.tlLayerHashTable=[]; | 343 | this.application.ninja.currentDocument.tlLayerHashTable=[]; |
344 | this.temparrLayers = []; | ||
312 | this.hashKey = this.application.ninja.currentSelectedContainer.uuid; | 345 | this.hashKey = this.application.ninja.currentSelectedContainer.uuid; |
313 | 346 | ||
314 | // Loop through the DOM of the document to find layers and animations. | 347 | // Are we creating a new doc, or opening an existing one? |
315 | // Fire off events as they are found. | 348 | if(!this.application.ninja.documentController.creatingNewFile) { |
316 | if(!this.application.ninja.documentController.creatingNewFile){ | 349 | // Opening an existing document. Loop through the DOM and build the data model. |
317 | if(this.application.ninja.currentDocument.documentRoot.children[0]){ | 350 | if(this.application.ninja.currentDocument.documentRoot.children[0]) { |
318 | myIndex=0; | 351 | myIndex=0; |
319 | while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) | 352 | while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) { |
320 | { | ||
321 | this._openDoc=true; | 353 | this._openDoc=true; |
322 | this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]); | 354 | this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]); |
323 | myIndex++; | 355 | myIndex++; |
324 | } | 356 | } |
325 | } | 357 | } else { |
326 | else{ | ||
327 | this.restoreLayer(1); | 358 | this.restoreLayer(1); |
328 | this.selectLayer(0); | 359 | //this.selectLayer(0); |
329 | } | 360 | } |
330 | }else{ | 361 | } else { |
362 | // New document. Create default layer and select it. | ||
331 | this.createNewLayer(1); | 363 | this.createNewLayer(1); |
332 | this.selectLayer(0); | 364 | //this.selectLayer(0); |
333 | 365 | ||
334 | } | 366 | } |
335 | // After recreating the tracks and layers, store the result in the currentDocument. | 367 | // After recreating the tracks and layers, store the result in the currentDocument. |
@@ -339,6 +371,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
339 | this.application.ninja.currentDocument.tlLayerHashTable = this.hashInstance; | 371 | this.application.ninja.currentDocument.tlLayerHashTable = this.hashInstance; |
340 | this.application.ninja.currentDocument.tlElementHashTable = this.hashElementMapToLayer; | 372 | this.application.ninja.currentDocument.tlElementHashTable = this.hashElementMapToLayer; |
341 | this.application.ninja.currentDocument.hashKey=this.hashKey; | 373 | this.application.ninja.currentDocument.hashKey=this.hashKey; |
374 | //this.selectLayer(0); | ||
342 | } else { | 375 | } else { |
343 | // we do have information stored. Use it. | 376 | // we do have information stored. Use it. |
344 | this._boolCacheArrays = false; | 377 | this._boolCacheArrays = false; |
@@ -347,9 +380,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
347 | this.hashInstance = this.application.ninja.currentDocument.tlLayerHashTable; | 380 | this.hashInstance = this.application.ninja.currentDocument.tlLayerHashTable; |
348 | this.hashElementMapToLayer = this.application.ninja.currentDocument.tlElementHashTable; | 381 | this.hashElementMapToLayer = this.application.ninja.currentDocument.tlElementHashTable; |
349 | this.hashKey = this.application.ninja.currentDocument.hashKey; | 382 | this.hashKey = this.application.ninja.currentDocument.hashKey; |
350 | this.selectLayer(0); | ||
351 | this._boolCacheArrays = true; | 383 | this._boolCacheArrays = true; |
384 | //this.selectLayer(0); | ||
352 | } | 385 | } |
386 | // Select the first layer. | ||
387 | //debugger; | ||
388 | //this.selectLayer(0); | ||
353 | } | 389 | } |
354 | }, | 390 | }, |
355 | 391 | ||
@@ -367,10 +403,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
367 | this.application.ninja.timeline.updateTimeText(0.00); | 403 | this.application.ninja.timeline.updateTimeText(0.00); |
368 | this.timebar.style.width = "0px"; | 404 | this.timebar.style.width = "0px"; |
369 | 405 | ||
370 | // Clear variables--including repetitions. | 406 | // Clear variables. |
371 | this.hashInstance = null; | 407 | this.hashInstance = null; |
372 | this.hashElementMapToLayer = null; | 408 | this.hashElementMapToLayer = null; |
373 | this.arrLayers = []; | ||
374 | 409 | ||
375 | this.currentLayerNumber = 0; | 410 | this.currentLayerNumber = 0; |
376 | this.currentLayerSelected = false; | 411 | this.currentLayerSelected = false; |
@@ -381,11 +416,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
381 | this._firstTimeLoaded=true; | 416 | this._firstTimeLoaded=true; |
382 | this.end_hottext.value = 25; | 417 | this.end_hottext.value = 25; |
383 | this.updateTrackContainerWidth(); | 418 | this.updateTrackContainerWidth(); |
419 | |||
420 | // Clear the repetitions | ||
421 | if (this.arrLayers.length > 0) { | ||
422 | console.log('Clearing repetitions!') | ||
423 | this.arrLayers = []; | ||
424 | } | ||
425 | |||
426 | |||
384 | } | 427 | } |
385 | }, | 428 | }, |
429 | |||
386 | 430 | ||
387 | handleDocumentChange:{ | 431 | handleDocumentChange:{ |
388 | value:function(){ | 432 | value:function(event){ |
433 | console.log(event); | ||
389 | this._boolCacheArrays = false; | 434 | this._boolCacheArrays = false; |
390 | this.clearTimelinePanel(); | 435 | this.clearTimelinePanel(); |
391 | this._boolCacheArrays = true; | 436 | this._boolCacheArrays = true; |
@@ -393,7 +438,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
393 | 438 | ||