Beispiel #1
0
 public void set_kinematic(KinematicMode mode, bool force = false)
 {
     // mode: 0-none, 1-IK, 2-FK, 3-IK&FK
     if (mode == KinematicMode.IKFK)
     {
         // enable IK
         this.objctrl.finalIK.enabled     = true;
         this.objctrl.oiCharInfo.enableIK = true;
         this.objctrl.ActiveIK(OIBoneInfo.BoneGroup.Body, this.objctrl.oiCharInfo.activeIK[0], true);
         this.objctrl.ActiveIK(OIBoneInfo.BoneGroup.RightLeg, this.objctrl.oiCharInfo.activeIK[1], true);
         this.objctrl.ActiveIK(OIBoneInfo.BoneGroup.LeftLeg, this.objctrl.oiCharInfo.activeIK[2], true);
         this.objctrl.ActiveIK(OIBoneInfo.BoneGroup.RightArm, this.objctrl.oiCharInfo.activeIK[3], true);
         this.objctrl.ActiveIK(OIBoneInfo.BoneGroup.LeftArm, this.objctrl.oiCharInfo.activeIK[4], true);
         // enable FK, disable "body" because it should be controlled by IK
         this.objctrl.oiCharInfo.activeFK[3] = false;
         this.objctrl.fkCtrl.enabled         = true;
         this.objctrl.oiCharInfo.enableFK    = true;
         foreach (var i in Enumerable.Range(0, FKCtrl.parts.Length))
         {
             try
             {
                 this.objctrl.ActiveFK(FKCtrl.parts[i], this.objctrl.oiCharInfo.activeFK[i], true);
             }
             catch (Exception e)
             {
                 Console.WriteLine(String.Format($"Error set kinematic to 3(IK&FK), when ActiveFK[{i}: {FKCtrl.parts[i]}]. Error message = {e}"));
             }
         }
         // call ActiveKinematicMode to set pvCopy?
         this.objctrl.ActiveKinematicMode(OICharInfo.KinematicMode.IK, true, false);
     }
     else if (mode == KinematicMode.FK)
     {
         if (this.objctrl.oiCharInfo.enableIK)
         {
             try
             {
                 this.objctrl.ActiveKinematicMode(OICharInfo.KinematicMode.IK, false, force);
             }
             catch (Exception e)
             {
                 Console.WriteLine($"Error set kinematic to 2(FK), when clear IK. Error message = {e}");
             }
         }
         if (!this.objctrl.oiCharInfo.enableFK)
         {
             try
             {
                 this.objctrl.ActiveKinematicMode(OICharInfo.KinematicMode.FK, true, force);
             }
             catch (Exception e)
             {
                 Console.WriteLine($"Error set kinematic to 2(FK), when set FK. Error message = {e}");
             }
         }
     }
     else if (mode == KinematicMode.IK)
     {
         if (this.objctrl.oiCharInfo.enableFK)
         {
             try
             {
                 this.objctrl.ActiveKinematicMode(OICharInfo.KinematicMode.FK, false, force);
             }
             catch (Exception e)
             {
                 Console.WriteLine($"Error set kinematic to 1(IK), when clear FK. Error message = {e}");
             }
         }
         if (!this.objctrl.oiCharInfo.enableIK)
         {
             try
             {
                 this.objctrl.ActiveKinematicMode(OICharInfo.KinematicMode.IK, true, force);
             }
             catch (Exception e)
             {
                 Console.WriteLine($"Error set kinematic to 1(IK), when set IK. Error message = {e}");
             }
         }
     }
     else
     {
         if (this.objctrl.oiCharInfo.enableIK)
         {
             try
             {
                 this.objctrl.ActiveKinematicMode(OICharInfo.KinematicMode.IK, false, force);
             }
             catch (Exception e)
             {
                 Console.WriteLine($"Error set kinematic to 0(None), when clear IK. Error message = {e}");
             }
         }
         if (this.objctrl.oiCharInfo.enableFK)
         {
             try
             {
                 this.objctrl.ActiveKinematicMode(OICharInfo.KinematicMode.FK, false, force);
             }
             catch (Exception e)
             {
                 Console.WriteLine($"Error set kinematic to 0(None), when clear FK. Error message = {e}");
             }
         }
     }
 }
Beispiel #2
0
        public NEOActorData(Actor a)
        {
            visible = a.Visible;
            if (visible)
            {
                position     = a.Position;
                rotation     = a.Rotation;
                scale        = a.Scale;
                animeSpeed   = a.AnimeSpeed;
                animePattern = a.AnimePattern;

                forceLoop = a.AnimationForceLoop;

                accessoryStatus = a.Accessories;

                faceRedness = a.FaceRedness;
                son         = a.Son;

                anim = a.Animation;

                animeOption = new AnimeOption_s {
                    height = a.Height, breast = a.Breast
                };

                cloth = a.Clothes;

                juice          = a.Juice;
                nippleHardness = a.NippleStand;

                simple      = a.Simple;
                simpleColor = a.SimpleColor;

                eyeLookPattern = a.Gaze;
                eyeLookPos     = a.GazeTarget;
                neckPattern    = a.LookNeckPattern;

                neck           = a.LookNeckFull2;
                eyebrowPattern = a.EyebrowPattern;
                eyePattern     = a.EyePattern;
                eyesOpen       = a.EyesOpenLevel;
                eyeAngles      = a.EyeAngles;
                blinking       = a.EyesBlink;
                mouthPattern   = a.MouthPattern;
                mouthOpen      = a.MouthOpenLevel;
                lipSync        = a.LipSync;
                handMotions    = a.HandPattern;
                kinematicType  = a.Kinematic;
                fkActive       = a.get_FK_active();
                ikActive       = a.get_IK_active();

                if (kinematicType == KinematicMode.FK || kinematicType == KinematicMode.IKFK)
                {
                    fk = a.export_fk_bone_info();
                }
                if (kinematicType == KinematicMode.IK || kinematicType == KinematicMode.IKFK)
                {
                    ik = a.export_ik_target_info();
                }

                voiceList   = a.VoiceList;
                voiceRepeat = a.VoiceRepeat;

                // External plugin data
                try
                {
                    if (kinematicType == KinematicMode.IK)
                    {
                        advIKData = new AdvIKData(a);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }