public MovieMaidIKTrack(Maid maid) : base() { this.maid = maid; this.targets = new Dictionary <string, Transform>(); foreach (string targetName in TARGET_NAMES) { targets[targetName] = CMT.SearchObjName(maid.body0.m_Bones.transform, targetName, true); } }
private static void MoveTargetCard(ThumShot thum, Maid maid) { var transform = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 HeadNub"); if (transform != null) { thum.transform.position = transform.TransformPoint(transform.localPosition + cameraOffset); thum.transform.rotation = transform.rotation * Quaternion.Euler(90f, 0f, 90f); } else { Debug.LogError("Failed to find maid's head!"); } }
// Stops all animations, locks eye & head position so that the Maid // is looking straight forward and applies transformations to a Maid's // armature to put her into a T-pose. public static void ApplyTPose(this Maid maid) { Animation anim = maid.body0.m_Bones.GetComponent <Animation>(); if (anim.enabled) { maid.body0.m_Bones.GetComponent <Animation>().enabled = false; maid.body0.Face.AnimationStop(); maid.EyeToReset(); maid.LockHeadAndEye(true); maid.boMabataki = false; maid.body0.Face.morph.EyeMabataki = 0f; maid.body0.Face.morph.FixBlendValues_Face(); Transform rootTransform = maid.body0.m_Bones.transform; foreach (var boneName in TPoseBonesToReset) { Transform transform = CMT.SearchObjName(rootTransform, boneName); transform.localRotation = Quaternion.identity; } foreach (var entry in TPoseBoneTransformRotations) { CMT.SearchObjName(rootTransform, entry.Key).localRotation *= entry.Value; } foreach (var dbone in maid.body0.m_Bones.GetComponentsInChildren <DynamicBone>()) { if (!dbone.enabled) { Debug.Log($"Dynamic Bone {dbone.name} is already disabled"); } dbone.enabled = false; } } else { maid.body0.m_Bones.GetComponent <Animation>().enabled = true; maid.LockHeadAndEye(false); maid.boMabataki = true; foreach (var dbone in maid.body0.m_Bones.GetComponentsInChildren <DynamicBone>()) { dbone.enabled = true; } } }
private void TargetObjectChangeCheck() { if (Setting.targetSelectMode == 0) { if (CommonUIData.maid == null || CommonUIData.slotNo == -2) { CommonUIData.SetObject(null); } else if (CommonUIData.slotNo == -1) { CommonUIData.SetObject(CommonUIData.maid.body0.m_Bones); } else { CommonUIData.SetObject(CommonUIData.maid.body0.goSlot[CommonUIData.slotNo].obj); } } if (!(this.targetObj == CommonUIData.obj) || (this.targetObj == null && this.braList != null)) { this.targetObj = CommonUIData.obj; this.Clear(); if (this.targetObj) { Transform[] fromBones; if (Setting.targetSelectMode == 0 && CommonUIData.slotNo == -1) { fromBones = (from bone in CommonUIData.maid.body0.goSlot[0].obj.GetComponentInChildren <SkinnedMeshRenderer>().bones where bone != null select CMT.SearchObjName(CommonUIData.obj.transform, bone.name, true) into bone where bone != null select bone).ToArray <Transform>(); } else { SkinnedMeshRenderer componentInChildren = this.targetObj.GetComponentInChildren <SkinnedMeshRenderer>(); if (componentInChildren == null) { return; } fromBones = (from bone in componentInChildren.bones where bone != null select bone).ToArray <Transform>(); } this.CopyBoneConstruction(this.targetObj.transform, fromBones); } } }
// Token: 0x06000063 RID: 99 RVA: 0x00007EC4 File Offset: 0x000060C4 public Texture2D ThumShot(Camera camera, Maid f_maid) { int width = 138; int height = 200; Transform transform = CMT.SearchObjName(f_maid.body0.m_Bones.transform, "Bip01 HeadNub", true); camera.transform.position = transform.TransformPoint(transform.localPosition + new Vector3(0.38f, 1.07f, 0f)); camera.transform.rotation = transform.rotation * Quaternion.Euler(90f, 0f, 90f); camera.fieldOfView = 30f; RenderTexture renderTexture = new RenderTexture(width, height, 24, RenderTextureFormat.ARGB32); renderTexture.filterMode = FilterMode.Bilinear; renderTexture.antiAliasing = 8; RenderTexture f_rtSub = new RenderTexture(width, height, 0, RenderTextureFormat.ARGB32); Texture2D result = this.RenderThum(camera, renderTexture, f_rtSub, width, height); this.Restore(); return(result); }
public MaidTransforms(TBody body) { Body = body.GetBone("Bip01"); FootL = body.GetBone("Bip01 L Foot"); FootR = body.GetBone("Bip01 R Foot"); ToesL = new[] { CMT.SearchObjName(FootL, "Bip01 L Toe0"), CMT.SearchObjName(FootL, "Bip01 L Toe1"), CMT.SearchObjName(FootL, "Bip01 L Toe2"), }; ToesR = new[] { CMT.SearchObjName(FootR, "Bip01 R Toe0"), CMT.SearchObjName(FootR, "Bip01 R Toe1"), CMT.SearchObjName(FootR, "Bip01 R Toe2"), }; }
// Stops all animations, locks eye & head position so that the Maid // is looking straight forward and applies transformations to a Maid's // armature to put her into a T-pose. public static void ApplyTPose(this Maid maid) { maid.body0.m_Bones.GetComponent <Animation>().Stop(); maid.body0.Face.AnimationStop(); maid.EyeToReset(); maid.LockHeadAndEye(true); Transform rootTransform = maid.body0.m_Bones.transform; foreach (var boneName in TPoseBonesToReset) { Transform transform = CMT.SearchObjName(rootTransform, boneName); transform.localRotation = Quaternion.identity; } foreach (var entry in TPoseBoneTransformRotations) { CMT.SearchObjName(rootTransform, entry.Key).localRotation *= entry.Value; } }
public void lateupdateFunc(int m, Maid maid, bool isArm, bool isLeft) { if (bIKAttach.ContainsKey(m) && bIKAttach[m]) { //公式撮影でアタッチ対象のメイドさんがいなくなった場合 if (goIKTarget[m] == null) { Debuginfo.Log(LogLabel + "IK is null!"); GameObject tempIKTarget = new GameObject(); tempIKTarget.transform.parent = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01", true); goIKTarget[m] = tempIKTarget; goIKTarget[m].transform.position = trIKBones[m][2].position; //if(trTargetIKBones.ContainsKey(m)) // trTargetIKBones.Remove(m); } else if (goIKTarget[m].activeInHierarchy == false) { //複数撮影でアタッチ対象のメイドさんがいなくなった場合 Debuginfo.Log(LogLabel + "IK is invisible!"); goIKTarget[m].transform.parent = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01", true); goIKTarget[m].transform.position = trIKBones[m][2].position; } if (isArm) { if (isLeft && (maid.body0.tgtHandL != null || maid.body0.tgtHandL_AttachName != string.Empty)) { return; } else if (maid.body0.tgtHandR != null || maid.body0.tgtHandR_AttachName != string.Empty) { return; } } IK[m].Proc(trIKBones[m][0], trIKBones[m][1], trIKBones[m][2], goIKTarget[m].transform.position); } }
private static void ApplyObjectDataToObject(ObjectData objectData) { bool flag = Setting.targetSelectMode == 0; BackUpObjectData backUpObjectData; BackUpBoneData backUpBoneData; if (flag) { backUpObjectData = BackUpData.GetOrAddMaidObjectData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj); backUpBoneData = BackUpData.GetOrAddMaidBoneData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj, CommonUIData.obj.transform); } else { backUpObjectData = BackUpData.GetOrAddObjectData(CommonUIData.obj); backUpBoneData = BackUpData.GetOrAddBoneData(CommonUIData.obj, CommonUIData.obj.transform); } bool flag2 = Setting.targetSelectMode == 0; if (flag2) { bool flag3 = CommonUIData.slotNo != -1; if (flag3) { bool changedYure = backUpObjectData.changedYure; if (changedYure) { bool flag4 = YureUtil.GetYureState(CommonUIData.maid, CommonUIData.slotNo) != objectData.bYure; if (flag4) { backUpObjectData.changedYure = false; backUpObjectData.bYure = true; YureUtil.SetYureState(CommonUIData.maid, CommonUIData.slotNo, objectData.bYure); } } else { bool flag5 = YureUtil.GetYureState(CommonUIData.maid, CommonUIData.slotNo) != objectData.bYure; if (flag5) { backUpObjectData.changedYure = true; backUpObjectData.bYure = YureUtil.GetYureState(CommonUIData.maid, CommonUIData.slotNo); YureUtil.SetYureState(CommonUIData.maid, CommonUIData.slotNo, objectData.bYure); } } } bool bMaidParts = objectData.bMaidParts; if (bMaidParts) { bool flag6 = !backUpBoneData.changedPos; if (flag6) { backUpBoneData.position = CommonUIData.obj.transform.localPosition; backUpBoneData.changedPos = true; } CommonUIData.obj.transform.localPosition = objectData.rootData.position; bool flag7 = !backUpBoneData.changedRot; if (flag7) { backUpBoneData.rotation = CommonUIData.obj.transform.localRotation; backUpBoneData.changedRot = true; } CommonUIData.obj.transform.localRotation = objectData.rootData.rotation; } } bool flag8 = !backUpBoneData.changedScl; if (flag8) { backUpBoneData.scale = CommonUIData.obj.transform.localScale; backUpBoneData.changedScl = true; } CommonUIData.obj.transform.localScale = objectData.rootData.scale; foreach (ObjectData.TransformData transformData in objectData.transformDataList) { bool flag9 = Setting.targetSelectMode == 0 && CommonUIData.slotNo == -1; Transform transform; if (flag9) { transform = CMT.SearchObjName(CommonUIData.obj.transform, transformData.name, true); } else { transform = CMT.SearchObjName(CommonUIData.obj.transform, transformData.name, false); } bool flag10 = !transform; if (!flag10) { bool flag11 = Setting.targetSelectMode == 0; BackUpBoneData backUpBoneData2; if (flag11) { backUpBoneData2 = BackUpData.GetOrAddMaidBoneData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj, transform); } else { backUpBoneData2 = BackUpData.GetOrAddBoneData(CommonUIData.obj, transform); } bool flag12 = !backUpBoneData2.changedPos; if (flag12) { backUpBoneData2.position = transform.localPosition; backUpBoneData2.changedPos = true; } transform.localPosition = transformData.position; bool flag13 = !backUpBoneData2.changedRot; if (flag13) { backUpBoneData2.rotation = transform.localRotation; backUpBoneData2.changedRot = true; } transform.localRotation = transformData.rotation; bool flag14 = !backUpBoneData2.changedScl; if (flag14) { backUpBoneData2.scale = transform.localScale; backUpBoneData2.changedScl = true; } transform.localScale = transformData.scale; } } }
public static ObjectData GetObjectDataFromObject() { PresetManager.trsHash = new HashSet <Transform>(); ObjectData objectData = new ObjectData(); objectData.version = "0.1.6"; objectData.bMaidParts = (Setting.targetSelectMode == 0); ObjectData.TransformData transformData = new ObjectData.TransformData(); transformData.name = CommonUIData.obj.name; bool flag = Setting.targetSelectMode == 0; if (flag) { transformData.position = CommonUIData.obj.transform.localPosition; transformData.rotation = CommonUIData.obj.transform.localRotation; } transformData.scale = CommonUIData.obj.transform.localScale; objectData.rootData = transformData; bool flag2 = Setting.targetSelectMode == 0; if (flag2) { bool flag3 = CommonUIData.slotNo == -1; if (flag3) { objectData.bYure = false; objectData.slotName = "base"; } else { objectData.bYure = YureUtil.GetYureState(CommonUIData.maid, CommonUIData.slotNo); objectData.slotName = SlotUtil.GetSlotName(CommonUIData.slotNo); } } else { objectData.bYure = false; } bool flag4 = Setting.targetSelectMode == 0 && CommonUIData.slotNo == -1; Transform[] array; if (flag4) { SkinnedMeshRenderer componentInChildren = CommonUIData.maid.body0.goSlot[0].obj.GetComponentInChildren <SkinnedMeshRenderer>(); array = (from bone in componentInChildren.bones where bone != null select CMT.SearchObjName(CommonUIData.obj.transform, bone.name, true) into bone where bone != null select bone).ToArray <Transform>(); } else { SkinnedMeshRenderer componentInChildren2 = CommonUIData.obj.GetComponentInChildren <SkinnedMeshRenderer>(); array = (from bone in componentInChildren2.bones where bone != null select bone).ToArray <Transform>(); } foreach (Transform transform in array) { Transform transform2 = transform; while (transform2 != CommonUIData.obj.transform) { bool flag5 = !transform2; if (flag5) { Debug.Log("ルートオブジェクト配下にありません:" + transform.name); return(null); } bool flag6 = PresetManager.trsHash.Contains(transform2); if (flag6) { break; } ObjectData.TransformData transformData2 = new ObjectData.TransformData(); transformData2.name = transform2.name; transformData2.scale = transform2.localScale; transformData2.position = transform2.localPosition; transformData2.rotation = transform2.localRotation; objectData.transformDataList.Add(transformData2); PresetManager.trsHash.Add(transform2); transform2 = transform2.parent; } } return(objectData); }
private Transform GetOrSetCopyBone(Transform root, Transform fromBone) { Transform result; if (this.fromToBoneDic.ContainsKey(fromBone)) { result = this.fromToBoneDic[fromBone]; } else if (fromBone.parent == null) { result = null; } else { BoneRendererAssist component; if (this.fromToBoneDic.ContainsKey(fromBone.parent)) { component = this.fromToBoneDic[fromBone.parent].GetComponent <BoneRendererAssist>(); if (this.parentChildDic.ContainsKey(fromBone.name)) { string name = this.parentChildDic[fromBone.name]; Transform transform2 = CMT.SearchObjName(root.transform, name, false); if (transform2) { component = this.GetOrSetCopyBone(root, transform2).GetComponent <BoneRendererAssist>(); } } } else { Transform transform3 = this.GetOrSetCopyBone(root, fromBone.parent); if (transform3 == null) { return(null); } component = transform3.GetComponent <BoneRendererAssist>(); } Transform transform4 = new GameObject().transform; transform4.name = fromBone.name; this.copyBoneList.Add(transform4); this.fromToBoneDic.Add(fromBone, transform4); this.toFromBoneDic.Add(transform4, fromBone); transform4.parent = this.boneRendererRoot; CopyTransform copyTransform = transform4.gameObject.AddComponent <CopyTransform>(); copyTransform.bScl = false; copyTransform.SetTarget(this.toFromBoneDic[transform4]); BoneRendererAssist boneRendererAssist = transform4.gameObject.AddComponent <BoneRendererAssist>(); boneRendererAssist.SetSelectable(this.selectable); if (component) { boneRendererAssist.SetParent(component); if (this.firstChildDic.ContainsKey(transform4.name) && this.firstChildDic[transform4.name] == component.transform.name) { component.SetFirstChild(boneRendererAssist); } else { component.SetChild(boneRendererAssist); } } if (this.boneDisplay == BoneDisplay.Visible) { boneRendererAssist.SetVisible(this.JudgeVisibleBone(boneRendererAssist)); } else { boneRendererAssist.SetVisible(false); } boneRendererAssist.SetColor(Setting.normalBoneColor.GetValue()); this.braList.Add(boneRendererAssist); result = transform4; } return(result); }
private static void SetMaidObjectData(Maid maid, int slotID, XElement objectXml) { bool flag = slotID == -1; GameObject gameObject; if (flag) { TBodySkin tbodySkin = maid.body0.goSlot[0]; gameObject = maid.body0.m_Bones.gameObject; } else { TBodySkin tbodySkin = maid.body0.GetSlot(slotID); gameObject = tbodySkin.obj; } XElement xelement = objectXml.Element("Yure"); bool flag2 = xelement != null; if (flag2) { bool flag3 = (bool)xelement; bool yureAble = YureUtil.GetYureAble(maid, slotID); if (yureAble) { bool flag4 = YureUtil.GetYureState(maid, slotID) != flag3; if (flag4) { BackUpObjectData orAddMaidObjectData = BackUpData.GetOrAddMaidObjectData(maid, slotID, gameObject); bool changedYure = orAddMaidObjectData.changedYure; if (changedYure) { orAddMaidObjectData.changedYure = false; orAddMaidObjectData.bYure = true; } else { orAddMaidObjectData.changedYure = true; orAddMaidObjectData.bYure = YureUtil.GetYureState(maid, slotID); } YureUtil.SetYureState(maid, slotID, flag3); } } } IEnumerable <XElement> enumerable = objectXml.Elements("TransformData"); bool flag5 = enumerable != null; if (flag5) { foreach (XElement xelement2 in enumerable) { XElement xelement3 = xelement2.Element("Name"); bool flag6 = xelement3 == null; if (flag6) { break; } bool flag7 = slotID == -1; Transform transform; if (flag7) { transform = CMT.SearchObjName(gameObject.transform, (string)xelement3, true); } else { transform = CMT.SearchObjName(gameObject.transform, (string)xelement3, false); } bool flag8 = transform == null; if (!flag8) { BackUpBoneData orAddMaidBoneData = BackUpData.GetOrAddMaidBoneData(maid, slotID, gameObject, transform); XElement xelement4 = xelement2.Element("Scale"); bool flag9 = xelement4 != null; if (flag9) { bool flag10 = !orAddMaidBoneData.changedScl; if (flag10) { orAddMaidBoneData.changedScl = true; orAddMaidBoneData.scale = transform.localScale; } Vector3 vectorData = SceneDataManager.GetVectorData(xelement4); transform.localScale = vectorData; } XElement xelement5 = xelement2.Element("Position"); bool flag11 = xelement5 != null; if (flag11) { bool flag12 = !orAddMaidBoneData.changedPos; if (flag12) { orAddMaidBoneData.changedPos = true; orAddMaidBoneData.position = transform.localPosition; } Vector3 vectorData2 = SceneDataManager.GetVectorData(xelement5); transform.localPosition = vectorData2; } XElement xelement6 = xelement2.Element("Rotation"); bool flag13 = xelement6 != null; if (flag13) { bool flag14 = !orAddMaidBoneData.changedRot; if (flag14) { orAddMaidBoneData.changedRot = true; orAddMaidBoneData.rotation = transform.localRotation; } Vector3 vectorData3 = SceneDataManager.GetVectorData(xelement6); transform.localEulerAngles = vectorData3; } } } } }
private static XElement GetMaidObjectData(Maid maid, int slotID) { SceneDataManager.trsHash = new HashSet <Transform>(); bool flag = false; bool flag2 = slotID == -1; GameObject gameObject; if (flag2) { TBodySkin tbodySkin = maid.body0.goSlot[0]; gameObject = maid.body0.m_Bones.gameObject; } else { TBodySkin tbodySkin = maid.body0.GetSlot(slotID); gameObject = tbodySkin.obj; } bool flag3 = !gameObject; XElement result; if (flag3) { result = null; } else { BackUpSlotData orNullMaidSlotData = BackUpData.GetOrNullMaidSlotData(maid, slotID); bool flag4 = orNullMaidSlotData == null; if (flag4) { result = null; } else { bool flag5 = !orNullMaidSlotData.objectDataDic.ContainsKey(gameObject); if (flag5) { result = null; } else { BackUpObjectData backUpObjectData = orNullMaidSlotData.objectDataDic[gameObject]; XElement xelement = new XElement("ObjectData"); bool changedYure = backUpObjectData.changedYure; if (changedYure) { XElement xelement2 = new XElement("Yure"); bool yureState = YureUtil.GetYureState(maid, slotID); xelement2.Add(yureState); xelement.Add(xelement2); bool flag6 = !yureState; if (flag6) { flag = true; } } bool flag7 = slotID == -1; Transform rootBone; Transform[] array; if (flag7) { SkinnedMeshRenderer componentInChildren = maid.body0.goSlot[0].obj.GetComponentInChildren <SkinnedMeshRenderer>(); rootBone = maid.body0.m_Bones.transform; array = (from bone in componentInChildren.bones where bone != null select CMT.SearchObjName(rootBone, bone.name, true) into bone where bone != null select bone).ToArray <Transform>(); } else { rootBone = maid.body0.goSlot[slotID].obj_tr; SkinnedMeshRenderer componentInChildren2 = rootBone.gameObject.GetComponentInChildren <SkinnedMeshRenderer>(); array = (from bone in componentInChildren2.bones where bone != null select bone).ToArray <Transform>(); } foreach (Transform transform in array) { Transform transform2 = transform; while (transform2 != rootBone) { bool flag8 = !transform2; if (flag8) { Debug.Log("ルートオブジェクト配下にありません:" + transform.name); return(null); } bool flag9 = SceneDataManager.trsHash.Contains(transform2); if (flag9) { break; } bool flag10 = flag || BackUpData.GetOrNullMaidBoneData(maid, slotID, gameObject, transform2) != null; if (flag10) { XElement xelement3 = new XElement("TransformData"); XElement xelement4 = new XElement("Name"); xelement4.Add(transform2.name); xelement3.Add(xelement4); xelement3.Add(SceneDataManager.GetVector3Data("Scale", transform2.localScale)); xelement3.Add(SceneDataManager.GetVector3Data("Position", transform2.localPosition)); xelement3.Add(SceneDataManager.GetVector3Data("Rotation", transform2.localEulerAngles)); xelement.Add(xelement3); } SceneDataManager.trsHash.Add(transform2); transform2 = transform2.parent; } } result = xelement; } } } return(result); }
public ShoeTransforms(TBodySkin skin) { ShoeL = CMT.SearchObjName(skin.obj_tr, "Bip01 L Foot", false); ShoeR = CMT.SearchObjName(skin.obj_tr, "Bip01 R Foot", false); OriginalScale = skin.body.GetBone("Bip01 L Foot").localScale; }