void _UpdateModelMorph() { if (_modelMorph != null) { if (string.IsNullOrEmpty(this.morphName) || _modelMorph.name != this.morphName) { if (_modelMorph.weight != 0.0f || _modelMorph.weight2 != 0.0f) { _inactiveModelMorphSet.Add(_modelMorph); } _modelMorph = null; } } if (_modelMorph == null) { if (_model != null) { _modelMorph = _model.GetMorph(this.morphName); if (_modelMorph != null && _inactiveModelMorphSet != null) { _inactiveModelMorphSet.Remove(_modelMorph); } } } }
void _PlayAnim(Anim anim) { _StopAnim(); // _playingAnim = null; _animTime = 0.0f; this.animName = ""; if (anim != null) { this.playingAnimName = anim.animName; } MMD4MecanimAnim.UpdateAnimModel(this, anim, _animTime); // _playingAnim = anim; if (_playingAnim != null && _inactiveModelMorphSet != null) { if (_playingAnim.morphMotionList != null) { for (int i = 0; i != _playingAnim.morphMotionList.Length; ++i) { _playingAnim.morphMotionList[i].lastKeyFrameIndex = 0; Morph morph = (Morph)(_playingAnim.morphMotionList[i].morph); if (morph != null) { _inactiveModelMorphSet.Remove(morph); } } } } }
void UpdatePreferredMorphs() { foreach (string morphName in preferredMorphs) { if (preferredModelMorphDict_.ContainsKey(morphName)) { continue; } // already included MMD4MecanimModel.Morph modelMorph = model_.GetMorph(morphName); if (modelMorph == null) { continue; } // not found preferredModelMorphDict_.Add(morphName, modelMorph); } }
void _StopAnim() { if (_playingAnim != null && _inactiveModelMorphSet != null) { if (_playingAnim.morphMotionList != null) { for (int i = 0; i != _playingAnim.morphMotionList.Length; ++i) { _playingAnim.morphMotionList[i].lastKeyFrameIndex = 0; Morph morph = (Morph)(_playingAnim.morphMotionList[i].morph); if (morph != null && (morph.weight != 0.0f || morph.weight2 != 0.0f)) { _inactiveModelMorphSet.Add(morph); } } } } MMD4MecanimAnim.StopAnimModel(this); // _playingAnim = null; _animTime = 0.0f; this.playingAnimName = ""; }