コード例 #1
0
        public void loadMaterialFilters()
        {
            ArrayObject MaterialFilterAllArray = "MaterialFilterAllArray";

            GuiDynamicCtrlArrayControl filterArray = this.FOT("filterArray");

            ArrayObject filteredTypesArray = new ObjectCreator("ArrayObject").Create();

            filteredTypesArray.duplicate(MaterialFilterAllArray);
            filteredTypesArray.uniqueKey();

            // sort the the keys before we do anything
            filteredTypesArray.sortkd();

            Util.eval(this.currentStaticFilter.name + "Checkbox.setStateOn(1);");
            // it may seem goofy why the checkbox can't be instanciated inside the container
            // reason being its because we need to store the checkbox ctrl in order to make changes
            // on it later in the function. 
            string selectedFilter = "";
            for (int i = 0; i < filteredTypesArray.count(); i++)
                {
                string filter = filteredTypesArray.getKey(i);
                if (filter == "")
                    continue;

                #region GuiControl ()        oc_Newobject67

                ObjectCreator oc_Newobject67 = new ObjectCreator("GuiControl", "");
                oc_Newobject67["profile"] = "ToolsGuiDefaultProfile";
                oc_Newobject67["Position"] = "0 0";
                oc_Newobject67["Extent"] = "128 18";
                oc_Newobject67["HorizSizing"] = "right";
                oc_Newobject67["VertSizing"] = "bottom";
                oc_Newobject67["isContainer"] = "1";

                #endregion

                GuiControl container = oc_Newobject67.Create();

                #region GuiCheckBoxCtrl ()        oc_Newobject68

                ObjectCreator oc_Newobject68 = new ObjectCreator("GuiCheckBoxCtrl", "");
                oc_Newobject68["Profile"] = "ToolsGuiCheckBoxListProfile";
                oc_Newobject68["position"] = "5 1";
                oc_Newobject68["Extent"] = "118 18";
                oc_Newobject68["Command"] = "";
                oc_Newobject68["groupNum"] = "0";
                oc_Newobject68["buttonType"] = "ToggleButton";
                oc_Newobject68["text"] = filter + " ( " + MaterialFilterAllArray.countKey(filter) + " )";
                oc_Newobject68["filter"] = filter;
                oc_Newobject68["Command"] = "MaterialSelector.preloadFilter();";

                #endregion

                GuiCheckBoxCtrl checkbox = oc_Newobject68.Create();

                container.add(checkbox);
                filterArray.add(container);

                int tagCount = Util.getWordCount(this.currentFilter);
                for (int j = 0; j < tagCount; j++)
                    {
                    if (filter == Util.getWord(this.currentFilter, j))
                        {
                        if (selectedFilter == "")
                            selectedFilter = filter;
                        else
                            selectedFilter = selectedFilter + " " + filter;

                        checkbox.setStateOn(true);
                        }
                    }
                }

            this.loadFilter(selectedFilter);

            filteredTypesArray.delete();
        }