Exemple #1
0
        public void ShowInternalData(UndoParentNode owner, bool useCustomLabel = false, string customLabel = null)
        {
            string label = (useCustomLabel == true && customLabel != null) ? customLabel : m_internalDataPropertyLabel;

            switch (m_dataType)
            {
            case WirePortDataType.OBJECT:
            case WirePortDataType.FLOAT:
            {
                FloatInternalData = owner.EditorGUILayoutFloatField(label, FloatInternalData);
            }
            break;

            case WirePortDataType.FLOAT2:
            {
                Vector2InternalData = owner.EditorGUILayoutVector2Field(label, Vector2InternalData);
            }
            break;

            case WirePortDataType.FLOAT3:
            {
                Vector3InternalData = owner.EditorGUILayoutVector3Field(label, Vector3InternalData);
            }
            break;

            case WirePortDataType.FLOAT4:
            {
                Vector4InternalData = owner.EditorGUILayoutVector4Field(label, Vector4InternalData);
            }
            break;

            case WirePortDataType.FLOAT3x3:
            {
                Matrix4x4 matrix   = Matrix4x4InternalData;
                Vector3   currVec3 = Vector3.zero;
                for (int i = 0; i < 3; i++)
                {
                    Vector4 currVec = matrix.GetRow(i);
                    currVec3.Set(currVec.x, currVec.y, currVec.z);
                    EditorGUI.BeginChangeCheck();
                    currVec3 = owner.EditorGUILayoutVector3Field(label + "[ " + i + " ]", currVec3);
                    if (EditorGUI.EndChangeCheck())
                    {
                        currVec.Set(currVec3.x, currVec3.y, currVec3.z, currVec.w);
                        matrix.SetRow(i, currVec);
                    }
                }
                Matrix4x4InternalData = matrix;
            }
            break;

            case WirePortDataType.FLOAT4x4:
            {
                Matrix4x4 matrix = Matrix4x4InternalData;
                for (int i = 0; i < 4; i++)
                {
                    Vector4 currVec = matrix.GetRow(i);
                    EditorGUI.BeginChangeCheck();
                    currVec = owner.EditorGUILayoutVector4Field(label + "[ " + i + " ]", currVec);
                    if (EditorGUI.EndChangeCheck())
                    {
                        matrix.SetRow(i, currVec);
                    }
                }
                Matrix4x4InternalData = matrix;
            }
            break;

            case WirePortDataType.COLOR:
            {
                ColorInternalData = owner.EditorGUILayoutColorField(label, ColorInternalData);
            }
            break;

            case WirePortDataType.INT:
            {
                IntInternalData = owner.EditorGUILayoutIntField(label, IntInternalData);
            }
            break;
            }
        }
Exemple #2
0
        public void Draw(UndoParentNode owner, GUIStyle toolbarstyle, Material mat)
        {
            Color cachedColor = GUI.color;

            GUI.color = new Color(cachedColor.r, cachedColor.g, cachedColor.b, 0.5f);
            EditorGUILayout.BeginHorizontal(toolbarstyle);
            GUI.color = cachedColor;
            EditorVariablesManager.OutlineActiveMode.Value = owner.GUILayoutToggle(EditorVariablesManager.OutlineActiveMode.Value, EditorVariablesManager.OutlineActiveMode.LabelName, UIUtils.MenuItemToggleStyle, GUILayout.ExpandWidth(true));
            EditorGUI.BeginChangeCheck();
            m_enabled = owner.EditorGUILayoutToggle(string.Empty, m_enabled, UIUtils.MenuItemEnableStyle, GUILayout.Width(16));
            if (EditorGUI.EndChangeCheck())
            {
                if (m_enabled)
                {
                    UpdateToMaterial(mat);
                }

                UIUtils.RequestSave();
            }
            EditorGUILayout.EndHorizontal();

            if (EditorVariablesManager.OutlineActiveMode.Value)
            {
                cachedColor = GUI.color;
                GUI.color   = new Color(cachedColor.r, cachedColor.g, cachedColor.b, (EditorGUIUtility.isProSkin ? 0.5f : 0.25f));
                EditorGUILayout.BeginVertical(UIUtils.MenuItemBackgroundStyle);
                GUI.color = cachedColor;

                EditorGUILayout.Separator();
                EditorGUI.BeginDisabledGroup(!m_enabled);

                EditorGUI.indentLevel += 1;
                {
                    m_mode = (OutlineMode)owner.EditorGUILayoutEnumPopup(ModePropertyStr, m_mode);

                    EditorGUI.BeginChangeCheck();
                    m_outlineColor = owner.EditorGUILayoutColorField(OutlineColorLabel, m_outlineColor);
                    if (EditorGUI.EndChangeCheck() && mat != null)
                    {
                        if (mat.HasProperty(ColorPropertyName))
                        {
                            mat.SetColor(ColorPropertyName, m_outlineColor);
                        }
                    }

                    EditorGUI.BeginChangeCheck();
                    m_outlineWidth = owner.EditorGUILayoutFloatField(OutlineWidthLabel, m_outlineWidth);
                    if (EditorGUI.EndChangeCheck() && mat != null)
                    {
                        if (mat.HasProperty(WidthPropertyName))
                        {
                            mat.SetFloat(WidthPropertyName, m_outlineWidth);
                        }
                    }

                    m_noFog = owner.EditorGUILayoutToggle(NoFogStr, m_noFog);
                }

                EditorGUI.indentLevel -= 1;
                EditorGUI.EndDisabledGroup();
                EditorGUILayout.Separator();
                EditorGUILayout.EndVertical();
            }
        }