Inheritance: UnityEditor.Editor
Exemplo n.º 1
0
		private Vector2 GUIMinMaxSlider(TreeEditor.PropertyType prop, string contentID, Vector2 value, float minimum, float maximum, bool hasCurve)
		{
			this.GUIPropBegin();
			Vector2 result = new Vector2(Mathf.Min(value.x, value.y), Mathf.Max(value.x, value.y));
			GUIContent gUIContent = TreeEditorHelper.GetGUIContent(contentID);
			bool changed = GUI.changed;
			Rect rect = GUILayoutUtility.GetRect(gUIContent, "Button");
			EditorGUI.MinMaxSlider(gUIContent, rect, ref result.x, ref result.y, minimum, maximum);
			if (changed != GUI.changed)
			{
				this.GUIHandlePropertyChange(prop);
			}
			if (!hasCurve)
			{
				this.GUIPropEnd();
			}
			return result;
		}
Exemplo n.º 2
0
		private void UndoStoreSelected(TreeEditor.EditMode mode)
		{
			TreeData treeData = TreeEditor.GetTreeData(this.target as Tree);
			if (!treeData)
			{
				return;
			}
			UnityEngine.Object[] objectsToUndo = new UnityEngine.Object[]
			{
				treeData
			};
			EditorUtility.SetDirty(treeData);
			switch (mode)
			{
			case TreeEditor.EditMode.MoveNode:
				Undo.RegisterCompleteObjectUndo(objectsToUndo, "Move");
				break;
			case TreeEditor.EditMode.RotateNode:
				Undo.RegisterCompleteObjectUndo(objectsToUndo, "Rotate");
				break;
			case TreeEditor.EditMode.Freehand:
				Undo.RegisterCompleteObjectUndo(objectsToUndo, "Freehand Drawing");
				break;
			case TreeEditor.EditMode.Parameter:
				Undo.RegisterCompleteObjectUndo(objectsToUndo, "Parameter Change");
				break;
			case TreeEditor.EditMode.Everything:
				Undo.RegisterCompleteObjectUndo(objectsToUndo, "Parameter Change");
				break;
			case TreeEditor.EditMode.Delete:
				Undo.RegisterCompleteObjectUndo(objectsToUndo, "Delete");
				break;
			case TreeEditor.EditMode.CreateGroup:
				Undo.RegisterCompleteObjectUndo(objectsToUndo, "Create Group");
				break;
			case TreeEditor.EditMode.Duplicate:
				Undo.RegisterCompleteObjectUndo(objectsToUndo, "Duplicate");
				break;
			}
		}
Exemplo n.º 3
0
		private UnityEngine.Object GUIObjectField(TreeEditor.PropertyType prop, string contentID, UnityEngine.Object value, Type type, bool hasCurve)
		{
			this.GUIPropBegin();
			UnityEngine.Object @object = EditorGUILayout.ObjectField(TreeEditorHelper.GetGUIContent(contentID), value, type, false, new GUILayoutOption[0]);
			if (@object != value)
			{
				this.GUIHandlePropertyChange(prop);
				this.m_WantCompleteUpdate = true;
			}
			if (!hasCurve)
			{
				this.GUIPropEnd();
			}
			return @object;
		}
Exemplo n.º 4
0
		private bool GUICurve(TreeEditor.PropertyType prop, AnimationCurve curve, Rect ranges)
		{
			bool changed = GUI.changed;
			EditorGUILayout.CurveField(curve, Color.green, ranges, new GUILayoutOption[]
			{
				GUILayout.Width(50f)
			});
			this.GUIPropEnd(false);
			if (changed != GUI.changed)
			{
				if (GUIUtility.hotControl == 0)
				{
					this.m_WantCompleteUpdate = true;
				}
				this.GUIHandlePropertyChange(prop);
				return true;
			}
			return false;
		}
Exemplo n.º 5
0
		private Material GUIMaterialField(TreeEditor.PropertyType prop, int uniqueNodeID, string contentID, Material value, TreeEditorHelper.NodeType nodeType)
		{
			string uniqueID = uniqueNodeID + "_" + contentID;
			this.GUIPropBegin();
			Material material = EditorGUILayout.ObjectField(TreeEditorHelper.GetGUIContent(contentID), value, typeof(Material), false, new GUILayoutOption[0]) as Material;
			this.GUIPropEnd();
			bool flag = this.m_TreeEditorHelper.GUIWrongShader(uniqueID, material, nodeType);
			if (material != value || flag)
			{
				this.GUIHandlePropertyChange(prop);
				this.m_WantCompleteUpdate = true;
			}
			return material;
		}
Exemplo n.º 6
0
		private int GUIPopup(TreeEditor.PropertyType prop, string contentID, string optionsContentID, string[] optionIDs, int value, bool hasCurve)
		{
			this.GUIPropBegin();
			GUIContent[] array = new GUIContent[optionIDs.Length];
			for (int i = 0; i < optionIDs.Length; i++)
			{
				array[i] = TreeEditorHelper.GetGUIContent(optionsContentID + "." + optionIDs[i]);
			}
			int num = EditorGUILayout.Popup(TreeEditorHelper.GetGUIContent(contentID), value, array, new GUILayoutOption[0]);
			if (num != value)
			{
				this.GUIHandlePropertyChange(prop);
				this.m_WantCompleteUpdate = true;
			}
			if (!hasCurve)
			{
				this.GUIPropEnd();
			}
			return num;
		}
Exemplo n.º 7
0
		private bool GUIToggle(TreeEditor.PropertyType prop, string contentID, bool value, bool hasCurve)
		{
			this.GUIPropBegin();
			bool flag = EditorGUILayout.Toggle(TreeEditorHelper.GetGUIContent(contentID), value, new GUILayoutOption[0]);
			if (flag != value)
			{
				this.GUIHandlePropertyChange(prop);
				this.m_WantCompleteUpdate = true;
			}
			if (!hasCurve)
			{
				this.GUIPropEnd();
			}
			return flag;
		}
Exemplo n.º 8
0
		private int GUIIntSlider(TreeEditor.PropertyType prop, string contentID, int value, int minimum, int maximum, bool hasCurve)
		{
			this.GUIPropBegin();
			int num = EditorGUILayout.IntSlider(TreeEditorHelper.GetGUIContent(contentID), value, minimum, maximum, new GUILayoutOption[0]);
			if (num != value)
			{
				this.GUIHandlePropertyChange(prop);
			}
			if (!hasCurve)
			{
				this.GUIPropEnd();
			}
			return num;
		}
Exemplo n.º 9
0
		private void GUIHandlePropertyChange(TreeEditor.PropertyType prop)
		{
			switch (prop)
			{
			case TreeEditor.PropertyType.Normal:
				this.UndoStoreSelected(TreeEditor.EditMode.Parameter);
				break;
			case TreeEditor.PropertyType.FullUndo:
				this.UndoStoreSelected(TreeEditor.EditMode.Everything);
				break;
			case TreeEditor.PropertyType.FullUpdate:
				this.UndoStoreSelected(TreeEditor.EditMode.Parameter);
				this.m_WantCompleteUpdate = true;
				break;
			case TreeEditor.PropertyType.FullUndoUpdate:
				this.UndoStoreSelected(TreeEditor.EditMode.Everything);
				this.m_WantCompleteUpdate = true;
				break;
			}
		}