void Redisplay()
        {
            //reset
            SelectorMode       = KeySelectorMode.Start;
            selectedStartFrame = selectedEndFrame = 0;
            cursorShown        = false;
            endCursor          = startCursor = cursor = null;
            space = null;
            KeySelector.Children.Clear();

            //display sequences
            foreach (var seq in _sequences)
            {
                if (seq.IsRootSeq)
                {
                    continue;
                }
                SolidColorBrush randomColor     = new SolidColorBrush(AppResources.BatchRandomColor(1)[0]);
                Brush           semiTransparent = new SolidColorBrush(randomColor.Color);
                semiTransparent.Opacity = .5;
                Border border = null;
                KeySelector.Children.Add(
                    border = new Border
                {
                    Child = new TextBlock()
                    {
                        HorizontalAlignment = HorizontalAlignment.Center,
                        VerticalAlignment   = VerticalAlignment.Center,
                        Text          = (string.IsNullOrWhiteSpace(seq.Name) ? seq.ID.ToString() : seq.Name + $" ({seq.ID})") + $": {seq.FrameLength} frames",
                        Padding       = new Thickness(5, 3, 5, 3),
                        TextWrapping  = TextWrapping.Wrap,
                        Background    = randomColor,
                        TextAlignment = TextAlignment.Center
                    },
                    Padding         = new Thickness(10),
                    BorderBrush     = randomColor,
                    BorderThickness = new Thickness(2, 0, 2, 0),
                    Background      = semiTransparent,
                    Width           = (seq.FrameLength / (double)blitz3DAnimation.Frames) * KeySelector.ActualWidth,
                    Height          = KeySelector.ActualHeight
                });

                if (border.Width < 60)
                {
                    ((TextBlock)border.Child).Text = seq.ID.ToString();
                    border.Padding = new Thickness(0);
                }
                Canvas.SetLeft(border, (seq.First / (double)blitz3DAnimation.Frames) * KeySelector.ActualWidth);
            }
            DescBlock.Text = $"Sequences: {_sequences.Count()}, Frames: {preview.numPositionKeys()}";
            DataChart.DisplayAnimation(preview);
        }
Ejemplo n.º 2
0
        private void LoadAnim(int key = 0)
        {
            var           selected          = selectedAnim;
            int           selectedObjectKey = key;
            StringBuilder posBuilder        = new StringBuilder(),
                          rotBuilder        = new StringBuilder(),
                          sclBuilder        = new StringBuilder();
            var anim = selected.keys.ElementAtOrDefault(selectedObjectKey);

            if (anim == null)
            {
                //MessageBox.Show("Animation not found!");
                return;
            }
            posBuilder.AppendLine(string.Join("\n", anim.AnimRep.pos_anim));
            sclBuilder.AppendLine(string.Join("\n", anim.AnimRep.scale_anim));
            rotBuilder.AppendLine(string.Join("\n", anim.AnimRep.rot_anim));
            PositionBlock.Text = posBuilder.ToString();
            RotationBlock.Text = rotBuilder.ToString();
            ScaleBlock.Text    = sclBuilder.ToString();
            ShowChart();
            DataChart.DisplayAnimation(selectedAnim.keys[key]);
        }