Example #1
0
 protected override void SetSaveableValues(float[] values)
 {
     if (values.Length == 1)
     {
         m_CurrentType = (TextureMixingType)values[0];
     }
 }
Example #2
0
        private void CustomEditorOptions(float boxWidth)
        {
            if (GUILayout.Button("Swap Tex", GUILayout.Width(boxWidth), GUILayout.Height(20.0f)))
            {
                Texture2D temp = m_ComponentBoxes["Image 1"].Texture;
                m_ComponentBoxes["Image 1"].Texture = m_ComponentBoxes["Image 2"].Texture;
                m_ComponentBoxes["Image 2"].Texture = temp;
            }

            GUILayout.Label("Type", GUILayout.Width(boxWidth));
            m_CurrentType = (TextureMixingType)EditorGUILayout.EnumPopup("", m_CurrentType, GUILayout.Width(boxWidth));

            if (m_CurrentType != m_LastType)
            {
                m_LastType = m_CurrentType;
                m_Result   = null;
            }

            GUILayout.Space(3.0f);

            GUILayout.Label("Image 2 Offset", GUILayout.Width(boxWidth));

            GUILayout.BeginHorizontal(GUILayout.Width(boxWidth));
            {
                m_Offset.x = EditorGUILayout.IntField("", m_Offset.x, GUILayout.Width((boxWidth / 2.0f) - 2.0f));
                m_Offset.y = EditorGUILayout.IntField("", m_Offset.y, GUILayout.Width((boxWidth / 2.0f) - 2.0f));
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(3.0f);

            if (m_CurrentType == TextureMixingType.Dissolve)
            {
                GUILayout.Label("Threshold", GUILayout.Width(boxWidth));
                m_DissolveThreshold = EditorGUILayout.FloatField("", m_DissolveThreshold, GUILayout.Width(boxWidth));
                m_DissolveThreshold = Mathf.Clamp(m_DissolveThreshold, 0.0f, 1.0f);
            }
        }