Exemplo n.º 1
0
        private void OnSceneGUI(SceneView view)
        {
            GetMouse();
            GetKeyboard();

            var displacements = GetSelected();

            selected = displacements;

            if (mode == Mode.Sculpt && mouseHeld)
            {
                if (!ctrlHeld)
                {
                    foreach (var d in displacements)
                    {
                        DisplacementTools.Sculpt(d, mousePos, GetBrushDirection(),
                                                 brushSize, brushStrength, brushFalloff);
                    }
                }
                else
                {
                    foreach (var d in displacements)
                    {
                        DisplacementTools.Smooth(d, mousePos, GetBrushDirection(),
                                                 brushSize, brushStrength, brushFalloff);
                    }
                }
            }

            if (mode == Mode.Sculpt && selected.Length > 0)
            {
                HandleUtility.AddDefaultControl(GUIUtility.
                                                GetControlID(FocusType.Passive));
            }

            Repaint();
        }
Exemplo n.º 2
0
        private void DrawSettings()
        {
            EditorGUILayout.Space();
            CenterGUI(() => GUILayout.Label($"Settings",
                                            EditorStyles.boldLabel));

            if (GUILayout.Button(sewIcon))
            {
                DisplacementTools.Sew(GetSelected());
            }
            if (GUILayout.Button(refreshIcon))
            {
                Recalculate();
            }

            GUI.color = Color.red;
            if (GUILayout.Button("Reset"))
            {
                ResetDisplacements();
            }
            GUI.color = Color.white;

            autoLighting = GUILayout.Toggle(autoLighting, "Auto Lighting");
        }