MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / OnPoll

Method OnPoll

Source/URLabEditor/Private/SMjStepModeIndicator.cpp:52–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52EActiveTimerReturnType SMjStepModeIndicator::OnPoll(double, float)
53{
54 AAMjManager* Mgr = AAMjManager::Instance;
55 if (!Mgr)
56 {
57 CachedLabel = FText::FromString(TEXT("URLab: -"));
58 CachedColor = FLinearColor(0.35f, 0.35f, 0.35f, 1.0f);
59 return EActiveTimerReturnType::Continue;
60 }
61
62 // Read the live runtime mode from the dispatcher, not the static
63 // UPROPERTY default (Mgr->StepMode is the configured pin, not the
64 // currently-active mode after a client set_mode promotion).
65 EStepMode Mode = Mgr->StepMode;
66 if (FURLabRpcDispatcher* Disp = Mgr->GetStepDispatcher())
67 {
68 Mode = Disp->GetActiveStepMode();
69 }
70
71 switch (Mode)
72 {
73 case EStepMode::Live:
74 CachedLabel = FText::FromString(TEXT("URLab: live"));
75 CachedColor = FLinearColor(0.18f, 0.55f, 0.20f, 1.0f); // green
76 break;
77 case EStepMode::Direct:
78 CachedLabel = FText::FromString(TEXT("URLab: direct"));
79 CachedColor = FLinearColor(0.85f, 0.55f, 0.10f, 1.0f); // amber
80 break;
81 case EStepMode::Puppet:
82 CachedLabel = FText::FromString(TEXT("URLab: puppet"));
83 CachedColor = FLinearColor(0.20f, 0.45f, 0.85f, 1.0f); // blue
84 break;
85 case EStepMode::Auto:
86 CachedLabel = FText::FromString(TEXT("URLab: auto"));
87 CachedColor = FLinearColor(0.40f, 0.40f, 0.40f, 1.0f); // grey
88 break;
89 }
90 return EActiveTimerReturnType::Continue;
91}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected