public static void DrawBiomeInfos(BiomeData b)
        {
            PWGUI.currentWindowRect = new Rect(0, 0, 200, 150);
            PWGUI.StartFrame();
            EditorGUILayout.LabelField("Biome datas:");

            update = GUILayout.Button("Update maps");

            //2D maps:
            if (b.terrain != null)
            {
                if ((terrainFoldout = EditorGUILayout.Foldout(terrainFoldout, "Terrain 2D")))
                {
                    PWGUI.Sampler2DPreview(b.terrain, update);
                }
            }

            if (b.waterHeight != null)
            {
                if ((waterFoldout = EditorGUILayout.Foldout(waterFoldout, "Water map")))
                {
                    PWGUI.Sampler2DPreview(b.waterHeight, update);
                }
            }

            if (b.wetness != null)
            {
                if ((wetnessFoldout = EditorGUILayout.Foldout(wetnessFoldout, "Wetness map")))
                {
                    PWGUI.Sampler2DPreview(b.wetness, update);
                }
            }

            if (b.temperature != null)
            {
                if ((temperatureFoldout = EditorGUILayout.Foldout(temperatureFoldout, "Temperature map")))
                {
                    PWGUI.Sampler2DPreview(b.temperature, update);
                }
            }

            //3D maps:
            if (b.terrain3D != null)
            {
                EditorGUILayout.LabelField("Terrain: 3D");
            }
        }
Exemple #2
0
        public void OnGUI(BiomeData biomeData)
        {
            PWGUI.StartFrame(new Rect(0, 0, 0, 0));

            if (biomeRepartitionPreview == null)
            {
                biomeRepartitionPreview = new Texture2D(previewTextureWidth, 1);
                UpdateBiomeRepartitionPreview(biomeData);
            }

            using (DefaultGUISkin.Get())
            {
                reorderableSwitchDataList.DoLayoutList();
            }

            EditorGUILayout.LabelField("repartition map: (" + localCoveragePercent.ToString("F1") + "%)");
            Rect previewRect = EditorGUILayout.GetControlRect(GUILayout.ExpandWidth(true), GUILayout.Height(0));

            previewRect.height = previewTextureHeight;
            GUILayout.Space(previewTextureHeight);

            PWGUI.TexturePreview(previewRect, biomeRepartitionPreview, false);
            PWGUI.SetScaleModeForField(-1, ScaleMode.StretchToFill);
        }
Exemple #3
0
        public static void DrawBiomeInfos(Rect view, BiomeData b)
        {
            if (b == null)
            {
                EditorGUILayout.LabelField("Null biome data");
                return;
            }

            PWGUI.StartFrame(view);

            if (samplerFoldouts == null || samplerFoldouts.Length != b.length)
            {
                samplerFoldouts = new bool[b.length];
            }

            // update = GUILayout.Button("Update maps");

            //2D maps:
            int i = 0;

            foreach (var samplerDataKP in b.biomeSamplerNameMap)
            {
                if (!samplerDataKP.Value.is3D)
                {
                    samplerFoldouts[i] = EditorGUILayout.Foldout(samplerFoldouts[i], samplerDataKP.Key);

                    if (samplerFoldouts[i])
                    {
                        PWGUI.Sampler2DPreview(samplerDataKP.Value.data2D);
                    }
                }
                //TODO: 3D maps preview

                i++;
            }
        }
Exemple #4
0
    //draw the default node graph:
    public override void OnGUI()
    {
        base.OnGUI();

        if (graph == null)
        {
            RenderGraphNotFound();
            return;
        }

        //update the current GUI settings storage and clear drawed popup list:
        graph.PWGUI.StartFrame(position);
        PWGUI.StartFrame(position);

        //set the skin for the current window
        GUI.skin = PWGUISkin;

        //protection against node class rename & corrupted nodes
        for (int i = 0; i < graph.nodes.Count; i++)
        {
            var node = graph.nodes[i];
            if (node == null)
            {
                graph.nodes.RemoveAt(i);
            }
            else if (node.GetType() == typeof(PWNode))
            {
                graph.RemoveNode(node);
            }
        }

        //disable events if mouse is above an eventMask Rect.
        MaskEvents();

        //profiling
        Profiler.BeginSample("[PW] Graph redering (" + e.type + ")");

        Rect pos = position;

        pos.position            = Vector2.zero;
        graph.zoomPanCorrection = GUIScaleUtility.BeginScale(ref pos, pos.size / 2, 1f / graph.scale, false);
        {
            //draw the background:
            RenderBackground();

            //manage selection:
            SelectAndDrag();

            //graph rendering
            RenderOrderingGroups();
            RenderLinks();
            RenderNodes();

            //context menu
            ContextMenu();

            //fill and process remaining events if there is
            ManageEvents();

            //reset events for the next frame
            editorEvents.Reset();

            if (e.type == EventType.Repaint)
            {
                Repaint();
            }
        }
        GUIScaleUtility.EndScale();

        Profiler.EndSample();

        //restore masked events:
        UnMaskEvents();

        //update delayedChanges
        delayedChanges.Update();
    }