Exemplo n.º 1
0
 public void SetComponent(string text, CoalescedValue <sbyte> current)
 {
     if (Parser.TryParse(text, out double newValue))
     {
         SetProperty((sbyte)newValue);
         editor.Text = ((sbyte)newValue).ToString();
     }
     else
     {
         editor.Text = current.IsDefined ? current.Value.ToString() : ManyValuesText;
     }
 }
 private void SetIndexValue(int index, CommonEditBox editor, CoalescedValue <int> prevValue)
 {
     if (float.TryParse(editor.Text, out float newValue))
     {
         DoTransaction(() => {
             SetProperty <SkinningWeights>((current) => {
                 current[index] = new BoneWeight {
                     Index  = (int)newValue,
                     Weight = current[index].Weight
                 };
                 CheckWarnings();
                 return(current);
             });
         });
     }
     else
     {
         editor.Text = prevValue.IsDefined ? prevValue.Value.ToString() : ManyValuesText;
     }
 }
        private void SetWeightValue(IPropertyEditorParams editorParams, int idx, CommonEditBox editor, CoalescedValue <float> prevWeight)
        {
            float newValue;

            if (float.TryParse(editor.Text, out newValue))
            {
                DoTransaction(() => {
                    SetProperty <SkinningWeights>((current) => {
                        current[idx] = new BoneWeight {
                            Index  = current[idx].Index,
                            Weight = newValue
                        };
                        return(current);
                    });
                });
            }
            else
            {
                editor.Text = prevWeight.IsDefined ? prevWeight.Value.ToString("0.###") : ManyValuesText;
            }
        }
Exemplo n.º 4
0
        void SetComponent(IPropertyEditorParams editorParams, int component, NumericEditBox editor, CoalescedValue <float> currentValue)
        {
            float newValue;

            if (float.TryParse(editor.Text, out newValue))
            {
                DoTransaction(() => {
                    SetProperty <Thickness>((current) => {
                        switch (component)
                        {
                        case 0: current.Left = newValue; break;

                        case 1: current.Right = newValue; break;

                        case 2: current.Top = newValue; break;

                        case 3: current.Bottom = newValue; break;
                        }
                        return(current);
                    });
                });
            }
            else
            {
                switch (component)
                {
                case 0: editor.Text = currentValue.IsDefined ? currentValue.Value.ToString("0.###") : ManyValuesText; break;

                case 1: editor.Text = currentValue.IsDefined ? currentValue.Value.ToString("0.###") : ManyValuesText; break;

                case 2: editor.Text = currentValue.IsDefined ? currentValue.Value.ToString("0.###") : ManyValuesText; break;

                case 3: editor.Text = currentValue.IsDefined ? currentValue.Value.ToString("0.###") : ManyValuesText; break;
                }
            }
        }
 void SetComponent(IPropertyEditorParams editorParams, int component, NumericEditBox editor, CoalescedValue <float> currentValue)
 {
     if (Parser.TryParse(editor.Text, out double newValue))
     {
         DoTransaction(() => {
             SetProperty <NumericRange>(current => {
                 if (component == 0)
                 {
                     current.Median = (float)newValue;
                 }
                 else
                 {
                     current.Dispersion = (float)newValue;
                 }
                 return(current);
             });
         });
         editor.Text = newValue.ToString("0.###");
     }
     else
     {
         editor.Text = currentValue.IsDefined
                                         ? currentValue.Value.ToString("0.###")
                                         : ManyValuesText;
     }
 }
Exemplo n.º 6
0
 void SetComponent(IPropertyEditorParams editorParams, int component, CommonEditBox editor, CoalescedValue <float> currentValue)
 {
     if (Parser.TryParse(editor.Text, out double newValue))
     {
         DoTransaction(() => {
             SetProperty <Vector2>(current => {
                 current[component] = (float)newValue;
                 return(current);
             });
         });
         editor.Text = newValue.ToString("0.###");
     }
     else
     {
         editor.Text = currentValue.IsDefined ? currentValue.Value.ToString("0.###") : ManyValuesText;
     }
 }