示例#1
0
        internal static dynamic convertFromValue(FScheme.Value exp, ObjectOperations invoker)
        {
            if (exp.IsList)
            {
                return(((FScheme.Value.List)exp).Item.Select(x => convertFromValue(x, invoker)).ToList());
            }
            else if (exp.IsNumber)
            {
                return(((FScheme.Value.Number)exp).Item);
            }
            else if (exp.IsString)
            {
                return(((FScheme.Value.String)exp).Item);
            }
            else if (exp.IsContainer)
            {
                return(((FScheme.Value.Container)exp).Item);
            }
            else if (exp.IsFunction)
            {
                var func = ((FScheme.Value.Function)exp).Item;

                PyWrapper wrapped =
                    args =>
                    convertFromValue(
                        func.Invoke(args.Select(a => convertToValue(a, invoker) as FScheme.Value).ToFSharpList()), invoker);

                return(wrapped);
            }
            else
            {
                throw new Exception("Not allowed to pass Functions into a Python Script.");
            }
        }
示例#2
0
        public void build_editor(PyWrapper.PropType type)
        {
            List<PyWrapper.PropDesc> descs = this.renmas.get_props_descs(type);

            // 1. renmas.get_props(Type, active_light or active_material)
            // 2.

            //active light  -- group
            //active material  -- group

            // list_of_props_descriptors = this.renmas.get_props(prop_type, group)
            // prop_desc {prop_type, name}

            // IntProperty(this.renmas.ID, name, prop_type, group)
        }
示例#3
0
文件: Utils.cs 项目: mario007/renmas
 public static UserControl build_editor(PyWrapper.RenmasProperty property)
 {
     Type t = property.GetType();
     if (t == typeof(PyWrapper.IntProperty))
     {
         IntEditor ed = new IntEditor();
         ed.set_target((PyWrapper.IntProperty)property);
         return ed;
     }
     else if (t == typeof(PyWrapper.FloatProperty))
     {
         FloatEditor ed = new FloatEditor();
         ed.set_target((PyWrapper.FloatProperty)property);
         return ed;
     }
     else
     {
         //TODO -- better message
         string msg = "Unknown type";
         throw new Exception(msg);
     }
 }
示例#4
0
 public Options(PyWrapper.Renmas renmas)
 {
     InitializeComponent();
     this.renmas = renmas;
     build_widgets();
 }
示例#5
0
 public void set_target(PyWrapper.IntProperty target)
 {
     this.target = target;
     build_widgets();
 }
示例#6
0
 public ToneMappingEditor(PyWrapper.Renmas renmas)
 {
     InitializeComponent();
     this.renmas = renmas;
     build_widgets();
 }