Skip to content

Commit d1a7646

Browse files
committed
Modified to allow external building.
1 parent 9798313 commit d1a7646

9 files changed

Lines changed: 19 additions & 10 deletions

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ For documentation please see the [Wiki](https://github.com/Cutter-H/ReplicatedDr
44

55
If you wish for further information on the plugin's C++ related content, please see the header files, as they are thoroughly commented.
66

7+
Release for 5.5: [Here](https://github.com/Cutter-H/ReplicatedDrawingWidgetPlugin/releases/tag/5.5)
8+
9+
If you want support for other versions let me know.
10+
711
You can find a settings data asset in the plugin's content folder. This has 2 separate variables you can use for optimization purposes. Moving or renaming the DataAsset will cause issues and it will no longer work.
812

913
DOES NOT CURRENTLY SUPPORT BRUSHES. At the moment it is only lines of different colors.
@@ -13,7 +17,7 @@ Any changes to pen data will immediately affect new lines. There are overridable
1317

1418
## How does it replicate?
1519

16-
Since widgets do not replicate, the plugin comes with a subsystem that spawns a replicated manager actor. It also listense for actor spawns and adds a lightweight component to player states when they are spawned. The player state component allows the widget to send information to the server. The manager actor holds all data and only 1 is created. Widgets are bound to a delegate on the replicated manager that sends out broadcasts on lines added. The widgets can also erase the data as well as refresh to match the manager to ensure no errors are present. The widgets are identified by the BoardName in the widget as well as the player drawing.
20+
Since widgets do not replicate, the plugin comes with a subsystem that spawns a replicated manager actor. It also listens for actor spawns and adds a lightweight component to player states when they are spawned. The player state component allows the widget to send information to the server. The manager actor holds all data and only 1 is created. Widgets are bound to a delegate on the replicated manager that sends out broadcasts on lines added. The widgets can also erase the data as well as refresh to match the manager to ensure no errors are present. The widgets are identified by the BoardName in the widget as well as the player drawing.
1721

1822
Please see the video below for an example of the usage.
1923

Source/ReplicatedDrawingWidgetPlugin/Private/Canvas/ReplicatedCanvasWidgetBase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "Components/Border.h"
1313
#include "Components/Overlay.h"
1414
#include "Components/OverlaySlot.h"
15-
#include "Debug/ReporterGraph.h"
1615

16+
#include "Curves/CurveFloat.h"
1717
#include "GameFramework/PlayerState.h"
1818
#include "Kismet/GameplayStatics.h"
1919

Source/ReplicatedDrawingWidgetPlugin/Private/Canvas/ReplicatedCanvasWidgetBase.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class REPLICATEDDRAWINGWIDGETPLUGIN_API UReplicatedCanvasWidgetBase : public UUs
7272
void OnLineAddedToBoard(FName board, const FCanvasLineData& line);
7373

7474
/* This is the data the widget currently has of all the lines. These are ordered by time drawn. */
75-
UFUNCTION(BlueprintCallable)
75+
UFUNCTION(BlueprintCallable, Category = "Canvas")
7676
TArray<FCanvasLineData> GetLineData() const { return LineData; }
7777

7878

@@ -85,7 +85,7 @@ class REPLICATEDDRAWINGWIDGETPLUGIN_API UReplicatedCanvasWidgetBase : public UUs
8585
* | |
8686
* \-------> Widget--> PlayerStateHelper---/ Client Level
8787
*/
88-
UFUNCTION(BlueprintCallable)
88+
UFUNCTION(BlueprintCallable, Category = "Canvas")
8989
AReplicatedCanvasManager* GetManagerActor() const {return CanvasManager;}
9090

9191
/* Blueprint Getter for the Player State component. This is used to send requests to the server.
@@ -97,15 +97,15 @@ class REPLICATEDDRAWINGWIDGETPLUGIN_API UReplicatedCanvasWidgetBase : public UUs
9797
* | |
9898
* \-------> Widget--> PlayerStateHelper---/ Client Level
9999
*/
100-
UFUNCTION(BlueprintCallable)
100+
UFUNCTION(BlueprintCallable, Category = "Canvas")
101101
UCanvasPlayerStateHelper* GetPlayerStateHelper() const {return StateHelper;}
102102

103103
/* Rebuilds the board to match the lines found in the Canvas Manager. */
104-
UFUNCTION(BlueprintCallable)
104+
UFUNCTION(BlueprintCallable, Category = "Canvas")
105105
void RefreshFromManager();
106106

107107
/* Erases all lines on the board. */
108-
UFUNCTION(BlueprintCallable)
108+
UFUNCTION(BlueprintCallable, Category = "Canvas")
109109
void CleanBoard();
110110

111111

Source/ReplicatedDrawingWidgetPlugin/Private/CanvasHelpers/CanvasPlayerStateHelper.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55

66
#include "CanvasHelpers/ReplicatedCanvasManager.h"
77
#include "CanvasHelpers/WorldCanvasSubsystem.h"
8-
#include "Kismet/KismetSystemLibrary.h"
98
#include "Net/UnrealNetwork.h"
109

10+
#include "Engine/World.h"
11+
1112

1213
UCanvasPlayerStateHelper::UCanvasPlayerStateHelper() {
1314
SetIsReplicatedByDefault(true);

Source/ReplicatedDrawingWidgetPlugin/Private/CanvasHelpers/ReplicatedCanvasManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "CanvasHelpers/WorldCanvasSubsystem.h"
77
#include "Kismet/KismetSystemLibrary.h"
88
#include "Net/UnrealNetwork.h"
9-
9+
#include "Engine/World.h"
1010
#include "UObject/ConstructorHelpers.h"
1111

1212

Source/ReplicatedDrawingWidgetPlugin/Private/CanvasHelpers/WorldCanvasSubsystem.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "GameFramework/PlayerState.h"
55
#include "CanvasHelpers/CanvasPlayerStateHelper.h"
66
#include "CanvasHelpers/ReplicatedCanvasManager.h"
7+
#include "Engine/World.h"
78

89
void UWorldCanvasSubsystem::OnActorSpawned(AActor* SpawnedActor) {
910
if (SpawnedActor && SpawnedActor->IsA<APlayerState>() && SpawnedActor->HasAuthority()) {

Source/ReplicatedDrawingWidgetPlugin/Public/CanvasHelpers/CanvasPlayerStateHelper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class REPLICATEDDRAWINGWIDGETPLUGIN_API UCanvasPlayerStateHelper : public UActor
1818
virtual void GetLifetimeReplicatedProps(TArray<class FLifetimeProperty>& OutLifetimeProps) const override;
1919

2020
/* Hard ref to the canvas manager so we don't have to find it or go through the subsystem every time. */
21-
UPROPERTY(BlueprintReadOnly, Replicated)
21+
UPROPERTY(BlueprintReadOnly, Replicated, Category = "Canvas")
2222
TObjectPtr<AReplicatedCanvasManager> CanvasManager;
2323

2424
/* Adds a new line to the server. */

Source/ReplicatedDrawingWidgetPlugin/Public/CanvasHelpers/ReplicatedCanvasData.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "ReplicatedCanvasData.generated.h"
77

88
class USlateBrushAsset;
9+
class UCurveFloat;
910

1011
UENUM(BlueprintType)
1112
enum EPenDataFadeType : uint8 {

Source/ReplicatedDrawingWidgetPlugin/Public/CanvasHelpers/ReplicatedCanvasManager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include "CanvasHelpers/ReplicatedCanvasData.h"
88
#include "ReplicatedCanvasManager.generated.h"
99

10+
class UCurveFloat;
11+
1012
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLineAddedSignature, FName, board, const FCanvasLineData&, line);
1113

1214
/* Struct used for a replicated pseudo-map. */

0 commit comments

Comments
 (0)