Exemplo n.º 1
0
        private void OnGUI()
        {
            //Grab our settings
            DynamicDecalSettings settings = DynamicDecals.System.Settings;

            //Calculate required rect height
            float maskHeight  = 120;
            float debugHeight = (Application.isPlaying) ? 360 : 80;
            float totalHeight = LlockhamEditorUtility.TabHeight * (settings.pools.Length + 4) + maskHeight + debugHeight + 54;

            //Begin change check & scrollView
            EditorGUI.BeginChangeCheck();
            Rect scrollRect = new Rect(0, 0, position.width - 20, totalHeight);

            scrollPosition = GUI.BeginScrollView(new Rect(10, 10, position.width - 20, position.height - 20), scrollPosition, scrollRect, GUIStyle.none, GUIStyle.none);

            //Mask settings
            MaskSettings(new Rect(0, 44 + (LlockhamEditorUtility.TabHeight * (settings.pools.Length + 4)), scrollRect.width, maskHeight), settings);

            //Pool settings
            PoolHeader(new Rect(0, 10, scrollRect.width, 24), settings);
            QualityTabs(new Rect(0, 34, scrollRect.width, LlockhamEditorUtility.TabHeight));
            PoolSettings(new Rect(0, 34 + LlockhamEditorUtility.TabHeight, scrollRect.width, LlockhamEditorUtility.TabHeight * (settings.pools.Length + 3)), settings);

            //Debug settings
            DebugSettings(new Rect(0, 54 + (LlockhamEditorUtility.TabHeight * (settings.pools.Length + 4)) + maskHeight, scrollRect.width, debugHeight));

            //End change check & scrollView
            GUI.EndScrollView();
            if (EditorGUI.EndChangeCheck())
            {
                //If the asset already exists, mark it to be saved
                if (Resources.Load <DynamicDecalSettings>("Settings") != null)
                {
                    EditorUtility.SetDirty(settings);
                }

                //If the asset doen't exist, create it
                else
                {
                    AssetDatabase.CreateAsset(settings, assetPath);
                }

                //Apply changes to system immediately
                DynamicDecals.ApplySettings();
            }
        }
Exemplo n.º 2
0
        private void UndoRedo()
        {
            //Grab our settings
            DynamicDecalSettings settings = DynamicDecals.System.Settings;

            //Recalculate passes
            settings.CalculatePasses();

            //Update renderers
            DynamicDecals.System.UpdateRenderers();

            //Repaint the window to show changes immediately
            Repaint();

            //Apply changes to system immediately
            DynamicDecals.ApplySettings();
        }