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);
        }
Exemplo n.º 2
0
        private static void ShowImportDataContextMenu(Rect r, TerrainGenerator instance)
        {
            GenericPopup menu = new GenericPopup();

            menu.AddDisabledItem(new GUIContent("Coming soon!"), false);
            menu.Show(r);
        }