コード例 #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();
        }
コード例 #2
0
        public void loadFilter(string selectedFilter, string staticFilter = "")
        {
            ArrayObject MatEdScheduleArray = "MatEdScheduleArray";
            ArrayObject MatEdPreviewArray = "MatEdPreviewArray";

            GuiDynamicCtrlArrayControl materialSelection = this.FOT("materialSelection");
            GuiStackControl materialPreviewPagesStack = this.FOT("materialPreviewPagesStack");
            GuiPopUpMenuCtrlEx materialPreviewCountPopup = this.FOT("materialPreviewCountPopup");

            // manage schedule array properly
            if (!MatEdScheduleArray.isObject())
                MatEdScheduleArray = new ObjectCreator("ArrayObject", "MatEdScheduleArray").Create();

            // if we select another list... delete all schedules that were created by 
            // previous load
            for (int i = 0; i < MatEdScheduleArray.count(); i++)
                Util.cancel(MatEdScheduleArray.getKey(i).AsInt());

            // we have to empty out the list; so when we create new schedules, these dont linger
            MatEdScheduleArray.empty();

            // manage preview array
            if (!MatEdPreviewArray.isObject())
                MatEdPreviewArray = new ObjectCreator("ArrayObject", "MatEdPreviewArray").Create();

            // we have to empty out the list; so when we create new guicontrols, these dont linger
            MatEdPreviewArray.empty();
            materialSelection.deleteAllObjects();
            materialPreviewPagesStack.deleteAllObjects();

            // changed to accomadate tagging. dig through the array for each tag name,
            // call unique value, sort, and we have a perfect set of materials
            if (staticFilter != "")
                this.currentStaticFilter = staticFilter;

            this.currentFilter = selectedFilter;

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

            int previewsPerPage = materialPreviewCountPopup.getTextById(materialPreviewCountPopup.getSelected()).AsInt();

            int tagCount = Util.getWordCount(this.currentFilter);
            if (tagCount != 0)
                {
                for (int j = 0; j < tagCount; j++)
                    {
                    for (int i = 0; i < this.currentStaticFilter.count(); i++)
                        {
                        string currentTag = Util.getWord(this.currentFilter, j);
                        if (this.currentStaticFilter.getKey(i) == currentTag)
                            filteredObjectsArray.add(this.currentStaticFilter.getKey(i), this.currentStaticFilter.getValue(i));
                        }
                    }

                filteredObjectsArray.uniqueValue();
                filteredObjectsArray.sortd();

                this.totalPages = Util.mCeil(filteredObjectsArray.count()/previewsPerPage);

                //Can we maintain the current preview page, or should we go to page 1?
                if ((this.currentPreviewPage*previewsPerPage) >= filteredObjectsArray.count())
                    this.currentPreviewPage = 0;

                // Build out the pages buttons
                this.buildPagesButtons(this.currentPreviewPage, this.totalPages);

                int previewCount = previewsPerPage;
                int possiblePreviewCount = filteredObjectsArray.count() - this.currentPreviewPage*previewsPerPage;
                if (possiblePreviewCount < previewCount)
                    previewCount = possiblePreviewCount;

                int start = this.currentPreviewPage*previewsPerPage;
                for (int i = start; i < start + previewCount; i++)
                    this.buildPreviewArray(filteredObjectsArray.getValue(i));

                filteredObjectsArray.delete();
                }
            else
                {
                this.currentStaticFilter.sortd();

                // Rebuild the static filter list without tagged materials
                ArrayObject noTagArray = new ObjectCreator("ArrayObject").Create();
                for (int i = 0; i < this.currentStaticFilter.count(); i++)
                    {
                    if (this.currentStaticFilter.getKey(i) != "")
                        continue;

                    SimObject material = this.currentStaticFilter.getValue(i);

                    // CustomMaterials are not available for selection
                    if (!material.isObject() || material.isMemberOfClass("CustomMaterial"))
                        continue;

                    noTagArray.add("", material);
                    }

                this.totalPages = Util.mCeil(noTagArray.count()/previewsPerPage);

                //Can we maintain the current preview page, or should we go to page 1?
                if ((this.currentPreviewPage*previewsPerPage) >= noTagArray.count())
                    this.currentPreviewPage = 0;

                // Build out the pages buttons
                this.buildPagesButtons(this.currentPreviewPage, this.totalPages);

                int previewCount = previewsPerPage;
                int possiblePreviewCount = noTagArray.count() - this.currentPreviewPage*previewsPerPage;
                if (possiblePreviewCount < previewCount)
                    previewCount = possiblePreviewCount;

                int start = this.currentPreviewPage*previewsPerPage;
                for (int i = start; i < start + previewCount; i++)
                    this.buildPreviewArray(noTagArray.getValue(i));
                }

            this.loadImages(0);
        }
コード例 #3
0
        public void buildStaticFilters()
        {
            TerrainEditor ETerrainEditor = "ETerrainEditor";
            SimSet materialSet = "materialSet";
            SimSet TerrainMaterialSet = "TerrainMaterialSet";
            ArrayObject UnlistedMaterials = "UnlistedMaterials";
            GuiCheckBoxCtrl MaterialFilterAllArrayCheckbox = "MaterialFilterAllArrayCheckbox";
            GuiCheckBoxCtrl MaterialFilterMappedArrayCheckbox = "MaterialFilterMappedArrayCheckbox";
            GuiCheckBoxCtrl MaterialFilterUnmappedArrayCheckbox = "MaterialFilterUnmappedArrayCheckbox";

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

            // if you want to add any more containers to staticFilterObjects, here's
            // where to do it

            //TODO

            #region GuiControl  ()        oc_Newobject58

            ObjectCreator oc_Newobject58 = new ObjectCreator("GuiControl ", "");

            #region GuiContainer ()        oc_Newobject46

            ObjectCreator oc_Newobject46 = new ObjectCreator("GuiContainer", "");
            oc_Newobject46["profile"] = "ToolsGuiDefaultProfile";
            oc_Newobject46["Position"] = "0 0";
            oc_Newobject46["Extent"] = "128 18";
            oc_Newobject46["HorizSizing"] = "right";
            oc_Newobject46["VertSizing"] = "bottom";
            oc_Newobject46["isContainer"] = "1";
            oc_Newobject46["parentGroup"] = new Creator.StringNoQuote("%filter");

            #region GuiContainer ()        oc_Newobject44

            ObjectCreator oc_Newobject44 = new ObjectCreator("GuiContainer", "");
            oc_Newobject44["profile"] = "inspectorStyleRolloutDarkProfile";
            oc_Newobject44["Position"] = "-1 0";
            oc_Newobject44["Extent"] = "128 32";
            oc_Newobject44["HorizSizing"] = "right";
            oc_Newobject44["VertSizing"] = "bottom";
            oc_Newobject44["isContainer"] = "1";

            #endregion

            oc_Newobject46["#Newobject44"] = oc_Newobject44;

            #region GuiTextCtrl ()        oc_Newobject45

            ObjectCreator oc_Newobject45 = new ObjectCreator("GuiTextCtrl", "");
            oc_Newobject45["Profile"] = "EditorTextProfile";
            oc_Newobject45["position"] = "5 0";
            oc_Newobject45["Extent"] = "118 18";
            oc_Newobject45["text"] = "Types";

            #endregion

            oc_Newobject46["#Newobject45"] = oc_Newobject45;

            #endregion

            oc_Newobject58["#Newobject46"] = oc_Newobject46;

            #region GuiContainer ()        oc_Newobject48

            ObjectCreator oc_Newobject48 = new ObjectCreator("GuiContainer", "");
            oc_Newobject48["profile"] = "ToolsGuiDefaultProfile";
            oc_Newobject48["Position"] = "415 191";
            oc_Newobject48["Extent"] = "128 18";
            oc_Newobject48["HorizSizing"] = "right";
            oc_Newobject48["VertSizing"] = "bottom";
            oc_Newobject48["isContainer"] = "1";
            oc_Newobject48["parentGroup"] = new Creator.StringNoQuote("%filter");

            #region GuiCheckBoxCtrl (MaterialFilterAllArrayCheckbox)        oc_Newobject47

            ObjectCreator oc_Newobject47 = new ObjectCreator("GuiCheckBoxCtrl", "MaterialFilterAllArrayCheckbox");
            oc_Newobject47["Profile"] = "ToolsGuiCheckBoxListProfile";
            oc_Newobject47["position"] = "5 2";
            oc_Newobject47["Extent"] = "118 18";
            oc_Newobject47["text"] = "All";
            oc_Newobject47["Command"] = "MaterialSelector.switchStaticFilters(\\\"MaterialFilterAllArray\\\");";

            #endregion

            oc_Newobject48["#Newobject47"] = oc_Newobject47;

            #endregion

            oc_Newobject58["#Newobject48"] = oc_Newobject48;

            #region GuiContainer ()        oc_Newobject50

            ObjectCreator oc_Newobject50 = new ObjectCreator("GuiContainer", "");
            oc_Newobject50["profile"] = "ToolsGuiDefaultProfile";
            oc_Newobject50["Position"] = "415 191";
            oc_Newobject50["Extent"] = "128 18";
            oc_Newobject50["HorizSizing"] = "right";
            oc_Newobject50["VertSizing"] = "bottom";
            oc_Newobject50["isContainer"] = "1";
            oc_Newobject50["parentGroup"] = new Creator.StringNoQuote("%filter");

            #region GuiCheckBoxCtrl (MaterialFilterMappedArrayCheckbox)        oc_Newobject49

            ObjectCreator oc_Newobject49 = new ObjectCreator("GuiCheckBoxCtrl", "MaterialFilterMappedArrayCheckbox");
            oc_Newobject49["Profile"] = "ToolsGuiCheckBoxListProfile";
            oc_Newobject49["position"] = "5 2";
            oc_Newobject49["Extent"] = "118 18";
            oc_Newobject49["text"] = "Mapped";
            oc_Newobject49["Command"] = "MaterialSelector.switchStaticFilters(\\\"MaterialFilterMappedArray\\\");";

            #endregion

            oc_Newobject50["#Newobject49"] = oc_Newobject49;

            #endregion

            oc_Newobject58["#Newobject50"] = oc_Newobject50;

            #region GuiContainer ()        oc_Newobject52

            ObjectCreator oc_Newobject52 = new ObjectCreator("GuiContainer", "");
            oc_Newobject52["profile"] = "ToolsGuiDefaultProfile";
            oc_Newobject52["Position"] = "415 191";
            oc_Newobject52["Extent"] = "128 18";
            oc_Newobject52["HorizSizing"] = "right";
            oc_Newobject52["VertSizing"] = "bottom";
            oc_Newobject52["isContainer"] = "1";
            oc_Newobject52["parentGroup"] = new Creator.StringNoQuote("%filter");

            #region GuiCheckBoxCtrl (MaterialFilterUnmappedArrayCheckbox)        oc_Newobject51

            ObjectCreator oc_Newobject51 = new ObjectCreator("GuiCheckBoxCtrl", "MaterialFilterUnmappedArrayCheckbox");
            oc_Newobject51["Profile"] = "ToolsGuiCheckBoxListProfile";
            oc_Newobject51["position"] = "5 2";
            oc_Newobject51["Extent"] = "118 18";
            oc_Newobject51["text"] = "Unmapped";
            oc_Newobject51["Command"] = "MaterialSelector.switchStaticFilters(\\\"MaterialFilterUnmappedArray\\\");";

            #endregion

            oc_Newobject52["#Newobject51"] = oc_Newobject51;

            #endregion

            oc_Newobject58["#Newobject52"] = oc_Newobject52;

            #region GuiContainer ()        oc_Newobject57

            ObjectCreator oc_Newobject57 = new ObjectCreator("GuiContainer", "");
            oc_Newobject57["profile"] = "ToolsGuiDefaultProfile";
            oc_Newobject57["Position"] = "0 0";
            oc_Newobject57["Extent"] = "128 18";
            oc_Newobject57["HorizSizing"] = "right";
            oc_Newobject57["VertSizing"] = "bottom";
            oc_Newobject57["isContainer"] = "1";
            oc_Newobject57["parentGroup"] = new Creator.StringNoQuote("%filter");

            #region GuiContainer ()        oc_Newobject53

            ObjectCreator oc_Newobject53 = new ObjectCreator("GuiContainer", "");
            oc_Newobject53["profile"] = "inspectorStyleRolloutDarkProfile";
            oc_Newobject53["Position"] = "-1 0";
            oc_Newobject53["Extent"] = "128 32";
            oc_Newobject53["HorizSizing"] = "right";
            oc_Newobject53["VertSizing"] = "bottom";
            oc_Newobject53["isContainer"] = "1";

            #endregion

            oc_Newobject57["#Newobject53"] = oc_Newobject53;

            #region GuiTextCtrl ()        oc_Newobject54

            ObjectCreator oc_Newobject54 = new ObjectCreator("GuiTextCtrl", "");
            oc_Newobject54["Profile"] = "EditorTextProfile";
            oc_Newobject54["position"] = "5 0";
            oc_Newobject54["Extent"] = "118 18";
            oc_Newobject54["text"] = "Tags";

            #endregion

            oc_Newobject57["#Newobject54"] = oc_Newobject54;

            #region GuiBitmapButtonCtrl ()        oc_Newobject55

            ObjectCreator oc_Newobject55 = new ObjectCreator("GuiBitmapButtonCtrl", "");
            oc_Newobject55["canSaveDynamicFields"] = "0";
            oc_Newobject55["Enabled"] = "1";
            oc_Newobject55["isContainer"] = "0";
            oc_Newobject55["Profile"] = "ToolsGuiDefaultProfile";
            oc_Newobject55["HorizSizing"] = "left";
            oc_Newobject55["VertSizing"] = "bottom";
            oc_Newobject55["position"] = "105 2";
            oc_Newobject55["Extent"] = "15 15";
            oc_Newobject55["MinExtent"] = "8 2";
            oc_Newobject55["canSave"] = "1";
            oc_Newobject55["Visible"] = "1";
            oc_Newobject55["Command"] = "MaterialSelector_addFilterWindow.setVisible(1); MaterialSelectorOverlay.pushToBack(MaterialSelector_addFilterWindow);";
            oc_Newobject55["hovertime"] = "1000";
            oc_Newobject55["tooltip"] = "Create New Tag";
            oc_Newobject55["bitmap"] = "tools/gui/images/new";
            oc_Newobject55["groupNum"] = "-1";
            oc_Newobject55["buttonType"] = "PushButton";
            oc_Newobject55["useMouseEvents"] = "0";

            #endregion

            oc_Newobject57["#Newobject55"] = oc_Newobject55;

            #region GuiBitmapButtonCtrl ()        oc_Newobject56

            ObjectCreator oc_Newobject56 = new ObjectCreator("GuiBitmapButtonCtrl", "");
            oc_Newobject56["canSaveDynamicFields"] = "0";
            oc_Newobject56["Enabled"] = "1";
            oc_Newobject56["isContainer"] = "0";
            oc_Newobject56["Profile"] = "ToolsGuiDefaultProfile";
            oc_Newobject56["HorizSizing"] = "left";
            oc_Newobject56["VertSizing"] = "bottom";
            oc_Newobject56["position"] = "89 2";
            oc_Newobject56["Extent"] = "13 13";
            oc_Newobject56["MinExtent"] = "8 2";
            oc_Newobject56["canSave"] = "1";
            oc_Newobject56["Visible"] = "1";
            oc_Newobject56["Command"] = "MaterialSelector.clearMaterialFilters();";
            oc_Newobject56["hovertime"] = "1000";
            oc_Newobject56["tooltip"] = "Clear Selected Tag";
            oc_Newobject56["bitmap"] = "tools/gui/images/clear-btn";
            oc_Newobject56["groupNum"] = "-1";
            oc_Newobject56["buttonType"] = "PushButton";
            oc_Newobject56["useMouseEvents"] = "0";

            #endregion

            oc_Newobject57["#Newobject56"] = oc_Newobject56;

            #endregion

            oc_Newobject58["#Newobject57"] = oc_Newobject57;

            #endregion

            GuiControl staticFilterContainer = oc_Newobject58.Create();

            int filterCount = staticFilterContainer.getCount();
            for (; filterCount != 0; filterCount--)
                filterArray.addGuiControl(staticFilterContainer.getObject(0));

            this.staticFilterObjects = filterArray.getCount();

            staticFilterContainer.delete();

            // Create our category array used in the selector, this code should be taken out
            // in order to make the material selector agnostic
            ArrayObject MaterialFilterAllArray = new ObjectCreator("ArrayObject", "MaterialFilterAllArray").Create();
            ArrayObject MaterialFilterMappedArray = new ObjectCreator("ArrayObject", "MaterialFilterMappedArray").Create();
            ArrayObject MaterialFilterUnmappedArray = new ObjectCreator("ArrayObject", "MaterialFilterUnmappedArray").Create();

            string mats = "";
            int count = 0;
            if (this.terrainMaterials)
                {
                mats = ETerrainEditor.getTerrainBlocksMaterialList();
                count = Util.getRecordCount(mats);
                }
            else
                count = materialSet.getCount();

            for (uint i = 0; i < count; i++)
                {
                Material material;
                // Process terrain materials
                if (this.terrainMaterials)
                    {
                    string matInternalName = Util.getRecord(mats, (int) i);
                    material = TerrainMaterialSet.findObjectByInternalName(matInternalName, false);

                    // Is there no material info for this slot?
                    if (!material.isObject())
                        continue;

                    // Add to the appropriate filters
                    MaterialFilterMappedArray.add("", material);
                    MaterialFilterAllArray.add("", material);

                    continue;
                    }

                // Process regular materials here
                material = materialSet.getObject(i);

                bool unlistedFound = false;
                for (int k = 0; k < UnlistedMaterials.count(); k++)
                    {
                    unlistedFound = false;
                    if (UnlistedMaterials.getValue(k) == material.name)
                        {
                        unlistedFound = true;
                        break;
                        }
                    }

                if (unlistedFound)
                    continue;

                if (material.mapTo == "" || material.mapTo == "unmapped_mat")
                    {
                    MaterialFilterUnmappedArray.add("", material.name);
                    //running through the existing tag names
                    for (int j = 0; material.getFieldValue("materialTag" + j, -1) != ""; j++)
                        MaterialFilterUnmappedArray.add(material.getFieldValue("materialTag" + j, -1), material.name);
                    }
                else
                    {
                    MaterialFilterMappedArray.add("", material.name);
                    for (int j = 0; material.getFieldValue("materialTag" + j, -1) != ""; j++)
                        MaterialFilterMappedArray.add(material.getFieldValue("materialTag" + j, -1), material.name);
                    }

                MaterialFilterAllArray.add("", material.name);
                for (int j = 0; material.getFieldValue("materialTag" + j, -1) != ""; j++)
                    MaterialFilterAllArray.add(material.getFieldValue("materialTag" + j, -1), material.name);
                }

            MaterialFilterAllArrayCheckbox.setText("All ( " + MaterialFilterAllArray.count() + " ) ");
            MaterialFilterMappedArrayCheckbox.setText("Mapped ( " + MaterialFilterMappedArray.count() + " ) ");
            MaterialFilterUnmappedArrayCheckbox.setText("Unmapped ( " + MaterialFilterUnmappedArray.count() + " ) ");
        }
コード例 #4
0
        public virtual void initClassList()
        {
            ArrayObject classArray = new ObjectCreator("ArrayObject").Create();
            this["classArray"] = classArray;

            // Add all classes to the array.

            string classes = Util._call("enumerateConsoleClasses");
            foreach (string className in classes.Split('\t'))
                {
                if (!includeClass(className))
                    continue;

                classArray.push_back(className, "true");
                }
            // Sort the class list.
            classArray.sortk(true);

            // Add checkboxes for all classes to the list.

            GuiStackControl classList = findObjectByInternalName("classList", true);
            int count = classArray.count();
            for (int i = 0; i < count; i++)
                {
                string className = classArray.getKey(i);
                int textLength = className.Length;
                string text = " " + className;

                ObjectCreator oc = new ObjectCreator("GuiCheckBoxCtrl");
                oc["canSaveDynamicFields"] = "0";
                oc["isContainer"] = "0";
                oc["Profile"] = "ToolsGuiCheckBoxListFlipedProfile";
                oc["HorizSizing"] = "right";
                oc["VertSizing"] = "bottom";
                oc["Position"] = "0 0";
                oc["Extent"] = (textLength*4) + " 18";
                oc["MinExtent"] = "8 2";
                oc["canSave"] = "0";
                oc["Visible"] = "1";
                oc["tooltipprofile"] = "ToolsGuiToolTipProfile";
                oc["hovertime"] = "1000";
                oc["tooltip"] = "Include/exclude all " + className + " objects.";
                oc["text"] = text;
                oc["groupNum"] = "-1";
                oc["buttonType"] = "ToggleButton";
                oc["useMouseEvents"] = "0";
                oc["useInactiveState"] = "0";
                oc["command"] = classArray + ".setValue( $ThisControl.getValue(), " + i + " );";

                GuiCheckBoxCtrl checkBox = oc.Create();
                checkBox.setStateOn(true);
                classList.addGuiControl(checkBox);
                }
        }
コード例 #5
0
ファイル: audio.cs プロジェクト: souxiaosou/OmniEngine.Net
        public static bool sfxAutodetect()
        {
            // Get all the available devices.
            string devices = omni.Util.sfxGetAvailableDevices();
            // Collect and sort the devices by preferentiality.

            int count = omni.Util.getRecordCount(devices);

            ArrayObject deviceTrySequence = new ObjectCreator("ArrayObject").Create().AsString();

            for (int i = 0; i < count; i++)
                {
                string info = omni.Util.getRecord(devices, i);
                string provider = omni.Util.getField(info, 0);
                deviceTrySequence.push_back(provider, info);
                }
            deviceTrySequence.sortfk("sfxCompareProvider");
            // Try the devices in order.

            count = deviceTrySequence.count();
            for (int i = 0; i < count; i++)
                {
                string provider = deviceTrySequence.getKey(i);
                string info = deviceTrySequence.getValue(i);
                omni.sGlobal["$pref::SFX::provider"] = provider;
                omni.sGlobal["$pref::SFX::device"] = omni.Util.getField(info, 1);
                omni.sGlobal["$pref::SFX::useHardware"] = omni.Util.getField(info, 2);
                // By default we've decided to avoid hardware devices as
                // they are buggy and prone to problems.
                omni.bGlobal["$pref::SFX::useHardware"] = false;
                if (!sfxInit())
                    continue;
                omni.bGlobal["$pref::SFX::autoDetect"] = false;
                deviceTrySequence.delete();
                return true;
                }
            // Found no suitable device.
            omni.console.error("sfxAutodetect - Could not initialize a valid SFX device.");
            omni.sGlobal["$pref::SFX::provider"] = "";
            omni.sGlobal["$pref::SFX::device"] = "";
            omni.sGlobal["$pref::SFX::useHardware"] = "";
            deviceTrySequence.delete();
            return false;
        }
コード例 #6
0
        public void setViewTypeAlphabetical()
        {
            GuiEditorGui.GuiEditor GuiEditor = "GuiEditor";
            string controls = Util.enumerateConsoleClassesByCategory("Gui");
            ArrayObject classes = new ObjectCreator("ArrayObject").Create();

            // Collect relevant classes.

            foreach (string className in controls.Split('\t'))
                {
                if (GuiEditor.isFilteredClass(className) || !(Util.isMemberOfClass(className, "GuiControl")))
                    continue;

                classes.push_back(className, "");
                }

            // Sort classes alphabetically.

            classes.sortk(true);

            // Add toolbox buttons.

            int numClasses = classes.count();
            for (int i = 0; i < numClasses; i ++)
                {
                string className = classes.getKey(i);

                #region GuiIconButtonCtrl ()        oc_Newobject2

                ObjectCreator oc_Newobject2 = new ObjectCreator("GuiIconButtonCtrl", "", typeof (GuiEditorToolboxButton));
                oc_Newobject2["profile"] = "ToolsGuiIconButtonSmallProfile";
                oc_Newobject2["extent"] = "128 18";
                oc_Newobject2["text"] = className;
                oc_Newobject2["iconBitmap"] = console.Call_Classname("EditorIconRegistry", "findIconByClassName", new string[] {className});
                oc_Newobject2["buttonMargin"] = "2 2";
                oc_Newobject2["iconLocation"] = "left";
                oc_Newobject2["textLocation"] = "left";
                oc_Newobject2["textMargin"] = "24";
                oc_Newobject2["AutoSize"] = new Creator.StringNoQuote("true");
                oc_Newobject2["command"] = "GuiEditor.createControl( " + className + " );";
                oc_Newobject2["useMouseEvents"] = new Creator.StringNoQuote("true");
                oc_Newobject2["tooltip"] = className + '\n' + "\n" + Util.getDescriptionOfClass(className);
                oc_Newobject2["tooltipProfile"] = "ToolsGuiToolTipProfile";

                #endregion

                GuiIconButtonCtrl ctrl = oc_Newobject2.Create();

                this.add(ctrl);
                }

            classes.delete();
            this.currentViewType = "Alphabetical";
        }