Esempio n. 1
0
        public static void AssetPopup <T>(SerializedProperty serializedProperty, GUIContent label, string fileExtension, string defaultFieldName) where T : UnityEngine.Object, new()
        {
            bool showMixedValue = EditorGUI.showMixedValue;

            EditorGUI.showMixedValue = serializedProperty.hasMultipleDifferentValues;
            string     objectReferenceTypeString = serializedProperty.objectReferenceTypeString;
            GUIContent buttonContent;

            if (serializedProperty.hasMultipleDifferentValues)
            {
                buttonContent = EditorGUI.mixedValueContent;
            }
            else if (serializedProperty.objectReferenceValue != null)
            {
                buttonContent = GUIContent.Temp(serializedProperty.objectReferenceStringValue);
            }
            else
            {
                buttonContent = GUIContent.Temp(defaultFieldName);
            }
            Rect buttonRect;

            if (AudioMixerEffectGUI.PopupButton(label, buttonContent, EditorStyles.popup, out buttonRect, new GUILayoutOption[0]))
            {
                AssetPopupBackend.ShowAssetsPopupMenu <T>(buttonRect, objectReferenceTypeString, serializedProperty, fileExtension, defaultFieldName);
            }
            EditorGUI.showMixedValue = showMixedValue;
        }
Esempio n. 2
0
        static public void LightmapParametersGUI(SerializedProperty prop, GUIContent content)
        {
            EditorGUILayout.BeginHorizontal();

            var rect = EditorGUILayout.GetControlRect();

            EditorGUI.BeginProperty(rect, content, prop);

            rect = EditorGUI.PrefixLabel(rect, content);

            GUIContent buttonContent = prop.hasMultipleDifferentValues ? EditorGUI.mixedValueContent : (prop.objectReferenceValue != null ? GUIContent.Temp(prop.objectReferenceStringValue) : Styles.lightmapParametersDefault);

            if (EditorGUI.DropdownButton(rect, buttonContent, FocusType.Passive, EditorStyles.popup))
            {
                AssetPopupBackend.ShowAssetsPopupMenu <LightmapParameters>(rect, prop.objectReferenceTypeString, prop, "giparams", Styles.lightmapParametersDefault.text);
            }

            string label = isBuiltIn(prop) ? "View" : "Edit...";

            // If object is null, then get the scene parameter setting and view this instead.
            using (new EditorGUI.DisabledScope(prop.hasMultipleDifferentValues))
            {
                if (prop.objectReferenceValue == null)
                {
                    SerializedObject   so = new SerializedObject(Lightmapping.GetLightingSettingsOrDefaultsFallback());
                    SerializedProperty lightmapParameters = so.FindProperty("m_LightmapParameters");

                    using (new EditorGUI.DisabledScope(lightmapParameters == null))
                    {
                        label = isBuiltIn(lightmapParameters) ? "View" : "Edit...";

                        if (GUILayout.Button(label, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
                        {
                            Selection.activeObject = lightmapParameters.objectReferenceValue;
                        }
                    }
                }
                else
                {
                    if (GUILayout.Button(label, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
                    {
                        Selection.activeObject = prop.objectReferenceValue;
                    }
                }
            }

            EditorGUILayout.EndHorizontal();
            EditorGUI.EndProperty();
        }
Esempio n. 3
0
        public static void AssetPopup <T>(SerializedProperty serializedProperty, GUIContent label, string fileExtension) where T : Object, new()
        {
            bool showMixedValue = EditorGUI.showMixedValue;

            EditorGUI.showMixedValue = serializedProperty.hasMultipleDifferentValues;
            string     referenceTypeString = serializedProperty.objectReferenceTypeString;
            GUIContent buttonContent       = !serializedProperty.hasMultipleDifferentValues ? (!(serializedProperty.objectReferenceValue != (Object)null) ? GUIContent.Temp("Default") : GUIContent.Temp(serializedProperty.objectReferenceStringValue)) : EditorGUI.mixedValueContent;
            Rect       buttonRect;

            if (AudioMixerEffectGUI.PopupButton(label, buttonContent, EditorStyles.popup, out buttonRect))
            {
                AssetPopupBackend.ShowAssetsPopupMenu <T>(buttonRect, referenceTypeString, serializedProperty, fileExtension);
            }
            EditorGUI.showMixedValue = showMixedValue;
        }
Esempio n. 4
0
 internal static void AssetPopup <T>(SerializedProperty serializedProperty, GUIContent content, string fileExtension) where T : UnityEngine.Object, new()
 {
     AssetPopupBackend.AssetPopup <T>(serializedProperty, content, fileExtension);
 }
Esempio n. 5
0
 private static void ShowAssetsPopupMenu <T>(Rect buttonRect, string typeName, SerializedProperty serializedProperty, string fileExtension) where T : UnityEngine.Object, new()
 {
     AssetPopupBackend.ShowAssetsPopupMenu <T>(buttonRect, typeName, serializedProperty, fileExtension, "Default");
 }
Esempio n. 6
0
 public static void AssetPopup <T>(SerializedProperty serializedProperty, GUIContent label, string fileExtension) where T : UnityEngine.Object, new()
 {
     AssetPopupBackend.AssetPopup <T>(serializedProperty, label, fileExtension, "Default");
 }
Esempio n. 7
0
 internal static void AssetPopup <T>(SerializedProperty serializedProperty, GUIContent content, string fileExtension, string defaultFieldName) where T : Object, new()
 {
     AssetPopupBackend.AssetPopup <T>(serializedProperty, content, fileExtension, defaultFieldName);
 }