Esempio n. 1
0
        /// <summary>
        /// BrushEditor項目のGUIを作成
        /// </summary>
        /// <param name="brushDetailNode">BrushDetailNode</param>
        void MakeBrushEditor(BrushDetailNode brushDetailNode)
        {
            foldoutBrushEditor =
                EditorGUILayout.Foldout(foldoutBrushEditor, "Brush Editor");
            if (!foldoutBrushEditor)
            {
                return;
            }

            ++EditorGUI.indentLevel;

            // Brush Type
            var brushType = (Brush)Enum
                            .GetValues(typeof(Brush))
                            .GetValue(propBrushType.enumValueIndex);

            propBrushType.enumValueIndex =
                (int)(BrushDetailNode.Brush)EditorGUILayout.EnumPopup("Brush Type", brushType);

            currentBrushType = (BrushDetailNode.Brush)propBrushType.enumValueIndex;

            using (new EditorGUI.DisabledGroupScope(currentBrushType == BrushDetailNode.Brush.Simple))
            {
                // Brush Map
                EditorGUICustomLayout.PencilNodeField(
                    "Brush Map",
                    typeof(TextureMapNode),
                    serializedObject,
                    propBrushMap,
                    selectedObject => { },
                    () =>
                {
                    var textureMap                    = Instantiate(Prefabs.TextureMap);
                    textureMap.name                   = Common.GetAllGameObject().GetUniqueName(Prefabs.TextureMap);
                    textureMap.transform.parent       = brushDetailNode.transform;
                    propBrushMap.objectReferenceValue = textureMap;
                    Selection.activeObject            = textureMap;
                    Undo.RegisterCreatedObjectUndo(textureMap, "Create Texture Map Node");
                });

                // Map Opacity
                propMapOpacity.floatValue = EditorGUILayout.Slider("Map Opacity",
                                                                   propMapOpacity.floatValue,
                                                                   0.0f, 1.0f);
            }



            // Stretch
            propStretch.floatValue = EditorGUILayout.Slider("Stretch",
                                                            propStretch.floatValue,
                                                            -1.0f, 1.0f);

            // Stretch Random
            propStretchRandom.floatValue = EditorGUILayout.Slider("Stretch Random",
                                                                  propStretchRandom.floatValue,
                                                                  0.0f, 1.0f);

            // Angle
            propAngle.floatValue = EditorGUILayout.Slider("Angle",
                                                          propAngle.floatValue,
                                                          -360.0f, 360.0f);

            // Angle Random
            propAngleRandom.floatValue = EditorGUILayout.Slider("Angle Random",
                                                                propAngleRandom.floatValue,
                                                                0.0f, 1.0f);

            using (new EditorGUI.DisabledGroupScope(currentBrushType == BrushDetailNode.Brush.Simple))
            {
                // Groove
                propGroove.floatValue = EditorGUILayout.Slider("Groove",
                                                               propGroove.floatValue,
                                                               0.0f, 1.0f);

                // Groove Number
                propGrooveNumber.intValue = EditorGUILayout.IntSlider("Groove Number",
                                                                      propGrooveNumber.intValue,
                                                                      3, 20);
            }


            using (new EditorGUI.DisabledGroupScope(currentBrushType != Brush.Multiple))
            {
                // Size
                propSize.floatValue = EditorGUILayout.Slider("Size",
                                                             propSize.floatValue,
                                                             0.1f, 100.0f);

                // Size Random
                propSizeRandom.floatValue = EditorGUILayout.Slider("Size Random",
                                                                   propSizeRandom.floatValue,
                                                                   0.0f, 1.0f);
                // Antialiasing
                propAntialiasing.floatValue = EditorGUILayout.Slider("Antialiasing",
                                                                     propAntialiasing.floatValue,
                                                                     0.0f, 10.0f);

                // Horizontal Space
                propHorizontalSpace.floatValue = EditorGUILayout.Slider("Horizontal Space",
                                                                        propHorizontalSpace.floatValue,
                                                                        0.0f, 1.0f);
                // Horizontal Space Random
                propHorizontalSpaceRandom.floatValue =
                    EditorGUILayout.Slider("Horizontal Space Random",
                                           propHorizontalSpaceRandom.floatValue,
                                           0.0f, 1.0f);

                // Vertical Space
                propVerticalSpace.floatValue = EditorGUILayout.Slider("Vertical Space",
                                                                      propVerticalSpace.floatValue,
                                                                      0.0f, 1.0f);

                // Vertical Space Random
                propVerticalSpaceRandom.floatValue =
                    EditorGUILayout.Slider("Vertical Space Random",
                                           propVerticalSpaceRandom.floatValue,
                                           0.0f, 1.0f);
            }

            using (new EditorGUI.DisabledGroupScope(currentBrushType == BrushDetailNode.Brush.Simple))
            {
                // Reduction Start
                propReductionStart.floatValue = EditorGUILayout.Slider("Reduction Start",
                                                                       propReductionStart.floatValue,
                                                                       0.0f, 1.0f);

                // Reduction End
                propReductionEnd.floatValue = EditorGUILayout.Slider("Reduction End",
                                                                     propReductionEnd.floatValue,
                                                                     0.0f, 1.0f);
            }

            EditorGUILayout.Separator();

            --EditorGUI.indentLevel;
        }
Esempio n. 2
0
        /// <summary>
        /// Distortion項目のGUIの作成
        /// </summary>
        /// <param name="brushDetailNode">BrushDetailNode</param>
        void MakeDistortion(BrushDetailNode brushDetailNode)
        {
            foldoutDistortion =
                EditorGUILayout.Foldout(foldoutDistortion, "Distortion");
            if (!foldoutDistortion)
            {
                return;
            }

            ++EditorGUI.indentLevel;

            // Enable
            propDistortionEnable.boolValue =
                EditorGUILayout.Toggle("Enable", propDistortionEnable.boolValue);


            using (new EditorGUI.DisabledGroupScope(!propDistortionEnable.boolValue))
            {
                // Distortion Map
                EditorGUICustomLayout.PencilNodeField(
                    "Brush Map",
                    typeof(TextureMapNode),
                    serializedObject,
                    propDistortionMap,
                    selectedObject => { },
                    () =>
                {
                    var textureMap                         = Instantiate(Prefabs.TextureMap);
                    textureMap.name                        = Common.GetAllGameObject().GetUniqueName(Prefabs.TextureMap);
                    textureMap.transform.parent            = brushDetailNode.transform;
                    propDistortionMap.objectReferenceValue = textureMap;
                    Selection.activeObject                 = textureMap;
                    Undo.RegisterCreatedObjectUndo(textureMap, "Create Texture Map Node");
                });



                // Map Amount
                propMapAmount.floatValue = EditorGUILayout.Slider("Map Amount",
                                                                  propMapAmount.floatValue,
                                                                  0.0f, 1000.0f);

                // Amount
                propAmount.floatValue = EditorGUILayout.Slider("Amount",
                                                               propAmount.floatValue,
                                                               0.0f, 1000.0f);

                // Random
                propRandom.floatValue = EditorGUILayout.Slider("Random",
                                                               propRandom.floatValue,
                                                               0.0f, 1.0f);
                // Cycles
                propCycles.floatValue = EditorGUILayout.Slider("Cycles",
                                                               propCycles.floatValue,
                                                               5.0f, 1000.0f);
                // Cycles Random
                propCyclesRandom.floatValue = EditorGUILayout.Slider("Cycles Random",
                                                                     propCyclesRandom.floatValue,
                                                                     0.0f, 1.0f);

                // Phase
                propPhase.floatValue = EditorGUILayout.Slider("Phase",
                                                              propPhase.floatValue,
                                                              -9999.0f, 9999.0f);
                // Phase Random
                propPhaseRandom.floatValue = EditorGUILayout.Slider("Phase Random",
                                                                    propPhaseRandom.floatValue,
                                                                    0.0f, 1.0f);
            }

            EditorGUILayout.Separator();

            --EditorGUI.indentLevel;
        }
Esempio n. 3
0
        /// <summary>
        /// BrushSettingsのGUI作成
        /// </summary>
        /// <param name="brushSettingsNode">BrushSettingsNode</param>
        void MakeBrushSettings(BrushSettingsNode brushSettingsNode)
        {
            foldoutBrushSettings =
                EditorGUILayout.Foldout(foldoutBrushSettings, "Brush Settings");
            if (!foldoutBrushSettings)
            {
                return;
            }

            ++EditorGUI.indentLevel;

            // Brush Detail

            EditorGUICustomLayout.PencilNodeField(
                "Brush Detail",
                typeof(BrushDetailNode),
                serializedObject,
                propBrushDetail,
                (nodeObject) =>
            {
                if (nodeObject == null)
                {
                    return;
                }

                serializedBrushDetailParams =
                    new SerializedObject(nodeObject.GetComponent <BrushDetailNode>());
                propStretch = serializedBrushDetailParams.FindProperty("Stretch");
                propAngle   = serializedBrushDetailParams.FindProperty("Angle");
            });


            // BlendMode
            //var blendMode = (BrushSettingsNode.BlendModeType)Enum
            //                .GetValues(typeof(BrushSettingsNode.BlendModeType))
            //                .GetValue(propBlendMode.enumValueIndex);

            //propBlendMode.enumValueIndex =
            //    (int)(LineSetNode.LineType)EditorGUILayout.EnumPopup("Blend Mode", blendMode);

            // BlendAmount
            propBlendAmount.floatValue = EditorGUILayout.Slider("Blend Amount",
                                                                propBlendAmount.floatValue,
                                                                0.0f, 1.0f);

            // Color
            propColor.colorValue =
                EditorGUILayout.ColorField("Color", propColor.colorValue);


            // ColorMap
            EditorGUICustomLayout.PencilNodeField(
                "Color Map",
                typeof(TextureMapNode),
                serializedObject,
                propColorMap,
                nodeObject => { },
                () =>
            {
                var textureMap                    = Instantiate(Prefabs.TextureMap);
                textureMap.name                   = Common.GetAllGameObject().GetUniqueName(Prefabs.TextureMap);
                textureMap.transform.parent       = brushSettingsNode.transform;
                propColorMap.objectReferenceValue = textureMap;
                Selection.activeObject            = textureMap;
                Undo.RegisterCreatedObjectUndo(textureMap, "Create Texture Map Node");
            });


            // MapOpacity
            propMapOpacity.floatValue = EditorGUILayout.Slider("Map Opacity",
                                                               propMapOpacity.floatValue,
                                                               0.0f, 1.0f);

            // Size
            propSize.floatValue = EditorGUILayout.Slider("Size",
                                                         propSize.floatValue,
                                                         0.1f, 20.0f);

            //// SizeMap
            EditorGUICustomLayout.PencilNodeField(
                "Size Map",
                typeof(TextureMapNode),
                serializedObject,
                propSizeMap,
                nodeObject => { },
                () =>
            {
                var textureMap                   = Instantiate(Prefabs.TextureMap);
                textureMap.name                  = Common.GetAllGameObject().GetUniqueName(Prefabs.TextureMap);
                textureMap.transform.parent      = brushSettingsNode.transform;
                propSizeMap.objectReferenceValue = textureMap;
                Selection.activeObject           = textureMap;
                Undo.RegisterCreatedObjectUndo(textureMap, "Create Texture Map Node");
            });

            //// SizeMapAmount
            propSizeMapAmount.floatValue = EditorGUILayout.Slider("Size Map Amount",
                                                                  propSizeMapAmount.floatValue,
                                                                  0.0f, 1.0f);

            // BrushDetailParams
            var bdObj = propBrushDetail.objectReferenceValue;

            using (new EditorGUI.DisabledGroupScope(bdObj == null))
            {
                MakeBrushDetail((GameObject)propBrushDetail.objectReferenceValue);
            }

            --EditorGUI.indentLevel;
        }