protected virtual void OnClickedAuto() { FTail_AnimatorBase tail = target as FTail_AnimatorBase; if (tail.TailTransforms.Count <= 1) { tail.AutoGetTailTransforms(true); } else { if (tail.TailTransforms[0] == null) { tail.AutoGetTailTransforms(true); } else { bool isnull = false; for (int i = 0; i < tail.TailTransforms.Count; i++) { if (tail.TailTransforms[i] == null) { isnull = true; break; } } if (isnull) { for (int i = 1; i < tail.TailTransforms.Count; i++) { if (tail.TailTransforms[i - 1].childCount == 0) { break; } tail.TailTransforms[i] = tail.TailTransforms[i - 1].GetChild(0); } } else { Transform first = tail.TailTransforms[0]; tail.TailTransforms.Clear(); tail.TailTransforms.Add(first); tail.AutoGetTailTransforms(true); } } } }
protected void DrawAddTailButtons(FTail_AnimatorBase tail) { // V1.2.2 if (GUILayout.Button("Auto", new GUILayoutOption[2] { GUILayout.MaxWidth(48), GUILayout.MaxHeight(14) })) { if (tail.TailTransforms.Count <= 1) { tail.AutoGetTailTransforms(true); } else { if (tail.TailTransforms[0] == null) { tail.AutoGetTailTransforms(true); } else { bool isnull = false; for (int i = 0; i < tail.TailTransforms.Count; i++) { if (tail.TailTransforms[i] == null) { isnull = true; break; } } if (isnull) { for (int i = 1; i < tail.TailTransforms.Count; i++) { if (tail.TailTransforms[i - 1].childCount == 0) { break; } tail.TailTransforms[i] = tail.TailTransforms[i - 1].GetChild(0); } } else { Transform first = tail.TailTransforms[0]; tail.TailTransforms.Clear(); tail.TailTransforms.Add(first); tail.AutoGetTailTransforms(true); } } } } if (GUILayout.Button("+", new GUILayoutOption[2] { GUILayout.MaxWidth(28), GUILayout.MaxHeight(14) })) { if (tail.TailTransforms.Count == 0) { drawTailBones = true; } tail.TailTransforms.Add(null); } if (GUILayout.Button("-", new GUILayoutOption[2] { GUILayout.MaxWidth(28), GUILayout.MaxHeight(14) })) { if (tail.TailTransforms.Count > 0) { tail.TailTransforms.RemoveAt(tail.TailTransforms.Count - 1); } } }