static void PrefixApplySubModel(int slot, string subModelInfo, ref Pathea.ActorNs.Actor __instance) { // just assume something's changed. // reset scaling so it gets picked up by update if (null != __instance.GetHead()) { __instance.GetHead().localScale = Main.resetVector; } if (null != __instance.modelRoot) { __instance.modelRoot.transform.localScale = Main.resetVector; } }
// rescale an actor if possible public static void rescaleActor(Pathea.ActorNs.Actor __instance) { if (__instance == null) { return; } if ( __instance.IsActorType(ActorTag.Npc) || __instance.IsActorType(ActorTag.Player) ) { Transform head = __instance.GetHead(); if (null != head && head.localScale != Main.headScaleVector) { // todo make preset. string modelType = Pathea.ActorNs.ActorMgr.Self.GetActorInfo(__instance.TmpltId).modelType; if (Main.headScaleVectorByTag.ContainsKey(modelType)) { head.localScale = Main.headScaleVectorByTag[modelType]; } else { head.localScale = Main.headScaleVector; } } } if (null != __instance.modelRoot) { bool female = false; // reset scale when sleeping to prevent clipping. // might get weird. if ( __instance.IsSleeping() || __instance.IsActionRunning(ACType.Sit) ) { __instance.modelRoot.transform.localScale = Main.resetVector; } else if (System.Object.ReferenceEquals(__instance, Player.Self.actor)) { __instance.modelRoot.transform.localScale = Main.playerScaleVector; if (Player.Self.GetGender() == Gender.Female) { female = true; } } else if (__instance.IsActorType(ActorTag.Npc)) { __instance.modelRoot.transform.localScale = Main.actorScaleVector; if (Pathea.NpcRepositoryNs.NpcRepository.Self.GetNpcGender(__instance.InstanceId) == Gender.Female) { female = true; } } // attempt to give wider hip. if ( female && !skipFemaleHipMod.Contains(__instance.name) && null != __instance.ikController && null != __instance.ikController.ik && ( __instance.ikController.ik.references.pelvis.localScale != Main.hipScaleVector // || __instance.ikController.ik.references.pelvis.localPosition != Main.hipOffsetVector ) ) { //Bip001 Pelvis //IEnumerable<Transform> bipPelvis = __instance.GetComponents<Transform>().Where(b => b.name == "Bip001 Pelvis"); //foreach (Transform pelvisBone in bipPelvis) //{ // Main.mod.Logger.Log(string.Format("bipPelvis {0} {1}", __instance.name, pelvisBone.ToString())); // Transform[] children = pelvisBone.Cast<Transform>().ToArray(); // pelvisBone.DetachChildren(); // pelvisBone.localScale = Main.hipScaleVector; // pelvisBone.localPosition = Main.hipOffsetVector; // foreach (Transform child in children) // { // child.parent = pelvisBone; // } //} Transform pelvisBone = __instance.ikController.ik.references.pelvis; if (null != pelvisBone) { Transform[] children = pelvisBone.Cast <Transform>().ToArray(); pelvisBone.DetachChildren(); pelvisBone.localScale = Main.hipScaleVector; //pelvisBone.localPosition = Main.hipOffsetVector; foreach (Transform child in children) { child.parent = pelvisBone; } } } } }