// Changing rotation interpolation will change the propertynames of the curves // Propertynames are used in treeview node IDs, so we need to anticipate the new IDs by injecting them into treeview state // This way treeview state (selection and expanding) will be preserved once the curve data is eventually reloaded private void MaintainTreeviewStateAfterRotationInterpolation(RotationCurveInterpolation.Mode newMode) { List <int> selectedInstaceIDs = state.hierarchyState.selectedIDs; List <int> expandedInstaceIDs = state.hierarchyState.expandedIDs; List <int> oldIDs = new List <int>(); List <int> newIds = new List <int>(); for (int i = 0; i < selectedInstaceIDs.Count; i++) { AnimationWindowHierarchyNode node = state.hierarchyData.FindItem(selectedInstaceIDs[i]) as AnimationWindowHierarchyNode; if (node != null && !node.propertyName.Equals(RotationCurveInterpolation.GetPrefixForInterpolation(newMode))) { string oldPrefix = node.propertyName.Split('.')[0]; string newPropertyName = node.propertyName.Replace(oldPrefix, RotationCurveInterpolation.GetPrefixForInterpolation(newMode)); // old treeview node id oldIDs.Add(selectedInstaceIDs[i]); // and its new replacement newIds.Add((node.path + node.animatableObjectType.Name + newPropertyName).GetHashCode()); } } // Replace old IDs with new ones for (int i = 0; i < oldIDs.Count; i++) { if (selectedInstaceIDs.Contains(oldIDs[i])) { int index = selectedInstaceIDs.IndexOf(oldIDs[i]); selectedInstaceIDs[index] = newIds[i]; } if (expandedInstaceIDs.Contains(oldIDs[i])) { int index = expandedInstaceIDs.IndexOf(oldIDs[i]); expandedInstaceIDs[index] = newIds[i]; } if (state.hierarchyState.lastClickedID == oldIDs[i]) { state.hierarchyState.lastClickedID = newIds[i]; } } state.hierarchyState.selectedIDs = new List <int>(selectedInstaceIDs); state.hierarchyState.expandedIDs = new List <int>(expandedInstaceIDs); }
private void MaintainTreeviewStateAfterRotationInterpolation(RotationCurveInterpolation.Mode newMode) { List <int> selectedIDs = this.state.hierarchyState.selectedIDs; List <int> expandedIDs = this.state.hierarchyState.expandedIDs; List <int> list3 = new List <int>(); List <int> list4 = new List <int>(); for (int i = 0; i < selectedIDs.Count; i++) { AnimationWindowHierarchyNode node = this.state.hierarchyData.FindItem(selectedIDs[i]) as AnimationWindowHierarchyNode; if ((node != null) && !node.propertyName.Equals(RotationCurveInterpolation.GetPrefixForInterpolation(newMode))) { char[] separator = new char[] { '.' }; string oldValue = node.propertyName.Split(separator)[0]; string str2 = node.propertyName.Replace(oldValue, RotationCurveInterpolation.GetPrefixForInterpolation(newMode)); list3.Add(selectedIDs[i]); list4.Add((node.path + node.animatableObjectType.Name + str2).GetHashCode()); } } for (int j = 0; j < list3.Count; j++) { if (selectedIDs.Contains(list3[j])) { int index = selectedIDs.IndexOf(list3[j]); selectedIDs[index] = list4[j]; } if (expandedIDs.Contains(list3[j])) { int num4 = expandedIDs.IndexOf(list3[j]); expandedIDs[num4] = list4[j]; } if (this.state.hierarchyState.lastClickedID == list3[j]) { this.state.hierarchyState.lastClickedID = list4[j]; } } this.state.hierarchyState.selectedIDs = new List <int>(selectedIDs); this.state.hierarchyState.expandedIDs = new List <int>(expandedIDs); }
public static string CreateRawQuaternionsBindingName(string componentName) { return($"{RotationCurveInterpolation.GetPrefixForInterpolation(RotationCurveInterpolation.Mode.RawQuaternions)}.{componentName}"); }
private void MaintainTreeviewStateAfterRotationInterpolation(RotationCurveInterpolation.Mode newMode) { List <int> selectedIDs = this.state.m_hierarchyState.selectedIDs; List <int> expandedIDs = this.state.m_hierarchyState.expandedIDs; List <int> list = new List <int>(); List <int> list2 = new List <int>(); for (int i = 0; i < selectedIDs.Count; i++) { AnimationWindowHierarchyNode animationWindowHierarchyNode = this.state.m_HierarchyData.FindItem(selectedIDs[i]) as AnimationWindowHierarchyNode; if (animationWindowHierarchyNode != null && !animationWindowHierarchyNode.propertyName.Equals(RotationCurveInterpolation.GetPrefixForInterpolation(newMode))) { string oldValue = animationWindowHierarchyNode.propertyName.Split(new char[] { '.' })[0]; string str = animationWindowHierarchyNode.propertyName.Replace(oldValue, RotationCurveInterpolation.GetPrefixForInterpolation(newMode)); list.Add(selectedIDs[i]); list2.Add((animationWindowHierarchyNode.path + animationWindowHierarchyNode.animatableObjectType.Name + str).GetHashCode()); } } for (int j = 0; j < list.Count; j++) { if (selectedIDs.Contains(list[j])) { int index = selectedIDs.IndexOf(list[j]); selectedIDs[index] = list2[j]; } if (expandedIDs.Contains(list[j])) { int index2 = expandedIDs.IndexOf(list[j]); expandedIDs[index2] = list2[j]; } if (this.state.m_hierarchyState.lastClickedID == list[j]) { this.state.m_hierarchyState.lastClickedID = list2[j]; } } this.state.m_hierarchyState.selectedIDs = new List <int>(selectedIDs); this.state.m_hierarchyState.expandedIDs = new List <int>(expandedIDs); }
private void MaintainTreeviewStateAfterRotationInterpolation(RotationCurveInterpolation.Mode newMode) { List <int> selectedIds = this.state.hierarchyState.selectedIDs; List <int> expandedIds = this.state.hierarchyState.expandedIDs; List <int> intList1 = new List <int>(); List <int> intList2 = new List <int>(); for (int index = 0; index < selectedIds.Count; ++index) { AnimationWindowHierarchyNode windowHierarchyNode = this.state.hierarchyData.FindItem(selectedIds[index]) as AnimationWindowHierarchyNode; if (windowHierarchyNode != null && !windowHierarchyNode.propertyName.Equals(RotationCurveInterpolation.GetPrefixForInterpolation(newMode))) { string oldValue = windowHierarchyNode.propertyName.Split('.')[0]; string str = windowHierarchyNode.propertyName.Replace(oldValue, RotationCurveInterpolation.GetPrefixForInterpolation(newMode)); intList1.Add(selectedIds[index]); intList2.Add((windowHierarchyNode.path + windowHierarchyNode.animatableObjectType.Name + str).GetHashCode()); } } for (int index1 = 0; index1 < intList1.Count; ++index1) { if (selectedIds.Contains(intList1[index1])) { int index2 = selectedIds.IndexOf(intList1[index1]); selectedIds[index2] = intList2[index1]; } if (expandedIds.Contains(intList1[index1])) { int index2 = expandedIds.IndexOf(intList1[index1]); expandedIds[index2] = intList2[index1]; } if (this.state.hierarchyState.lastClickedID == intList1[index1]) { this.state.hierarchyState.lastClickedID = intList2[index1]; } } this.state.hierarchyState.selectedIDs = new List <int>((IEnumerable <int>)selectedIds); this.state.hierarchyState.expandedIDs = new List <int>((IEnumerable <int>)expandedIds); }