//추가 19.5.28 : Async용으로 다시 작성된 함수 public IEnumerator LinkAsync(apPortrait portrait, apAsyncTimer asyncTimer) { yield return(_sortedRenderBuffer.LinkAsync(portrait, this, asyncTimer)); for (int i = 0; i < _optTransforms.Count; i++) { _optTransforms[i].SetExtraDepthChangedEvent(OnExtraDepthChanged); } if (asyncTimer.IsYield()) { yield return(asyncTimer.WaitAndRestart()); } }
public IEnumerator LinkOptAsync(apAnimClip animClip, apAsyncTimer asyncTimer) { _parentAnimClip = animClip; animClip._portrait.RegistUniqueID(apIDManager.TARGET.AnimTimeline, _uniqueID); if (asyncTimer.IsYield()) { yield return(asyncTimer.WaitAndRestart()); } _linkedOptModifier = null; //TODO : linkedBone 연결하자 switch (_linkType) { case apAnimClip.LINK_TYPE.AnimatedModifier: { //_boneUniqueID = -1; if (_parentAnimClip._targetOptTranform != null) { _linkedOptModifier = _parentAnimClip._targetOptTranform.GetModifier(_modifierUniqueID); if (_linkedOptModifier == null) { Debug.LogError("AnyPortrait Error : Runtime Timeline Link Error - No Modifier [" + _modifierUniqueID + "]"); _modifierUniqueID = -1; } } } break; //case apAnimClip.LINK_TYPE.Bone: case apAnimClip.LINK_TYPE.ControlParam: _modifierUniqueID = -1; break; } for (int i = 0; i < _layers.Count; i++) { _layers[i].LinkOpt(animClip, this); } }
public IEnumerator LinkOptAsync(apPortrait portrait, apAsyncTimer asyncTimer) { _portrait = portrait; if (_targetMeshGroupID < 0) { //연결되지 않았네요. UnityEngine.Debug.LogError("AnyPortrait : Animation Clip [" + _name + "] : No MeshGroup Linked"); yield break; } _targetOptTranform = _portrait.GetOptTransformAsMeshGroup(_targetMeshGroupID); //추가 : 여기서 FPS 관련 코드 확인 if (_FPS < 1) { _FPS = 1; } _secPerFrame = 1.0f / (float)_FPS; if (_targetOptTranform == null) { //UnityEngine.Debug.LogError("AnimClip이 적용되는 Target Opt Transform이 Null이다. [" + _targetMeshGroupID + "] (" + _name + ")"); //이 AnimClip을 사용하지 맙시다. yield break; } for (int i = 0; i < _timelines.Count; i++) { yield return(_timelines[i].LinkOptAsync(this, asyncTimer)); } if (asyncTimer.IsYield()) { yield return(asyncTimer.WaitAndRestart()); } }
public IEnumerator LinkAsync(apPortrait portrait, apOptRootUnit rootUnit, apAsyncTimer asyncTimer) { if (!_isBaked) { //return; yield break; } //_parentRootUnit = rootUnit; if (_nOptTransforms == 0) { //return; yield break; } OptBufferData curBuff = null; apOptTransform linkedOptTransform = null; if (_optTransform2Buff == null) { _optTransform2Buff = new Dictionary <apOptTransform, OptBufferData>(); } _optTransform2Buff.Clear(); for (int i = 0; i < _nOptTransforms; i++) { curBuff = _buffers[i]; linkedOptTransform = rootUnit.GetTransform(curBuff._optTransformID); if (linkedOptTransform == null) { curBuff._optTransform = null; continue; } curBuff._optTransform = linkedOptTransform; curBuff.ResetLink(); //OptTransform2Buff에도 연결 if (_optTransform2Buff.ContainsKey(linkedOptTransform)) { continue; } _optTransform2Buff.Add(linkedOptTransform, curBuff); //Async Wait if (asyncTimer.IsYield()) { yield return(asyncTimer.WaitAndRestart()); } } //OptTransform을 돌면서 부모/자식 관계를 연결해준다. apOptTransform parentOptTransform = null; OptBufferData parentBuff = null; for (int i = 0; i < _nOptTransforms; i++) { curBuff = _buffers[i]; linkedOptTransform = curBuff._optTransform; if (linkedOptTransform == null) { continue; } parentOptTransform = linkedOptTransform._parentTransform; if (parentOptTransform != null) { if (_optTransform2Buff.ContainsKey(parentOptTransform)) { parentBuff = _optTransform2Buff[parentOptTransform]; curBuff.SetParent(parentBuff); //<<부모로 연결 } } } _isNeedToSortDepthChangedBuffers = true; _isNeedToApplyDepthChangedBuffers = true; //현재 상태 + 이전 상태에 대해서 모두 값을 가지고 "상태가 바뀔 때" 이벤트를 호출해야한다. _isDepthChanged = false; _isDepthChanged_Prev = false; //<<에디터와 다르게 이 변수에 따라서 "다시 초기화"라는 이벤트를 만들어야 한다. //옵션에 따라 자동으로 Mesh의 Sorting Order를 설정해야한다. SetSortingOrderChangedAutomatically(true); //Async Wait if (asyncTimer.IsYield()) { yield return(asyncTimer.WaitAndRestart()); } }
public IEnumerator LinkAsync(apPortrait portrait, apOptTransform parentTransform, apAsyncTimer asyncTimer) { _portrait = portrait; //_parentTransform = _portrait.GetOptTransform(_parentTransformID); _parentTransform = parentTransform; for (int i = 0; i < _modifiers.Count; i++) { yield return(_modifiers[i].LinkAsync(portrait, _parentTransform, asyncTimer)); } _nModifiers = _modifiers.Count; if (asyncTimer.IsYield()) { yield return(asyncTimer.WaitAndRestart()); } }
// [런타임에서] Portrait를 연결하고, Portrait를 검색하여 animPlayData를 세팅한다. // 다른 Link가 모두 끝난뒤에 호출하자 /// <summary> /// Connect to Portrait and initialize it for runtime processing. /// </summary> /// <param name="portrait"></param> public IEnumerator LinkPortraitAsync(apPortrait portrait, apAsyncTimer asyncTimer) { _portrait = portrait; InitAndLink(); //Async Wait if (asyncTimer.IsYield()) { yield return(asyncTimer.WaitAndRestart()); } if (_animPlayDataList == null) { _animPlayDataList = new List <apAnimPlayData>(); } apAnimPlayData animPlayData = null; for (int i = 0; i < _animPlayDataList.Count; i++) { animPlayData = _animPlayDataList[i]; animPlayData._isValid = false; //일단 유효성 초기화 (나중에 값 넣으면 자동으로 true) apAnimClip animClip = _portrait.GetAnimClip(animPlayData._animClipID); apOptRootUnit rootUnit = _portrait._optRootUnitList.Find(delegate(apOptRootUnit a) { if (a._rootOptTransform != null) { if (a._rootOptTransform._meshGroupUniqueID == animPlayData._meshGroupID) { return(true); } } return(false); }); if (animClip != null && rootUnit != null) { animPlayData.Link(animClip, rootUnit); //추가 : 여기서 ControlParamResult를 미리 만들어서 이후에 AnimClip이 미리 만들수 있게 해주자 animClip.MakeAndLinkControlParamResults(); } //Async Wait if (asyncTimer.IsYield()) { yield return(asyncTimer.WaitAndRestart()); } } //추가 : 메카님 연동 _mecanim.LinkPortrait(portrait, this); //Async Wait if (asyncTimer.IsYield()) { yield return(asyncTimer.WaitAndRestart()); } if (portrait._isUsingMecanim && portrait._animator != null) { _isMecanim = true; } else { _isMecanim = false; } }
public IEnumerator LinkPortraitAsync(apPortrait portrait, apOptModifierUnitBase parentModifier, apAsyncTimer asyncTimer) { _portrait = portrait; _parentModifier = parentModifier; switch (_syncTarget) { case apModifierParamSetGroup.SYNC_TARGET.Static: break; case apModifierParamSetGroup.SYNC_TARGET.Controller: //_keyControlParam = _portrait.GetControlParam(_keyControlParamName); _keyControlParam = _portrait.GetControlParam(_keyControlParamID); break; case apModifierParamSetGroup.SYNC_TARGET.KeyFrame: _keyAnimClip = _portrait.GetAnimClip(_keyAnimClipID); if (_keyAnimClip == null) { Debug.LogError("Error : No AnimClip [" + _keyAnimClipID + "]"); break; } _keyAnimTimeline = _keyAnimClip.GetTimeline(_keyAnimTimelineID); if (_keyAnimTimeline == null) { Debug.LogError("Error : No AnimTimeline [" + _keyAnimTimelineID + "]"); break; } _keyAnimTimelineLayer = _keyAnimTimeline.GetTimelineLayer(_keyAnimTimelineLayerID); if (_keyAnimTimelineLayer == null) { Debug.LogError("Error : No AnimTimelineLayer [" + _keyAnimTimelineLayerID + "]"); break; } break; default: Debug.LogError("apOptParamSetGroup : 알수 없는 타입 : " + _syncTarget); break; } for (int i = 0; i < _paramSetList.Count; i++) { yield return(_paramSetList[i].LinkParamSetGroupAsync(this, portrait, asyncTimer)); } //Async Wait if (asyncTimer.IsYield()) { yield return(asyncTimer.WaitAndRestart()); } }
public IEnumerator LinkParamSetGroupAsync(apOptParamSetGroup paramSetGroup, apPortrait portrait, apAsyncTimer asyncTimer) { _parentParamSetGroup = paramSetGroup; _syncKeyframe = null; if (_keyframeUniqueID >= 0) { //TODO //_syncKeyframe = if (paramSetGroup._keyAnimTimelineLayer != null) { _syncKeyframe = paramSetGroup._keyAnimTimelineLayer.GetKeyframeByID(_keyframeUniqueID); } } if (asyncTimer.IsYield()) { yield return(asyncTimer.WaitAndRestart()); } if (_isUseModMeshSet) { //19.5.23 : 새로운 버전 for (int i = 0; i < _meshSetData.Count; i++) { _meshSetData[i].Link(portrait); if (asyncTimer.IsYield()) { yield return(asyncTimer.WaitAndRestart()); } } } else { //이전 버전 for (int i = 0; i < _meshData.Count; i++) { _meshData[i].Link(portrait); if (asyncTimer.IsYield()) { yield return(asyncTimer.WaitAndRestart()); } } } //TODO : OptBone은 현재 Link할 객체가 없다. //필요하다면 Link를 여기에 추가해주자 }