Example #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();
        }
 public void PropertyGrid_Init()
 {
     CustomEditors.RegisterEditor("Display Folder", new FormDisplayFolderSelect());
     CustomEditors.RegisterEditor("Connection String", new ConnectSqlForm());
     CustomEditors.RegisterEditor("Sort By Column", new ColumnSelectDialog());
     CustomEditors.RegisterEditor(TOMWrapper.Properties.GROUPBYCOLUMNS, new ColumnSelectDialog());
 }
 public void PropertyGrid_Init()
 {
     CustomEditors.RegisterEditor(nameof(Measure.DisplayFolder), new FormDisplayFolderSelect());
     CustomEditors.RegisterEditor(nameof(ProviderDataSource.ConnectionString), new ConnectSqlForm());
     CustomEditors.RegisterEditor(nameof(Column.SortByColumn), new ColumnSelectDialog());
     CustomEditors.RegisterEditor(nameof(Column.GroupByColumns), new ColumnSelectDialog());
 }
Example #4
0
 public void OnEnable()
 {
     _source           = serializedObject.FindProperty("_source");
     _separateMask     = serializedObject.FindProperty("_separateMask");
     _sprite           = serializedObject.FindProperty("_sprite");
     _spriteBorderMode = serializedObject.FindProperty("_spriteBorderMode");
     _spritePixelsPerUnitMultiplier = serializedObject.FindProperty("_spritePixelsPerUnitMultiplier");
     _texture          = serializedObject.FindProperty("_texture");
     _textureUVRect    = serializedObject.FindProperty("_textureUVRect");
     _channelWeights   = serializedObject.FindProperty("_channelWeights");
     _raycastThreshold = serializedObject.FindProperty("_raycastThreshold");
     _invertMask       = serializedObject.FindProperty("_invertMask");
     _invertOutsides   = serializedObject.FindProperty("_invertOutsides");
     Assert.IsNotNull(_source);
     Assert.IsNotNull(_separateMask);
     Assert.IsNotNull(_sprite);
     Assert.IsNotNull(_spriteBorderMode);
     Assert.IsNotNull(_spritePixelsPerUnitMultiplier);
     Assert.IsNotNull(_texture);
     Assert.IsNotNull(_textureUVRect);
     Assert.IsNotNull(_channelWeights);
     Assert.IsNotNull(_raycastThreshold);
     Assert.IsNotNull(_invertMask);
     Assert.IsNotNull(_invertOutsides);
     _customWeightsExpanded = CustomEditors.CustomChannelShouldBeExpandedFor(_channelWeights.colorValue);
 }
Example #5
0
        private void DrawTilingRuleSettings()
        {
            if (!isVertical) // horizontal
            {
                EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(false));
                {
                    float buttonSize        = position.height - (EditorGUIUtility.singleLineHeight + (EditorGUIUtility.standardVerticalSpacing * 3f));
                    float buttonSizeClamped = Mathf.Clamp(buttonSize, 0f, maxButtonSize);

                    EditorGUILayout.BeginVertical(GUILayout.Width(buttonSizeClamped * 3f));
                    {
                        EditorGUILayout.LabelField("Self", EditorStyles.boldLabel, GUILayout.Width(buttonSizeClamped * 3f));

                        EditorGUILayout.BeginHorizontal();
                        CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("Cycle", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), null, ref TilingRulePropertyDrawer.brushType);
                        CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("Eraser", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), RuleBehaviour.DontCare, ref TilingRulePropertyDrawer.brushType);
                        CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("This", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), RuleBehaviour.This, ref TilingRulePropertyDrawer.brushType);
                        CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("NotThis", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), RuleBehaviour.NotThis, ref TilingRulePropertyDrawer.brushType);
                        EditorGUILayout.EndHorizontal();
                    }
                    EditorGUILayout.EndVertical();

                    //vertical line
                    EditorGUILayout.BeginVertical(GUILayout.Width(1f));
                    EditorGUILayout.LabelField(GUIContent.none, GUILayout.Width(EditorGUIUtility.singleLineHeight / 2f));
                    EditorGUILayout.EndVertical();

                    EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndHorizontal();
            }
            else // vertical
            {
                float buttonSize = position.width - (EditorGUIUtility.standardVerticalSpacing * 2f);

                EditorGUILayout.LabelField("Self", EditorStyles.boldLabel, GUILayout.Width(buttonSize));

                CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("Cycle", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), null, ref TilingRulePropertyDrawer.brushType);
                CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("Eraser", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), RuleBehaviour.DontCare, ref TilingRulePropertyDrawer.brushType);
                CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("This", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), RuleBehaviour.This, ref TilingRulePropertyDrawer.brushType);
                CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("NotThis", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), RuleBehaviour.NotThis, ref TilingRulePropertyDrawer.brushType);
            }
        }
Example #6
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();
        }
 public void PropertyGrid_Init()
 {
     CustomEditors.RegisterEditor("Display Folder", new FormDisplayFolderSelect());
 }
Example #8
0
        private void DrawPositionHandles()
        {
            if (!isVertical) // horizontal
            {
                EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(false));
                {
                    float buttonSize        = position.height - (EditorGUIUtility.singleLineHeight + (EditorGUIUtility.standardVerticalSpacing * 3f));
                    float buttonSizeClamped = Mathf.Clamp(buttonSize, 0f, maxButtonSize);

                    GUILayout.Box(GUIContent.none, positionStyle, GUILayout.Height(position.height), GUILayout.Width(position.height));

                    EditorGUILayout.BeginVertical(GUILayout.Width(buttonSizeClamped * 3f));
                    {
                        EditorGUILayout.LabelField("Self", EditorStyles.boldLabel, GUILayout.Width(buttonSizeClamped * 3f));

                        EditorGUILayout.BeginHorizontal();
                        CustomEditors.EnumButton(this, () => GUILayout.Button("Self", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), LinkSpaceRotation.Self, ref CustomPositionEditor.selfHandleRot);
                        CustomEditors.EnumButton(this, () => GUILayout.Button("Parent", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), LinkSpaceRotation.Parent, ref CustomPositionEditor.selfHandleRot);
                        CustomEditors.EnumButton(this, () => GUILayout.Button("World", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), LinkSpaceRotation.World, ref CustomPositionEditor.selfHandleRot);
                        EditorGUILayout.EndHorizontal();
                    }
                    EditorGUILayout.EndVertical();

                    //vertical line
                    EditorGUILayout.BeginVertical(GUILayout.Width(1f));
                    EditorGUILayout.LabelField(GUIContent.none, GUILayout.Width(EditorGUIUtility.singleLineHeight / 2f));
                    EditorGUILayout.EndVertical();

                    EditorGUILayout.BeginVertical(GUILayout.Width(buttonSizeClamped * 2f));
                    {
                        EditorGUILayout.LabelField("World", EditorStyles.boldLabel, GUILayout.Width(buttonSizeClamped * 2f));

                        EditorGUILayout.BeginHorizontal();
                        CustomEditors.EnumButton(this, () => GUILayout.Button("Self", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), Space.Self, ref CustomPositionEditor.worldHandleRot);
                        CustomEditors.EnumButton(this, () => GUILayout.Button("World", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), Space.World, ref CustomPositionEditor.worldHandleRot);
                        EditorGUILayout.EndHorizontal();
                    }
                    EditorGUILayout.EndVertical();

                    //vertical line
                    EditorGUILayout.BeginVertical(GUILayout.Width(1f));
                    EditorGUILayout.LabelField(GUIContent.none, GUILayout.Width(EditorGUIUtility.singleLineHeight / 2f));
                    EditorGUILayout.EndVertical();

                    EditorGUILayout.BeginVertical();
                    {
                        EditorGUILayout.LabelField("Extra", EditorStyles.boldLabel);

                        CustomPositionEditor.offsetHandleRaw = EditorGUILayout.Toggle("Use Raw Position", CustomPositionEditor.offsetHandleRaw);
                    }
                    EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndHorizontal();
            }
            else // vertical
            {
                GUILayout.Box(GUIContent.none, positionStyle, GUILayout.Height(position.width), GUILayout.Width(position.width));

                float buttonSize = position.width - (EditorGUIUtility.standardVerticalSpacing * 2f);

                EditorGUILayout.LabelField("Self", EditorStyles.boldLabel, GUILayout.Width(buttonSize));

                CustomEditors.EnumButton(this, () => GUILayout.Button("Self", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), LinkSpaceRotation.Self, ref CustomPositionEditor.selfHandleRot);
                CustomEditors.EnumButton(this, () => GUILayout.Button("Parent", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), LinkSpaceRotation.Parent, ref CustomPositionEditor.selfHandleRot);
                CustomEditors.EnumButton(this, () => GUILayout.Button("World", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), LinkSpaceRotation.World, ref CustomPositionEditor.selfHandleRot);

                EditorGUILayout.LabelField("World", EditorStyles.boldLabel, GUILayout.Width(buttonSize));
                CustomEditors.EnumButton(this, () => GUILayout.Button("Self", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), Space.Self, ref CustomPositionEditor.worldHandleRot);
                CustomEditors.EnumButton(this, () => GUILayout.Button("World", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), Space.World, ref CustomPositionEditor.worldHandleRot);
                EditorGUILayout.LabelField("Extra", EditorStyles.boldLabel, GUILayout.Width(position.width));

                CustomPositionEditor.offsetHandleRaw = EditorGUILayout.Toggle(new GUIContent(string.Empty, "Use Raw Position"), CustomPositionEditor.offsetHandleRaw, GUILayout.Width(buttonSize));
            }
        }
 public void PropertyGrid_Init()
 {
     CustomEditors.RegisterEditor("Display Folder", new FormDisplayFolderSelect());
     CustomEditors.RegisterEditor("Connection String", new ConnectSqlForm());
 }