コード例 #1
0
        public void ResetMasking()
        {
            //Mask method set to both
            maskMethod = DecalMaskMethod.Both;

            //Reset layers
            layers = new ProjectionLayer[] { new ProjectionLayer("Layer 1"), new ProjectionLayer("Layer 2"), new ProjectionLayer("Layer 3"), new ProjectionLayer("Layer 4") };
            CalculatePasses();

            //Initialize or clear material lists
            if (materials == null)
            {
                materials      = new List <Material>();
                materialQueues = new List <int>();
            }
            else
            {
                ClearMaterials();
            }
        }
コード例 #2
0
        //Masking
        private void MaskSettings(Rect Area, DynamicDecalSettings Settings)
        {
            GUI.BeginGroup(Area);

            //Header
            EditorGUI.DrawRect(new Rect(0, 0, Area.width, 24), LlockhamEditorUtility.HeaderColor);
            EditorGUI.LabelField(new Rect(8, 4, Area.width - 146, 16), "Masking", EditorStyles.boldLabel);

            //Enabled
            DecalMaskMethod maskMethod = (DecalMaskMethod)EditorGUI.EnumPopup(new Rect(Area.width - 138, 4, 110, 16), GUIContent.none, Settings.maskMethod);

            if (maskMethod != Settings.maskMethod)
            {
                Undo.RecordObject(Settings, "Change Mask Method");
                Settings.maskMethod = maskMethod;
            }

            //Reset
            Rect Reset = new Rect(Area.width - 20, 6, 12, 12);

            if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && Reset.Contains(Event.current.mousePosition))
            {
                Undo.RecordObject(Settings, "Reset Masking");
                Settings.ResetMasking();
                Event.current.Use();
            }
            GUI.DrawTexture(Reset, LlockhamEditorUtility.Reset);

            if (Settings.maskMethod != DecalMaskMethod.None)
            {
                //Background
                EditorGUI.DrawRect(new Rect(0, 24, Area.width, Area.height - 24), LlockhamEditorUtility.MidgroundColor);

                LayerMasking(new Rect(8, 32, Area.width - 16, Settings.maskMethod == DecalMaskMethod.Both ? 88 : 80), Settings);
                MaterialMasking(new Rect(8, Area.height - 132, Area.width - 16, 124), Settings);
            }
            GUI.EndGroup();
        }