Exemplo n.º 1
0
        public static void OpenBrushSettingsNode()
        {
            GameObject newBrushSettings = Instantiate(Prefabs.BrushSettings);

            Undo.RegisterCreatedObjectUndo(newBrushSettings, "Create Brush Settings Node");
            List <GameObject> allGameObjs = Common.GetAllGameObject();

            newBrushSettings.name = allGameObjs.GetUniqueName(Prefabs.BrushSettings);

            // BrushDetailの追加
            BrushSettingsNode brushSettingsNode = newBrushSettings.GetComponent <BrushSettingsNode>();
            GameObject        newBrushDetail    =
                Common.CreateObject(newBrushSettings, allGameObjs, Prefabs.BrushDetail);

            brushSettingsNode.BrushDetail = newBrushDetail;
        }
Exemplo n.º 2
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;
        }