public void SetFromRaw(UnityEngine.Config.ModelImporterAnimationClip raw) { this.raw = raw; this.name = raw.name; }
internal static AnimationClip GetAnimationClip(UnityEngine.Config.FileMap fms) { if (fms.IsEmpty()) { return(null); } MeshImport mi = GetMeshImport(fms); if (mi == null || mi.config == null || mi.config.importAnimation == 0) { return(null); } var key = fms.Key(); if (animationClips.ContainsKey(key)) { return(animationClips[key]); } // find name from fileID var name = mi.config.fileIDToRecycleName.GetValueFromKey(fms.fileID); if (String.IsNullOrEmpty(name)) { return(null); } foreach (var c in mi.config.animations.clipAnimations) { if (c.name == name) { var clip = new AnimationClip(); clip.SetFromRaw(c); animationClips[key] = clip; return(clip); } } // if the name is not found in the file. it is the default. var rm = rmManager.GetFromInfo(fms); if (rm == null) { return(null); } var rawclip = new UnityEngine.Config.ModelImporterAnimationClip(); rawclip.firstFrame = 0; rawclip.lastFrame = 30; rawclip.wrapMode = 1; var antStarts = rm.name.IndexOf("@"); if (antStarts != -1) { rawclip.name = rm.name.Substring(antStarts + 1); } else { rawclip.name = name; } var aclip = new AnimationClip(); aclip.SetFromRaw(rawclip); animationClips[key] = aclip; return(aclip); }