Example #1
0
        //!
        //! @brief Transform
        //!
        public Vector3[] Transform(Vector3[] previous, Attribute.TransformAttribute transAttr, Attribute.AxisAttribute axisAttr = null)
        {
            PushStackOrientation(Attribute.StackAttribute.Orientation.Vertical, GUI.skin.box);

            if (axisAttr == null)
            {
                return(previous);
            }

            var trans = previous[0];

            if (axisAttr.enabledAxis.HasFlag(Entity.Axis.TranslateX))
            {
                trans.x = EditorGUILayout.Slider(label: transAttr.label + "(Trans)(X)", value: previous[0].x, leftValue: transAttr.transMin, rightValue: transAttr.transMax);
            }

            if (axisAttr.enabledAxis.HasFlag(Entity.Axis.TranslateY))
            {
                trans.y = EditorGUILayout.Slider(label: transAttr.label + "(Trans)(Y)", value: previous[0].y, leftValue: transAttr.transMin, rightValue: transAttr.transMax);
            }

            if (axisAttr.enabledAxis.HasFlag(Entity.Axis.TranslateZ))
            {
                trans.z = EditorGUILayout.Slider(label: transAttr.label + "(Trans)(Z)", value: previous[0].z, leftValue: transAttr.transMin, rightValue: transAttr.transMax);
            }

            var rotate = previous[1];

            if (axisAttr.enabledAxis.HasFlag(Entity.Axis.RotationX))
            {
                rotate.x = EditorGUILayout.Slider(label: transAttr.label + "(Rotate)(X)", value: previous[1].x, leftValue: transAttr.rotateMin, rightValue: transAttr.rotateMax);
            }

            if (axisAttr.enabledAxis.HasFlag(Entity.Axis.RotationY))
            {
                rotate.y = EditorGUILayout.Slider(label: transAttr.label + "(Rotate)(Y)", value: previous[1].y, leftValue: transAttr.rotateMin, rightValue: transAttr.rotateMax);
            }

            if (axisAttr.enabledAxis.HasFlag(Entity.Axis.RotationZ))
            {
                rotate.z = EditorGUILayout.Slider(label: transAttr.label + "(Rotate)(Z)", value: previous[1].z, leftValue: transAttr.rotateMin, rightValue: transAttr.rotateMax);
            }

            var scale = previous[2];

            if (axisAttr.enabledAxis.HasFlag(Entity.Axis.ScaleX))
            {
                scale.x = EditorGUILayout.Slider(label: transAttr.label + "(Scale)(X)", value: previous[2].x, leftValue: transAttr.scaleMin, rightValue: transAttr.scaleMax);
            }

            if (axisAttr.enabledAxis.HasFlag(Entity.Axis.ScaleY))
            {
                scale.y = EditorGUILayout.Slider(label: transAttr.label + "(Scale)(Y)", value: previous[2].y, leftValue: transAttr.scaleMin, rightValue: transAttr.scaleMax);
            }

            if (axisAttr.enabledAxis.HasFlag(Entity.Axis.ScaleZ))
            {
                scale.z = EditorGUILayout.Slider(label: transAttr.label + "(Scale)(Z)", value: previous[2].z, leftValue: transAttr.scaleMin, rightValue: transAttr.scaleMax);
            }

            var modified = new Vector3[] {
                trans,
                rotate,
                scale
            };

            PopStackOrientation();

            return(modified);
        }