コード例 #1
0
        private Rect ColLabel(GUIContent label, ref bool use)
        {
            Rect r       = ColLabel(label);
            Rect toggleR = r;

            toggleR.width = 16;
            InspectorWidgets.MiniToggle(t, r, GUIContent.none, ref use, false);

            return(r);
        }
コード例 #2
0
        private void ParamSection()
        {
            if (PaddedBoxGS == null)
            {
                PaddedBoxGS = new GUIStyle((GUIStyle)"HelpBox")
                {
                    normal = ((GUIStyle)"GroupBox").normal, padding = new RectOffset(4, 4, 4, 4)
                }
            }
            ;

            if (PaddedGS == null)
            {
                PaddedGS = new GUIStyle(PaddedBoxGS)
                {
                    normal = ((GUIStyle)"MiniLabel").normal
                }
            }
            ;

            t.useGlobalParamSettings = EditorGUILayout.ToggleLeft("Use Global Settings", t.useGlobalParamSettings);

            showAdvancedParams[uid] = IndentedFoldout(new GUIContent("Adv. Parameter Settings"), showAdvancedParams[uid], 1);

            if (showAdvancedParams[uid])
            {
                var indenthold = EditorGUI.indentLevel;

                EditorGUI.indentLevel = 0;
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.GetControlRect(GUILayout.MinWidth(COL1));
                EditorGUILayout.LabelField(label_Interp, (GUIStyle)"MiniLabel", GUILayout.MaxWidth(COL2));
                EditorGUILayout.LabelField(label_Extrap, (GUIStyle)"MiniLabel", GUILayout.MaxWidth(COL3));
                EditorGUILayout.LabelField(label_Default, (GUIStyle)"MiniLabel", GUILayout.MaxWidth(COL4));
                EditorGUILayout.EndHorizontal();

                var defs = t.sharedParamDefaults;

                if (t.useGlobalParamSettings)
                {
                    EditorGUILayout.BeginHorizontal();
                    InspectorWidgets.MiniToggle(t, EditorGUILayout.GetControlRect(GUILayout.MinWidth(COL1)), new GUIContent("Ints"), ref defs.includeInts);
                    DrawInterp(AnimatorControllerParameterType.Int, ref defs.interpolateInts);
                    DrawExtrap(AnimatorControllerParameterType.Int, ref defs.extrapolateInts);
                    DrawDefaults(AnimatorControllerParameterType.Int, ref defs.defaultInt);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    InspectorWidgets.MiniToggle(t, EditorGUILayout.GetControlRect(GUILayout.MinWidth(COL1)), new GUIContent("Floats"), ref defs.includeFloats);
                    DrawInterp(AnimatorControllerParameterType.Float, ref defs.interpolateFloats);
                    DrawExtrap(AnimatorControllerParameterType.Float, ref defs.extrapolateFloats);
                    DrawDefaults(AnimatorControllerParameterType.Float, ref defs.defaultFloat);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    InspectorWidgets.MiniToggle(t, EditorGUILayout.GetControlRect(GUILayout.MinWidth(COL1)), new GUIContent("Bools"), ref defs.includeBools);
                    EditorGUILayout.GetControlRect(GUILayout.MaxWidth(COL2));
                    DrawExtrap(AnimatorControllerParameterType.Bool, ref defs.extrapolateBools);
                    DrawDefaults(AnimatorControllerParameterType.Bool, ref defs.defaultBool);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    var tr = EditorGUILayout.GetControlRect(GUILayout.MinWidth(COL1));
                    InspectorWidgets.MiniToggle(t, tr, triggerLabel, ref defs.includeTriggers);
                    if (t.sharedParamDefaults.includeTriggers)
                    {
                        GUI.DrawTexture(new Rect(tr)
                        {
                            x = 2, width = 16
                        }, EditorGUIUtility.FindTexture("console.warnicon"));
                    }
                    EditorGUILayout.GetControlRect(GUILayout.MaxWidth(COL2));
                    DrawExtrap(AnimatorControllerParameterType.Trigger, ref defs.extrapolateTriggers);
                    DrawDefaults(AnimatorControllerParameterType.Trigger, ref defs.defaultTrigger);
                    EditorGUILayout.EndHorizontal();
                }
                else
                {
                    var names = ParameterSettings.RebuildParamSettings(a, ref t.sharedParamSettings, ref t.paramCount, t.sharedParamDefaults);
                    serializedObject.Update();

                    var pms = t.sharedParamSettings;
                    for (int i = 0; i < t.paramCount; ++i)
                    {
                        var pm = pms[i];

                        EditorGUILayout.BeginHorizontal();

                        // Type Letter Box (left vertical)
                        EditorGUILayout.BeginVertical(PaddedBoxGS, GUILayout.MaxWidth(8));
                        TypeLabel(EditorGUILayout.GetControlRect(GUILayout.MaxWidth(12)), pm.paramType);

                        EditorGUILayout.EndVertical();

                        // Main Vertical (Right)
                        EditorGUILayout.BeginVertical((pm.include) ? PaddedBoxGS : PaddedGS);

                        EditorGUILayout.BeginHorizontal();

                        InspectorWidgets.MiniToggle(t, EditorGUILayout.GetControlRect(GUILayout.MinWidth(COL1)), new GUIContent(names[i]), ref pm.include);

                        EditorGUI.BeginDisabledGroup(!pm.include);
                        DrawInterp(pm.paramType, ref pm.interpolate);
                        DrawExtrap(pm.paramType, ref pm.extrapolate);
                        DrawDefaults(pm.paramType, ref pm.defaultValue);
                        EditorGUI.EndDisabledGroup();

                        EditorGUILayout.EndHorizontal();

                        // Compression Row
                        if (pm.include)
                        {
                            if (pm.paramType == AnimatorControllerParameterType.Float || pm.paramType == AnimatorControllerParameterType.Int)
                            {
                                var sharedPSs = serializedObject.FindProperty("sharedParamSettings");
                                var ps        = sharedPSs.GetArrayElementAtIndex(i);

                                var fcrusher = (pm.paramType == AnimatorControllerParameterType.Float) ? ps.FindPropertyRelative("fcrusher") : ps.FindPropertyRelative("icrusher");

                                var r = EditorGUILayout.GetControlRect(false, EditorGUI.GetPropertyHeight(fcrusher));

                                Rect rectCrusher = new Rect(r)
                                {
                                    height = 16
                                };
                                EditorGUI.PropertyField(rectCrusher, fcrusher);
                            }
                        }

                        // End Right Vertical
                        EditorGUILayout.EndVertical();

                        // End Parameter
                        EditorGUILayout.EndHorizontal();
                    }
                }

                EditorGUI.indentLevel = indenthold;
            }
        }
コード例 #3
0
        private void StatesSection()
        {
            NormTimeCompressEnum(EditorGUILayout.GetControlRect(), new GUIContent("Compress NormalizedTime"), ref t.normalizedTimeCompress);

            InspectorWidgets.MiniToggle(t, EditorGUILayout.GetControlRect(), label_syncLayers, ref t.syncLayers);
        }