예제 #1
0
        private void HandleTextboxFramedataChange(object sender, RoutedEventArgs e)
        {
            FrameInputBox srcInput = e.Source as FrameInputBox;

            bool isParsed = decimal.TryParse(srcInput.Text, out decimal parsedValue);

            if (isParsed)
            {
                if (parsedValue.Equals(srcInput.value))
                {
                    return;
                }

                srcInput.value = parsedValue;
                TempFrameData.UpdateFrameAxis(srcInput.Frame, srcInput.axis, srcInput.value, isRelative: true);

                DrawGraphs(TempFrameData.Absolute);
            }
            else
            {
                srcInput.Text = srcInput.value.ToString();
            }
        }
예제 #2
0
        public void OpenFrameData(string xmlFile)
        {
            Data = new AnimXml(xmlFile);
            var(rootmotionData, rootmotionNotFound) = Data.GetRootmotionData();

            if (rootmotionNotFound)
            {
                TextBlock textBlock = new TextBlock
                {
                    Text       = "No Rootmotion Found to Edit",
                    Foreground = Brushes.Red,
                    FontSize   = 60,
                };

                Canvas.Children.Add(textBlock);
                OpenFile.xmlPath = string.Empty;
                OpenFile.hkxPath = string.Empty;
                return;
            }

            var(frameData, parsingError) = Data.processRootmotionData(rootmotionData);
            if (!parsingError)
            {
                FrameData     = new FrameDataModel(frameData);
                TempFrameData = new FrameDataModel(frameData);

                StackPanel.Children.Clear();
                foreach (var frame in FrameData.Relative.Select((motion, index) => (motion, index)))
                {
                    StackPanel newPanel = new StackPanel
                    {
                        Height      = 40,
                        Orientation = Orientation.Horizontal
                    };

                    Label Frame = new Label {
                        Content = frame.index, Background = Brushes.LightGray, Width = 60, VerticalContentAlignment = VerticalAlignment.Center
                    };
                    FrameInputBox X = new FrameInputBox {
                        Text = frame.motion["X"].ToString(), Background = Brushes.IndianRed, Width = 150, VerticalContentAlignment = VerticalAlignment.Center, BorderThickness = new Thickness(0)
                    };
                    FrameInputBox Y = new FrameInputBox {
                        Text = frame.motion["Y"].ToString(), Background = Brushes.LightYellow, Width = 150, VerticalContentAlignment = VerticalAlignment.Center, BorderThickness = new Thickness(0)
                    };
                    FrameInputBox Z = new FrameInputBox {
                        Text = frame.motion["Z"].ToString(), Background = Brushes.DodgerBlue, Width = 150, VerticalContentAlignment = VerticalAlignment.Center, BorderThickness = new Thickness(0)
                    };

                    X.Frame = frame.index;
                    Y.Frame = frame.index;
                    Z.Frame = frame.index;

                    X.axis = "X";
                    Y.axis = "Y";
                    Z.axis = "Z";

                    X.value = frame.motion["X"];
                    Y.value = frame.motion["Y"];
                    Z.value = frame.motion["Z"];

                    X.LostFocus += HandleTextboxFramedataChange;
                    Y.LostFocus += HandleTextboxFramedataChange;
                    Z.LostFocus += HandleTextboxFramedataChange;

                    newPanel.Children.Add(Frame);
                    newPanel.Children.Add(X);
                    newPanel.Children.Add(Y);
                    newPanel.Children.Add(Z);

                    StackPanel.Children.Add(newPanel);
                }

                DrawGraphs(frameData);
            }
        }