Beispiel #1
0
        /// <inheritoc/>
        protected internal override void Initialize(int layoutIndex)
        {
            if (property != null)
            {
                guiField            = new GUICurvesField(new GUIContent(title));
                guiField.OnChanged += OnFieldValueChanged;

                layout.AddElement(layoutIndex, guiField);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new material parameter GUI.
        /// </summary>
        /// <param name="shaderParam">Shader parameter to create the GUI for. Must be of floating point type.</param>
        /// <param name="material">Material the parameter is a part of.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        internal MaterialParamFloatGUI(ShaderParameter shaderParam, Material material, GUILayout layout)
            : base(shaderParam)
        {
            LocString title = new LocEdString(shaderParam.name);

            var guiToggle = new GUIToggle(new GUIContent(
                                              EditorBuiltin.GetEditorToggleIcon(EditorToggleIcon.AnimateProperty), new LocString("Animate")));

            guiConstant = new GUIFloatField(title);
            guiCurves   = new GUICurvesField(title);

            bool isAnimated = material.IsAnimated(shaderParam.name);

            guiConstant.Active = !isAnimated;
            guiCurves.Active   = isAnimated;

            fieldLayout = layout.AddLayoutX();
            fieldLayout.AddElement(guiConstant);
            fieldLayout.AddElement(guiCurves);
            fieldLayout.AddSpace(10);
            fieldLayout.AddElement(guiToggle);

            guiConstant.OnChanged += (x) =>
            {
                material.SetFloat(shaderParam.name, x);
                EditorApplication.SetDirty(material);
            };

            guiCurves.OnChanged += x =>
            {
                material.SetFloatCurve(shaderParam.name, x);
                EditorApplication.SetDirty(material);
            };

            guiToggle.OnToggled += x =>
            {
                guiConstant.Active = !x;
                guiCurves.Active   = x;
            };
        }
Beispiel #3
0
 private static extern void Internal_create6(GUICurvesField managedInstance, string style);
Beispiel #4
0
 private static extern void Internal_create5(GUICurvesField managedInstance, LocString labelText, string style);
Beispiel #5
0
 private static extern void Internal_create3(GUICurvesField managedInstance, ref GUIContent labelContent, string style);
Beispiel #6
0
 private static extern void Internal_create1(GUICurvesField managedInstance, CurveDrawOptions drawOptions, string style);
Beispiel #7
0
 private static extern void Internal_create0(GUICurvesField managedInstance, CurveDrawOptions drawOptions, LocString labelText, int labelWidth, string style);
Beispiel #8
0
 private static extern void Internal_create(GUICurvesField managedInstance, CurveDrawOptions drawOptions, ref GUIContent labelContent, int labelWidth, string style);