public void init() { GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; SimSet GuiDataGroup = "GuiDataGroup"; this.clear(); int defaultGroup = this.insertItem(0, "Default", "-1", "", 1, 1); int otherGroup = this.insertItem(0, sGlobal["$GUI_EDITOR_DEFAULT_PROFILE_CATEGORY"], "-1", "", 1, 1); for (uint i = 0; i < GuiDataGroup.getCount(); i++) { SimObject obj = GuiDataGroup.getObject(i); if (!obj.isMemberOfClass("GuiControlProfile")) { continue; } // If it's an Editor profile, skip if showing them is not enabled. if (obj["category"] == "Editor" && !GuiEditor["showEditorProfiles"].AsBool()) { continue; } // Create a visible name. string name = obj.getName(); if (name == "") { name = "<Unnamed>"; } string text = name + " (" + obj.getId() + ")"; // Find which group to put the control in. bool isDefaultProfile = GuiEditor.isDefaultProfile(name); int group; if (isDefaultProfile) { group = defaultGroup; } else if (obj["category"] != "") { group = this.findChildItemByName(0, obj["category"]); if (group == 0) { group = this.insertItem(0, obj["category"], "", "", 1, 1); } } else { group = otherGroup; } // Insert the item. this.insertItem(group, text, obj.getId().AsString(), "", 1, 1); } this.sort(0, true, true, false); }