public BlendShapeAssignReceiver(IMessageReceiver receiver, FaceControlManager faceControlManager)
        {
            _faceControlManager = faceControlManager;

            receiver.AssignCommandHandler(
                VmmCommands.EyebrowLeftUpKey,
                message =>
            {
                EyebrowBlendShape.LeftUpKey = message.Content;
                RefreshTarget();
            });
            receiver.AssignCommandHandler(
                VmmCommands.EyebrowLeftDownKey,
                message =>
            {
                EyebrowBlendShape.LeftDownKey = message.Content;
                RefreshTarget();
            });
            receiver.AssignCommandHandler(
                VmmCommands.EyebrowLeftDownKey,
                message =>
            {
                EyebrowBlendShape.LeftDownKey = message.Content;
                RefreshTarget();
            });
            receiver.AssignCommandHandler(
                VmmCommands.UseSeparatedKeyForEyebrow,
                message =>
            {
                EyebrowBlendShape.UseSeparatedTarget = message.ToBoolean();
                RefreshTarget();
            });
            receiver.AssignCommandHandler(
                VmmCommands.EyebrowRightUpKey,
                message =>
            {
                EyebrowBlendShape.RightUpKey = message.Content;
                RefreshTarget();
            });
            receiver.AssignCommandHandler(
                VmmCommands.EyebrowRightDownKey,
                message =>
            {
                EyebrowBlendShape.RightDownKey = message.Content;
                RefreshTarget();
            });
            receiver.AssignCommandHandler(
                VmmCommands.EyebrowUpScale,
                message => EyebrowBlendShape.UpScale = message.ParseAsPercentage()
                );
            receiver.AssignCommandHandler(
                VmmCommands.EyebrowDownScale,
                message => EyebrowBlendShape.DownScale = message.ParseAsPercentage()
                );
        }
        public FaceControlManagerMessageIo(
            IMessageReceiver receiver, IMessageSender sender,
            EyeBonePostProcess eyeBonePostProcess,
            FaceControlManager faceControlManager
            )
        {
            receiver.AssignCommandHandler(
                VmmCommands.AutoBlinkDuringFaceTracking,
                message =>
                faceControlManager.PreferAutoBlinkOnWebCamTracking = message.ToBoolean()
                );

            receiver.AssignCommandHandler(
                VmmCommands.FaceDefaultFun,
                message =>
                faceControlManager.DefaultBlendShape.FaceDefaultFunValue = message.ParseAsPercentage()
                );

            receiver.AssignCommandHandler(
                VmmCommands.SetEyeBoneRotationScale,
                message => eyeBonePostProcess.Scale = message.ParseAsPercentage()
                );

            receiver.AssignQueryHandler(
                VmmQueries.GetBlendShapeNames,
                query => query.Result = string.Join("\t", faceControlManager.BlendShapeStore.GetBlendShapeNames())
                );

            faceControlManager.VrmInitialized += () =>
            {
                sender.SendCommand(MessageFactory.Instance.SetBlendShapeNames(
                                       string.Join("\t", faceControlManager.BlendShapeStore.GetBlendShapeNames())
                                       ));
            };

            //特に眉まわりのブレンドシェイプ割り当てだけは別途やる
            var _ = new BlendShapeAssignReceiver(receiver, faceControlManager);
        }
Exemplo n.º 3
0
        public FaceControlManagerMessageIo(
            IMessageReceiver receiver, IMessageSender sender,
            EyeBonePostProcess eyeBonePostProcess,
            FaceControlManager faceControlManager
            )
        {
            receiver.AssignCommandHandler(
                VmmCommands.AutoBlinkDuringFaceTracking,
                message =>
                faceControlManager.PreferAutoBlinkOnWebCamTracking = message.ToBoolean()
                );

            receiver.AssignCommandHandler(
                VmmCommands.FaceDefaultFun,
                message =>
                faceControlManager.DefaultBlendShape.FaceDefaultFunValue = message.ParseAsPercentage()
                );

            receiver.AssignCommandHandler(
                VmmCommands.SetEyeBoneRotationScale,
                message => eyeBonePostProcess.Scale = message.ParseAsPercentage()
                );
        }