Esempio n. 1
0
        protected override void DrawPropertyLayout(GUIContent label)
        {
            Rect labelRect;
            Rect contentRect = SirenixEditorGUI.BeginHorizontalPropertyLayout(label, out labelRect);

            {
                // Slide rect
                {
                    var val = this.ValueEntry.SmartValue;
                    EditorGUI.BeginChangeCheck();
                    var vec = SirenixEditorFields.VectorPrefixSlideRect(labelRect, new Vector4((float)val.x, (float)val.y, (float)val.z, (float)val.w));
                    val = new double4(vec.x, vec.y, vec.z, vec.w);
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.ValueEntry.SmartValue = val;
                    }
                }

                var showLabels = !this.isMatrixChild && SirenixEditorFields.ResponsiveVectorComponentFields && contentRect.width >= 185;
                GUIHelper.PushLabelWidth(SirenixEditorFields.SingleLetterStructLabelWidth);
                this.ValueEntry.Property.Children[0].Draw(showLabels ? GUIHelper.TempContent("X") : null);
                this.ValueEntry.Property.Children[1].Draw(showLabels ? GUIHelper.TempContent("Y") : null);
                this.ValueEntry.Property.Children[2].Draw(showLabels ? GUIHelper.TempContent("Z") : null);
                this.ValueEntry.Property.Children[3].Draw(showLabels ? GUIHelper.TempContent("W") : null);
                GUIHelper.PopLabelWidth();
            }
            SirenixEditorGUI.EndHorizontalPropertyLayout();
        }
Esempio n. 2
0
        protected override void DrawPropertyLayout(GUIContent label)
        {
            Rect labelRect;
            Rect contentRect = SirenixEditorGUI.BeginHorizontalPropertyLayout(label, out labelRect);

            {
                var showLabels = !this.isMatrixChild && SirenixEditorFields.ResponsiveVectorComponentFields && contentRect.width >= 100;

                if (label != null)
                {
                    GUILayout.Space(3); // Ugh, better than nothing
                }

                var options = GUILayoutOptions.Height(EditorGUIUtility.singleLineHeight);

                GUIHelper.PushLabelWidth(SirenixEditorFields.SingleLetterStructLabelWidth);
                EditorGUILayout.BeginVertical(options);
                this.ValueEntry.Property.Children[0].Draw(showLabels ? GUIHelper.TempContent("X") : null);
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical(options);
                this.ValueEntry.Property.Children[1].Draw(showLabels ? GUIHelper.TempContent("Y") : null);
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical(options);
                this.ValueEntry.Property.Children[2].Draw(showLabels ? GUIHelper.TempContent("Z") : null);
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical(options);
                this.ValueEntry.Property.Children[3].Draw(showLabels ? GUIHelper.TempContent("W") : null);
                EditorGUILayout.EndVertical();
                GUIHelper.PopLabelWidth();
            }
            SirenixEditorGUI.EndHorizontalPropertyLayout();
        }
Esempio n. 3
0
        protected override void DrawPropertyLayout(GUIContent label)
        {
            Rect labelRect;
            Rect contentRect = SirenixEditorGUI.BeginHorizontalPropertyLayout(label, out labelRect);

            {
                var showLabels = !this.isMatrixChild && SirenixEditorFields.ResponsiveVectorComponentFields && contentRect.width >= 185;
                GUIHelper.PushLabelWidth(SirenixEditorFields.SingleLetterStructLabelWidth);
                this.ValueEntry.Property.Children[0].Draw(showLabels ? GUIHelper.TempContent("X") : null);
                this.ValueEntry.Property.Children[1].Draw(showLabels ? GUIHelper.TempContent("Y") : null);
                GUIHelper.PopLabelWidth();
            }
            SirenixEditorGUI.EndHorizontalPropertyLayout();
        }
Esempio n. 4
0
        /// <summary>
        /// Draws the property.
        /// </summary>
        protected override void DrawPropertyLayout(GUIContent label)
        {
            Rect labelRect;
            var  contentRect = SirenixEditorGUI.BeginHorizontalPropertyLayout(label, out labelRect);

            {
                EditorGUI.BeginChangeCheck();
                var val = SirenixEditorFields.VectorPrefixSlideRect(labelRect, (Vector2)this.ValueEntry.SmartValue);
                if (EditorGUI.EndChangeCheck())
                {
                    this.ValueEntry.SmartValue = new Vector2Int((int)val.x, (int)val.y);
                }

                var showLabels = SirenixEditorFields.ResponsiveVectorComponentFields && contentRect.width >= 185;
                GUIHelper.PushLabelWidth(SirenixEditorFields.SingleLetterStructLabelWidth);
                this.ValueEntry.Property.Children[0].Draw(showLabels ? GUIHelper.TempContent("X") : null);
                this.ValueEntry.Property.Children[1].Draw(showLabels ? GUIHelper.TempContent("Y") : null);
                GUIHelper.PopLabelWidth();
            }
            SirenixEditorGUI.EndHorizontalPropertyLayout();
        }