예제 #1
0
 internal void SetMesh(UnityEngine.Config.FileMap fms)
 {
     this.fms = fms;
     if (IsValid())
     {
         mesh_raw = Resources.GetMeshImport(fms);
     }
 }
예제 #2
0
 internal static AudioClip GetAudioClip(UnityEngine.Config.FileMap fms)
 {
     if (fms.IsEmpty())
     {
         return(null);
     }
     return(GetAudioClip(fms.guid));
 }
예제 #3
0
 public void Init(UnityEngine.Config.Material mat)
 {
     shader = Resources.GetShader(mat.m_Shader);
     UnityEngine.Config.FileMap fms = mat.m_SavedProperties.m_TexEnvs[0].data.second.m_Texture;
     if (fms.IsEmpty())
     {
         mainTexture = null;
     }
     else
     {
         // Hack, need to read TextureImporter from fms.
         string guid = mat.m_SavedProperties.m_TexEnvs[0].data.second.m_Texture.guid;
         mainTexture         = Resources.GetTexture(guid);
         mainTextureOffset.x = mat.m_SavedProperties.m_TexEnvs[0].data.second.m_Offset.x;
         mainTextureOffset.y = mat.m_SavedProperties.m_TexEnvs[0].data.second.m_Offset.y;
         mainTextureScale.x  = mat.m_SavedProperties.m_TexEnvs[0].data.second.m_Scale.x;
         mainTextureScale.y  = mat.m_SavedProperties.m_TexEnvs[0].data.second.m_Scale.y;
     }
 }
예제 #4
0
 internal static Shader GetShader(UnityEngine.Config.FileMap fms)
 {
     if (!shaders.ContainsKey(fms.Key()))
     {
         // get a shader from fms.
         var m = rmManager.GetFromInfo(fms);
         if (m == null)          // it is maybe a internal shader, need to manual return here.
         {
             var shader = new Shader();
             shader._Init(fms);
             shader.name        = "";
             shaders[fms.Key()] = shader;
         }
         else
         {
             var shader = new Shader();
             shader._Init(fms);
             shader.name        = m.p0;
             shaders[fms.Key()] = shader;
         }
     }
     return(shaders[fms.Key()]);
 }
예제 #5
0
 internal string GetNameFromFileMap(UnityEngine.Config.FileMap fms)
 {
     return(config.fileIDToRecycleName.GetValueFromKey(fms.fileID));
 }
예제 #6
0
 internal static Texture GetTexture(UnityEngine.Config.FileMap fms)
 {
     return(GetTexture(fms.guid));
 }
예제 #7
0
 internal static MeshImport GetMeshImport(UnityEngine.Config.FileMap fms)
 {
     return(GetMeshImport(fms.guid));
 }
예제 #8
0
        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);
        }
예제 #9
0
 internal static Material GetMaterial(UnityEngine.Config.FileMap fms)
 {
     return(GetMaterial(fms.guid));
 }
예제 #10
0
 internal void _Init(UnityEngine.Config.FileMap fms)
 {
     this.fms = fms;
 }