Ejemplo n.º 1
0
        void SetComponent(IPropertyEditorParams editorParams, int component, NumericEditBox editor, float currentValue)
        {
            float newValue;

            if (float.TryParse(editor.Text, out newValue))
            {
                foreach (var obj in editorParams.Objects)
                {
                    var current = new Property <NumericRange>(obj, editorParams.PropertyName).Value;
                    if (component == 0)
                    {
                        current.Median = newValue;
                    }
                    else
                    {
                        current.Dispersion = newValue;
                    }
                    editorParams.PropertySetter(obj, editorParams.PropertyName, current);
                }
            }
            else
            {
                editor.Text = currentValue.ToString();
            }
        }
Ejemplo n.º 2
0
        void SetComponent(IPropertyEditorParams editorParams, int component, NumericEditBox editor, float currentValue)
        {
            float newValue;

            if (float.TryParse(editor.Text, out newValue))
            {
                foreach (var obj in editorParams.Objects)
                {
                    var current = new Property <Vector3>(obj, editorParams.PropertyName).Value;
                    current[component] = newValue;
                    editorParams.PropertySetter(obj, editorParams.PropertyName, current);
                }
            }
            else
            {
                editor.Text = currentValue.ToString();
            }
        }
Ejemplo n.º 3
0
        void SetComponent(IPropertyEditorParams editorParams, int component, NumericEditBox editor, Quaternion currentValue)
        {
            float newValue;

            if (float.TryParse(editor.Text, out newValue))
            {
                foreach (var obj in editorParams.Objects)
                {
                    var current = new Property <Quaternion>(obj, editorParams.PropertyName).Value.ToEulerAngles();
                    current[component] = newValue * Mathf.DegToRad;
                    editorParams.PropertySetter(obj, editorParams.PropertyName,
                                                Quaternion.CreateFromEulerAngles(current));
                }
            }
            else
            {
                editor.Text = RoundAngle(currentValue.ToEulerAngles()[component] * Mathf.RadToDeg).ToString();
            }
        }
Ejemplo n.º 4
0
        private void SetWeightValue(IPropertyEditorParams editorParams, int idx, CommonEditBox editor, SkinningWeights sw)
        {
            float newValue;

            if (float.TryParse(editor.Text, out newValue))
            {
                foreach (var obj in editorParams.Objects)
                {
                    var prop = new Property <SkinningWeights>(obj, editorParams.PropertyName).Value.Clone();
                    prop[idx] = new BoneWeight {
                        Index  = prop[idx].Index,
                        Weight = newValue
                    };
                    editorParams.PropertySetter(obj, editorParams.PropertyName, prop);
                }
            }
            else
            {
                editor.Text = sw[idx].Weight.ToString();
            }
        }