Example #1
0
        public List <PropDesc> get_props_descs(PropType prop_type, string group = "")
        {
            List <PropDesc> descs  = new List <PropDesc>();
            string          result = "";
            string          args   = "";

            switch (prop_type)
            {
            case PropType.Options:
                args   = "options," + group;
                result = PyUtils.ExectueObjMethod(this.ID, "get_props_descs", args);
                break;

            case PropType.ToneMapping:
                args   = "tone," + group;
                result = PyUtils.ExectueObjMethod(this.ID, "get_props_descs", args);
                break;

            default:
                result = "";
                break;
            }

            string[] words = result.Split(',');
            for (int i = 0; i < words.Length; i = i + 2)
            {
                descs.Add(new PropDesc(words[i], words[i + 1]));
            }
            return(descs);
        }
Example #2
0
        public bool render()
        {
            string ret = PyUtils.ExectueObjMethod(this.ID, "render", "");

            if (ret == "True")
            {
                return(true);
            }
            else if (ret == "False")
            {
                return(false);
            }
            else
            {
                throw new Exception("True or False is expeted to be returned from render function!");
            }
        }
Example #3
0
        public BitmapSource output_image()
        {
            // NOTE bgra format is expected
            // "width, height, pixels, pitch"
            string ret = PyUtils.ExectueObjMethod(this.ID, "output_image", "");

            string[] tokens = ret.Split(',');
            int      width  = int.Parse(tokens[0]);
            int      height = int.Parse(tokens[1]);
            int      pitch  = int.Parse(tokens[3]);
            long     adr    = long.Parse(tokens[2]);
            IntPtr   pixels = new IntPtr(adr);

            PixelFormat  pixformat = PixelFormats.Bgra32;
            BitmapSource image     = BitmapSource.Create(width, height, 96, 96, pixformat,
                                                         null, pixels, height * pitch, pitch);

            return(image);
        }
Example #4
0
 public void save_project(string filename)
 {
     // TODO check if file exists or null raise exception
     PyUtils.ExectueObjMethod(this.ID, "save_project", filename);
 }
Example #5
0
 public void import_scene(string filename)
 {
     // TODO check if file exists or null raise exception
     PyUtils.ExectueObjMethod(this.ID, "parse_scene_file", filename);
 }