King_Zero
(King_Zero)
November 28, 2018, 10:24am
1
Hi, I’ve created a custom UCanvasPanel, which has 4 public variables:
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ExposeOnSpawn = "true"), Category = "Other Panels")
UDB_InteractiveCanvasPanel* LeftPanel;
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ExposeOnSpawn = "true"), Category = "Other Panels")
UDB_InteractiveCanvasPanel* RightPanel;
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ExposeOnSpawn = "true"), Category = "Other Panels")
UDB_InteractiveCanvasPanel* TopPanel;
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ExposeOnSpawn = "true"), Category = "Other Panels")
UDB_InteractiveCanvasPanel* BotPanel;
basicly they are pointers to other canvas panels in current widget. The problem is that I cannot set them up in the details tab - they show up on the list but when I click any canvas panel, nothing happens.
Image:
For now what I do is I’m setting everything up in the Event Construct, but that is just making mess when there is a lot of panels on the widget. Is there a way to make it work?
There SynchronizeProperties event where you should sync UMG widget properties with Slate widgets that your UMG widget operates
King_Zero
(King_Zero)
November 28, 2018, 11:38am
3
I don’t quite understand how to use it to synchronize my variables, and from what I’ve seen in the Internet, I’m not sure if that function would help.
King_Zero
(King_Zero)
November 29, 2018, 8:19am
4
Ok, I managed to finally solve it with your help, thank you so much!
I don’t know if it’s the best way to do it, but I’ve created bindings to my variables. For anyone having the same problem here is my code:
.h
//Property Bindings
public:
virtual void SynchronizeProperties() override;
DECLARE_DYNAMIC_DELEGATE_RetVal(UDB_InteractiveCanvasPanel*, FGetPanel);
UPROPERTY() FGetPanel TopPanelDelegate;
UPROPERTY() FGetPanel BotPanelDelegate;
UPROPERTY() FGetPanel LeftPanelDelegate;
UPROPERTY() FGetPanel RightPanelDelegate;
protected:
PROPERTY_BINDING_IMPLEMENTATION(UDB_InteractiveCanvasPanel*, TopPanel);
PROPERTY_BINDING_IMPLEMENTATION(UDB_InteractiveCanvasPanel*, BotPanel);
PROPERTY_BINDING_IMPLEMENTATION(UDB_InteractiveCanvasPanel*, LeftPanel);
PROPERTY_BINDING_IMPLEMENTATION(UDB_InteractiveCanvasPanel*, RightPanel);
.cpp
void UDB_InteractiveCanvasPanel::SynchronizeProperties()
{
Super::SynchronizeProperties();
TAttribute<UDB_InteractiveCanvasPanel*> TopPanelBinding = PROPERTY_BINDING(UDB_InteractiveCanvasPanel*, TopPanel);// OPTIONAL_BINDING_CONVERT(FSlateBrush, Brush, const FSlateBrush*, ConvertImage);
TopPanel = TopPanelBinding.Get();
TAttribute<UDB_InteractiveCanvasPanel*> BotPanelBinding = PROPERTY_BINDING(UDB_InteractiveCanvasPanel*, BotPanel);// OPTIONAL_BINDING_CONVERT(FSlateBrush, Brush, const FSlateBrush*, ConvertImage);
BotPanel = BotPanelBinding.Get();
TAttribute<UDB_InteractiveCanvasPanel*> LeftPanelBinding = PROPERTY_BINDING(UDB_InteractiveCanvasPanel*, LeftPanel);// OPTIONAL_BINDING_CONVERT(FSlateBrush, Brush, const FSlateBrush*, ConvertImage);
LeftPanel = LeftPanelBinding.Get();
TAttribute<UDB_InteractiveCanvasPanel*> RightPanelBinding = PROPERTY_BINDING(UDB_InteractiveCanvasPanel*, RightPanel);// OPTIONAL_BINDING_CONVERT(FSlateBrush, Brush, const FSlateBrush*, ConvertImage);
RightPanel = RightPanelBinding.Get();
}