Exemple #1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EditorGUILayout.PropertyField(_source);
            CustomEditors.WithIndent(() => {
                switch ((SoftMask.MaskSource)_source.enumValueIndex)
                {
                case SoftMask.MaskSource.Graphic:
                    break;

                case SoftMask.MaskSource.Sprite:
                    EditorGUILayout.PropertyField(_sprite);
                    EditorGUILayout.PropertyField(_spriteBorderMode);
                    break;

                case SoftMask.MaskSource.Texture:
                    EditorGUILayout.PropertyField(_texture);
                    EditorGUILayout.PropertyField(_textureUVRect);
                    break;
                }
            });
            EditorGUILayout.PropertyField(_separateMask);
            EditorGUILayout.Slider(_raycastThreshold, 0, 1);
            CustomEditors.ChannelWeights(Labels.MaskChannel, _channelWeights, ref _customWeightsExpanded);
            ShowErrorsIfAny();
            serializedObject.ApplyModifiedProperties();
        }
Exemple #2
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EditorGUILayout.PropertyField(_source, Labels.Source);
            CustomEditors.WithIndent(() => {
                switch ((SoftMask.MaskSource)_source.enumValueIndex)
                {
                case SoftMask.MaskSource.Graphic:
                    break;

                case SoftMask.MaskSource.Sprite:
                    EditorGUILayout.PropertyField(_sprite, Labels.Sprite);
                    EditorGUILayout.PropertyField(_spriteBorderMode, Labels.SpriteBorderMode);
                    if ((SoftMask.BorderMode)_spriteBorderMode.enumValueIndex != SoftMask.BorderMode.Simple)
                    {
                        EditorGUILayout.PropertyField(_spritePixelsPerUnitMultiplier, Labels.SpritePixelsPerUnitMultiplier);
                    }
                    break;

                case SoftMask.MaskSource.Texture:
                    EditorGUILayout.PropertyField(_texture, Labels.Texture);
                    EditorGUILayout.PropertyField(_textureUVRect, Labels.TextureUVRect);
                    break;
                }
            });
            EditorGUILayout.PropertyField(_separateMask, Labels.SeparateMask);
            EditorGUILayout.Slider(_raycastThreshold, 0, 1, Labels.RaycastThreshold);
            EditorGUILayout.PropertyField(_invertMask, Labels.InvertMask);
            EditorGUILayout.PropertyField(_invertOutsides, Labels.InvertOutsides);
            var newExpanded = CustomEditors.ChannelWeights(Labels.MaskChannel, _channelWeights, _customWeightsExpanded);

            if (newExpanded != _customWeightsExpanded)
            {
                _customWeightsExpanded = newExpanded;
                Repaint();
            }
            ShowErrorsIfAny();
            serializedObject.ApplyModifiedProperties();
        }