internal ExternalTrackerViewModel(
            ExternalTrackerSettingSync model,
            MotionSettingSync motionModel,
            IMessageSender sender,
            IMessageReceiver receiver
            ) : base(sender)
        {
            _model       = model;
            _motionModel = motionModel;

            //この辺はModel/VMの接続とかコマンド周りの設定
            UpdateTrackSourceType();
            model.TrackSourceType.PropertyChanged        += (_, __) => UpdateTrackSourceType();
            model.EnableExternalTracking.PropertyChanged += (_, __) => UpdateShouldNotifyMissingBlendShapeClipNames();

            MissingBlendShapeNames = new RProperty <string>(
                "", _ => UpdateShouldNotifyMissingBlendShapeClipNames()
                );

            model.FaceSwitchSettingReloaded += (_, __) =>
            {
                if (!model.IsLoading)
                {
                    LoadFaceSwitchSetting();
                }
            };
            model.Loaded += (_, __) => LoadFaceSwitchSetting();

            RefreshIFacialMocapTargetCommand = new ActionCommand(
                () => NetworkEnvironmentUtils.SendIFacialMocapDataReceiveRequest(IFacialMocapTargetIpAddress.Value)
                );
            OpenInstructionUrlCommand                = new ActionCommand(OpenInstructionUrl);
            OpenPerfectSyncTipsUrlCommand            = new ActionCommand(OpenPerfectSyncTipsUrl);
            OpenIFMTroubleShootCommand               = new ActionCommand(OpenIFMTroubleShoot);
            EndExTrackerIfNeededCommand              = new ActionCommand(EndExTrackerIfNeeded);
            ShowMissingBlendShapeNotificationCommand = new ActionCommand(ShowMissingBlendShapeNotification);
            ResetSettingsCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetToDefault)
                );

            //TODO: メッセージ受信の処理もモデル側案件のはず…うーん…
            receiver.ReceivedCommand += OnMessageReceived;

            LoadFaceSwitchSetting();
        }
        public RootSettingSync(IMessageSender sender, IMessageReceiver receiver)
        {
            AvailableLanguageNames = new ReadOnlyObservableCollection <string>(_availableLanguageNames);

            _sender = sender;

            Window          = new WindowSettingSync(sender);
            Motion          = new MotionSettingSync(sender);
            Layout          = new LayoutSettingSync(sender);
            Gamepad         = new GamepadSettingSync(sender);
            Light           = new LightSettingSync(sender);
            WordToMotion    = new WordToMotionSettingSync(sender, receiver);
            ExternalTracker = new ExternalTrackerSettingSync(sender);
            Automation      = new AutomationSettingSync(sender);

            //NOTE; LanguageSelectorとの二重管理っぽくて若干アレだがこのままで行く
            //初期値Defaultを入れることで、起動直後にPCのカルチャベースで言語を指定しなきゃダメかどうか判別する
            LanguageName = new RProperty <string>("Default", s =>
            {
                LanguageSelector.Instance.LanguageName = s;
            });
        }
Пример #3
0
        internal MotionSettingViewModel(MotionSettingSync model, IMessageSender sender, IMessageReceiver receiver) : base(sender)
        {
            _model = model;

            ResetFaceBasicSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(ResetFaceBasicSetting)
                );
            ResetFaceEyeSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetFaceEyeSetting)
                );
            ResetFaceBlendShapeSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetFaceBlendShapeSetting)
                );
            ResetArmMotionSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetArmSetting)
                );
            ResetHandMotionSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetHandSetting)
                );
            ResetWaitMotionSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetWaitMotionSetting)
                );

            CalibrateFaceCommand = new ActionCommand(() => SendMessage(MessageFactory.Instance.CalibrateFace()));
            OpenFullEditionDownloadUrlCommand = new ActionCommand(() => UrlNavigate.Open("https://baku-dreameater.booth.pm/items/3064040"));
            OpenHandTrackingPageUrlCommand    = new ActionCommand(() => UrlNavigate.Open(LocalizedString.GetString("URL_docs_hand_tracking")));

            ShowMicrophoneVolume = new RProperty <bool>(false, b =>
            {
                SendMessage(MessageFactory.Instance.SetMicrophoneVolumeVisibility(b));
                if (!b)
                {
                    MicrophoneVolumeValue.Value = 0;
                }
            });

            _model.KeyboardAndMouseMotionMode.PropertyChanged += (_, __) => UpdateKeyboardAndMouseMotionMode();
            UpdateKeyboardAndMouseMotionMode();
            _model.GamepadMotionMode.PropertyChanged += (_, __) => UpdateGamepadMotionMode();
            UpdateGamepadMotionMode();

            _model.EyeBoneRotationScale.PropertyChanged += (_, __) => UpdateEyeRotRangeText();
            _model.EnableLipSync.PropertyChanged        += (_, __) =>
            {
                if (!_model.EnableLipSync.Value)
                {
                    ShowMicrophoneVolume.Value = false;
                }
            };

            _model.FaceNeutralClip.PropertyChanged += (_, __) =>
                                                      _blendShapeNameStore.Refresh(_model.FaceNeutralClip.Value, _model.FaceOffsetClip.Value);
            _model.FaceOffsetClip.PropertyChanged += (_, __) =>
                                                     _blendShapeNameStore.Refresh(_model.FaceNeutralClip.Value, _model.FaceOffsetClip.Value);

            //両方trueのときだけポインターを表示したいので、それのチェック
            _model.KeyboardAndMouseMotionMode.PropertyChanged += (_, __) => UpdatePointerVisibility();
            _model.ShowPresentationPointer.PropertyChanged    += (_, __) => UpdatePointerVisibility();
            //通常発生しないが、VMの初期化時点でポインター表示が必要ならそうする
            UpdatePointerVisibility();

            UpdateEyeRotRangeText();

            receiver.ReceivedCommand    += OnReceivedCommand;
            ShowInstallPathWarning.Value = InstallPathChecker.HasMultiByteCharInInstallPath();
        }