public virtual void initGroupList()
        {
            GuiPopUpMenuCtrl groupList = findObjectByInternalName("groupList", true);

            int selected = 0;

            if (groupList.size() > 0)
            {
                selected = groupList.getSelected();
            }

            groupList.clear();

            SimGroup root = getRootGroup();

            if (!root.isObject())
            {
                return;
            }
            // Add all non-empty groups.
            scanGroup(root, groupList, 0);

            // Select initial group.
            if (selected != 0 && selected.AsString().isObject())
            {
                groupList.setSelected(selected);
            }
            else
            {
                groupList.setSelected(root.getId());
            }
        }
Exemple #2
0
        public override void onWorldEditorStartup()
        {
            ForestEditorGui.ForestEditBrushTree ForestEditBrushTree = "ForestEditBrushTree";
            SimSet ForestItemDataSet = "ForestItemDataSet";

            ForestEditorGui.ForestEditMeshTree ForestEditMeshTree = "ForestEditMeshTree";
            EditorGui EditorGui = "EditorGui";

            ForestEditorGui.ForestEditTabBook            ForestEditTabBook            = "ForestEditTabBook";
            ForestEditorGui.ForestEditorPropertiesWindow ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow";
            ForestEditorGui.ForestEditorPalleteWindow    ForestEditorPalleteWindow    = "ForestEditorPalleteWindow";

            new ObjectCreator("PersistenceManager", "ForestDataManager").Create();

            const string brushPath = "art/forest/brushes.cs";

            if (!Util.isFile(brushPath))
            {
                Util.createPath(brushPath);
            }

            // This creates the ForestBrushGroup, all brushes, and elements.
            Util.exec(brushPath, false, false);

            SimGroup ForestBrushGroup = "ForestBrushGroup";

            if (!ForestBrushGroup.isObject())
            {
                ForestBrushGroup  = new ObjectCreator("SimGroup", "ForestBrushGroup").Create();
                this["showError"] = true.AsString();
            }

            ForestEditBrushTree.open(ForestBrushGroup);

            if (!ForestItemDataSet.isObject())
            {
                ForestItemDataSet = new ObjectCreator("SimSet", "ForestItemDataSet").Create();
            }

            ForestEditMeshTree.open(ForestItemDataSet);

            // Add ourselves to the window menu.
            string accel = EditorGui.addToEditorsMenu("Forest Editor", "", this);

            // Add ourselves to the tools menu.
            string tooltip = "Forest Editor (" + accel + ")";

            EditorGui.addToToolsToolbar("ForestEditorPlugin", "ForestEditorPalette",
                                        Util._expandFilename("tools/forestEditor/images/forest-editor-btn"), tooltip);

            //connect editor windows
            ForestEditorPalleteWindow.attachTo(ForestEditorPropertiesWindow);
            ForestEditTabBook.selectPage(0);
        }
Exemple #3
0
        public override void onWorldEditorShutdown()
        {
            SimGroup           ForestBrushGroup  = "ForestBrushGroup";
            PersistenceManager ForestDataManager = "ForestDataManager";

            if (ForestBrushGroup.isObject())
            {
                ForestBrushGroup.delete();
            }
            if (ForestDataManager.isObject())
            {
                ForestDataManager.delete();
            }
        }
        public static void IODropdown(string title, string message, SimGroup simgroup, string callback, string cancelCallback)
        {
            ((GuiWindowCtrl)"IODropdownFrame").text = title;
            //bug GuiCanvas.pushDialog doesn't seem to work the mouse right.
            ((GuiCanvas)"Canvas").pushDialog("IODropdownDlg");
            MBSetText("IODropdownText", "IODropdownFrame", message);
            GuiPopUpMenuCtrl IODropdownMenu = "IODropdownMenu";

            if (simgroup.isObject())
            {
                for (uint i = 0; i < simgroup.getCount(); i++)
                {
                    IODropdownMenu.add(simgroup.getObject(i).getName());
                }
            }

            IODropdownMenu.sort();
            IODropdownMenu.setFirstSelected(false);
            ((GuiControl)"IODropdownDlg")["callback"]       = callback;
            ((GuiControl)"IODropdownDlg")["cancelCallback"] = cancelCallback;
        }