Exemplo n.º 1
0
    public static void Open()
    {
        if (Application.isPlaying)
        {
            return;
        }

        ClayxelsPrefsWindow.prefs = ClayContainer.loadPrefs();

        ClayxelsPrefsWindow window = (ClayxelsPrefsWindow)EditorWindow.GetWindow(typeof(ClayxelsPrefsWindow));

        window.Show();
    }
Exemplo n.º 2
0
    void OnGUI()
    {
        if (Application.isPlaying)
        {
            return;
        }

        if (ClayxelsPrefsWindow.prefs == null)
        {
            ClayxelsPrefsWindow.prefs = ClayContainer.loadPrefs();
        }

        EditorGUI.BeginChangeCheck();

        Color boundsColor = new Color((float)ClayxelsPrefsWindow.prefs.boundsColor[0] / 255.0f, (float)ClayxelsPrefsWindow.prefs.boundsColor[1] / 255.0f, (float)ClayxelsPrefsWindow.prefs.boundsColor[2] / 255.0f, (float)ClayxelsPrefsWindow.prefs.boundsColor[3] / 255.0f);

        boundsColor = EditorGUILayout.ColorField(new GUIContent("boundsColor", "Color of the bounds indicator in the viewport, enable Gizmos in the viewport to see this."), boundsColor);
        ClayxelsPrefsWindow.prefs.boundsColor[0] = (byte)(boundsColor.r * 255);
        ClayxelsPrefsWindow.prefs.boundsColor[1] = (byte)(boundsColor.g * 255);
        ClayxelsPrefsWindow.prefs.boundsColor[2] = (byte)(boundsColor.b * 255);
        ClayxelsPrefsWindow.prefs.boundsColor[3] = (byte)(boundsColor.a * 255);

        ClayxelsPrefsWindow.prefs.pickingKey         = EditorGUILayout.TextField(new GUIContent("picking shortcut", "Press this shortcut to pick/select containers and clayObjects in scene."), ClayxelsPrefsWindow.prefs.pickingKey);
        ClayxelsPrefsWindow.prefs.mirrorDuplicateKey = EditorGUILayout.TextField(new GUIContent("mirrorDuplicate shortcut", "Press this shortcut to duplicate and mirror a clayObject on the X axis."), ClayxelsPrefsWindow.prefs.mirrorDuplicateKey);

        string[] pointCountPreset = new string[] { "low", "mid", "high" };
        ClayxelsPrefsWindow.prefs.maxPointCount = EditorGUILayout.Popup(new GUIContent("pointCloud memory", "Preset to allocate video ram to handle bigger point clouds."), ClayxelsPrefsWindow.prefs.maxPointCount, pointCountPreset);

        string[] solidsCountPreset = new string[] { "low", "mid", "high" };
        ClayxelsPrefsWindow.prefs.maxSolidsCount = EditorGUILayout.Popup(new GUIContent("clayObjects memory", "Preset to allocate video ram to handle more clayObjects per container."), ClayxelsPrefsWindow.prefs.maxSolidsCount, solidsCountPreset);

        string[] solidsPerVoxelPreset = new string[] { "best performance", "balanced", "max sculpt detail" };
        ClayxelsPrefsWindow.prefs.maxSolidsPerVoxel = EditorGUILayout.Popup(new GUIContent("clayObjects per voxel", "Preset to handle more clayObjects per voxel, it might fix some artifacts caused by having a lot of clayObjects all close to each other."), ClayxelsPrefsWindow.prefs.maxSolidsPerVoxel, solidsPerVoxelPreset);

        int frameSkip = EditorGUILayout.IntField(new GUIContent("frame skip", ""), ClayxelsPrefsWindow.prefs.frameSkip);

        if (frameSkip < 0)
        {
            frameSkip = 0;
        }
        else if (frameSkip > 100)
        {
            frameSkip = 100;
        }
        ClayxelsPrefsWindow.prefs.frameSkip = frameSkip;

        int maxBounds = EditorGUILayout.IntField(new GUIContent("max bounds size", "Smaller bounds use less video memory but give you less space to work with."), ClayxelsPrefsWindow.prefs.maxBounds);

        if (maxBounds < 1)
        {
            maxBounds = 1;
        }
        else if (maxBounds > 4)
        {
            maxBounds = 4;
        }
        ClayxelsPrefsWindow.prefs.maxBounds = maxBounds;

        ClayxelsPrefsWindow.prefs.vramLimitEnabled = EditorGUILayout.Toggle(new GUIContent("video ram limit enabled", "When this limit is enabled you won't be able to exceed your available vram when creating new container."), ClayxelsPrefsWindow.prefs.vramLimitEnabled);

        EditorGUILayout.Space();

        EditorGUILayout.MinMaxSlider(new GUIContent("LOD: " + Mathf.Round(ClayxelsPrefsWindow.prefs.lodNear) + " - " + Mathf.Round(ClayxelsPrefsWindow.prefs.lodFar), "Level Of Detail in scene unit, measures the distance from the camera to automatically reduce the amount of points rendered."),
                                     ref ClayxelsPrefsWindow.prefs.lodNear, ref ClayxelsPrefsWindow.prefs.lodFar, 0.0f, 1000.0f);

        if (EditorGUI.EndChangeCheck())
        {
            ClayContainer.savePrefs(ClayxelsPrefsWindow.prefs);
            ClayContainer.reloadAll();
        }

        EditorGUILayout.Space();

        int[] memStats = ClayContainer.getMemoryStats();
        EditorGUILayout.LabelField("- vram rough usage -");
        EditorGUILayout.LabelField("upfront vram allocated: " + memStats[0] + "MB");
        EditorGUILayout.LabelField("containers in scene: " + memStats[1] + "MB");

        EditorGUILayout.Space();

        if (GUILayout.Button((new GUIContent("reload all", "This is necessary after you make changes to the shaders or to the claySDF file."))))
        {
            ClayContainer.reloadAll();
        }
    }