public apTimelineLayerInfo(apAnimTimelineLayer timelineLayer, apAnimTimeline parentTimeline, apTimelineLayerInfo parentInfo) { _isTimeline = false; _layer = timelineLayer; _parentTimeline = parentTimeline; _parentInfo = parentInfo; _isSelected = false; _isAvailable = true; if (_layer._linkType == apAnimClip.LINK_TYPE.AnimatedModifier) { switch (_layer._linkModType) { case apAnimTimelineLayer.LINK_MOD_TYPE.None: _layerType = LAYER_TYPE.Transform; break; case apAnimTimelineLayer.LINK_MOD_TYPE.MeshTransform: case apAnimTimelineLayer.LINK_MOD_TYPE.MeshGroupTransform: _layerType = LAYER_TYPE.Transform; break; case apAnimTimelineLayer.LINK_MOD_TYPE.Bone: _layerType = LAYER_TYPE.Bone; break; } } else //if(_layer._linkType == apAnimClip.LINK_TYPE.ControlParam) { _layerType = LAYER_TYPE.ControlParam; } }
// Init //------------------------------------------------------------------------ public void Init(FUNC_RETARGET_SINGLE_POSE_IMPORT_ANIM funcResult_Anim, FUNC_RETARGET_SINGLE_POSE_IMPORT_MOD funcResult_Mod, apEditor editor, object loadKey, apMeshGroup targetMeshGroup, apModifierBase targetModifier, apModifierParamSet targetParamSet, //<<일반 Modifier에서 작업하는 경우 apAnimClip targetAnimClip, apAnimTimeline targetAnimTimeline, int targetFrame) { _editor = editor; _loadKey = loadKey; _targetMeshGroup = targetMeshGroup; _funcResult_Anim = funcResult_Anim; _funcResult_Mod = funcResult_Mod; _targetModifier = targetModifier; _targetParamSet = targetParamSet; _targetAnimClip = targetAnimClip; _targetAnimTimeline = targetAnimTimeline; _targetFrame = targetFrame; //_imgIcon_Bone = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_Bone); _category = CATEGORY.SameMeshGroup; _retarget.LoadSinglePoseFileList(editor); _selectedBonePoseFile = null; _isValidPose = false; _meshGroupUniqueID = _targetMeshGroup._uniqueID; _portraitName = _targetMeshGroup._parentPortrait.name; }
//----------------------------------------------------------------------------------- // Copy For Bake //----------------------------------------------------------------------------------- public void CopyFromTimelineLayer(apAnimTimelineLayer srcTimelineLayer, apAnimClip parentAnimClip, apAnimTimeline parentTimeline) { _uniqueID = srcTimelineLayer._uniqueID; _parentTimeline = parentTimeline; _parentAnimClip = parentAnimClip; _keyframes.Clear(); for (int iKey = 0; iKey < srcTimelineLayer._keyframes.Count; iKey++) { apAnimKeyframe srcKeyframe = srcTimelineLayer._keyframes[iKey]; //Keyframe을 복사하자 apAnimKeyframe newKeyframe = new apAnimKeyframe(); newKeyframe.CopyFromKeyframe(srcKeyframe); _keyframes.Add(newKeyframe); } _linkModType = srcTimelineLayer._linkModType; _transformID = srcTimelineLayer._transformID; _boneID = srcTimelineLayer._boneID; _guiColor = srcTimelineLayer._guiColor; _guiLayerVisible = srcTimelineLayer._guiLayerVisible; _controlParamID = srcTimelineLayer._controlParamID; _linkType = srcTimelineLayer._linkType; //SortAndRefreshKeyframes(false, true);//<<추가 3.31 : 커브 복사 버그 수정 SortAndRefreshKeyframes(); //변경 19.5.20 }
//------------------------------------------------------------------------------------------ // Copy For Bake //------------------------------------------------------------------------------------------ public void CopyFromTimeline(apAnimTimeline srcTimeline, apAnimClip parentAnimClip) { _uniqueID = srcTimeline._uniqueID; _guiColor = srcTimeline._guiColor; _linkType = srcTimeline._linkType; _modifierUniqueID = srcTimeline._modifierUniqueID; _parentAnimClip = parentAnimClip; _layers.Clear(); for (int iLayer = 0; iLayer < srcTimeline._layers.Count; iLayer++) { apAnimTimelineLayer srcLayer = srcTimeline._layers[iLayer]; //복사해준다. apAnimTimelineLayer newLayer = new apAnimTimelineLayer(); newLayer.CopyFromTimelineLayer(srcLayer, parentAnimClip, this); _layers.Add(newLayer); } _guiTimelineFolded = false; //<<이건 에디트에서 사용되는 값 }
// Functions //----------------------------------------------- // Timeline -> File //--------------------------------------------- public void SetTimeline(int unitID, apAnimTimeline timeline) { _unitID = unitID; _timelineUniqueID = timeline._uniqueID; _linkedTimeline = timeline; _guiColor = timeline._guiColor; _linkType = timeline._linkType; _modifierUniqueID = timeline._modifierUniqueID; //연결된 Modifier의 Type을 넣자. //같은걸 대입하기 위함 (UniqueID를 찾지 못했다면..) _linkedModifierType = apModifierBase.MODIFIER_TYPE.Base; if (timeline._linkedModifier != null && _linkType == apAnimClip.LINK_TYPE.AnimatedModifier) { _linkedModifierType = timeline._linkedModifier.ModifierType; } _layerUnits.Clear(); int curUnitID = 0; for (int i = 0; i < timeline._layers.Count; i++) { //Layer도 넣자 apRetargetTimelineLayerUnit layerUnit = new apRetargetTimelineLayerUnit(); layerUnit.SetTimelineLayer(curUnitID, timeline._layers[i]); curUnitID++; _layerUnits.Add(layerUnit); } }
// Init //----------------------------------------------------------------------------- public apTimelineLayerInfo(apAnimTimeline timeline) { _isTimeline = true; _timeline = timeline; _isSelected = false; _isAvailable = true; }
public void Bake(apPortrait portrait, apOptModifierUnitBase parentModifier, apModifierParamSetGroup srcParamSetGroup) { _portrait = portrait; _parentModifier = parentModifier; _syncTarget = srcParamSetGroup._syncTarget; //_keyControlParamName = srcParamSetGroup._keyControlParamName; _keyControlParamID = srcParamSetGroup._keyControlParamID; _keyControlParam = null; //<<이건 링크로 해결하자 //애니메이션 값도 넣어주자 _keyAnimClipID = srcParamSetGroup._keyAnimClipID; _keyAnimTimelineID = srcParamSetGroup._keyAnimTimelineID; _keyAnimTimelineLayerID = srcParamSetGroup._keyAnimTimelineLayerID; _keyAnimClip = null; _keyAnimTimeline = null; _keyAnimTimelineLayer = null; _paramSetList.Clear(); for (int i = 0; i < srcParamSetGroup._paramSetList.Count; i++) { apModifierParamSet srcParamSet = srcParamSetGroup._paramSetList[i]; apOptParamSet optParamSet = new apOptParamSet(); optParamSet.LinkParamSetGroup(this, portrait); optParamSet.BakeModifierParamSet(srcParamSet, portrait); _paramSetList.Add(optParamSet); } _isEnabled = srcParamSetGroup._isEnabled; _layerIndex = srcParamSetGroup._layerIndex; _layerWeight = srcParamSetGroup._layerWeight; _blendMethod = srcParamSetGroup._blendMethod; _isColorPropertyEnabled = srcParamSetGroup._isColorPropertyEnabled; //<<추가. _calculatedWeightedVertexList.Clear(); for (int i = 0; i < srcParamSetGroup._calculatedWeightedVertexList.Count; i++) { apModifierParamSetGroupVertWeight srcWV = srcParamSetGroup._calculatedWeightedVertexList[i]; apOptParamSetGroupVertWeight optWV = new apOptParamSetGroupVertWeight(); optWV.Bake(srcWV); optWV.Link(portrait.GetOptTransform(optWV._meshTransform_ID)); //OptTransform을 연결한다. _calculatedWeightedVertexList.Add(optWV); } LinkPortrait(portrait, parentModifier); }
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 void LinkPortrait(apPortrait portrait, apOptModifierUnitBase parentModifier) { _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++) { _paramSetList[i].LinkParamSetGroup(this, portrait); } // 삭제 19.5.20 : _calculatedWeightedVertexList 변수 삭제 //for (int i = 0; i < _calculatedWeightedVertexList.Count; i++) //{ // _calculatedWeightedVertexList[i].Link(portrait.GetOptTransform(_calculatedWeightedVertexList[i]._meshTransform_ID)); //} }
public void Init_ControlParam(apAnimTimeline timeline, int uniqueID, int controlParamID) { _uniqueID = uniqueID; _parentTimeline = timeline; _controlParamID = controlParamID; _linkType = apAnimClip.LINK_TYPE.ControlParam; _linkModType = LINK_MOD_TYPE.None; _guiColor = GetRandomColor(); }
public void Init_Bone(apAnimTimeline timeline, int uniqueID, int boneID) { _uniqueID = uniqueID; _parentTimeline = timeline; _boneID = boneID; //_linkType = apAnimClip.LINK_TYPE.Bone; _linkType = apAnimClip.LINK_TYPE.AnimatedModifier; //Bone 타입이 AnimatedModifier에 통합되었다. _linkModType = LINK_MOD_TYPE.Bone; _guiColor = GetRandomColor(); }
//TODO : 이걸 호출해야한다. public void SetTimeline(apAnimClip animClip, apAnimTimeline timeline, apAnimTimelineLayer timelineLayer) { _syncTarget = SYNC_TARGET.KeyFrame; _keyAnimClipID = animClip._uniqueID; _keyAnimClip = animClip; _keyAnimTimelineID = timeline._uniqueID; _keyAnimTimeline = timeline; _keyAnimTimelineLayerID = timelineLayer._uniqueID; _keyAnimTimelineLayer = timelineLayer; }
/// <summary> /// AnimClip이 Control Param을 제어하기 위해서는 이 함수를 호출하여 업데이트를 할 수 있게 해야한다. /// [Opt에서는 AnimPlayData를 링크할때 만들어주자] /// </summary> public void MakeAndLinkControlParamResults() { if (_controlParamResult == null) { _controlParamResult = new List <apAnimControlParamResult>(); } _controlParamResult.Clear(); apAnimTimeline timeline = null; apAnimTimelineLayer layer = null; for (int iTL = 0; iTL < _timelines.Count; iTL++) { timeline = _timelines[iTL]; if (timeline._linkType != LINK_TYPE.ControlParam) { continue; } for (int iL = 0; iL < timeline._layers.Count; iL++) { layer = timeline._layers[iL]; if (layer._linkedControlParam == null) { continue; } apAnimControlParamResult cpResult = GetControlParamResult(layer._linkedControlParam); if (cpResult == null) { cpResult = new apAnimControlParamResult(layer._linkedControlParam); cpResult.Init(); _controlParamResult.Add(cpResult); } //레이어와도 연동해주자 //ControlParam <- CPResult <- Layer // ^------------------------] layer._linkedControlParamResult = cpResult; } } }
//--------------------------------------------------------------------------------------- // Copy For Bake //--------------------------------------------------------------------------------------- public void CopyFromAnimClip(apAnimClip srcAnimClip) { _uniqueID = srcAnimClip._uniqueID; _name = srcAnimClip._name; _targetMeshGroupID = srcAnimClip._targetMeshGroupID; _targetMeshGroup = null; _targetOptTranform = null; _FPS = srcAnimClip._FPS; _secPerFrame = srcAnimClip._secPerFrame; //수정 3.31 : 이게 버그의 원인 _startFrame = srcAnimClip._startFrame; _endFrame = srcAnimClip._endFrame; _isLoop = srcAnimClip._isLoop; //Timeline 복사 _timelines.Clear(); for (int iTimeline = 0; iTimeline < srcAnimClip._timelines.Count; iTimeline++) { apAnimTimeline srcTimeline = srcAnimClip._timelines[iTimeline]; //Timeline을 복사하자. //내부에서 차례로 Layer, Keyframe도 복사된다. apAnimTimeline newTimeline = new apAnimTimeline(); newTimeline.CopyFromTimeline(srcTimeline, this); _timelines.Add(newTimeline); } //AnimEvent 복사 _animEvents.Clear(); for (int iEvent = 0; iEvent < srcAnimClip._animEvents.Count; iEvent++) { apAnimEvent srcEvent = srcAnimClip._animEvents[iEvent]; //Event 복사하자 apAnimEvent newEvent = new apAnimEvent(); newEvent.CopyFromAnimEvent(srcEvent); _animEvents.Add(newEvent); } }
public void Init_TransformOfModifier(apAnimTimeline timeline, int uniqueID, int transformID, bool isMeshTransform) { _uniqueID = uniqueID; _parentTimeline = timeline; _transformID = transformID; _boneID = -1; if (isMeshTransform) { _linkModType = LINK_MOD_TYPE.MeshTransform; } else { _linkModType = LINK_MOD_TYPE.MeshGroupTransform; } //_isMeshTransform = isMeshTransform; _linkType = apAnimClip.LINK_TYPE.AnimatedModifier; _guiColor = GetRandomColor(); }
private static object ShowDialog(FUNC_RETARGET_SINGLE_POSE_IMPORT_ANIM funcResult_Anim, FUNC_RETARGET_SINGLE_POSE_IMPORT_MOD funcResult_Mod, apEditor editor, apMeshGroup targetMeshGroup, apModifierBase targetModifier, apModifierParamSet targetParamSet, //<<일반 Modifier에서 작업하는 경우 apAnimClip targetAnimClip, apAnimTimeline targetAnimTimeline, int targetFrame //<<애니메이션에서 Pose를 여는 경우 ) { CloseDialog(); if (editor == null || editor._portrait == null || editor._portrait._controller == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_RetargetSinglePoseImport), true, "Import Pose", true); apDialog_RetargetSinglePoseImport curTool = curWindow as apDialog_RetargetSinglePoseImport; object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 500; int height = 700; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(funcResult_Anim, funcResult_Mod, editor, loadKey, targetMeshGroup, targetModifier, targetParamSet, targetAnimClip, targetAnimTimeline, targetFrame); return(loadKey); } else { return(null); } }
/// <summary> /// [Editor] 업데이트 중 Control Param 제어 Timeline에 대해 업데이트 후 적용을 한다. /// [Runtime] isAdaptToWeight = false로 두고 나머지 처리를 한다. /// </summary> /// <param name="isAdaptToWeight1">[Editor]에서 Weight=1로 두고 적용을 한다</param> public void UpdateControlParam(bool isAdaptToWeight1, int optLayer = 0, float optWeight = 1.0f, apAnimPlayUnit.BLEND_METHOD optBlendMethod = apAnimPlayUnit.BLEND_METHOD.Interpolation) { if (_controlParamResult.Count == 0) { return; } for (int i = 0; i < _controlParamResult.Count; i++) { _controlParamResult[i].Init(); } apAnimTimeline timeline = null; apAnimTimelineLayer layer = null; int curFrame = CurFrame; float curFrameF = CurFrameFloat; //apAnimKeyframe firstKeyframe = null; //apAnimKeyframe lastKeyframe = null; apAnimKeyframe curKeyframe = null; apAnimKeyframe prevKeyframe = null; apAnimKeyframe nextKeyframe = null; int lengthFrames = _endFrame - _startFrame; int tmpCurFrame = 0; apAnimControlParamResult cpResult = null; for (int iTL = 0; iTL < _timelines.Count; iTL++) { timeline = _timelines[iTL]; if (timeline._linkType != LINK_TYPE.ControlParam) { continue; } for (int iL = 0; iL < timeline._layers.Count; iL++) { layer = timeline._layers[iL]; if (layer._linkedControlParam == null || layer._linkedControlParamResult == null) { continue; } cpResult = layer._linkedControlParamResult; //firstKeyframe = layer._firstKeyFrame; //lastKeyframe = layer._lastKeyFrame; for (int iK = 0; iK < layer._keyframes.Count; iK++) { curKeyframe = layer._keyframes[iK]; prevKeyframe = curKeyframe._prevLinkedKeyframe; nextKeyframe = curKeyframe._nextLinkedKeyframe; if (curFrame == curKeyframe._frameIndex || ((curKeyframe._isLoopAsStart || curKeyframe._isLoopAsEnd) && curKeyframe._loopFrameIndex == curFrame) ) { cpResult.SetKeyframeResult(curKeyframe, 1.0f); } else if (curKeyframe.IsFrameIn(curFrame, apAnimKeyframe.LINKED_KEY.Prev)) { //Prev - Cur 범위 안에 들었다. if (prevKeyframe != null) { //Prev 키가 있다면 tmpCurFrame = curFrame; if (tmpCurFrame > curKeyframe._frameIndex) { //한바퀴 돌았다면 tmpCurFrame -= lengthFrames; } //TODO : 여길 나중에 "정식 Curve로 변경"할 것 //float itp = apAnimCurve.GetCurvedRelativeInterpolation(curKeyframe._curveKey, prevKeyframe._curveKey, tmpCurFrame, true); //>> 변경 float itp = curKeyframe._curveKey.GetItp_Int(tmpCurFrame, true); cpResult.SetKeyframeResult(curKeyframe, itp); } else { //Prev 키가 없다면 이게 100%다 cpResult.SetKeyframeResult(curKeyframe, 1.0f); } } else if (curKeyframe.IsFrameIn(curFrame, apAnimKeyframe.LINKED_KEY.Next)) { //Cur - Next 범위 안에 들었다. if (nextKeyframe != null) { //Next 키가 있다면 tmpCurFrame = curFrame; if (tmpCurFrame < curKeyframe._frameIndex) { //한바퀴 돌았다면 tmpCurFrame += lengthFrames; } //TODO : 여길 나중에 "정식 Curve로 변경"할 것 //float itp = apAnimCurve.GetCurvedRelativeInterpolation(curKeyframe._curveKey, nextKeyframe._curveKey, tmpCurFrame, false); //>> 변경 float itp = curKeyframe._curveKey.GetItp_Int(tmpCurFrame, false); cpResult.SetKeyframeResult(curKeyframe, itp); } else { //Prev 키가 없다면 이게 100%다 cpResult.SetKeyframeResult(curKeyframe, 1.0f); } } } } } //Control Param에 적용을 해야한다. if (isAdaptToWeight1) { //Editor인 경우 Weight 1로 강제한다. for (int i = 0; i < _controlParamResult.Count; i++) { _controlParamResult[i].AdaptToControlParam(); } } else { //Runtime인 경우 지정된 Weight, Layer로 처리한다. for (int i = 0; i < _controlParamResult.Count; i++) { //Debug.Log("AnimClip [" + _name + " > Control Param : " + _controlParamResult[i]._targetControlParam._keyName + " ]"); _controlParamResult[i].AdaptToControlParam_Opt(optWeight, optBlendMethod); } } }
// Show Window / Close Dialog //------------------------------------------------------------------------ public static object ShowDialog(FUNC_RETARGET_SINGLE_POSE_IMPORT_ANIM funcResult_Anim, apEditor editor, apMeshGroup targetMeshGroup, apAnimClip targetAnimClip, apAnimTimeline targetAnimTimeline, int targetFrame) { return(ShowDialog(funcResult_Anim, null, editor, targetMeshGroup, null, null, targetAnimClip, targetAnimTimeline, targetFrame)); }
// Get / Set //--------------------------------------------- public bool IsTimelineContain(apAnimTimeline animTimeline) { return(_timelines.Contains(animTimeline)); }
public void Link(apAnimClip animClip, apAnimTimeline timeline) { _parentAnimClip = animClip; _parentTimeline = timeline; _linkType = _parentTimeline._linkType; _parentAnimClip._portrait.RegistUniqueID(apIDManager.TARGET.AnimTimelineLayer, _uniqueID); switch (_linkType) { case apAnimClip.LINK_TYPE.AnimatedModifier: { switch (_linkModType) { case LINK_MOD_TYPE.MeshTransform: //수정 : 재귀적으로 링크를 수행한다. _linkedMeshTransform = _parentAnimClip._targetMeshGroup.GetMeshTransformRecursive(_transformID); if (_linkedMeshTransform == null) { _transformID = -1; } break; case LINK_MOD_TYPE.MeshGroupTransform: //수정 : 재귀적으로 링크를 수행한다. _linkedMeshGroupTransform = _parentAnimClip._targetMeshGroup.GetMeshGroupTransformRecursive(_transformID); if (_linkedMeshGroupTransform == null) { _transformID = -1; } break; case LINK_MOD_TYPE.Bone: _linkedBone = _parentAnimClip._targetMeshGroup.GetBoneRecursive(_boneID); //Recursive 방식으로 검색한다. if (_linkedBone == null) { _boneID = -1; } break; case LINK_MOD_TYPE.None: //?? 이 타입이 들어올리가 없는뎅.. _linkedMeshTransform = null; _linkedMeshGroupTransform = null; _linkedBone = null; _transformID = -1; _boneID = -1; break; } } break; case apAnimClip.LINK_TYPE.ControlParam: { _linkedControlParam = _parentAnimClip._portrait.GetControlParam(_controlParamID); if (_linkedControlParam == null) { _controlParamID = -1; } } break; } for (int i = 0; i < _keyframes.Count; i++) { _keyframes[i].Link(this); } }
public void LinkOpt(apAnimClip animClip, apAnimTimeline timeline) { _parentAnimClip = animClip; _parentTimeline = timeline; _linkType = _parentTimeline._linkType; if (_parentAnimClip == null) { Debug.Log("Parent Anim Clip이 Null이다."); } else if (_parentAnimClip._targetOptTranform == null) { Debug.LogError("Parent Anim Clip TargetOptTranform이 Null이다."); } switch (_linkType) { case apAnimClip.LINK_TYPE.AnimatedModifier: { switch (_linkModType) { case LINK_MOD_TYPE.MeshTransform: //수정 : 재귀적으로 링크를 수행한다. _linkedOptTransform = _parentAnimClip._targetOptTranform.GetMeshTransformRecursive(_transformID); if (_linkedOptTransform == null) { Debug.LogError("Opt TimelineLayer MeshTransform 연결 실패 : " + _transformID); _transformID = -1; } break; case LINK_MOD_TYPE.MeshGroupTransform: //수정 : 재귀적으로 링크를 수행한다. _linkedOptTransform = _parentAnimClip._targetOptTranform.GetMeshGroupTransformRecursive(_transformID); if (_linkedOptTransform == null) { Debug.LogError("Opt TimelineLayer MeshGroupTransform 연결 실패 : " + _transformID); _transformID = -1; } break; case LINK_MOD_TYPE.Bone: //TODO : Bone 타입 연결을 해야한다. _linkedOptBone = _parentAnimClip._targetOptTranform.GetBoneRecursive(_boneID); break; case LINK_MOD_TYPE.None: _linkedOptTransform = null; _transformID = -1; _boneID = -1; break; } } break; case apAnimClip.LINK_TYPE.ControlParam: { _linkedControlParam = _parentAnimClip._portrait.GetControlParam(_controlParamID); if (_linkedControlParam == null) { _controlParamID = -1; } } break; //case apAnimClip.LINK_TYPE.Bone: // { // Debug.LogError("TODO : TimelineLayer의 Bone 타입 연동하기"); // } // break; } for (int i = 0; i < _keyframes.Count; i++) { _keyframes[i].Link(this); } SortAndRefreshKeyframes(); }
public void Bake(apPortrait portrait, apOptModifierUnitBase parentModifier, apModifierParamSetGroup srcParamSetGroup, bool isAnimated, bool isUseModMeshSet) { _portrait = portrait; _parentModifier = parentModifier; _syncTarget = srcParamSetGroup._syncTarget; //_keyControlParamName = srcParamSetGroup._keyControlParamName; _keyControlParamID = srcParamSetGroup._keyControlParamID; _keyControlParam = null; //<<이건 링크로 해결하자 //애니메이션 값도 넣어주자 _keyAnimClipID = srcParamSetGroup._keyAnimClipID; _keyAnimTimelineID = srcParamSetGroup._keyAnimTimelineID; _keyAnimTimelineLayerID = srcParamSetGroup._keyAnimTimelineLayerID; _keyAnimClip = null; _keyAnimTimeline = null; _keyAnimTimelineLayer = null; _paramSetList.Clear(); for (int i = 0; i < srcParamSetGroup._paramSetList.Count; i++) { apModifierParamSet srcParamSet = srcParamSetGroup._paramSetList[i]; apOptParamSet optParamSet = new apOptParamSet(); optParamSet.LinkParamSetGroup(this, portrait); optParamSet.BakeModifierParamSet(srcParamSet, portrait, isUseModMeshSet); _paramSetList.Add(optParamSet); } _isEnabled = srcParamSetGroup._isEnabled; _layerIndex = srcParamSetGroup._layerIndex; _layerWeight = srcParamSetGroup._layerWeight; if (!isAnimated) { _blendMethod = srcParamSetGroup._blendMethod; } else { _blendMethod = apModifierParamSetGroup.BLEND_METHOD.Additive; //<<애니메이션에서는 Additive 강제 } _isColorPropertyEnabled = srcParamSetGroup._isColorPropertyEnabled; //<<추가. // 삭제 19.5.20 : _calculatedWeightedVertexList 변수 삭제 //_calculatedWeightedVertexList.Clear(); //for (int i = 0; i < srcParamSetGroup._calculatedWeightedVertexList.Count; i++) //{ // apModifierParamSetGroupVertWeight srcWV = srcParamSetGroup._calculatedWeightedVertexList[i]; // apOptParamSetGroupVertWeight optWV = new apOptParamSetGroupVertWeight(); // optWV.Bake(srcWV); // optWV.Link(portrait.GetOptTransform(optWV._meshTransform_ID));//OptTransform을 연결한다. // _calculatedWeightedVertexList.Add(optWV); //} LinkPortrait(portrait, parentModifier); }