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();
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
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);
                }
        }
        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";
        }