コード例 #1
0
 public ImportExportScreen(EmbodyContext context, IEmbody embody, IWorldScaleModule worldScale, ISnugModule snug)
     : base(context)
 {
     _embody     = embody;
     _worldScale = worldScale;
     _snug       = snug;
 }
コード例 #2
0
 public MeasureHandsPaddingStep(EmbodyContext context)
     : base(context)
 {
     _head             = context.containingAtom.rigidbodies.First(fc => fc.name == "head");
     _leftHandControl  = context.containingAtom.freeControllers.First(fc => fc.name == "lHandControl");
     _rightHandControl = context.containingAtom.freeControllers.First(fc => fc.name == "rHandControl");
 }
コード例 #3
0
 public MeasureArmsAtRestStep(EmbodyContext context, ControllerAnchorPoint anchor)
     : base(context)
 {
     _anchor           = anchor;
     _leftHandControl  = context.containingAtom.freeControllers.First(fc => fc.name == "lHandControl");
     _rightHandControl = context.containingAtom.freeControllers.First(fc => fc.name == "rHandControl");
     _leftHandMotion   = context.trackers.motionControls.First(mc => mc.name == MotionControlNames.LeftHand);
     _rightHandMotion  = context.trackers.motionControls.First(mc => mc.name == MotionControlNames.RightHand);
 }
コード例 #4
0
 public MeasureAnchorWidthStep(EmbodyContext context, ControllerAnchorPoint anchor, float handRotate, bool ignoreDepth = false)
     : base(context)
 {
     _anchor           = anchor;
     _handRotate       = handRotate;
     _ignoreDepth      = ignoreDepth;
     _leftHandControl  = context.containingAtom.freeControllers.First(fc => fc.name == "lHandControl");
     _rightHandControl = context.containingAtom.freeControllers.First(fc => fc.name == "rHandControl");
 }
コード例 #5
0
    private T CreateModule <T>(EmbodyContext context) where T : MonoBehaviour, IEmbodyModule
    {
        var module = _modules.AddComponent <T>();

        module.enabled    = module.alwaysEnabled;
        module.context    = context;
        module.activeJSON = activeJSON;
        return(module);
    }
コード例 #6
0
 public static void MarkForRecord(EmbodyContext context)
 {
     foreach (var controller in context.plugin.containingAtom.freeControllers.Where(fc => fc.possessed))
     {
         var mac = controller.GetComponent <MotionAnimationControl>();
         mac.ClearAnimation();
         mac.armedForRecord = true;
     }
 }
コード例 #7
0
 private static IEnumerator WaitForRecordComplete(EmbodyContext context)
 {
     while (!string.IsNullOrEmpty(SuperController.singleton.helpText))
     {
         yield return(0);
     }
     context.motionAnimationMaster.StopPlayback();
     context.motionAnimationMaster.ResetAnimation();
 }
コード例 #8
0
 public MeasureAnchorDepthAndOffsetStep(EmbodyContext context, ControllerAnchorPoint anchor, float handRotate)
     : base(context)
 {
     _anchor           = anchor;
     _handRotate       = handRotate;
     _leftHandControl  = context.containingAtom.freeControllers.First(fc => fc.name == "lHandControl");
     _rightHandControl = context.containingAtom.freeControllers.First(fc => fc.name == "rHandControl");
     _headControl      = context.containingAtom.freeControllers.First(fc => fc.name == "headControl");
     _chestControl     = context.containingAtom.freeControllers.First(fc => fc.name == "chestControl");
 }
コード例 #9
0
ファイル: Embody.cs プロジェクト: acidbubbles/vam-embody
    private T CreateModule <T>(EmbodyContext context) where T : MonoBehaviour, IEmbodyModule
    {
        var module = _modules.AddComponent <T>();

        module.enabled = false;
        module.context = context;
        module.InitStorables();
        module.activeJSON = activeJSON;
        _modulesList.Add(module);
        return(module);
    }
コード例 #10
0
 public static void ApplyPossessionSpring(EmbodyContext context)
 {
     foreach (var controller in context.trackers.motionControls
              .Where(mc => mc.enabled && mc.mappedControllerName != null)
              .Select(mc => context.containingAtom.freeControllers.FirstOrDefault(fc => fc.name == mc.mappedControllerName))
              .Where(fc => fc != null))
     {
         controller.RBHoldPositionSpring = SuperController.singleton.possessPositionSpring;
         controller.RBHoldRotationSpring = SuperController.singleton.possessRotationSpring;
     }
 }
コード例 #11
0
 public static void ResetToDefaults(EmbodyContext context)
 {
     context.embody.activeJSON.val = false;
     context.automation.ResetToDefault();
     context.worldScale.ResetToDefault();
     context.hideGeometry.ResetToDefault();
     context.offsetCamera.ResetToDefault();
     context.passenger.ResetToDefault();
     context.trackers.ResetToDefault();
     context.snug.ResetToDefault();
     context.eyeTarget.ResetToDefault();
 }
コード例 #12
0
    // ReSharper disable once Unity.NoNullPropagation Unity.NoNullCoalescing

    public static void StartRecord(EmbodyContext context)
    {
        context.embody.activeJSON.val = true;

        context.motionAnimationMaster.StopPlayback();
        context.motionAnimationMaster.ResetAnimation();

        MarkForRecord(context);

        SuperController.singleton.SelectModeAnimationRecord();

        SuperController.singleton.StartCoroutine(WaitForRecordComplete(context));
    }
コード例 #13
0
 public static void DisableUntrackedControls(EmbodyContext context)
 {
     foreach (var control in context.containingAtom.freeControllers.Where(fc => fc.name.EndsWith("Control")))
     {
         if (control.name == "eyeTargetControl")
         {
             continue;
         }
         if (context.trackers.motionControls.Any(mc => mc.mappedControllerName == control.name))
         {
             control.deactivateOtherControlsOnPossess = false;
         }
         else
         {
             control.currentPositionState = FreeControllerV3.PositionState.Off;
             control.currentRotationState = FreeControllerV3.RotationState.Off;
         }
     }
 }
コード例 #14
0
 public ImportExportScreen(EmbodyContext context)
     : base(context)
 {
     _storage = new Storage(context);
 }
コード例 #15
0
 public HideGeometrySettingsScreen(EmbodyContext context, IHideGeometryModule hideGeometry)
     : base(context)
 {
     _hideGeometry = hideGeometry;
 }
コード例 #16
0
 public TrackerAutoSetup(EmbodyContext context)
 {
     _context = context;
 }
コード例 #17
0
 public ProfilesScreen(EmbodyContext context)
     : base(context)
 {
     _storage = new Storage(context);
 }
コード例 #18
0
 public ExperimentalAskViveTrackersStep(EmbodyContext context, List <IWizardStep> steps)
     : base(context)
 {
     _steps = steps;
 }
コード例 #19
0
 public PassengerSettingsScreen(EmbodyContext context, IPassengerModule passenger)
     : base(context)
 {
     _passenger = passenger;
 }
コード例 #20
0
 public RecordViveTrackersStep(EmbodyContext context)
     : base(context)
 {
 }
コード例 #21
0
 public EyeTargetSettingsScreen(EmbodyContext context, IEyeTargetModule eyeTarget)
     : base(context)
 {
     _eyeTarget = eyeTarget;
 }
コード例 #22
0
ファイル: WizardScreen.cs プロジェクト: QuantD-VAM/vam-embody
 public WizardScreen(EmbodyContext context, IWizard wizard)
     : base(context)
 {
     _wizard = wizard;
 }
コード例 #23
0
ファイル: MainScreen.cs プロジェクト: via5/vam-embody
 public MainScreen(EmbodyContext context, IEmbodyModule[] modules)
     : base(context)
 {
     _modules = modules;
 }
コード例 #24
0
 public MakeDefaultsStep(EmbodyContext context)
     : base(context)
 {
 }
コード例 #25
0
 public TrackersSettingsScreen(EmbodyContext context, ITrackersModule trackers)
     : base(context)
 {
     _trackers         = trackers;
     _trackerAutoSetup = new TrackerAutoSetup(context);
 }
コード例 #26
0
    public override void Init()
    {
        try
        {
            activeJSON = new JSONStorableBool("Active", false)
            {
                isStorable = false
            };

            _modules = new GameObject();
            _modules.transform.SetParent(transform, false);
            _modules.SetActive(false);

            _context = new EmbodyContext(this, this);
            _context.Initialize();

            var automationModule   = CreateModule <AutomationModule>(_context);
            var worldScaleModule   = CreateModule <WorldScaleModule>(_context);
            var hideGeometryModule = CreateModule <HideGeometryModule>(_context);
            var offsetCameraModule = CreateModule <OffsetCameraModule>(_context);
            var passengerModule    = CreateModule <PassengerModule>(_context);
            var trackersModule     = CreateModule <TrackersModule>(_context);
            var snugModule         = CreateModule <SnugModule>(_context);
            var eyeTargetModule    = CreateModule <EyeTargetModule>(_context);
            var wizardModule       = CreateModule <WizardModule>(_context);

            automationModule.embody  = this;
            trackersModule.snug      = snugModule;
            trackersModule.passenger = passengerModule;
            snugModule.trackers      = trackersModule;
            wizardModule.embody      = this;
            wizardModule.passenger   = passengerModule;
            wizardModule.worldScale  = worldScaleModule;
            wizardModule.snug        = snugModule;

            _modules.SetActive(true);

            _screensManager = new ScreensManager();
            _screensManager.Add(MainScreen.ScreenName, new MainScreen(_context, _modules.GetComponents <IEmbodyModule>(), wizardModule));
            _screensManager.Add(TrackersSettingsScreen.ScreenName, new TrackersSettingsScreen(_context, trackersModule));
            _screensManager.Add(PassengerSettingsScreen.ScreenName, new PassengerSettingsScreen(_context, passengerModule));
            _screensManager.Add(SnugSettingsScreen.ScreenName, new SnugSettingsScreen(_context, snugModule));
            _screensManager.Add(HideGeometrySettingsScreen.ScreenName, new HideGeometrySettingsScreen(_context, hideGeometryModule));
            _screensManager.Add(OffsetCameraSettingsScreen.ScreenName, new OffsetCameraSettingsScreen(_context, offsetCameraModule));
            _screensManager.Add(WorldScaleSettingsScreen.ScreenName, new WorldScaleSettingsScreen(_context, worldScaleModule));
            _screensManager.Add(EyeTargetSettingsScreen.ScreenName, new EyeTargetSettingsScreen(_context, eyeTargetModule));
            _screensManager.Add(AutomationSettingsScreen.ScreenName, new AutomationSettingsScreen(_context, automationModule));
            _screensManager.Add(WizardScreen.ScreenName, new WizardScreen(_context, wizardModule));
            _screensManager.Add(ImportExportScreen.ScreenName, new ImportExportScreen(_context, this, worldScaleModule, snugModule));
            _screensManager.Add(UtilitiesScreen.ScreenName, new UtilitiesScreen(_context));

            activeJSON.setCallbackFunction = val =>
            {
                if (val)
                {
                    _context.Initialize();
                    foreach (var module in _modules.GetComponents <IEmbodyModule>())
                    {
                        if (module.alwaysEnabled)
                        {
                            continue;
                        }
                        if (!module.selectedJSON.val)
                        {
                            module.enabledJSON.val = false;
                            continue;
                        }
                        if (module.BeforeEnable())
                        {
                            module.enabledJSON.val = true;
                        }
                    }
                }
                else
                {
                    automationModule.Reset();
                    foreach (var module in _modules.GetComponents <IEmbodyModule>().Reverse())
                    {
                        if (module.alwaysEnabled)
                        {
                            continue;
                        }
                        module.enabledJSON.val = false;
                    }
                }
            };
            RegisterBool(activeJSON);

            var activeToggle = CreateToggle(activeJSON, false);
            activeToggle.label               = "Active";
            activeToggle.backgroundColor     = Color.cyan;
            activeToggle.labelText.fontStyle = FontStyle.Bold;
            var popup = CreateScrollablePopup(_screensManager.screensJSON);
            popup.popupPanelHeight = 700f;
            popup.AddNav(this);

            SuperController.singleton.StartCoroutine(DeferredInit());
        }
        catch (Exception)
        {
            enabledJSON.val = false;
            if (_modules != null)
            {
                Destroy(_modules);
            }
            throw;
        }
    }
コード例 #27
0
 public RecordPlayerHeightStep(EmbodyContext context)
     : base(context)
 {
     _playerMeasurements = new PlayerMeasurements(context);
 }
コード例 #28
0
ファイル: AskSnugStep.cs プロジェクト: via5/vam-embody
 public AskSnugStep(EmbodyContext context, List <IWizardStep> steps)
     : base(context)
 {
     _steps = steps;
 }
コード例 #29
0
 public ResetPoseStep(EmbodyContext context)
     : base(context)
 {
 }
コード例 #30
0
 public DiagnosticsScreen(EmbodyContext context, IDiagnosticsModule diagnostics)
     : base(context)
 {
     _diagnostics = diagnostics;
 }