Skip to content
Snippets Groups Projects
Commit 3d91c6a5 authored by Sebastian Pape's avatar Sebastian Pape
Browse files

Fixing bug in binary sync events

parent 96af0a9a
No related branches found
No related tags found
1 merge request!2Backporting many features from the study on top of the Dasher3D-Core
...@@ -51,13 +51,11 @@ FReply SDasherWidget::HandleMouseMoveEvent(const FGeometry& Geometry, const FPoi ...@@ -51,13 +51,11 @@ FReply SDasherWidget::HandleMouseMoveEvent(const FGeometry& Geometry, const FPoi
{ {
FDisplayClusterClusterEventBinary ClusterEvent; FDisplayClusterClusterEventBinary ClusterEvent;
ClusterEvent.EventId = DasherEventID; ClusterEvent.EventId = DasherEventID;
ClusterEvent.EventData.Reserve(sizeof(CursorPosition.X) + sizeof(CursorPosition.Y) + 1); ClusterEvent.EventData.SetNumUninitialized(sizeof(CursorPosition.X) + sizeof(CursorPosition.Y) + 1);
ClusterEvent.EventData[0] = static_cast<uint8>(DasherEventType::Input_MouseMove); ClusterEvent.EventData[0] = static_cast<uint8>(DasherEventType::Input_MouseMove);
FMemory::Memcpy(&ClusterEvent.EventData[1], &CursorPosition.X, sizeof(CursorPosition.X)); FMemory::Memcpy(&ClusterEvent.EventData[1], &CursorPosition.X, sizeof(CursorPosition.X));
FMemory::Memcpy(&ClusterEvent.EventData[1] + sizeof(CursorPosition.X), &CursorPosition.Y, sizeof(CursorPosition.Y)); FMemory::Memcpy(&ClusterEvent.EventData[1] + sizeof(CursorPosition.X), &CursorPosition.Y, sizeof(CursorPosition.Y));
IDisplayCluster::Get().GetClusterMgr()->EmitClusterEventBinary(ClusterEvent, false); IDisplayCluster::Get().GetClusterMgr()->EmitClusterEventBinary(ClusterEvent, false);
return FReply::Handled().ReleaseMouseLock();
} }
} }
return FReply::Handled(); return FReply::Handled();
...@@ -71,11 +69,11 @@ FReply SDasherWidget::HandleMouseDownEvent(const FGeometry& Geometry, const FPoi ...@@ -71,11 +69,11 @@ FReply SDasherWidget::HandleMouseDownEvent(const FGeometry& Geometry, const FPoi
{ {
FDisplayClusterClusterEventBinary ClusterEvent; FDisplayClusterClusterEventBinary ClusterEvent;
ClusterEvent.EventId = DasherEventID; ClusterEvent.EventId = DasherEventID;
ClusterEvent.EventData.Reserve(1); ClusterEvent.EventData.SetNumUninitialized(1);
ClusterEvent.EventData[0] = static_cast<uint8>(DasherEventType::Input_MouseDown); ClusterEvent.EventData[0] = static_cast<uint8>(DasherEventType::Input_MouseDown);
IDisplayCluster::Get().GetClusterMgr()->EmitClusterEventBinary(ClusterEvent, false); IDisplayCluster::Get().GetClusterMgr()->EmitClusterEventBinary(ClusterEvent, false);
return FReply::Handled().ReleaseMouseLock(); return FReply::Handled().LockMouseToWidget(AsShared());
} }
if (CurrentlyUsingVectorInput) if (CurrentlyUsingVectorInput)
...@@ -95,7 +93,7 @@ FReply SDasherWidget::HandleMouseUpEvent(const FGeometry& Geometry, const FPoint ...@@ -95,7 +93,7 @@ FReply SDasherWidget::HandleMouseUpEvent(const FGeometry& Geometry, const FPoint
{ {
FDisplayClusterClusterEventBinary ClusterEvent; FDisplayClusterClusterEventBinary ClusterEvent;
ClusterEvent.EventId = DasherEventID; ClusterEvent.EventId = DasherEventID;
ClusterEvent.EventData.Reserve(1); ClusterEvent.EventData.SetNumUninitialized(1);
ClusterEvent.EventData[0] = static_cast<uint8>(DasherEventType::Input_MouseUp); ClusterEvent.EventData[0] = static_cast<uint8>(DasherEventType::Input_MouseUp);
IDisplayCluster::Get().GetClusterMgr()->EmitClusterEventBinary(ClusterEvent, false); IDisplayCluster::Get().GetClusterMgr()->EmitClusterEventBinary(ClusterEvent, false);
return FReply::Handled().ReleaseMouseLock(); return FReply::Handled().ReleaseMouseLock();
...@@ -121,10 +119,10 @@ FReply SDasherWidget::HandleMouseDoubleClickEvent(const FGeometry& Geometry, con ...@@ -121,10 +119,10 @@ FReply SDasherWidget::HandleMouseDoubleClickEvent(const FGeometry& Geometry, con
{ {
FDisplayClusterClusterEventBinary ClusterEvent; FDisplayClusterClusterEventBinary ClusterEvent;
ClusterEvent.EventId = DasherEventID; ClusterEvent.EventId = DasherEventID;
ClusterEvent.EventData.Reserve(1); ClusterEvent.EventData.SetNumUninitialized(1);
ClusterEvent.EventData[0] = static_cast<uint8>(DasherEventType::Input_MouseDown); ClusterEvent.EventData[0] = static_cast<uint8>(DasherEventType::Input_MouseDown);
IDisplayCluster::Get().GetClusterMgr()->EmitClusterEventBinary(ClusterEvent, false); IDisplayCluster::Get().GetClusterMgr()->EmitClusterEventBinary(ClusterEvent, false);
return FReply::Handled().ReleaseMouseLock(); return FReply::Handled();
} }
if (CurrentlyUsingVectorInput) if (CurrentlyUsingVectorInput)
...@@ -260,10 +258,9 @@ void SDasherWidget::SetParameter(FString& ParameterName, FString Value) { ...@@ -260,10 +258,9 @@ void SDasherWidget::SetParameter(FString& ParameterName, FString Value) {
} }
//paints our stuff, then lets compoundwidget (super::) draw its stuff //paints our stuff, then lets compoundwidget (super::) draw its stuff
//This draws from bottom to top rectangles->lines->labels, this is enough for our use, but for more complex scenarios a proper layering system might have to be implemented
int32 SDasherWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const int32 SDasherWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const
{ {
//this doesn't draw anything red, we just need a brush. Could probably find a better "empty" brush ////this doesn't draw anything red, we just need a brush. Could probably find a better "empty" brush
auto MyBrush = FSlateColorBrush(FColor::Red); auto MyBrush = FSlateColorBrush(FColor::Red);
FFilledRect* RectObject; FFilledRect* RectObject;
...@@ -299,12 +296,12 @@ int32 SDasherWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe ...@@ -299,12 +296,12 @@ int32 SDasherWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
} }
//The tick function, we tick dasher in it and update the screen size for dasher //The tick function, we tick dasher in it and update the screen size for dasher
void SDasherWidget::Tick(const FGeometry& AllotedGeometry, const double InCurrentTime, const float InDeltaTime) { void SDasherWidget::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) {
SCompoundWidget::Tick(AllottedGeometry, InCurrentTime, InDeltaTime);
//don't tick in the editor //don't tick in the editor
if (IsEditor || InputPaused) return; if (IsEditor || InputPaused) return;
SCompoundWidget::Tick(AllotedGeometry, InCurrentTime, InDeltaTime);
if(!URWTHVRUtilities::IsRoomMountedMode()){ if(!URWTHVRUtilities::IsRoomMountedMode()){
DasherMainInterface->Tick(static_cast<unsigned long>(InCurrentTime * 1000.0)); //we need to provide ticks in milliseconds DasherMainInterface->Tick(static_cast<unsigned long>(InCurrentTime * 1000.0)); //we need to provide ticks in milliseconds
} }
...@@ -313,7 +310,7 @@ void SDasherWidget::Tick(const FGeometry& AllotedGeometry, const double InCurren ...@@ -313,7 +310,7 @@ void SDasherWidget::Tick(const FGeometry& AllotedGeometry, const double InCurren
{ {
FDisplayClusterClusterEventBinary ClusterEvent; FDisplayClusterClusterEventBinary ClusterEvent;
ClusterEvent.EventId = DasherEventID; ClusterEvent.EventId = DasherEventID;
ClusterEvent.EventData.Reserve(sizeof(InCurrentTime) + 1); ClusterEvent.EventData.SetNumUninitialized(sizeof(InCurrentTime) + 1);
ClusterEvent.EventData[0] = static_cast<uint8>(DasherEventType::Tick); ClusterEvent.EventData[0] = static_cast<uint8>(DasherEventType::Tick);
FMemory::Memcpy(&ClusterEvent.EventData[1], &InCurrentTime, sizeof(InCurrentTime)); FMemory::Memcpy(&ClusterEvent.EventData[1], &InCurrentTime, sizeof(InCurrentTime));
IDisplayCluster::Get().GetClusterMgr()->EmitClusterEventBinary(ClusterEvent, false); IDisplayCluster::Get().GetClusterMgr()->EmitClusterEventBinary(ClusterEvent, false);
......
...@@ -117,7 +117,7 @@ public: ...@@ -117,7 +117,7 @@ public:
void StartTraining(FString PathToTextFile); void StartTraining(FString PathToTextFile);
//Tick function inherited from SCompoundWidget //Tick function inherited from SCompoundWidget
virtual void Tick(const FGeometry& AllotedGeometry, const double InCurrentTime, const float InDeltaTime) override; virtual void Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) override;
//Function to set if the widget is in editor or not //Function to set if the widget is in editor or not
void SetEditor(bool EditorState); void SetEditor(bool EditorState);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment