Пример #1
0
        void DrawProcessorInspector()
        {
            if (!m_ProcessorList.HasSelection())
            {
                return;
            }
            var processor = (ShaderProcessor)m_ProcessorList.GetArrayElement(m_ProcessorList.index)?.objectReferenceValue;

            if (processor != null)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(processor.GetType().GetFriendlyName() + " Processor Settings", EditorStyles.boldLabel);
                Editor.CreateCachedEditor(processor, null, ref m_CachedProcessorEditor);
                m_CachedProcessorEditor.OnInspectorGUI();
            }

            EditorGUILayout.Space();
        }
Пример #2
0
        void OnRemoveProcessorButtonClicked(ReorderableList list)
        {
            var element = list.GetArrayElement(list.index);
            var obj     = element.objectReferenceValue;

            obj.RemoveNestedObjectsFromUnityAsset(AssetDatabase.GetAssetPath(m_Target));
            ReorderableList.defaultBehaviours.DoRemoveButton(list); // remove the SerializedProperty from the element
            ReorderableList.defaultBehaviours.DoRemoveButton(list); // remove the empty element from the collection
            m_Settings.ApplyModifiedProperties();
            EditorUtility.SetDirty(m_Target);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
Пример #3
0
 void OnEnable()
 {
     m_List = new ReorderableList(serializedObject, serializedObject.FindProperty("paths"), true, true, true, true);
     m_List.drawHeaderCallback = rect =>
     {
         EditorGUI.LabelField(rect, "Shader Paths", EditorStyles.boldLabel);
         EditorGUI.LabelField(new Rect(rect.x + rect.width - 75, rect.y, 75, rect.height), "Ignore Case", EditorStyles.boldLabel);
     };
     m_List.drawElementCallback = (rect, index, active, focused) => EditorGUI.PropertyField(rect, m_List.GetArrayElement(index), GUIContent.none);
 }
Пример #4
0
 void OnEnable()
 {
     m_Target = (IncludeShaderVariantCollection)target;
     m_IncludeMatchesWithoutLocalKeywords = serializedObject.FindProperty("matchWithoutLocalKeywords");
     m_OnlyStripShadersInCollections      = serializedObject.FindProperty("onlyStripShadersInCollections");
     m_List = new ReorderableList(serializedObject, serializedObject.FindProperty("shaderVariantCollections"), true, true, true, true);
     m_List.drawHeaderCallback  = rect => EditorGUI.LabelField(rect, Styles.shaderVariantCollections, EditorStyles.boldLabel);
     m_List.drawElementCallback = (rect, index, active, focused) => EditorGUI.PropertyField(rect, m_List.GetArrayElement(index), GUIContent.none);
     m_List.drawFooterCallback  = rect =>
     {
         var buttonRect = new Rect(rect.x + 10, rect.y, 100, rect.height);
         if (Event.current.type == EventType.Repaint)
         {
             s_Styles.FooterButtonBackground.Draw(buttonRect, false, false, false, false);
         }
         buttonRect.x     += 4;
         buttonRect.width -= 8;
         buttonRect.height = 16;
         if (GUI.Button(buttonRect, Styles.combineVariantCollections, s_Styles.FooterButton))
         {
             string assetPath = EditorUtility.SaveFilePanelInProject(Styles.shaderVariantCollectionSave, "NewShaderVariants", "shadervariants", Styles.shaderVariantCollectionSave, UnityEditorDynamic.ProjectWindowUtil.GetActiveFolderPath());
             if (!string.IsNullOrEmpty(assetPath))
             {
                 CombineShaderVariantCollections(assetPath);
             }
         }
         ReorderableList.defaultBehaviours.DrawFooter(rect, m_List);
     };
 }
Пример #5
0
 void OnEnable()
 {
     m_DevelopmentList = new ReorderableList(serializedObject, serializedObject.FindProperty("excludeDevelopmentKeywords"), true, true, true, true);
     m_DevelopmentList.drawHeaderCallback = rect =>
     {
         EditorGUI.LabelField(rect, "Keywords to exclude in Development builds", EditorStyles.boldLabel);
         EditorGUI.LabelField(new Rect(rect.x + rect.width - 75, rect.y, 75, rect.height), "Ignore Case", EditorStyles.boldLabel);
     };
     m_DevelopmentList.drawElementCallback = (rect, index, active, focused) => EditorGUI.PropertyField(rect, m_DevelopmentList.GetArrayElement(index), GUIContent.none);
     m_ReleaseList = new ReorderableList(serializedObject, serializedObject.FindProperty("excludeReleaseKeywords"), true, true, true, true);
     m_ReleaseList.drawHeaderCallback = rect =>
     {
         EditorGUI.LabelField(rect, "Keywords to exclude in Release builds", EditorStyles.boldLabel);
         EditorGUI.LabelField(new Rect(rect.x + rect.width - 75, rect.y, 75, rect.height), "Ignore Case", EditorStyles.boldLabel);
     };
     m_ReleaseList.drawElementCallback = (rect, index, active, focused) => EditorGUI.PropertyField(rect, m_ReleaseList.GetArrayElement(index), GUIContent.none);
 }
Пример #6
0
 void OnEnable()
 {
     m_List = new ReorderableList(serializedObject, serializedObject.FindProperty("platformTiers"), true, true, true, true);
     m_List.drawHeaderCallback  = rect => EditorGUI.LabelField(rect, "Platform Tiers", EditorStyles.boldLabel);
     m_List.drawElementCallback = (rect, index, active, focused) => EditorGUI.PropertyField(rect, m_List.GetArrayElement(index), GUIContent.none);
 }