예제 #1
0
        public override void Execute(List <string> arguments, Models model)
        {
            var reader   = new ParameterReader(arguments);
            var color    = reader.ReadString("image equation");
            var hasAlpha = reader.HasMoreArgs();
            var alpha    = reader.ReadString("alpha equation", "");

            reader.ExpectNoMoreArgs();

            model.Pipelines[0].Color.Formula = color;
            if (hasAlpha)
            {
                model.Pipelines[0].Alpha.Formula = alpha;
            }
        }
        public override void Execute(List <string> arguments, Models model)
        {
            var reader = new ParameterReader(arguments);
            var idx    = reader.ReadInt("index");
            var name   = reader.ReadString("param name");

            foreach (var fp in model.Filter.Filter[idx].Parameters)
            {
                if (fp.GetBase().Name == name)
                {
                    switch (fp.GetParamterType())
                    {
                    case ParameterType.Float:
                        fp.GetFloatModel().Value = reader.ReadInt("value");
                        break;

                    case ParameterType.Int:
                        fp.GetIntModel().Value = reader.ReadInt("value");
                        break;

                    case ParameterType.Bool:
                        fp.GetBoolModel().Value = reader.ReadBool("value");
                        break;
                    }
                    reader.ExpectNoMoreArgs();
                    return;
                }
            }

            foreach (var tp in model.Filter.Filter[idx].TextureParameters)
            {
                if (tp.Name == name)
                {
                    tp.Source = reader.ReadInt("value");
                    reader.ExpectNoMoreArgs();
                    return;
                }
            }

            throw new Exception($"parameter {name} not found");
        }
예제 #3
0
        public override void Execute(List <string> arguments, Models model)
        {
            var reader   = new ParameterReader(arguments);
            var filename = reader.ReadString("filename");
            var format   = reader.ReadEnum <GliFormat>("gliFormat");

            reader.ExpectNoMoreArgs();

            // split filename
            var splitIdx = filename.LastIndexOf('.');

            if (splitIdx < 0)
            {
                throw new Exception($"{filename} missing file extension");
            }

            var leftFile  = filename.Substring(0, splitIdx);
            var rightFile = filename.Substring(splitIdx + 1);

            model.ExportPipelineImage(leftFile, rightFile, format);
        }
예제 #4
0
        public override void Execute(List <string> arguments, Models model)
        {
            var reader   = new ParameterReader(arguments);
            var filename = reader.ReadString("filename");
            var format   = reader.ReadEnum <GliFormat>("gliFormat");

            reader.ExpectNoMoreArgs();

            // split filename
            var splitIdx = filename.LastIndexOf('.');

            if (splitIdx < 0)
            {
                throw new Exception($"{filename} missing file extension");
            }

            var leftFile  = filename.Substring(0, splitIdx);
            var rightFile = filename.Substring(splitIdx + 1);

            if (!model.Pipelines[0].IsValid)
            {
                throw new Exception("image formula is invalid.");
            }

            // apply changes before exporting
            model.Apply();
            var desc = new ExportDescription(model.Pipelines[0].Image, leftFile, rightFile)
            {
                FileFormat  = format,
                UseCropping = UseCropping,
                CropStart   = CropStart,
                CropEnd     = CropEnd,
                Quality     = Quality,
                Layer       = Layer,
                Mipmap      = Mipmap
            };

            model.Export.Export(desc);
        }
예제 #5
0
        public override void Execute(List <string> arguments, Models model)
        {
            var reader = new ParameterReader(arguments);
            var ext    = reader.ReadString("file extension");

            reader.ExpectNoMoreArgs();

            foreach (var exportFormatModel in model.Export.Formats)
            {
                if (exportFormatModel.Extension == ext)
                {
                    foreach (var gliFormat in exportFormatModel.Formats)
                    {
                        Console.Out.WriteLine(gliFormat.ToString());
                    }

                    Console.Out.WriteLine(); // signal params end
                    return;
                }
            }

            throw new Exception("could not find extension " + ext);
        }