public static Patch ( |
||
serializedObject | ||
classID | int | |
oldName | string | |
newName | string | |
return | void |
private void PatchDefaultClipTakeNamesToSplitClipNames() { foreach (TakeInfo info in this.singleImporter.importedTakeInfos) { PatchImportSettingRecycleID.Patch(base.serializedObject, 0x4a, info.name, info.defaultClipName); } }
// When switching to explicitly defined clips, we must fix up the recycleID's to not lose AnimationClip references. // When m_ClipAnimations is defined, the clips are identified by the clipName // When m_ClipAnimations is not defined, the clips are identified by the takeName void PatchDefaultClipTakeNamesToSplitClipNames() { foreach (TakeInfo takeInfo in singleImporter.importedTakeInfos) { PatchImportSettingRecycleID.Patch(serializedObject, 74, takeInfo.name, takeInfo.defaultClipName); } }
private void PatchDefaultClipTakeNamesToSplitClipNames() { TakeInfo[] importedTakeInfos = this.singleImporter.importedTakeInfos; for (int i = 0; i < importedTakeInfos.Length; i++) { TakeInfo takeInfo = importedTakeInfos[i]; PatchImportSettingRecycleID.Patch(base.serializedObject, 74, takeInfo.name, takeInfo.defaultClipName); } }
private void AnimationSplitTable() { if (this.m_ClipList == null) { this.m_ClipList = new ReorderableList(new List <AnimationClipInfoProperties>(), typeof(string), false, true, true, true); this.m_ClipList.onAddCallback = new ReorderableList.AddCallbackDelegate(this.AddClipInList); this.m_ClipList.onSelectCallback = new ReorderableList.SelectCallbackDelegate(this.SelectClipInList); this.m_ClipList.onRemoveCallback = new ReorderableList.RemoveCallbackDelegate(this.RemoveClipInList); this.m_ClipList.drawElementCallback = new ReorderableList.ElementCallbackDelegate(this.DrawClipElement); this.m_ClipList.drawHeaderCallback = new ReorderableList.HeaderCallbackDelegate(this.DrawClipHeader); this.m_ClipList.elementHeight = 16f; this.UpdateList(); this.m_ClipList.index = this.selectedClipIndex; } this.m_ClipList.DoLayoutList(); EditorGUI.BeginChangeCheck(); AnimationClipInfoProperties selectedClipInfo = this.GetSelectedClipInfo(); if (selectedClipInfo != null) { if ((this.m_AnimationClipEditor != null) && (this.selectedClipIndex != -1)) { GUILayout.Space(5f); AnimationClip target = this.m_AnimationClipEditor.target as AnimationClip; if (!target.legacy) { this.GetSelectedClipInfo().AssignToPreviewClip(target); } TakeInfo[] importedTakeInfos = this.singleImporter.importedTakeInfos; string[] array = new string[importedTakeInfos.Length]; for (int i = 0; i < importedTakeInfos.Length; i++) { array[i] = importedTakeInfos[i].name; } EditorGUI.BeginChangeCheck(); string name = selectedClipInfo.name; int index = ArrayUtility.IndexOf <string>(array, selectedClipInfo.takeName); this.m_AnimationClipEditor.takeNames = array; this.m_AnimationClipEditor.takeIndex = ArrayUtility.IndexOf <string>(array, selectedClipInfo.takeName); this.m_AnimationClipEditor.DrawHeader(); if (EditorGUI.EndChangeCheck()) { if (selectedClipInfo.name != name) { this.TransferDefaultClipsToCustomClips(); PatchImportSettingRecycleID.Patch(base.serializedObject, 0x4a, name, selectedClipInfo.name); } int takeIndex = this.m_AnimationClipEditor.takeIndex; if ((takeIndex != -1) && (takeIndex != index)) { selectedClipInfo.name = this.MakeUniqueClipName(array[takeIndex], -1); this.SetupTakeNameAndFrames(selectedClipInfo, importedTakeInfos[takeIndex]); GUIUtility.keyboardControl = 0; this.SelectClip(this.selectedClipIndex); target = this.m_AnimationClipEditor.target as AnimationClip; } } this.m_AnimationClipEditor.OnInspectorGUI(); if (!target.legacy) { this.GetSelectedClipInfo().ExtractFromPreviewClip(target); } } if (EditorGUI.EndChangeCheck()) { this.TransferDefaultClipsToCustomClips(); } } }
void AnimationSplitTable() { if (m_ClipList == null) { m_ClipList = new ReorderableList(new List <AnimationClipInfoProperties>(), typeof(string), false, true, true, true); m_ClipList.onAddCallback = AddClipInList; m_ClipList.onSelectCallback = SelectClipInList; m_ClipList.onRemoveCallback = RemoveClipInList; m_ClipList.drawElementCallback = DrawClipElement; m_ClipList.drawHeaderCallback = DrawClipHeader; m_ClipList.elementHeight = 16; UpdateList(); m_ClipList.index = selectedClipIndex; } m_ClipList.DoLayoutList(); EditorGUI.BeginChangeCheck(); // Show selected clip info { AnimationClipInfoProperties clip = GetSelectedClipInfo(); if (clip == null) { return; } if (m_AnimationClipEditor != null && selectedClipIndex != -1) { GUILayout.Space(5); AnimationClip actualClip = m_AnimationClipEditor.target as AnimationClip; if (!actualClip.legacy) { GetSelectedClipInfo().AssignToPreviewClip(actualClip); } TakeInfo[] importedTakeInfos = singleImporter.importedTakeInfos; string[] takeNames = new string[importedTakeInfos.Length]; for (int i = 0; i < importedTakeInfos.Length; i++) { takeNames[i] = importedTakeInfos[i].name; } EditorGUI.BeginChangeCheck(); string currentName = clip.name; int takeIndex = ArrayUtility.IndexOf(takeNames, clip.takeName); m_AnimationClipEditor.takeNames = takeNames; m_AnimationClipEditor.takeIndex = ArrayUtility.IndexOf(takeNames, clip.takeName); m_AnimationClipEditor.DrawHeader(); if (EditorGUI.EndChangeCheck()) { // We renamed the clip name, try to maintain the localIdentifierInFile so we don't lose any data. if (clip.name != currentName) { TransferDefaultClipsToCustomClips(); PatchImportSettingRecycleID.Patch(serializedObject, 74, currentName, clip.name); } int newTakeIndex = m_AnimationClipEditor.takeIndex; if (newTakeIndex != -1 && newTakeIndex != takeIndex) { clip.name = MakeUniqueClipName(takeNames[newTakeIndex]); SetupTakeNameAndFrames(clip, importedTakeInfos[newTakeIndex]); GUIUtility.keyboardControl = 0; SelectClip(selectedClipIndex); // actualClip has been changed by SelectClip actualClip = m_AnimationClipEditor.target as AnimationClip; } } m_AnimationClipEditor.OnInspectorGUI(); AvatarMaskSettings(GetSelectedClipInfo()); if (!actualClip.legacy) { GetSelectedClipInfo().ExtractFromPreviewClip(actualClip); } } } if (EditorGUI.EndChangeCheck() || m_AnimationClipEditor.needsToGenerateClipInfo) { TransferDefaultClipsToCustomClips(); m_AnimationClipEditor.needsToGenerateClipInfo = false; } }