Skip to content

Commit

Permalink
Show circles for the timeline values at each keyframe.
Browse files Browse the repository at this point in the history
Fix default name of timeline elements
  • Loading branch information
Lyeeedar committed Sep 9, 2016
1 parent 141e3a9 commit a5a9a3f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion StructuredXmlEditor/Core.xmldef
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@

<StructDef Name="Timeline" ToolTip="A collection of keyframes." TextColour="Struct">
<Attributes>
<String Name="Name" Default="Struct" ToolTip="The name to be written for this element." />
<String Name="Name" Default="Timeline" ToolTip="The name to be written for this element." />
<String Name="TimeChild" Default="Time" SkipIfDefault="false" ToolTip="The name of the child containing the keyframe time." />
<Boolean Name="Interpolate" Default="true" ToolTip="Whether the timeline should show interpolated values" />
<Number Name="MinCount" Min="0" ToolTip="The minimum number of keyframesthis can have." />
Expand Down
32 changes: 31 additions & 1 deletion StructuredXmlEditor/View/CustomControls/Timeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,20 @@ protected override void OnRender(DrawingContext drawingContext)
var thisDrawPos = TimelineItem.GetKeyframeTime(thisKeyframe) * pixelsASecond + TimelineItem.LeftPad;
var nextDrawPos = TimelineItem.GetKeyframeTime(nextKeyframe) * pixelsASecond + TimelineItem.LeftPad;

drawingContext.DrawRectangle(brush, null, new Rect(thisDrawPos, drawPos, nextDrawPos - thisDrawPos, lineHeight));
drawingContext.DrawRectangle(brush, indicatorPen, new Rect(thisDrawPos, drawPos, nextDrawPos - thisDrawPos, lineHeight));
}

for (int ii = 0; ii < sortedKeyframes.Count; ii++)
{
var thisKeyframe = sortedKeyframes[ii];

var thisCol = TimelineItem.GetColourData(thisKeyframe, i);

var brush = new SolidColorBrush(thisCol);

var thisDrawPos = TimelineItem.GetKeyframeTime(thisKeyframe) * pixelsASecond + TimelineItem.LeftPad;

drawingContext.DrawRoundedRectangle(brush, indicatorPen, new Rect(thisDrawPos-5, (drawPos+lineHeight/2)-5, 10, 10), 5, 5);
}
}

Expand Down Expand Up @@ -190,8 +203,25 @@ protected override void OnRender(DrawingContext drawingContext)
var thisDrawPos = TimelineItem.GetKeyframeTime(thisKeyframe) * pixelsASecond + TimelineItem.LeftPad;
var nextDrawPos = TimelineItem.GetKeyframeTime(nextKeyframe) * pixelsASecond + TimelineItem.LeftPad;

var borderPen = new Pen(IndicatorBrush, 4);
drawingContext.DrawLine(borderPen, new Point(thisDrawPos, thisH), new Point(nextDrawPos, nextH));
drawingContext.DrawLine(pen, new Point(thisDrawPos, thisH), new Point(nextDrawPos, nextH));
}

for (int ii = 0; ii < sortedKeyframes.Count; ii++)
{
var thisKeyframe = sortedKeyframes[ii];

var thisNum = TimelineItem.GetNumberData(thisKeyframe, i);

var thisAlpha = (thisNum - min) / (max - min);

var thisH = (ActualHeight - 20) - (ActualHeight - 25) * thisAlpha;

var thisDrawPos = TimelineItem.GetKeyframeTime(thisKeyframe) * pixelsASecond + TimelineItem.LeftPad;

drawingContext.DrawRoundedRectangle(pen.Brush, indicatorPen, new Rect(thisDrawPos - 5, thisH - 5, 10, 10), 5, 5);
}
}
}

Expand Down

0 comments on commit a5a9a3f

Please sign in to comment.