public void LoadData(MotionData data)
 {
     if (Data != data)
     {
         if (Data != null)
         {
             if (Save)
             {
                 Data.Save();
             }
             Data.Unload();
         }
         if (Character == null && Actor != null)
         {
             Utility.Destroy(Actor.gameObject);
         }
         Data = data;
         if (Data != null)
         {
             Data.Load();
             LoadBoneMapping();
             LoadFrame(0f);
         }
     }
 }
示例#2
0
    public MotionData LoadData(string guid)
    {
        if (guid != null && Data != null && Data.GetName() == Utility.GetAssetName(guid))
        {
            return(Data);
        }
        MotionData data = GetAsset(guid);

        if (Data != data)
        {
            //Unload Previous
            UnloadData();

            //Character
            if (Model == null && Actor != null)
            {
                Utility.Destroy(Actor.gameObject);
            }

            //Load Next
            Data = data;
            if (Data != null)
            {
                Data.Load(this);
                LoadFrame(0f);
            }

            //Assign Index
            AssetIndex = FindIndex(Assets, Utility.GetAssetGUID(Data));
        }
        return(Data);
    }
 public void LoadFile()
 {
     if (!File.Exists(Path))
     {
         Debug.Log("File at path " + Path + " does not exist.");
         return;
     }
     Data = ScriptableObject.CreateInstance <MotionData>();
     Data.Load(Path);
     Playing   = false;
     PlayTime  = 0f;
     Timestamp = Utility.GetTimestamp();
     Timescale = 1f;
     CheckSkeleton();
 }