public IEnumerable <PessoaResponse> Consulte(string uf) { foreach (var item in DBSet.Where(x => x.UF == uf).ToList()) { yield return(ConvertMap.Converta <Pessoa, PessoaResponse>(item)); } }
/// <summary> /// get the axis value for the parent joint of the specified bindingPath /// </summary> private Axis _GetAxisValueForParent(string bindingPath, ConvertMap convMap) { Transform curBone = m_AnimRoot.Find(bindingPath); if (curBone == null) { Dbg.LogErr("AnimMirrorEditorWindow._GetAxisValueForParent: failed to find transform named: {0}, Did you specify wrong AnimRoot?", bindingPath); return(Axis.XZ); } if (curBone == m_AnimRoot) { return(m_NonSymBoneAxis); //if bindingPath points to AnimRoot, then just return non-sym bone axis, should be OK? } Transform parentBone = curBone.parent; string trPath = AnimationUtility.CalculateTransformPath(parentBone, m_AnimRoot); if (convMap.ContainsKey(trPath)) { return(m_SymBoneAxis); } else { return(m_NonSymBoneAxis); } }
private Axis _GetAxisValue(string bindingPath, ConvertMap convMap) { if (convMap.ContainsKey(bindingPath)) { return(m_SymBoneAxis); } else { return(m_NonSymBoneAxis); } }
public PessoaResponse Delete(Guid codigoSessao, Guid codigoEntidade) { try { ValideSessao(codigoSessao); var pes = ServicoDePessoa.Consulte(codigoEntidade); if (pes.Erro) { return(pes); } pes.Ativo = false; return(ServicoDePessoa.AtualizarEntidade(ConvertMap.Converta <PessoaResponse, PessoaRequest>(pes))); } catch (Exception erro) { return(ErroPessoa(erro)); } }
private void _CreateMirrorClip(string newPath) { ConvertMap convMap = new ConvertMap(); foreach (var entry in m_MatchMap) { string fromPath = entry.Key; string toPath = entry.Value.path; bool bFound = entry.Value.found; convMap[fromPath] = toPath; if (bFound) { convMap[toPath] = fromPath; } } AnimationClip newClip = new AnimationClip(); float totalTime = m_Clip.length; float deltaTime = 1 / m_Clip.frameRate; var allBindings = AnimationUtility.GetCurveBindings(m_Clip); //collect bindings based on same path Dictionary <string, CurveBindingGroup> bindingMap = new Dictionary <string, CurveBindingGroup>(); foreach (var oneBinding in allBindings) { string bindingPath = oneBinding.path; string bindingProp = oneBinding.propertyName; CurveBindingGroup grp = null; if (!bindingMap.TryGetValue(bindingPath, out grp)) { grp = new CurveBindingGroup(); grp.path = bindingPath; bindingMap.Add(bindingPath, grp); } if (bindingProp.StartsWith("m_LocalPosition")) { grp.HasPosCurves = true; } else if (bindingProp.StartsWith("m_LocalRotation")) { grp.HasRotCurves = true; } else { grp.OtherCurves.Add(oneBinding); } } // fix foreach (var oneEntry in bindingMap) { string oldBindingPath = oneEntry.Key; CurveBindingGroup grp = oneEntry.Value; // get newBindingPath string newBindingPath = oldBindingPath; if (convMap.ContainsKey(oldBindingPath)) { newBindingPath = convMap[oldBindingPath]; } Axis selfAxisValue = _GetAxisValue(oldBindingPath, convMap); Axis parentAxisValue = _GetAxisValueForParent(oldBindingPath, convMap); // fix rotation curve and bindingProp if (grp.HasRotCurves) { AnimationCurve xCurve = AnimationUtility.GetEditorCurve(m_Clip, EditorCurveBinding.FloatCurve(oldBindingPath, typeof(Transform), "m_LocalRotation.x")); AnimationCurve yCurve = AnimationUtility.GetEditorCurve(m_Clip, EditorCurveBinding.FloatCurve(oldBindingPath, typeof(Transform), "m_LocalRotation.y")); AnimationCurve zCurve = AnimationUtility.GetEditorCurve(m_Clip, EditorCurveBinding.FloatCurve(oldBindingPath, typeof(Transform), "m_LocalRotation.z")); AnimationCurve wCurve = AnimationUtility.GetEditorCurve(m_Clip, EditorCurveBinding.FloatCurve(oldBindingPath, typeof(Transform), "m_LocalRotation.w")); AnimationCurve newXCurve = null; AnimationCurve newYCurve = null; AnimationCurve newZCurve = null; AnimationCurve newWCurve = null; if (parentAxisValue != selfAxisValue) { newXCurve = new AnimationCurve(); newYCurve = new AnimationCurve(); newZCurve = new AnimationCurve(); newWCurve = new AnimationCurve(); Vector3 planeNormal = Vector3.zero; switch (parentAxisValue) { case Axis.XY: planeNormal = Vector3.forward; break; case Axis.XZ: planeNormal = Vector3.up; break; case Axis.YZ: planeNormal = Vector3.right; break; default: Dbg.LogErr("AnimMirrorEditorWindow._CreateMirrorClip: unexpected parentAxisValue: {0}", parentAxisValue); break; } for (float t = 0; t <= totalTime;) { Quaternion oldQ = _BakeQ(xCurve, yCurve, zCurve, wCurve, t); Quaternion newQ = _ReflectQ(oldQ, selfAxisValue, planeNormal); newXCurve.AddKey(t, newQ.x); newYCurve.AddKey(t, newQ.y); newZCurve.AddKey(t, newQ.z); newWCurve.AddKey(t, newQ.w); if (Mathf.Approximately(t, totalTime)) { break; } t = Mathf.Min(totalTime, t + deltaTime); } } else { newXCurve = xCurve; newYCurve = yCurve; newZCurve = zCurve; newWCurve = wCurve; switch (parentAxisValue) { case Axis.XY: { newXCurve = _NegateCurve(xCurve); newYCurve = _NegateCurve(yCurve); } break; case Axis.XZ: { newXCurve = _NegateCurve(xCurve); newZCurve = _NegateCurve(zCurve); } break; case Axis.YZ: { newYCurve = _NegateCurve(yCurve); newZCurve = _NegateCurve(zCurve); } break; default: Dbg.LogErr("AnimMirrorEditorWindow._CreateMirrorClip: unexpected parentAxisValue: {0}", parentAxisValue); break; } } AnimationUtility.SetEditorCurve(newClip, EditorCurveBinding.FloatCurve(newBindingPath, typeof(Transform), "m_LocalRotation.x"), newXCurve); AnimationUtility.SetEditorCurve(newClip, EditorCurveBinding.FloatCurve(newBindingPath, typeof(Transform), "m_LocalRotation.y"), newYCurve); AnimationUtility.SetEditorCurve(newClip, EditorCurveBinding.FloatCurve(newBindingPath, typeof(Transform), "m_LocalRotation.z"), newZCurve); AnimationUtility.SetEditorCurve(newClip, EditorCurveBinding.FloatCurve(newBindingPath, typeof(Transform), "m_LocalRotation.w"), newWCurve); } // fix position curve if (grp.HasPosCurves) { AnimationCurve xCurve = AnimationUtility.GetEditorCurve(m_Clip, EditorCurveBinding.FloatCurve(oldBindingPath, typeof(Transform), "m_LocalPosition.x")); AnimationCurve yCurve = AnimationUtility.GetEditorCurve(m_Clip, EditorCurveBinding.FloatCurve(oldBindingPath, typeof(Transform), "m_LocalPosition.y")); AnimationCurve zCurve = AnimationUtility.GetEditorCurve(m_Clip, EditorCurveBinding.FloatCurve(oldBindingPath, typeof(Transform), "m_LocalPosition.z")); AnimationCurve newXCurve = xCurve; AnimationCurve newYCurve = yCurve; AnimationCurve newZCurve = zCurve; Axis posAxisValue = _GetAxisValueForParent(oldBindingPath, convMap); switch (posAxisValue) { case Axis.XZ: { newYCurve = _NegateCurve(newYCurve); } break; case Axis.XY: { newZCurve = _NegateCurve(newZCurve); } break; case Axis.YZ: { newXCurve = _NegateCurve(newXCurve); } break; default: Dbg.LogErr("AnimMirrorEditorWindow._CreateMirrorClip: unexpected mirror axis value (2nd): {0}", posAxisValue); break; } AnimationUtility.SetEditorCurve(newClip, EditorCurveBinding.FloatCurve(newBindingPath, typeof(Transform), "m_LocalPosition.x"), newXCurve); AnimationUtility.SetEditorCurve(newClip, EditorCurveBinding.FloatCurve(newBindingPath, typeof(Transform), "m_LocalPosition.y"), newYCurve); AnimationUtility.SetEditorCurve(newClip, EditorCurveBinding.FloatCurve(newBindingPath, typeof(Transform), "m_LocalPosition.z"), newZCurve); } // other curves foreach (var oneBinding in grp.OtherCurves) { Type tp = oneBinding.type; string propName = oneBinding.propertyName; if (oneBinding.isPPtrCurve) { EditorCurveBinding newBinding = EditorCurveBinding.PPtrCurve(newBindingPath, tp, propName); ObjectReferenceKeyframe[] array = AnimationUtility.GetObjectReferenceCurve(m_Clip, oneBinding); AnimationUtility.SetObjectReferenceCurve(newClip, newBinding, array); //add new } else { EditorCurveBinding newBinding = EditorCurveBinding.FloatCurve(newBindingPath, tp, propName); AnimationCurve curve = AnimationUtility.GetEditorCurve(m_Clip, oneBinding); AnimationUtility.SetEditorCurve(newClip, newBinding, curve); //add new } } } //end of foreach // finishing part #if !U5 var oldAnimType = (ModelImporterAnimationType)RCall.CallMtd("UnityEditor.AnimationUtility", "GetAnimationType", null, m_Clip); AnimationUtility.SetAnimationType(newClip, oldAnimType); #endif AnimationClipSettings oldSettings = AnimationUtility.GetAnimationClipSettings(m_Clip); RCall.CallMtd("UnityEditor.AnimationUtility", "SetAnimationClipSettings", null, newClip, oldSettings); newClip.EnsureQuaternionContinuity(); // save to disk AnimationClip existingClip = AssetDatabase.LoadAssetAtPath(newPath, typeof(AnimationClip)) as AnimationClip; if (existingClip != null) { EditorUtility.CopySerialized(newClip, existingClip); } else { AssetDatabase.CreateAsset(newClip, newPath); } AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); Dbg.Log("Created mirror-ed animation clip at: {0}", newPath); }