public void OnChildTransform(GameObject obj) { if (!obj.activeInHierarchy) { return; } int index = Components.IndexOf(obj); if (index < 0) { return; } int[] mat = Matrix.TransformToMatrix2x3(obj.transform); ST_frame frame = CurrentAction.frames[FrameIndex]; frame.parts[index].mat = mat; OwnerPackage.OnPackageChanged(AniPackID); /* string x = ""; * foreach (int i in mat) * x += " " + i.ToString(); * Debug.Log(x);*/ }
public void AniStep() { if (Components == null) { return; } ST_action action = CurrentAction; if (FrameIndex < 0 || FrameIndex >= action.frames.Length) { return; } ST_frame frame = action.frames[FrameIndex]; VisibleInFrame.Clear(); for (int i = 0; i < frame.parts.Length; i++) { ST_frame_part part = frame.parts[i]; if (part.index >= 0 && part.index < Components.Count) { GameObject obj = Components[part.index]; VisibleInFrame.Add(obj); obj.SetActive(true); var mat = Matrix.ToMatrix4x4(part.mat, -i * 1.0f); Matrix.SetTransformFromMatrix(obj.transform, ref mat); } else { //Debug.LogError("components out of range"); } } if (VisibleInFrame.Count != Components.Count) { foreach (var obj in Components) { if (!VisibleInFrame.Contains(obj)) { obj.SetActive(false); } } } }