void HandleVector2ShaderProperty(PropertySheet propertySheet, Vector2ShaderProperty vector2ShaderProperty)
        {
            var vector2PropertyDrawer = new Vector2PropertyDrawer();

            vector2PropertyDrawer.preValueChangeCallback  = () => this._preChangeValueCallback("Change property value");
            vector2PropertyDrawer.postValueChangeCallback = () => this._postChangeValueCallback();

            propertySheet.Add(vector2PropertyDrawer.CreateGUI(
                                  newValue => _changeValueCallback(newValue),
                                  vector2ShaderProperty.value,
                                  "Default",
                                  out var propertyVec2Field));
        }
Beispiel #2
0
        void HandleMatrix2Property(
            ValueChangedCallback valueChangedCallback,
            PropertySheet propertySheet,
            Matrix4x4 matrix2Property,
            string labelName = "Default")
        {
            var vector2PropertyDrawer = new Vector2PropertyDrawer();

            vector2PropertyDrawer.preValueChangeCallback  = PreValueChangeCallback;
            vector2PropertyDrawer.postValueChangeCallback = PostValueChangeCallback;

            propertySheet.Add(vector2PropertyDrawer.CreateGUI(
                                  newValue =>
            {
                Vector2 row1 = MatrixRowFetchCallback(1);
                valueChangedCallback(new Matrix4x4()
                {
                    m00 = newValue.x,
                    m01 = newValue.y,
                    m02 = 0,
                    m03 = 0,
                    m10 = row1.x,
                    m11 = row1.y,
                    m12 = 0,
                    m13 = 0,
                    m20 = 0,
                    m21 = 0,
                    m22 = 0,
                    m23 = 0,
                    m30 = 0,
                    m31 = 0,
                    m32 = 0,
                    m33 = 0,
                });
            },
                                  matrix2Property.GetRow(0),
                                  labelName,
                                  out var row0Field
                                  ));

            propertySheet.Add(vector2PropertyDrawer.CreateGUI(
                                  newValue =>
            {
                Vector2 row0 = MatrixRowFetchCallback(0);
                valueChangedCallback(new Matrix4x4()
                {
                    m00 = row0.x,
                    m01 = row0.y,
                    m02 = 0,
                    m03 = 0,
                    m10 = newValue.x,
                    m11 = newValue.y,
                    m12 = 0,
                    m13 = 0,
                    m20 = 0,
                    m21 = 0,
                    m22 = 0,
                    m23 = 0,
                    m30 = 0,
                    m31 = 0,
                    m32 = 0,
                    m33 = 0,
                });
            },
                                  matrix2Property.GetRow(1),
                                  "",
                                  out var row1Field
                                  ));
        }