8 private static Transform[] m_objs;
9 private static Vector3[] m_positions;
10 private static Quaternion[] m_rotations;
11 private static Vector3[] m_scales;
13 [MenuItem(
"GameObject/SoxATK/AnimPose/Copy with Children",
false, 12)]
14 static void AnimPoseCopy()
18 if (Selection.gameObjects.Length != 1)
20 EditorUtility.DisplayDialog(
"Anim pose Copy & Paste",
"Please select one object",
"OK");
24 m_objs = Selection.activeGameObject.GetComponentsInChildren<Transform>();
25 m_positions =
new Vector3[m_objs.Length];
26 m_rotations =
new Quaternion[m_objs.Length];
27 m_scales =
new Vector3[m_objs.Length];
29 for (
int i = 0; i < m_objs.Length; i++)
31 m_positions[i] = m_objs[i].localPosition;
32 m_rotations[i] = m_objs[i].localRotation;
33 m_scales[i] = m_objs[i].localScale;
37 [MenuItem(
"GameObject/SoxATK/AnimPose/Copy with Children",
true)]
38 static bool ValidateAnimPoseCopy()
40 return (Selection.gameObjects.Length == 1);
43 [MenuItem(
"GameObject/SoxATK/AnimPose/Paste with Children",
false, 12)]
44 private static void AnimPosePaste()
48 if (Selection.gameObjects.Length != 1)
50 EditorUtility.DisplayDialog(
"Anim pose Copy & Paste",
"Please select one object",
"OK");
55 if (m_objs.Length <= 0)
60 Transform[] selObjs = Selection.activeGameObject.GetComponentsInChildren<Transform>();
63 int minLength = Mathf.Min(m_objs.Length, selObjs.Length);
65 Undo.RecordObjects(selObjs,
"Anim Pose Paste");
66 for (
int i = 0; i < minLength; i++)
68 selObjs[i].localPosition = m_positions[i];
69 selObjs[i].localRotation = m_rotations[i];
70 selObjs[i].localScale = m_scales[i];
74 [MenuItem(
"GameObject/SoxATK/AnimPose/Paste with Children",
true)]
75 static bool ValidateAnimPosePaste()
77 return (Selection.gameObjects.Length == 1);