Пример #1
0
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            var getNumber = new GetInteger();

            getNumber.SetLowerLimit(0, false);
            getNumber.SetUpperLimit(500, false);
            getNumber.SetDefaultInteger(RcCore.It.EngineSettings.ThrottleMs);
            getNumber.SetCommandPrompt("Set throttle (in ms)");

            var toggleVerbose = new OptionToggle(RcCore.It.EngineSettings.Verbose, "No", "Yes");

            var spotlightFactor  = new OptionDouble(RcCore.It.EngineSettings.SpotlightFactor, 0.0, 1000000.0);
            var pointlightFactor = new OptionDouble(RcCore.It.EngineSettings.PointlightFactor, 0.0, 1000000.0);
            var sunlightFactor   = new OptionDouble(RcCore.It.EngineSettings.SunlightFactor, 0.0, 1000000.0);
            var arealightFactor  = new OptionDouble(RcCore.It.EngineSettings.ArealightFactor, 0.0, 1000000.0);
            var polishFactor     = new OptionDouble(RcCore.It.EngineSettings.PolishFactor, 0.0, 1000000.0);

            getNumber.AddOptionToggle("verbose", ref toggleVerbose);

            getNumber.AddOptionDouble("spotlight_factor", ref spotlightFactor);
            getNumber.AddOptionDouble("pointlight_factor", ref pointlightFactor);
            getNumber.AddOptionDouble("sunlight_factor", ref sunlightFactor);
            getNumber.AddOptionDouble("arealight_factor", ref arealightFactor);
            getNumber.AddOptionDouble("polish_factor", ref polishFactor);


            while (true)
            {
                var getRc = getNumber.Get();
                if (getNumber.CommandResult() != Result.Success)
                {
                    return(getNumber.CommandResult());
                }
                switch (getRc)
                {
                case GetResult.Nothing:
                case GetResult.Number:
                    RcCore.It.EngineSettings.ThrottleMs = getNumber.Number();
                    ReadOptions(toggleVerbose, spotlightFactor, pointlightFactor, sunlightFactor, arealightFactor, polishFactor);
                    break;

                case GetResult.Option:
                    ReadOptions(toggleVerbose, spotlightFactor, pointlightFactor, sunlightFactor, arealightFactor, polishFactor);
                    continue;

                default:
                    continue;
                }

                break;
            }
            return(Result.Success);
        }