示例#1
0
        private static void ShowImportDataContextMenu(Rect r, TerrainGenerator instance)
        {
            GenericPopup menu = new GenericPopup();

            menu.AddDisabledItem(new GUIContent("Coming soon!"), false);
            menu.Show(r);
        }
        private static void DisplayContextMenuForPrefab(Rect r, TerrainGenerator instance, int i)
        {
            int  childCount = instance.EnvironmentalPainter.GetGroupChildCount(i);
            bool active     = instance.EnvironmentalPainter.IsGroupActive(i);

            GameObject prefab         = instance.EnvironmentalPainterSettings.GetPrefabs()[i];
            bool       hasCombination = instance.EnvironmentalPainter.GetCombinationsGroup(prefab).childCount > 0;

            GenericPopup menu = new GenericPopup();

            if (childCount > 0 && active)
            {
                menu.AddItem(new GUIContent("Group"), false, () => { GroupPrefabInstancesContextHandler(instance, i); });
            }
            else
            {
                menu.AddDisabledItem(new GUIContent("Group"), false);
            }
            if (childCount > 0 && active && hasCombination)
            {
                menu.AddItem(new GUIContent("UnGroup"), false, () => { UnGroupPrefabInstancesContextHandler(instance, i); });
            }
            else
            {
                menu.AddDisabledItem(new GUIContent("UnGroup"), false);
            }
            menu.AddSeparator();
            if (childCount > 0 && !active)
            {
                menu.AddItem(new GUIContent("Show All"), false, () => { ShowAllPrefabInstancesContextHandler(instance, i); });
            }
            else
            {
                menu.AddDisabledItem(new GUIContent("Show All"), false);
            }
            if (childCount > 0 && active)
            {
                menu.AddItem(new GUIContent("Hide All"), false, () => { HideAllPrefabInstancesContextHandler(instance, i); });
            }
            else
            {
                menu.AddDisabledItem(new GUIContent("Hide All"), false);
            }
            menu.AddSeparator();
            menu.AddItem(new GUIContent("Export Distribution Map"), false, () => { ExportDistributionMapContextHandler(instance, i); });
            menu.AddItem(new GUIContent("Mass Placement"), false, () => { MassPlacementContextHandler(instance, i); });
            menu.AddSeparator();
            if (childCount > 0)
            {
                menu.AddItem(new GUIContent("Clear All"), false, () => { ClearAllPrefabInstancesContextHandler(instance, i); });
            }
            else
            {
                menu.AddDisabledItem(new GUIContent("Clear All"), false);
            }

            menu.Show(r);
        }
        private static void DisplayContextMenuForBrush(Rect r, TerrainGenerator instance, int i)
        {
            GenericPopup popup = new GenericPopup();

            popup.AddItem(
                new GUIContent("Edit"),
                false,
                () =>
            {
                DisplayEditBrushPopup(instance, i);
            });
            popup.AddItem(
                new GUIContent("Remove"),
                false,
                () =>
            {
                ConfirmAndRemoveBrushFromPaletteAt(instance, i);
            });

            popup.Show(r);
        }
示例#4
0
        private static void ShowExportDataContextMenu(Rect r, TerrainGenerator instance)
        {
            GenericPopup menu = new GenericPopup();

            menu.AddItem(
                new GUIContent("3D file from Mesh"),
                false,
                () => { MeshSaverGUI.ShowWindow(instance); });
            menu.AddSeparator();
            menu.AddItem(
                new GUIContent("UV layout"),
                false,
                () => { TextureExporterGUI.ShowWindow(instance, TextureExporter.TextureType.UvLayout); });
            menu.AddItem(
                new GUIContent("Vertex color map"),
                false,
                () => { TextureExporterGUI.ShowWindow(instance, TextureExporter.TextureType.VertexColor); });
            menu.AddItem(
                new GUIContent("Height map"),
                false,
                () => { HeightMapExporterGUI.ShowWindow(instance); });
            menu.Show(r);
        }