private void FillInMissingTransformCurves(List <AnimationWindowCurve> transformCurves, ref List <AnimationWindowCurve> curvesCache) { EditorCurveBinding lastBinding = transformCurves[0].binding; EditorCurveBinding?[] propertyGroup = new EditorCurveBinding?[3]; foreach (AnimationWindowCurve curve in transformCurves) { EditorCurveBinding binding = curve.binding; if ((binding.path != lastBinding.path) || (AnimationWindowUtility.GetPropertyGroupName(binding.propertyName) != AnimationWindowUtility.GetPropertyGroupName(lastBinding.propertyName))) { string propertyGroupName = AnimationWindowUtility.GetPropertyGroupName(lastBinding.propertyName); this.FillPropertyGroup(ref propertyGroup, lastBinding, propertyGroupName, ref curvesCache); lastBinding = binding; propertyGroup = new EditorCurveBinding?[3]; } this.AssignBindingToRightSlot(binding, ref propertyGroup); } this.FillPropertyGroup(ref propertyGroup, lastBinding, AnimationWindowUtility.GetPropertyGroupName(lastBinding.propertyName), ref curvesCache); }
public List <AnimationWindowHierarchyNode> CreateTreeFromCurves() { List <AnimationWindowHierarchyNode> nodes = new List <AnimationWindowHierarchyNode>(); List <AnimationWindowCurve> singlePropertyCurves = new List <AnimationWindowCurve>(); AnimationWindowCurve[] curves = state.allCurves.ToArray(); AnimationWindowHierarchyNode parentNode = (AnimationWindowHierarchyNode)m_RootItem; for (int i = 0; i < curves.Length; i++) { AnimationWindowCurve curve = curves[i]; if (!state.ShouldShowCurve(curve)) { continue; } AnimationWindowCurve nextCurve = i < curves.Length - 1 ? curves[i + 1] : null; singlePropertyCurves.Add(curve); bool areSameGroup = nextCurve != null && AnimationWindowUtility.GetPropertyGroupName(nextCurve.propertyName) == AnimationWindowUtility.GetPropertyGroupName(curve.propertyName); bool areSamePathAndType = nextCurve != null && curve.path.Equals(nextCurve.path) && curve.type == nextCurve.type; // We expect curveBindings to come sorted by propertyname // So we compare curve vs nextCurve. If its different path or different group (think "scale.xyz" as group), then we know this is the last element of such group. if (i == curves.Length - 1 || !areSameGroup || !areSamePathAndType) { if (singlePropertyCurves.Count > 1) { nodes.Add(AddPropertyGroupToHierarchy(singlePropertyCurves.ToArray(), parentNode)); } else { nodes.Add(AddPropertyToHierarchy(singlePropertyCurves[0], parentNode)); } singlePropertyCurves.Clear(); } } return(nodes); }
public static List <AnimationWindowCurve> FilterCurves(AnimationWindowCurve[] curves, string path, Type animatableObjectType, string propertyName) { List <AnimationWindowCurve> list = new List <AnimationWindowCurve>(); if (curves != null) { string propertyGroupName = AnimationWindowUtility.GetPropertyGroupName(propertyName); bool flag = propertyGroupName == propertyName; for (int i = 0; i < curves.Length; i++) { AnimationWindowCurve animationWindowCurve = curves[i]; bool flag2 = (!flag) ? animationWindowCurve.propertyName.Equals(propertyName) : AnimationWindowUtility.GetPropertyGroupName(animationWindowCurve.propertyName).Equals(propertyGroupName); if (animationWindowCurve.path.Equals(path) && animationWindowCurve.type == animatableObjectType && flag2) { list.Add(animationWindowCurve); } } } return(list); }
private TreeViewItem AddAnimatableObjectToHierarchy(EditorCurveBinding[] curveBindings, TreeViewItem parentNode, string path) { TreeViewItem node = new AddCurvesPopupObjectNode(parentNode, path, GetClassName(curveBindings[0])); node.icon = GetIcon(curveBindings[0]); List <TreeViewItem> childNodes = new List <TreeViewItem>(); List <EditorCurveBinding> singlePropertyBindings = new List <EditorCurveBinding>(); SerializedObject so = null; for (int i = 0; i < curveBindings.Length; i++) { EditorCurveBinding curveBinding = curveBindings[i]; if (curveBinding.isSerializeReferenceCurve) { var animatedObject = AnimationUtility.GetAnimatedObject(AddCurvesPopup.s_State.activeRootGameObject, curveBinding); if (animatedObject != null && (so == null || so.targetObject != animatedObject)) { so = new SerializedObject(animatedObject); } } singlePropertyBindings.Add(curveBinding); // We expect curveBindings to come sorted by propertyname if (i == curveBindings.Length - 1 || AnimationWindowUtility.GetPropertyGroupName(curveBindings[i + 1].propertyName) != AnimationWindowUtility.GetPropertyGroupName(curveBinding.propertyName)) { TreeViewItem newNode = CreateNode(singlePropertyBindings.ToArray(), node, so); if (newNode != null) { childNodes.Add(newNode); } singlePropertyBindings.Clear(); } } childNodes.Sort(); TreeViewUtility.SetChildParentReferences(childNodes, node); return(node); }
public static bool ForceGrouping(EditorCurveBinding binding) { if (binding.type == typeof(Transform)) { return(true); } if (binding.type == typeof(RectTransform)) { string propertyGroupName = AnimationWindowUtility.GetPropertyGroupName(binding.propertyName); if (!(propertyGroupName == "m_LocalPosition") && !(propertyGroupName == "m_LocalScale") && (!(propertyGroupName == "m_LocalRotation") && !(propertyGroupName == "localEulerAnglesBaked")) && !(propertyGroupName == "localEulerAngles")) { return(propertyGroupName == "localEulerAnglesRaw"); } return(true); } if (typeof(Renderer).IsAssignableFrom(binding.type)) { return(AnimationWindowUtility.GetPropertyGroupName(binding.propertyName) == "material._Color"); } return(false); }
public List <AnimationWindowHierarchyNode> CreateTreeFromCurves() { List <AnimationWindowHierarchyNode> list = new List <AnimationWindowHierarchyNode>(); List <AnimationWindowCurve> list2 = new List <AnimationWindowCurve>(); AnimationWindowSelectionItem[] array = this.state.selection.ToArray(); for (int i = 0; i < array.Length; i++) { AnimationWindowSelectionItem animationWindowSelectionItem = array[i]; AnimationWindowCurve[] array2 = animationWindowSelectionItem.curves.ToArray(); AnimationWindowHierarchyNode parentNode = (AnimationWindowHierarchyNode)this.m_RootItem; if (this.state.selection.count > 1) { AnimationWindowHierarchyNode animationWindowHierarchyNode = this.AddClipNodeToHierarchy(animationWindowSelectionItem, array2, parentNode); list.Add(animationWindowHierarchyNode); parentNode = animationWindowHierarchyNode; } for (int j = 0; j < array2.Length; j++) { AnimationWindowCurve animationWindowCurve = array2[j]; AnimationWindowCurve animationWindowCurve2 = (j >= array2.Length - 1) ? null : array2[j + 1]; list2.Add(animationWindowCurve); bool flag = animationWindowCurve2 != null && AnimationWindowUtility.GetPropertyGroupName(animationWindowCurve2.propertyName) == AnimationWindowUtility.GetPropertyGroupName(animationWindowCurve.propertyName); bool flag2 = animationWindowCurve2 != null && animationWindowCurve.path.Equals(animationWindowCurve2.path) && animationWindowCurve.type == animationWindowCurve2.type; if (j == array2.Length - 1 || !flag || !flag2) { if (list2.Count > 1) { list.Add(this.AddPropertyGroupToHierarchy(animationWindowSelectionItem, list2.ToArray(), parentNode)); } else { list.Add(this.AddPropertyToHierarchy(animationWindowSelectionItem, list2[0], parentNode)); } list2.Clear(); } } } return(list); }
public static bool ForceGrouping(EditorCurveBinding binding) { bool result; if (binding.type == typeof(Transform)) { result = true; } else if (binding.type == typeof(RectTransform)) { string propertyGroupName = AnimationWindowUtility.GetPropertyGroupName(binding.propertyName); result = (propertyGroupName == "m_LocalPosition" || propertyGroupName == "m_LocalScale" || propertyGroupName == "m_LocalRotation" || propertyGroupName == "localEulerAnglesBaked" || propertyGroupName == "localEulerAngles" || propertyGroupName == "localEulerAnglesRaw"); } else if (typeof(Renderer).IsAssignableFrom(binding.type)) { string propertyGroupName2 = AnimationWindowUtility.GetPropertyGroupName(binding.propertyName); result = (propertyGroupName2 == "material._Color"); } else { result = false; } return(result); }
public AddCurvesPopupPropertyNode(TreeViewItem parent, EditorCurveBinding[] curveBindings) : base(curveBindings[0].GetHashCode(), parent.depth + 1, parent, AnimationWindowUtility.NicifyPropertyGroupName(curveBindings[0].type, AnimationWindowUtility.GetPropertyGroupName(curveBindings[0].propertyName))) { this.curveBindings = curveBindings; }
private TreeViewItem AddAnimatableObjectToHierarchy(EditorCurveBinding[] curveBindings, TreeViewItem parentNode, string path) { TreeViewItem node = new AddCurvesPopupObjectNode(parentNode, path, GetClassName(curveBindings[0])); node.icon = GetIcon(curveBindings[0]); List <TreeViewItem> childNodes = new List <TreeViewItem>(); List <EditorCurveBinding> singlePropertyBindings = new List <EditorCurveBinding>(); for (int i = 0; i < curveBindings.Length; i++) { EditorCurveBinding curveBinding = curveBindings[i]; singlePropertyBindings.Add(curveBinding); // We expect curveBindings to come sorted by propertyname if (i == curveBindings.Length - 1 || AnimationWindowUtility.GetPropertyGroupName(curveBindings[i + 1].propertyName) != AnimationWindowUtility.GetPropertyGroupName(curveBinding.propertyName)) { TreeViewItem newNode = CreateNode(singlePropertyBindings.ToArray(), node); if (newNode != null) { childNodes.Add(newNode); } singlePropertyBindings.Clear(); } } childNodes.Sort(); TreeViewUtility.SetChildParentReferences(childNodes, node); return(node); }
private void FillInMissingTransformCurves(List <AnimationWindowCurve> transformCurves, ref List <AnimationWindowCurve> curvesCache) { EditorCurveBinding lastBinding = transformCurves[0].binding; var propertyGroup = new EditorCurveBinding ? [3]; string propertyGroupName; foreach (var transformCurve in transformCurves) { var transformBinding = transformCurve.binding; //if it's a new property group if (transformBinding.path != lastBinding.path || AnimationWindowUtility.GetPropertyGroupName(transformBinding.propertyName) != AnimationWindowUtility.GetPropertyGroupName(lastBinding.propertyName)) { propertyGroupName = AnimationWindowUtility.GetPropertyGroupName(lastBinding.propertyName); FillPropertyGroup(ref propertyGroup, lastBinding, propertyGroupName, ref curvesCache); lastBinding = transformBinding; propertyGroup = new EditorCurveBinding ? [3]; } AssignBindingToRightSlot(transformBinding, ref propertyGroup); } FillPropertyGroup(ref propertyGroup, lastBinding, AnimationWindowUtility.GetPropertyGroupName(lastBinding.propertyName), ref curvesCache); }
public List <AnimationWindowHierarchyNode> CreateTreeFromCurves() { List <AnimationWindowHierarchyNode> list = new List <AnimationWindowHierarchyNode>(); List <AnimationWindowCurve> list2 = new List <AnimationWindowCurve>(); AnimationWindowCurve[] curveArray = this.state.allCurves.ToArray(); for (int i = 0; i < curveArray.Length; i++) { AnimationWindowCurve item = curveArray[i]; AnimationWindowCurve curve2 = (i >= (curveArray.Length - 1)) ? null : curveArray[i + 1]; list2.Add(item); bool flag = (curve2 != null) && (AnimationWindowUtility.GetPropertyGroupName(curve2.propertyName) == AnimationWindowUtility.GetPropertyGroupName(item.propertyName)); bool flag2 = ((curve2 != null) && item.path.Equals(curve2.path)) && (item.type == curve2.type); if (((i == (curveArray.Length - 1)) || !flag) || !flag2) { if (list2.Count > 1) { list.Add(this.AddPropertyGroupToHierarchy(list2.ToArray(), (AnimationWindowHierarchyNode)base.m_RootItem)); } else { list.Add(this.AddPropertyToHierarchy(list2[0], (AnimationWindowHierarchyNode)base.m_RootItem)); } list2.Clear(); } } return(list); }
private AnimationWindowHierarchyPropertyGroupNode AddPropertyGroupToHierarchy(AnimationWindowCurve[] curves, AnimationWindowHierarchyNode parentNode) { List <AnimationWindowHierarchyNode> list = new List <AnimationWindowHierarchyNode>(); AnimationWindowHierarchyPropertyGroupNode node = new AnimationWindowHierarchyPropertyGroupNode(curves[0].type, AnimationWindowUtility.GetPropertyGroupName(curves[0].propertyName), curves[0].path, parentNode) { icon = this.GetIcon(curves[0].binding), indent = curves[0].depth, curves = curves }; foreach (AnimationWindowCurve curve in curves) { AnimationWindowHierarchyPropertyNode item = this.AddPropertyToHierarchy(curve, node); item.displayName = AnimationWindowUtility.GetPropertyDisplayName(item.propertyName); list.Add(item); } TreeViewUtility.SetChildParentReferences(new List <TreeViewItem>(list.ToArray()), node); return(node); }
public int CompareTo(AnimationWindowCurve obj) { bool flag = this.path.Equals(obj.path); bool flag2 = obj.type == this.type; int result; if (!flag && this.depth != obj.depth) { int num = Math.Min(this.path.Length, obj.path.Length); int startIndex = 0; int i; for (i = 0; i < num; i++) { if (this.path[i] != obj.path[i]) { break; } if (this.path[i] == '/') { startIndex = i + 1; } } if (i == num) { startIndex = num; } string text = this.path.Substring(startIndex); string text2 = obj.path.Substring(startIndex); if (string.IsNullOrEmpty(text)) { result = -1; } else if (string.IsNullOrEmpty(text2)) { result = 1; } else { Regex regex = new Regex("^[^\\/]*\\/"); Match match = regex.Match(text); string text3 = (!match.Success) ? text : match.Value.Substring(0, match.Value.Length - 1); Match match2 = regex.Match(text2); string strB = (!match2.Success) ? text2 : match2.Value.Substring(0, match2.Value.Length - 1); result = text3.CompareTo(strB); } } else { bool flag3 = this.type == typeof(Transform) && obj.type == typeof(Transform) && flag; bool flag4 = (this.type == typeof(Transform) || obj.type == typeof(Transform)) && flag; if (flag3) { string nicePropertyGroupDisplayName = AnimationWindowUtility.GetNicePropertyGroupDisplayName(typeof(Transform), AnimationWindowUtility.GetPropertyGroupName(this.propertyName)); string nicePropertyGroupDisplayName2 = AnimationWindowUtility.GetNicePropertyGroupDisplayName(typeof(Transform), AnimationWindowUtility.GetPropertyGroupName(obj.propertyName)); if (nicePropertyGroupDisplayName.Contains("Position") && nicePropertyGroupDisplayName2.Contains("Rotation")) { result = -1; return(result); } if (nicePropertyGroupDisplayName.Contains("Rotation") && nicePropertyGroupDisplayName2.Contains("Position")) { result = 1; return(result); } } else if (flag4) { if (this.type == typeof(Transform)) { result = -1; return(result); } result = 1; return(result); } if (flag && flag2) { int componentIndex = AnimationWindowUtility.GetComponentIndex(obj.propertyName); int componentIndex2 = AnimationWindowUtility.GetComponentIndex(this.propertyName); if (componentIndex != -1 && componentIndex2 != -1 && this.propertyName.Substring(0, this.propertyName.Length - 2) == obj.propertyName.Substring(0, obj.propertyName.Length - 2)) { result = componentIndex2 - componentIndex; return(result); } } result = (this.path + this.type + this.propertyName).CompareTo(obj.path + obj.type + obj.propertyName); } return(result); }
private AnimationWindowHierarchyPropertyGroupNode AddPropertyGroupToHierarchy(AnimationWindowCurve[] curves, AnimationWindowHierarchyNode parentNode) { List <AnimationWindowHierarchyNode> windowHierarchyNodeList = new List <AnimationWindowHierarchyNode>(); AnimationWindowHierarchyPropertyGroupNode propertyGroupNode = new AnimationWindowHierarchyPropertyGroupNode(curves[0].type, AnimationWindowUtility.GetPropertyGroupName(curves[0].propertyName), curves[0].path, (TreeViewItem)parentNode); propertyGroupNode.icon = this.GetIcon(curves[0].binding); propertyGroupNode.indent = curves[0].depth; propertyGroupNode.curves = curves; foreach (AnimationWindowCurve curve in curves) { AnimationWindowHierarchyPropertyNode hierarchy = this.AddPropertyToHierarchy(curve, (AnimationWindowHierarchyNode)propertyGroupNode); hierarchy.displayName = AnimationWindowUtility.GetPropertyDisplayName(hierarchy.propertyName); windowHierarchyNodeList.Add((AnimationWindowHierarchyNode)hierarchy); } TreeViewUtility.SetChildParentReferences(new List <TreeViewItem>((IEnumerable <TreeViewItem>)windowHierarchyNodeList.ToArray()), (TreeViewItem)propertyGroupNode); return(propertyGroupNode); }
private TreeViewItem AddAnimatableObjectToHierarchy(GameObject root, EditorCurveBinding[] curveBindings, TreeViewItem parentNode, string path) { TreeViewItem treeViewItem = (TreeViewItem) new AddCurvesPopupObjectNode(parentNode, path, AddCurvesPopupHierarchyDataSource.GetClassName(root, curveBindings[0])); treeViewItem.icon = AssetPreview.GetMiniThumbnail(AnimationUtility.GetAnimatedObject(root, curveBindings[0])); List <TreeViewItem> visibleItems = new List <TreeViewItem>(); List <EditorCurveBinding> editorCurveBindingList = new List <EditorCurveBinding>(); for (int index = 0; index < curveBindings.Length; ++index) { EditorCurveBinding curveBinding = curveBindings[index]; editorCurveBindingList.Add(curveBinding); if (index == curveBindings.Length - 1 || AnimationWindowUtility.GetPropertyGroupName(curveBindings[index + 1].propertyName) != AnimationWindowUtility.GetPropertyGroupName(curveBinding.propertyName)) { TreeViewItem node = this.CreateNode(editorCurveBindingList.ToArray(), treeViewItem); if (node != null) { visibleItems.Add(node); } editorCurveBindingList.Clear(); } } visibleItems.Sort(); TreeViewUtility.SetChildParentReferences(visibleItems, treeViewItem); return(treeViewItem); }
private AnimationWindowHierarchyPropertyGroupNode AddPropertyGroupToHierarchy(AnimationWindowCurve[] curves, AnimationWindowHierarchyNode parentNode) { List <AnimationWindowHierarchyNode> list = new List <AnimationWindowHierarchyNode>(); Type type = curves[0].type; AnimationWindowHierarchyPropertyGroupNode animationWindowHierarchyPropertyGroupNode = new AnimationWindowHierarchyPropertyGroupNode(type, AnimationWindowUtility.GetPropertyGroupName(curves[0].propertyName), curves[0].path, parentNode); animationWindowHierarchyPropertyGroupNode.icon = this.GetIcon(curves[0].binding); animationWindowHierarchyPropertyGroupNode.indent = curves[0].depth; animationWindowHierarchyPropertyGroupNode.curves = curves; for (int i = 0; i < curves.Length; i++) { AnimationWindowCurve curve = curves[i]; AnimationWindowHierarchyPropertyNode animationWindowHierarchyPropertyNode = this.AddPropertyToHierarchy(curve, animationWindowHierarchyPropertyGroupNode); animationWindowHierarchyPropertyNode.displayName = AnimationWindowUtility.GetPropertyDisplayName(animationWindowHierarchyPropertyNode.propertyName); list.Add(animationWindowHierarchyPropertyNode); } TreeViewUtility.SetChildParentReferences(new List <TreeViewItem>(list.ToArray()), animationWindowHierarchyPropertyGroupNode); return(animationWindowHierarchyPropertyGroupNode); }
public AnimationWindowHierarchyPropertyGroupNode(System.Type animatableObjectType, int setId, string propertyName, string path, TreeViewItem parent, string displayName) : base(AnimationWindowUtility.GetPropertyNodeID(setId, path, animatableObjectType, propertyName), parent != null ? parent.depth + 1 : -1, parent, animatableObjectType, AnimationWindowUtility.GetPropertyGroupName(propertyName), path, displayName) { }
internal static bool IsRotationCurve(EditorCurveBinding curveBinding) { string propertyGroupName = AnimationWindowUtility.GetPropertyGroupName(curveBinding.propertyName); return(propertyGroupName == "m_LocalRotation" || propertyGroupName == "localEulerAnglesRaw"); }
private AnimationWindowHierarchyPropertyGroupNode AddPropertyGroupToHierarchy(AnimationWindowCurve[] curves, AnimationWindowHierarchyNode parentNode) { List <AnimationWindowHierarchyNode> childNodes = new List <AnimationWindowHierarchyNode>(); System.Type animatableObjectType = curves[0].type; AnimationWindowHierarchyPropertyGroupNode node = new AnimationWindowHierarchyPropertyGroupNode(animatableObjectType, 0, AnimationWindowUtility.GetPropertyGroupName(curves[0].propertyName), curves[0].path, parentNode); node.icon = GetIcon(curves[0].binding); node.indent = curves[0].depth; node.curves = curves; foreach (AnimationWindowCurve curve in curves) { AnimationWindowHierarchyPropertyNode childNode = AddPropertyToHierarchy(curve, node); // For child nodes we do not want to display the type in front (It is already shown by the group node) childNode.displayName = AnimationWindowUtility.GetPropertyDisplayName(childNode.propertyName); childNodes.Add(childNode); } TreeViewUtility.SetChildParentReferences(new List <TreeViewItem>(childNodes.ToArray()), node); return(node); }
public static bool IsRectTransformPosition(EditorCurveBinding curveBinding) { return(curveBinding.type == typeof(RectTransform) && AnimationWindowUtility.GetPropertyGroupName(curveBinding.propertyName) == "m_LocalPosition"); }
private TreeViewItem AddAnimatableObjectToHierarchy(EditorCurveBinding[] curveBindings, TreeViewItem parentNode, string path) { TreeViewItem treeViewItem = new AddCurvesPopupObjectNode(parentNode, path, AddCurvesPopupHierarchyDataSource.GetClassName(curveBindings[0])); treeViewItem.icon = AddCurvesPopupHierarchyDataSource.GetIcon(curveBindings[0]); List <TreeViewItem> list = new List <TreeViewItem>(); List <EditorCurveBinding> list2 = new List <EditorCurveBinding>(); for (int i = 0; i < curveBindings.Length; i++) { EditorCurveBinding item = curveBindings[i]; list2.Add(item); if (i == curveBindings.Length - 1 || AnimationWindowUtility.GetPropertyGroupName(curveBindings[i + 1].propertyName) != AnimationWindowUtility.GetPropertyGroupName(item.propertyName)) { TreeViewItem treeViewItem2 = this.CreateNode(list2.ToArray(), treeViewItem); if (treeViewItem2 != null) { list.Add(treeViewItem2); } list2.Clear(); } } list.Sort(); TreeViewUtility.SetChildParentReferences(list, treeViewItem); return(treeViewItem); }
private TreeViewItem AddAnimatableObjectToHierarchy(GameObject root, EditorCurveBinding[] curveBindings, TreeViewItem parentNode, string path) { TreeViewItem item = new AddCurvesPopupObjectNode(parentNode, path, GetClassName(root, curveBindings[0])) { icon = AssetPreview.GetMiniThumbnail(AnimationUtility.GetAnimatedObject(root, curveBindings[0])) }; List <TreeViewItem> visibleItems = new List <TreeViewItem>(); List <EditorCurveBinding> list2 = new List <EditorCurveBinding>(); for (int i = 0; i < curveBindings.Length; i++) { EditorCurveBinding binding = curveBindings[i]; list2.Add(binding); if ((i == (curveBindings.Length - 1)) || (AnimationWindowUtility.GetPropertyGroupName(curveBindings[i + 1].propertyName) != AnimationWindowUtility.GetPropertyGroupName(binding.propertyName))) { TreeViewItem item2 = this.CreateNode(list2.ToArray(), item); if (item2 != null) { visibleItems.Add(item2); } list2.Clear(); } } visibleItems.Sort(); TreeViewUtility.SetChildParentReferences(visibleItems, item); return(item); }
public int CompareTo(AnimationWindowCurve obj) { bool flag = this.path.Equals(obj.path); if (!flag && this.depth != obj.depth) { return((this.depth >= obj.depth) ? 1 : -1); } bool flag2 = this.type == typeof(Transform) && obj.type == typeof(Transform) && flag; bool flag3 = (this.type == typeof(Transform) || obj.type == typeof(Transform)) && flag; if (flag2) { string nicePropertyGroupDisplayName = AnimationWindowUtility.GetNicePropertyGroupDisplayName(typeof(Transform), AnimationWindowUtility.GetPropertyGroupName(this.propertyName)); string nicePropertyGroupDisplayName2 = AnimationWindowUtility.GetNicePropertyGroupDisplayName(typeof(Transform), AnimationWindowUtility.GetPropertyGroupName(obj.propertyName)); if (nicePropertyGroupDisplayName.Contains("Position") && nicePropertyGroupDisplayName2.Contains("Rotation")) { return(-1); } if (nicePropertyGroupDisplayName.Contains("Rotation") && nicePropertyGroupDisplayName2.Contains("Position")) { return(1); } } else { if (flag3) { if (this.type == typeof(Transform)) { return(-1); } return(1); } else { if (this.path == obj.path && obj.type == this.type) { int componentIndex = AnimationWindowUtility.GetComponentIndex(obj.propertyName); int componentIndex2 = AnimationWindowUtility.GetComponentIndex(this.propertyName); if (componentIndex != -1 && componentIndex2 != -1 && this.propertyName.Substring(0, this.propertyName.Length - 2) == obj.propertyName.Substring(0, obj.propertyName.Length - 2)) { return(componentIndex2 - componentIndex); } } } } return((this.path + this.type + this.propertyName).CompareTo(obj.path + obj.type + obj.propertyName)); }
public int CompareTo(AnimationWindowCurve obj) { bool pathEquals = path.Equals(obj.path); bool typeEquals = obj.type == type; if (!pathEquals && depth != obj.depth) { int minLength = Math.Min(path.Length, obj.path.Length); int commonLength = 0; int index = 0; for (; index < minLength; ++index) { if (path[index] != obj.path[index]) { break; } if (path[index] == '/') { commonLength = index + 1; } } if (index == minLength) { commonLength = minLength; } string subPath1 = path.Substring(commonLength); string subPath2 = obj.path.Substring(commonLength); if (String.IsNullOrEmpty(subPath1)) { return(-1); } else if (String.IsNullOrEmpty(subPath2)) { return(1); } Regex r = new Regex(@"^[^\/]*\/"); Match match1 = r.Match(subPath1); string next1 = match1.Success ? match1.Value.Substring(0, match1.Value.Length - 1) : subPath1; Match match2 = r.Match(subPath2); string next2 = match2.Success ? match2.Value.Substring(0, match2.Value.Length - 1) : subPath2; return(next1.CompareTo(next2)); } bool sameTransformComponent = type == typeof(Transform) && obj.type == typeof(Transform) && pathEquals; bool oneIsTransformComponent = (type == typeof(Transform) || obj.type == typeof(Transform)) && pathEquals; // We want to sort position before rotation if (sameTransformComponent) { string propertyGroupA = AnimationWindowUtility.GetNicePropertyGroupDisplayName(typeof(Transform), AnimationWindowUtility.GetPropertyGroupName(propertyName)); string propertyGroupB = AnimationWindowUtility.GetNicePropertyGroupDisplayName(typeof(Transform), AnimationWindowUtility.GetPropertyGroupName(obj.propertyName)); if (propertyGroupA.Contains("Position") && propertyGroupB.Contains("Rotation")) { return(-1); } if (propertyGroupA.Contains("Rotation") && propertyGroupB.Contains("Position")) { return(1); } } // Transform component should always come first. else if (oneIsTransformComponent) { if (type == typeof(Transform)) { return(-1); } else { return(1); } } // Sort (.r, .g, .b, .a) and (.x, .y, .z, .w) if (pathEquals && typeEquals) { int lhsIndex = AnimationWindowUtility.GetComponentIndex(obj.propertyName); int rhsIndex = AnimationWindowUtility.GetComponentIndex(propertyName); if (lhsIndex != -1 && rhsIndex != -1 && propertyName.Substring(0, propertyName.Length - 2) == obj.propertyName.Substring(0, obj.propertyName.Length - 2)) { return(rhsIndex - lhsIndex); } } return((path + type + propertyName).CompareTo(obj.path + obj.type + obj.propertyName)); }
public List <AnimationWindowHierarchyNode> CreateTreeFromCurves() { List <AnimationWindowHierarchyNode> list = new List <AnimationWindowHierarchyNode>(); List <AnimationWindowCurve> list2 = new List <AnimationWindowCurve>(); AnimationWindowCurve[] array = this.state.allCurves.ToArray(); for (int i = 0; i < array.Length; i++) { AnimationWindowCurve animationWindowCurve = array[i]; AnimationWindowCurve animationWindowCurve2 = (i >= array.Length - 1) ? null : array[i + 1]; list2.Add(animationWindowCurve); bool flag = animationWindowCurve2 != null && AnimationWindowUtility.GetPropertyGroupName(animationWindowCurve2.propertyName) == AnimationWindowUtility.GetPropertyGroupName(animationWindowCurve.propertyName); bool flag2 = animationWindowCurve2 != null && animationWindowCurve.path.Equals(animationWindowCurve2.path) && animationWindowCurve.type == animationWindowCurve2.type; if (i == array.Length - 1 || !flag || !flag2) { if (list2.Count > 1) { list.Add(this.AddPropertyGroupToHierarchy(list2.ToArray(), (AnimationWindowHierarchyNode)this.m_RootItem)); } else { list.Add(this.AddPropertyToHierarchy(list2[0], (AnimationWindowHierarchyNode)this.m_RootItem)); } list2.Clear(); } } return(list); }
public int CompareTo(AnimationWindowCurve obj) { if (!path.Equals(obj.path)) { return(ComparePaths(obj.path)); } bool sameTransformComponent = type == typeof(Transform) && obj.type == typeof(Transform); bool oneIsTransformComponent = (type == typeof(Transform) || obj.type == typeof(Transform)); // We want to sort position before rotation if (sameTransformComponent) { string propertyGroupA = AnimationWindowUtility.GetNicePropertyGroupDisplayName(typeof(Transform), AnimationWindowUtility.GetPropertyGroupName(propertyName)); string propertyGroupB = AnimationWindowUtility.GetNicePropertyGroupDisplayName(typeof(Transform), AnimationWindowUtility.GetPropertyGroupName(obj.propertyName)); if (propertyGroupA.Contains("Position") && propertyGroupB.Contains("Rotation")) { return(-1); } if (propertyGroupA.Contains("Rotation") && propertyGroupB.Contains("Position")) { return(1); } } // Transform component should always come first. else if (oneIsTransformComponent) { if (type == typeof(Transform)) { return(-1); } else { return(1); } } // Sort (.r, .g, .b, .a) and (.x, .y, .z, .w) if (obj.type == type) { int lhsIndex = AnimationWindowUtility.GetComponentIndex(obj.propertyName); int rhsIndex = AnimationWindowUtility.GetComponentIndex(propertyName); if (lhsIndex != -1 && rhsIndex != -1 && propertyName.Substring(0, propertyName.Length - 2) == obj.propertyName.Substring(0, obj.propertyName.Length - 2)) { return(rhsIndex - lhsIndex); } } return(string.Compare((path + type + propertyName), obj.path + obj.type + obj.propertyName, StringComparison.Ordinal)); }
public AnimationWindowHierarchyPropertyGroupNode(Type animatableObjectType, int setId, string propertyName, string path, TreeViewItem parent) : base(AnimationWindowUtility.GetPropertyNodeID(setId, path, animatableObjectType, propertyName), (parent == null) ? -1 : (parent.depth + 1), parent, animatableObjectType, AnimationWindowUtility.GetPropertyGroupName(propertyName), path, AnimationWindowUtility.GetNicePropertyGroupDisplayName(animatableObjectType, propertyName)) { }
public List <AnimationWindowHierarchyNode> CreateTreeFromCurves() { List <AnimationWindowHierarchyNode> windowHierarchyNodeList = new List <AnimationWindowHierarchyNode>(); List <AnimationWindowCurve> animationWindowCurveList = new List <AnimationWindowCurve>(); AnimationWindowCurve[] array = this.state.allCurves.ToArray(); for (int index = 0; index < array.Length; ++index) { AnimationWindowCurve animationWindowCurve1 = array[index]; AnimationWindowCurve animationWindowCurve2 = index >= array.Length - 1 ? (AnimationWindowCurve)null : array[index + 1]; animationWindowCurveList.Add(animationWindowCurve1); bool flag1 = animationWindowCurve2 != null && AnimationWindowUtility.GetPropertyGroupName(animationWindowCurve2.propertyName) == AnimationWindowUtility.GetPropertyGroupName(animationWindowCurve1.propertyName); bool flag2 = animationWindowCurve2 != null && animationWindowCurve1.path.Equals(animationWindowCurve2.path) && animationWindowCurve1.type == animationWindowCurve2.type; if (index == array.Length - 1 || !flag1 || !flag2) { if (animationWindowCurveList.Count > 1) { windowHierarchyNodeList.Add((AnimationWindowHierarchyNode)this.AddPropertyGroupToHierarchy(animationWindowCurveList.ToArray(), (AnimationWindowHierarchyNode)this.m_RootItem)); } else { windowHierarchyNodeList.Add((AnimationWindowHierarchyNode)this.AddPropertyToHierarchy(animationWindowCurveList[0], (AnimationWindowHierarchyNode)this.m_RootItem)); } animationWindowCurveList.Clear(); } } return(windowHierarchyNodeList); }