public void LoadBonePoseFile(string path) { if (_model == null) { Debug.LogWarning("model not loaded yet, skip LoadBonePoseFile"); return; } _bonePoseFileStorage = new BonePoseFileStorage(_model, path); StopBonePoseCalculation(); }
private void ReleaseBonePoseFile() { if (_bonePoseFileStorage == null) { return; } _bonePoseFileStorage.Release(); _bonePoseFileStorage = null; BonePoseFilePath = null; }
public bool LoadModel(string path)//OYM:根据路径加载模型 { ModelPath = path; try { DoLoadModel(path);//OYM:加载模型 } catch (Exception e) { Debug.LogException(e); return(false); } if (_bonePoseFileStorage != null) { _bonePoseFileStorage.Release(); _bonePoseFileStorage = null; } Utils.ClearAllTransformChild(transform); _bones = CreateBones(gameObject); if (PhysicsMode == PhysicsModeEnum.Unity) { CreateUnityPhysicsCompoments(); } _morphVertexCache = new Vector3[_model.Vertices.Length]; if (Mesh != null) { LoadMaterials(); GetComponent <MeshFilter>().mesh = Mesh; BuildBindpose(Mesh, GetComponent <SkinnedMeshRenderer>(), true); } else { GetComponent <MeshFilter>().mesh = null; CreatePartObjects(); _partMorphVertexCache = new List <Vector3[]>(); foreach (var partIndex in _partIndexes) { _partMorphVertexCache.Add(new Vector3[partIndex.Count]); } } if (_motion != null) { ResetMotionPlayer(); } _playTime = 0.0; RestartBonePoseCalculation(0.0f, 1 / PhysicsFps); UpdateBones(); return(true); }
private void Release() { if (_materialLoader != null) { _materialLoader.Dispose(); _materialLoader = null; } if (_bonePoseFileStorage != null) { _bonePoseFileStorage.Release(); _bonePoseFileStorage = null; } StopBonePoseCalculation(); }
private void Release() //OYM:发布 { if (_materialLoader != null) { _materialLoader.Dispose();//OYM:添加材质,写到这里我快饿死了,工作完成差不多三成 _materialLoader = null; } if (_bonePoseFileStorage != null) { _bonePoseFileStorage.Release(); _bonePoseFileStorage = null; } StopBonePoseCalculation(); }