Ejemplo n.º 1
0
        protected override void OnInspectorGUI()
        {
            GPActionFloatAnimation action = (GPActionFloatAnimation)TargetAction;

            // Provider A

            EditorGUILayout.LabelField("Variable");

            EditorGUI.indentLevel++;

            if (m_providerAEditor == null)
            {
                m_providerAEditor          = new ValueProviderEditor <float>();
                m_providerAEditor.Provider = action._provider;
            }

            if (m_providerAEditor.Provider != action._provider)
            {
                m_providerAEditor.Provider = action._provider;
            }


            m_providerAEditor.Display();

            EditorGUI.indentLevel--;

            EditorGUILayout.PropertyField(SerialObject.FindProperty("_duration"));
            EditorGUILayout.PropertyField(SerialObject.FindProperty("_curve"));

            SerialObject.ApplyModifiedProperties();
        }
Ejemplo n.º 2
0
        protected override void OnInspectorGUI()
        {
            GPActionMaterialColorAnimation anim = (GPActionMaterialColorAnimation)TargetAction;

            anim.UseThisObject = EditorGUILayout.Toggle("Use This Object", anim.UseThisObject);

            Material newMaterial = (Material)EditorGUILayout.ObjectField("Material", anim.Material, typeof(Material), true);

            if (newMaterial != anim.Material)
            {
                ChangeMaterial(newMaterial);
            }

            if (anim.Material == null)
            {
                return;
            }
            else
            {
                if (m_properties == null)
                {
                    CreatePropertyList(anim.Material.shader);
                }

                if (m_properties.Length == 0)
                {
                    EditorGUILayout.HelpBox("No color properties", MessageType.Info);
                    return;
                }

                m_selectedIndex = System.Array.IndexOf(m_properties, anim._animatedVariable);

                m_selectedIndex = Mathf.Max(0, m_selectedIndex);

                m_selectedIndex = EditorGUILayout.Popup("Property", m_selectedIndex, m_properties);

                anim._animatedVariable = m_properties[m_selectedIndex];
            }

            anim._duration = EditorGUILayout.FloatField("Duration", anim._duration);

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(SerialObject.FindProperty("_colorMap"));
            if (EditorGUI.EndChangeCheck())
            {
                SerialObject.ApplyModifiedProperties();
            }

            anim._curve = EditorGUILayout.CurveField("Curve", anim._curve);

            if (anim.UseThisObject && anim.ParentGameObject.GetComponent <Renderer>())
            {
                EditorGUILayout.HelpBox("'Use This Action' requires a Renderer in the GameObject", MessageType.Error);
            }
        }