From 2e4831cf0fe04f37a179f84b098ae0899d4e40b8 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Thu, 24 May 2012 09:34:05 -0700 Subject: recreating layer props Signed-off-by: Jonathan Duran --- js/panels/Timeline/Layer.reel/Layer.js | 9 +++++-- .../Timeline/TimelineTrack.reel/TimelineTrack.js | 29 +++++++++++++++++++--- 2 files changed, 32 insertions(+), 6 deletions(-) (limited to 'js/panels/Timeline') diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js index 4fb3e43c..8df0e9ae 100644 --- a/js/panels/Timeline/Layer.reel/Layer.js +++ b/js/panels/Timeline/Layer.reel/Layer.js @@ -556,7 +556,7 @@ var Layer = exports.Layer = Montage.create(Component, { } }, addStyle : { - value: function() { + value: function(styleProperty) { // Add a new style rule. It should be added above the currently selected rule, // Or at the end, if no rule is selected. @@ -579,7 +579,12 @@ var Layer = exports.Layer = Montage.create(Component, { newStyle.styleID = newEvent.styleID; newStyle.whichView = "hintable"; - newStyle.editorProperty = ""; + newStyle.editorProperty = ""; + if(styleProperty){ + newStyle.editorProperty = styleProperty; + newEvent.layerEventType = "restoreStyle"; + newEvent.trackEditorProperty = styleProperty; + } newStyle.editorValue = ""; newStyle.ruleTweener = false; newStyle.isSelected = false; diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index faa3ba77..47e04d71 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -834,9 +834,17 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { recreatePropertyTracks:{ value:function(ruleSet){ + + //var selectIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); + //var test = this.application.ninja.timeline.layerRepetition.childComponents[0].addStyle(); + //console.log(test); + for(var i in ruleSet){ - //console.log(i); + console.log(i); //console.log(ruleSet[i]); + var styleProp = ruleSet[i][0].style[0]; + console.log(styleProp); + this.application.ninja.timeline.layerRepetition.childComponents[0].addStyle(styleProp); } } }, @@ -958,9 +966,22 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { this.arrStyleTracks.push(newStyleTrack); - } else if (layerEvent.layerEventType === "deleteStyle") { - // TODO: Delete the right track. Index can be passed in event object, use that for splice(). - this.arrStyleTracks.pop(); + } else if (layerEvent.layerEventType === "restoreStyle") { + var restoredStyleTrack = {}; + restoredStyleTrack.propTrackData = {}; + restoredStyleTrack.propTrackData.styleSelection = layerEvent.styleSelection; + restoredStyleTrack.propTrackData.propTweens = []; + restoredStyleTrack.propTrackData.trackType = "style"; + restoredStyleTrack.propTrackData.trackEditorProperty = layerEvent.trackEditorProperty; + restoredStyleTrack.propTrackData.styleIndex = layerEvent.styleIndex; + + this.arrStyleTracks.push(restoredStyleTrack); + + this.isStyleCollapsed = true; + } + else if (layerEvent.layerEventType === "deleteStyle") { + // TODO: Delete the right track. Index can be passed in event object, use that for splice(). + this.arrStyleTracks.pop(); } } }, -- cgit v1.2.3