static public int constructor(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.ProceduralPropertyDescription o;
         o = new UnityEngine.ProceduralPropertyDescription();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 static public int constructor(IntPtr l)
 {
     UnityEngine.ProceduralPropertyDescription o;
     o = new UnityEngine.ProceduralPropertyDescription();
     pushObject(l, o);
     return(1);
 }
 static public int set_name(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.ProceduralPropertyDescription self = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
         System.String v;
         checkType(l, 2, out v);
         self.name = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 static void ProceduralPropertyDescription_componentLabels(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ProceduralPropertyDescription _this = (UnityEngine.ProceduralPropertyDescription)vc.csObj;
         var result = _this.componentLabels;
         var arrRet = result;
         for (int i = 0; arrRet != null && i < arrRet.Length; i++)
         {
             JSApi.setStringS((int)JSApi.SetType.SaveAndTempTrace, arrRet[i]);
             JSApi.moveSaveID2Arr(i);
         }
         JSApi.setArrayS((int)JSApi.SetType.Rval, (arrRet != null ? arrRet.Length : 0), true);
     }
     else
     {
         System.String[] arg0 = JSDataExchangeMgr.GetJSArg <System.String[]>(() =>
         {
             int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg);
             int length  = JSApi.getArrayLength(jsObjID);
             var ret     = new System.String[length];
             for (var i = 0; i < length; i++)
             {
                 JSApi.getElement(jsObjID, i);
                 ret[i] = (System.String)JSApi.getStringS((int)JSApi.GetType.SaveAndRemove);
             }
             return(ret);
         });
         UnityEngine.ProceduralPropertyDescription _this = (UnityEngine.ProceduralPropertyDescription)vc.csObj;
         _this.componentLabels = arg0;
     }
 }
 static public int set_hasRange(IntPtr l)
 {
     UnityEngine.ProceduralPropertyDescription o = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
     System.Boolean v;
     checkType(l, 2, out v);
     o.hasRange = v;
     return(0);
 }
 static public int set_type(IntPtr l)
 {
     UnityEngine.ProceduralPropertyDescription o = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
     UnityEngine.ProceduralPropertyType        v;
     checkEnum(l, 2, out v);
     o.type = v;
     return(0);
 }
 static public int set_group(IntPtr l)
 {
     UnityEngine.ProceduralPropertyDescription o = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
     System.String v;
     checkType(l, 2, out v);
     o.group = v;
     return(0);
 }
 static public int set_componentLabels(IntPtr l)
 {
     UnityEngine.ProceduralPropertyDescription o = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
     System.String[] v;
     checkType(l, 2, out v);
     o.componentLabels = v;
     return(0);
 }
 static public int set_maximum(IntPtr l)
 {
     UnityEngine.ProceduralPropertyDescription o = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
     System.Single v;
     checkType(l, 2, out v);
     o.maximum = v;
     return(0);
 }
 public MaterialPropertyDescriptor(object target, string label, ProcPropertyDescription procDescription, PropertyInfo propertyInfo, PropertyEditorCallback callback)
 {
     Target = target;
     Label  = label;
     Type   = RTShaderPropertyType.Procedural;
     ProceduralDescription = procDescription;
     PropertyInfo          = propertyInfo;
     ValueChangedCallback  = callback;
 }
 static public int get_group(IntPtr l)
 {
     try {
         UnityEngine.ProceduralPropertyDescription self = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
         pushValue(l, self.group);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int get_type(IntPtr l)
 {
     try {
         UnityEngine.ProceduralPropertyDescription self = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
         pushEnum(l, (int)self.type);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Beispiel #13
0
 static public int get_group(IntPtr l)
 {
     try {
         UnityEngine.ProceduralPropertyDescription self = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.group);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.ProceduralPropertyDescription o;
			o=new UnityEngine.ProceduralPropertyDescription();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.ProceduralPropertyDescription o;
         o = new UnityEngine.ProceduralPropertyDescription();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.ProceduralPropertyDescription o;
         o=new UnityEngine.ProceduralPropertyDescription();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
Beispiel #17
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.ProceduralPropertyDescription o;
         o = new UnityEngine.ProceduralPropertyDescription();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #18
0
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.ProceduralPropertyDescription o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.ProceduralPropertyDescription();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
 static public int set_type(IntPtr l)
 {
     try {
         UnityEngine.ProceduralPropertyDescription self = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
         UnityEngine.ProceduralPropertyType        v;
         checkEnum(l, 2, out v);
         self.type = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int set_group(IntPtr l)
 {
     try {
         UnityEngine.ProceduralPropertyDescription self = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
         System.String v;
         checkType(l, 2, out v);
         self.group = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Beispiel #21
0
 static public int set_type(IntPtr l)
 {
     try {
         UnityEngine.ProceduralPropertyDescription self = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
         UnityEngine.ProceduralPropertyType        v;
         checkEnum(l, 2, out v);
         self.type = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #22
0
 static public int set_label(IntPtr l)
 {
     try {
         UnityEngine.ProceduralPropertyDescription self = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
         System.String v;
         checkType(l, 2, out v);
         self.label = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #23
0
 static public int set_componentLabels(IntPtr l)
 {
     try {
         UnityEngine.ProceduralPropertyDescription self = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
         System.String[] v;
         checkArray(l, 2, out v);
         self.componentLabels = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static void ProceduralPropertyDescription_type(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ProceduralPropertyDescription _this = (UnityEngine.ProceduralPropertyDescription)vc.csObj;
         var result = _this.type;
         JSApi.setEnum((int)JSApi.SetType.Rval, (int)result);
     }
     else
     {
         UnityEngine.ProceduralPropertyType        arg0  = (UnityEngine.ProceduralPropertyType)JSApi.getEnum((int)JSApi.GetType.Arg);
         UnityEngine.ProceduralPropertyDescription _this = (UnityEngine.ProceduralPropertyDescription)vc.csObj;
         _this.type = arg0;
     }
 }
 static void ProceduralPropertyDescription_step(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ProceduralPropertyDescription _this = (UnityEngine.ProceduralPropertyDescription)vc.csObj;
         var result = _this.step;
         JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
     }
     else
     {
         System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
         UnityEngine.ProceduralPropertyDescription _this = (UnityEngine.ProceduralPropertyDescription)vc.csObj;
         _this.step = arg0;
     }
 }
 static void ProceduralPropertyDescription_hasRange(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ProceduralPropertyDescription _this = (UnityEngine.ProceduralPropertyDescription)vc.csObj;
         var result = _this.hasRange;
         JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
     }
     else
     {
         System.Boolean arg0 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg);
         UnityEngine.ProceduralPropertyDescription _this = (UnityEngine.ProceduralPropertyDescription)vc.csObj;
         _this.hasRange = arg0;
     }
 }
 static void ProceduralPropertyDescription_group(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ProceduralPropertyDescription _this = (UnityEngine.ProceduralPropertyDescription)vc.csObj;
         var result = _this.group;
         JSApi.setStringS((int)JSApi.SetType.Rval, result);
     }
     else
     {
         System.String arg0 = (System.String)JSApi.getStringS((int)JSApi.GetType.Arg);
         UnityEngine.ProceduralPropertyDescription _this = (UnityEngine.ProceduralPropertyDescription)vc.csObj;
         _this.group = arg0;
     }
 }
 private void InputSeedGUI(ProceduralPropertyDescription input)
 {
     Rect controlRect = EditorGUILayout.GetControlRect(new GUILayoutOption[0]);
     EditorGUI.BeginChangeCheck();
     float num = this.RandomIntField(controlRect, this.m_Styles.randomSeedContent, (int) m_Material.GetProceduralFloat(input.name), 0, 0x270f);
     if (EditorGUI.EndChangeCheck())
     {
         this.RecordForUndo(m_Material, m_Importer, "Modified random seed for material " + m_Material.name);
         m_Material.SetProceduralFloat(input.name, num);
     }
 }
 private void InputHSLGUI(ProceduralPropertyDescription hInput, ProceduralPropertyDescription sInput, ProceduralPropertyDescription lInput)
 {
     GUILayout.Space(5f);
     this.m_ShowHSLInputs = EditorPrefs.GetBool("ProceduralShowHSL", true);
     EditorGUI.BeginChangeCheck();
     this.m_ShowHSLInputs = EditorGUILayout.Foldout(this.m_ShowHSLInputs, this.m_Styles.hslContent, true);
     if (EditorGUI.EndChangeCheck())
     {
         EditorPrefs.SetBool("ProceduralShowHSL", this.m_ShowHSLInputs);
     }
     if (this.m_ShowHSLInputs)
     {
         EditorGUI.indentLevel++;
         this.InputGUI(hInput);
         this.InputGUI(sInput);
         this.InputGUI(lInput);
         EditorGUI.indentLevel--;
     }
 }
        private void InputGUI(ProceduralPropertyDescription input)
        {
            float num;
            ProceduralPropertyType type = input.type;
            GUIContent label = new GUIContent(input.label, input.name);
            switch (type)
            {
                case ProceduralPropertyType.Boolean:
                {
                    EditorGUI.BeginChangeCheck();
                    bool flag = EditorGUILayout.Toggle(label, m_Material.GetProceduralBoolean(input.name), new GUILayoutOption[0]);
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.RecordForUndo(m_Material, m_Importer, "Modified property " + input.name + " for material " + m_Material.name);
                        m_Material.SetProceduralBoolean(input.name, flag);
                    }
                    return;
                }
                case ProceduralPropertyType.Float:
                {
                    EditorGUI.BeginChangeCheck();
                    if (!input.hasRange)
                    {
                        num = EditorGUILayout.FloatField(label, m_Material.GetProceduralFloat(input.name), new GUILayoutOption[0]);
                        break;
                    }
                    float minimum = input.minimum;
                    float maximum = input.maximum;
                    num = EditorGUILayout.Slider(label, m_Material.GetProceduralFloat(input.name), minimum, maximum, new GUILayoutOption[0]);
                    break;
                }
                case ProceduralPropertyType.Vector2:
                case ProceduralPropertyType.Vector3:
                case ProceduralPropertyType.Vector4:
                {
                    int num4 = (type != ProceduralPropertyType.Vector2) ? ((type != ProceduralPropertyType.Vector3) ? 4 : 3) : 2;
                    Vector4 proceduralVector = m_Material.GetProceduralVector(input.name);
                    EditorGUI.BeginChangeCheck();
                    if (!input.hasRange)
                    {
                        switch (num4)
                        {
                            case 2:
                                proceduralVector = EditorGUILayout.Vector2Field(input.name, (Vector2) proceduralVector, new GUILayoutOption[0]);
                                break;

                            case 3:
                                proceduralVector = EditorGUILayout.Vector3Field(input.name, (Vector3) proceduralVector, new GUILayoutOption[0]);
                                break;

                            case 4:
                                proceduralVector = EditorGUILayout.Vector4Field(input.name, proceduralVector, new GUILayoutOption[0]);
                                break;
                        }
                    }
                    else
                    {
                        float leftValue = input.minimum;
                        float rightValue = input.maximum;
                        EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
                        EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
                        GUILayout.Space((float) (EditorGUI.indentLevel * 15));
                        GUILayout.Label(label, new GUILayoutOption[0]);
                        EditorGUILayout.EndHorizontal();
                        EditorGUI.indentLevel++;
                        for (int i = 0; i < num4; i++)
                        {
                            proceduralVector[i] = EditorGUILayout.Slider(new GUIContent(input.componentLabels[i]), proceduralVector[i], leftValue, rightValue, new GUILayoutOption[0]);
                        }
                        EditorGUI.indentLevel--;
                        EditorGUILayout.EndVertical();
                    }
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.RecordForUndo(m_Material, m_Importer, "Modified property " + input.name + " for material " + m_Material.name);
                        m_Material.SetProceduralVector(input.name, proceduralVector);
                    }
                    return;
                }
                case ProceduralPropertyType.Color3:
                case ProceduralPropertyType.Color4:
                {
                    EditorGUI.BeginChangeCheck();
                    Color color = EditorGUILayout.ColorField(label, m_Material.GetProceduralColor(input.name), new GUILayoutOption[0]);
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.RecordForUndo(m_Material, m_Importer, "Modified property " + input.name + " for material " + m_Material.name);
                        m_Material.SetProceduralColor(input.name, color);
                    }
                    return;
                }
                case ProceduralPropertyType.Enum:
                {
                    GUIContent[] displayedOptions = new GUIContent[input.enumOptions.Length];
                    for (int j = 0; j < displayedOptions.Length; j++)
                    {
                        displayedOptions[j] = new GUIContent(input.enumOptions[j]);
                    }
                    EditorGUI.BeginChangeCheck();
                    int num9 = EditorGUILayout.Popup(label, m_Material.GetProceduralEnum(input.name), displayedOptions, new GUILayoutOption[0]);
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.RecordForUndo(m_Material, m_Importer, "Modified property " + input.name + " for material " + m_Material.name);
                        m_Material.SetProceduralEnum(input.name, num9);
                    }
                    return;
                }
                case ProceduralPropertyType.Texture:
                {
                    EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    GUILayout.Space((float) (EditorGUI.indentLevel * 15));
                    GUILayout.Label(label, new GUILayoutOption[0]);
                    GUILayout.FlexibleSpace();
                    GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
                    Rect position = GUILayoutUtility.GetRect((float) 64f, (float) 64f, options);
                    EditorGUI.BeginChangeCheck();
                    Texture2D textured = EditorGUI.DoObjectField(position, position, GUIUtility.GetControlID(0x3042, FocusType.Keyboard, position), m_Material.GetProceduralTexture(input.name), typeof(Texture2D), null, null, false) as Texture2D;
                    EditorGUILayout.EndHorizontal();
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.RecordForUndo(m_Material, m_Importer, "Modified property " + input.name + " for material " + m_Material.name);
                        m_Material.SetProceduralTexture(input.name, textured);
                    }
                    return;
                }
                default:
                    return;
            }
            if (EditorGUI.EndChangeCheck())
            {
                this.RecordForUndo(m_Material, m_Importer, "Modified property " + input.name + " for material " + m_Material.name);
                m_Material.SetProceduralFloat(input.name, num);
            }
        }
 static public int get_enumOptions(IntPtr l)
 {
     UnityEngine.ProceduralPropertyDescription o = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
     pushValue(l, o.enumOptions);
     return(1);
 }
        public void BuildEditor()
        {
            foreach (Transform t in EditorsPanel)
            {
                Destroy(t.gameObject);
            }

            IMaterialDescriptor selector;

            if (!m_propertySelectors.TryGetValue(Material.shader.name, out selector))
            {
                selector = new MaterialDescriptor();
            }


            object converter = selector.CreateConverter(this);

            MaterialPropertyDescriptor[] descriptors = selector.GetProperties(this, converter);
            if (descriptors == null)
            {
                Destroy(gameObject);
                return;
            }

            for (int i = 0; i < descriptors.Length; ++i)
            {
                MaterialPropertyDescriptor descriptor = descriptors[i];
                PropertyEditor             editor     = null;
                object       target       = descriptor.Target;
                PropertyInfo propertyInfo = descriptor.PropertyInfo;
#if !UNITY_WEBGL && PROC_MATERIAL
                if (descriptor.ProceduralDescription == null)
#endif
                {
                    RTShaderPropertyType propertyType = descriptor.Type;

                    switch (propertyType)
                    {
                    case RTShaderPropertyType.Range:
                        if (RangeEditor != null)
                        {
                            RangeEditor range = Instantiate(RangeEditor);
                            range.transform.SetParent(EditorsPanel, false);

                            var rangeLimits = descriptor.Limits;
                            range.Min = rangeLimits.Min;
                            range.Max = rangeLimits.Max;
                            editor    = range;
                        }
                        break;

                    default:
                        if (EditorsMap.IsPropertyEditorEnabled(propertyInfo.PropertyType))
                        {
                            GameObject editorPrefab = EditorsMap.GetPropertyEditor(propertyInfo.PropertyType);
                            GameObject instance     = Instantiate(editorPrefab);
                            instance.transform.SetParent(EditorsPanel, false);

                            if (instance != null)
                            {
                                editor = instance.GetComponent <PropertyEditor>();
                            }
                        }
                        break;
                    }
                }
#if !UNITY_WEBGL && PROC_MATERIAL
                else
                {
                    ProcPropertyDescription input = descriptor.ProceduralDescription;
                    if (input.hasRange)
                    {
                        if (input.type == ProcPropertyType.Float)
                        {
                            if (RangeEditor != null)
                            {
                                RangeEditor range = Instantiate(RangeEditor);
                                range.transform.SetParent(EditorsPanel, false);
                                range.Min = input.minimum;
                                range.Max = input.maximum;
                                //TODO implement step on range editor // = input.step
                                editor = range;
                            }
                        }
                        else
                        {
                            //TODO: Implement range on vector editors

                            if (EditorsMap.IsPropertyEditorEnabled(propertyInfo.PropertyType))
                            {
                                GameObject editorPrefab = EditorsMap.GetPropertyEditor(propertyInfo.PropertyType);
                                GameObject instance     = Instantiate(editorPrefab);
                                instance.transform.SetParent(EditorsPanel, false);

                                if (instance != null)
                                {
                                    editor = instance.GetComponent <PropertyEditor>();
                                }
                            }
                        }
                    }
                    else
                    {
                        //if(input.type == ProceduralPropertyType.Enum)
                        //TODO: Implement enum from string array editor. //input.enumOptions

                        if (EditorsMap.IsPropertyEditorEnabled(propertyInfo.PropertyType))
                        {
                            GameObject editorPrefab = EditorsMap.GetPropertyEditor(propertyInfo.PropertyType);
                            GameObject instance     = Instantiate(editorPrefab);
                            instance.transform.SetParent(EditorsPanel, false);

                            if (instance != null)
                            {
                                editor = instance.GetComponent <PropertyEditor>();
                            }
                        }
                    }
                }
#endif

                if (editor == null)
                {
                    continue;
                }

                editor.Init(target, propertyInfo, descriptor.Label, null, descriptor.ValueChangedCallback, () =>
                {
                    RuntimeEditorApplication.SaveSelectedObjects();
                });
            }
        }
 static public int get_componentLabels(IntPtr l)
 {
     UnityEngine.ProceduralPropertyDescription o = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
     pushValue(l, o.componentLabels);
     return(1);
 }
 static public int get_type(IntPtr l)
 {
     UnityEngine.ProceduralPropertyDescription o = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
     pushEnum(l, (int)o.type);
     return(1);
 }
 static public int get_hasRange(IntPtr l)
 {
     UnityEngine.ProceduralPropertyDescription o = (UnityEngine.ProceduralPropertyDescription)checkSelf(l);
     pushValue(l, o.hasRange);
     return(1);
 }
 private void InputSeedGUI(ProceduralPropertyDescription input)
 {
   Rect controlRect = EditorGUILayout.GetControlRect();
   EditorGUI.BeginChangeCheck();
   float num = (float) this.RandomIntField(controlRect, this.m_Styles.randomSeedContent, (int) ProceduralMaterialInspector.m_Material.GetProceduralFloat(input.name), 0, 9999);
   if (!EditorGUI.EndChangeCheck())
     return;
   this.RecordForUndo(ProceduralMaterialInspector.m_Material, ProceduralMaterialInspector.m_Importer, "Modified random seed for material " + ProceduralMaterialInspector.m_Material.name);
   ProceduralMaterialInspector.m_Material.SetProceduralFloat(input.name, num);
 }
		private void InputGUI(ProceduralPropertyDescription input)
		{
			bool flag = true;
			ProceduralMaterial proceduralMaterial = this.target as ProceduralMaterial;
			string name = proceduralMaterial.name;
			string key = name + input.group;
			if (input.group != this.m_LastGroup)
			{
				GUILayout.Space(5f);
				if (input.group != string.Empty)
				{
					this.m_LastGroup = input.group;
					flag = EditorPrefs.GetBool(key, true);
					EditorGUI.BeginChangeCheck();
					flag = EditorGUILayout.Foldout(flag, input.group);
					if (EditorGUI.EndChangeCheck())
					{
						EditorPrefs.SetBool(key, flag);
					}
				}
			}
			else
			{
				flag = EditorPrefs.GetBool(key, true);
			}
			if (flag || input.group == string.Empty)
			{
				int indentLevel = EditorGUI.indentLevel;
				if (input.group != string.Empty)
				{
					EditorGUI.indentLevel++;
				}
				ProceduralPropertyType type = input.type;
				GUIContent gUIContent = new GUIContent(input.label, input.name);
				switch (type)
				{
				case ProceduralPropertyType.Boolean:
				{
					EditorGUI.BeginChangeCheck();
					bool value = EditorGUILayout.Toggle(gUIContent, ProceduralMaterialInspector.m_Material.GetProceduralBoolean(input.name), new GUILayoutOption[0]);
					if (EditorGUI.EndChangeCheck())
					{
						this.RecordForUndo(ProceduralMaterialInspector.m_Material, ProceduralMaterialInspector.m_Importer, "Modified property " + input.name + " for material " + ProceduralMaterialInspector.m_Material.name);
						ProceduralMaterialInspector.m_Material.SetProceduralBoolean(input.name, value);
					}
					break;
				}
				case ProceduralPropertyType.Float:
				{
					EditorGUI.BeginChangeCheck();
					float value2;
					if (input.hasRange)
					{
						float minimum = input.minimum;
						float maximum = input.maximum;
						value2 = EditorGUILayout.Slider(gUIContent, ProceduralMaterialInspector.m_Material.GetProceduralFloat(input.name), minimum, maximum, new GUILayoutOption[0]);
					}
					else
					{
						value2 = EditorGUILayout.FloatField(gUIContent, ProceduralMaterialInspector.m_Material.GetProceduralFloat(input.name), new GUILayoutOption[0]);
					}
					if (EditorGUI.EndChangeCheck())
					{
						this.RecordForUndo(ProceduralMaterialInspector.m_Material, ProceduralMaterialInspector.m_Importer, "Modified property " + input.name + " for material " + ProceduralMaterialInspector.m_Material.name);
						ProceduralMaterialInspector.m_Material.SetProceduralFloat(input.name, value2);
					}
					break;
				}
				case ProceduralPropertyType.Vector2:
				case ProceduralPropertyType.Vector3:
				case ProceduralPropertyType.Vector4:
				{
					int num = (type != ProceduralPropertyType.Vector2) ? ((type != ProceduralPropertyType.Vector3) ? 4 : 3) : 2;
					Vector4 vector = ProceduralMaterialInspector.m_Material.GetProceduralVector(input.name);
					EditorGUI.BeginChangeCheck();
					if (input.hasRange)
					{
						float minimum2 = input.minimum;
						float maximum2 = input.maximum;
						EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
						GUILayout.Label(gUIContent, new GUILayoutOption[0]);
						EditorGUI.indentLevel++;
						for (int i = 0; i < num; i++)
						{
							vector[i] = EditorGUILayout.Slider(new GUIContent(input.componentLabels[i]), vector[i], minimum2, maximum2, new GUILayoutOption[0]);
						}
						EditorGUI.indentLevel--;
						EditorGUILayout.EndVertical();
					}
					else
					{
						switch (num)
						{
						case 2:
							vector = EditorGUILayout.Vector2Field(input.name, vector, new GUILayoutOption[0]);
							break;
						case 3:
							vector = EditorGUILayout.Vector3Field(input.name, vector, new GUILayoutOption[0]);
							break;
						case 4:
							vector = EditorGUILayout.Vector4Field(input.name, vector, new GUILayoutOption[0]);
							break;
						}
					}
					if (EditorGUI.EndChangeCheck())
					{
						this.RecordForUndo(ProceduralMaterialInspector.m_Material, ProceduralMaterialInspector.m_Importer, "Modified property " + input.name + " for material " + ProceduralMaterialInspector.m_Material.name);
						ProceduralMaterialInspector.m_Material.SetProceduralVector(input.name, vector);
					}
					break;
				}
				case ProceduralPropertyType.Color3:
				case ProceduralPropertyType.Color4:
				{
					EditorGUI.BeginChangeCheck();
					Color value3 = EditorGUILayout.ColorField(gUIContent, ProceduralMaterialInspector.m_Material.GetProceduralColor(input.name), new GUILayoutOption[0]);
					if (EditorGUI.EndChangeCheck())
					{
						this.RecordForUndo(ProceduralMaterialInspector.m_Material, ProceduralMaterialInspector.m_Importer, "Modified property " + input.name + " for material " + ProceduralMaterialInspector.m_Material.name);
						ProceduralMaterialInspector.m_Material.SetProceduralColor(input.name, value3);
					}
					break;
				}
				case ProceduralPropertyType.Enum:
				{
					GUIContent[] array = new GUIContent[input.enumOptions.Length];
					for (int j = 0; j < array.Length; j++)
					{
						array[j] = new GUIContent(input.enumOptions[j]);
					}
					EditorGUI.BeginChangeCheck();
					int value4 = EditorGUILayout.Popup(gUIContent, ProceduralMaterialInspector.m_Material.GetProceduralEnum(input.name), array, new GUILayoutOption[0]);
					if (EditorGUI.EndChangeCheck())
					{
						this.RecordForUndo(ProceduralMaterialInspector.m_Material, ProceduralMaterialInspector.m_Importer, "Modified property " + input.name + " for material " + ProceduralMaterialInspector.m_Material.name);
						ProceduralMaterialInspector.m_Material.SetProceduralEnum(input.name, value4);
					}
					break;
				}
				case ProceduralPropertyType.Texture:
				{
					EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
					GUILayout.Label(gUIContent, new GUILayoutOption[0]);
					GUILayout.FlexibleSpace();
					Rect rect = GUILayoutUtility.GetRect(64f, 64f, new GUILayoutOption[]
					{
						GUILayout.ExpandWidth(false)
					});
					EditorGUI.BeginChangeCheck();
					Texture2D value5 = EditorGUI.DoObjectField(rect, rect, GUIUtility.GetControlID(12354, EditorGUIUtility.native, rect), ProceduralMaterialInspector.m_Material.GetProceduralTexture(input.name), typeof(Texture2D), null, null, false) as Texture2D;
					EditorGUILayout.EndHorizontal();
					if (EditorGUI.EndChangeCheck())
					{
						this.RecordForUndo(ProceduralMaterialInspector.m_Material, ProceduralMaterialInspector.m_Importer, "Modified property " + input.name + " for material " + ProceduralMaterialInspector.m_Material.name);
						ProceduralMaterialInspector.m_Material.SetProceduralTexture(input.name, value5);
					}
					break;
				}
				}
				EditorGUI.indentLevel = indentLevel;
			}
		}
 private void InputGUI(ProceduralPropertyDescription input)
 {
   ProceduralPropertyType type = input.type;
   GUIContent guiContent = new GUIContent(input.label, input.name);
   switch (type)
   {
     case ProceduralPropertyType.Boolean:
       EditorGUI.BeginChangeCheck();
       bool flag = EditorGUILayout.Toggle(guiContent, ProceduralMaterialInspector.m_Material.GetProceduralBoolean(input.name), new GUILayoutOption[0]);
       if (!EditorGUI.EndChangeCheck())
         break;
       this.RecordForUndo(ProceduralMaterialInspector.m_Material, ProceduralMaterialInspector.m_Importer, "Modified property " + input.name + " for material " + ProceduralMaterialInspector.m_Material.name);
       ProceduralMaterialInspector.m_Material.SetProceduralBoolean(input.name, flag);
       break;
     case ProceduralPropertyType.Float:
       EditorGUI.BeginChangeCheck();
       float num1;
       if (input.hasRange)
       {
         float minimum = input.minimum;
         float maximum = input.maximum;
         num1 = EditorGUILayout.Slider(guiContent, ProceduralMaterialInspector.m_Material.GetProceduralFloat(input.name), minimum, maximum, new GUILayoutOption[0]);
       }
       else
         num1 = EditorGUILayout.FloatField(guiContent, ProceduralMaterialInspector.m_Material.GetProceduralFloat(input.name), new GUILayoutOption[0]);
       if (!EditorGUI.EndChangeCheck())
         break;
       this.RecordForUndo(ProceduralMaterialInspector.m_Material, ProceduralMaterialInspector.m_Importer, "Modified property " + input.name + " for material " + ProceduralMaterialInspector.m_Material.name);
       ProceduralMaterialInspector.m_Material.SetProceduralFloat(input.name, num1);
       break;
     case ProceduralPropertyType.Vector2:
     case ProceduralPropertyType.Vector3:
     case ProceduralPropertyType.Vector4:
       int num2 = type != ProceduralPropertyType.Vector2 ? (type != ProceduralPropertyType.Vector3 ? 4 : 3) : 2;
       Vector4 vector4 = ProceduralMaterialInspector.m_Material.GetProceduralVector(input.name);
       EditorGUI.BeginChangeCheck();
       if (input.hasRange)
       {
         float minimum = input.minimum;
         float maximum = input.maximum;
         EditorGUILayout.BeginVertical();
         EditorGUILayout.BeginHorizontal();
         GUILayout.Space((float) (EditorGUI.indentLevel * 15));
         GUILayout.Label(guiContent);
         EditorGUILayout.EndHorizontal();
         ++EditorGUI.indentLevel;
         for (int index = 0; index < num2; ++index)
           vector4[index] = EditorGUILayout.Slider(new GUIContent(input.componentLabels[index]), vector4[index], minimum, maximum, new GUILayoutOption[0]);
         --EditorGUI.indentLevel;
         EditorGUILayout.EndVertical();
       }
       else
       {
         switch (num2)
         {
           case 2:
             vector4 = (Vector4) EditorGUILayout.Vector2Field(input.name, (Vector2) vector4);
             break;
           case 3:
             vector4 = (Vector4) EditorGUILayout.Vector3Field(input.name, (Vector3) vector4);
             break;
           case 4:
             vector4 = EditorGUILayout.Vector4Field(input.name, vector4);
             break;
         }
       }
       if (!EditorGUI.EndChangeCheck())
         break;
       this.RecordForUndo(ProceduralMaterialInspector.m_Material, ProceduralMaterialInspector.m_Importer, "Modified property " + input.name + " for material " + ProceduralMaterialInspector.m_Material.name);
       ProceduralMaterialInspector.m_Material.SetProceduralVector(input.name, vector4);
       break;
     case ProceduralPropertyType.Color3:
     case ProceduralPropertyType.Color4:
       EditorGUI.BeginChangeCheck();
       Color color = EditorGUILayout.ColorField(guiContent, ProceduralMaterialInspector.m_Material.GetProceduralColor(input.name), new GUILayoutOption[0]);
       if (!EditorGUI.EndChangeCheck())
         break;
       this.RecordForUndo(ProceduralMaterialInspector.m_Material, ProceduralMaterialInspector.m_Importer, "Modified property " + input.name + " for material " + ProceduralMaterialInspector.m_Material.name);
       ProceduralMaterialInspector.m_Material.SetProceduralColor(input.name, color);
       break;
     case ProceduralPropertyType.Enum:
       GUIContent[] displayedOptions = new GUIContent[input.enumOptions.Length];
       for (int index = 0; index < displayedOptions.Length; ++index)
         displayedOptions[index] = new GUIContent(input.enumOptions[index]);
       EditorGUI.BeginChangeCheck();
       int num3 = EditorGUILayout.Popup(guiContent, ProceduralMaterialInspector.m_Material.GetProceduralEnum(input.name), displayedOptions, new GUILayoutOption[0]);
       if (!EditorGUI.EndChangeCheck())
         break;
       this.RecordForUndo(ProceduralMaterialInspector.m_Material, ProceduralMaterialInspector.m_Importer, "Modified property " + input.name + " for material " + ProceduralMaterialInspector.m_Material.name);
       ProceduralMaterialInspector.m_Material.SetProceduralEnum(input.name, num3);
       break;
     case ProceduralPropertyType.Texture:
       EditorGUILayout.BeginHorizontal();
       GUILayout.Space((float) (EditorGUI.indentLevel * 15));
       GUILayout.Label(guiContent);
       GUILayout.FlexibleSpace();
       Rect rect = GUILayoutUtility.GetRect(64f, 64f, new GUILayoutOption[1]{ GUILayout.ExpandWidth(false) });
       EditorGUI.BeginChangeCheck();
       Texture2D texture2D = EditorGUI.DoObjectField(rect, rect, GUIUtility.GetControlID(12354, EditorGUIUtility.native, rect), (UnityEngine.Object) ProceduralMaterialInspector.m_Material.GetProceduralTexture(input.name), typeof (Texture2D), (SerializedProperty) null, (EditorGUI.ObjectFieldValidator) null, false) as Texture2D;
       EditorGUILayout.EndHorizontal();
       if (!EditorGUI.EndChangeCheck())
         break;
       this.RecordForUndo(ProceduralMaterialInspector.m_Material, ProceduralMaterialInspector.m_Importer, "Modified property " + input.name + " for material " + ProceduralMaterialInspector.m_Material.name);
       ProceduralMaterialInspector.m_Material.SetProceduralTexture(input.name, texture2D);
       break;
   }
 }