A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
DialogueSpeechSequenceEntry_Details.cpp
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
3
4#include "IPropertyUtilities.h"
5#include "IDetailChildrenBuilder.h"
6
12
13#define LOCTEXT_NAMESPACE "DialogueSpeechSequenceEntry_Details"
14
16// FDialogueSpeechSequenceEntry_Details
17void FDialogueSpeechSequenceEntry_Details::CustomizeHeader(TSharedRef<IPropertyHandle> InStructPropertyHandle,
18 FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
19{
20 StructPropertyHandle = InStructPropertyHandle;
22
23 const bool bShowOnlyInnerProperties = StructPropertyHandle->GetProperty()->HasMetaData(META_ShowOnlyInnerProperties);
24 if (!bShowOnlyInnerProperties)
25 {
26 HeaderRow.NameContent()
27 [
28 StructPropertyHandle->CreatePropertyNameWidget()
29 ];
30 }
31}
32
33void FDialogueSpeechSequenceEntry_Details::CustomizeChildren(TSharedRef<IPropertyHandle> InStructPropertyHandle,
34 IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
35{
36 const bool bHasDialogue = Dialogue != nullptr;
37
38 // Speaker
39 {
40 const TSharedPtr<IPropertyHandle> ParticipantNamePropertyHandle =
41 StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FDlgSpeechSequenceEntry, Speaker));
42 FDetailWidgetRow* DetailWidgetRow = &StructBuilder.AddCustomRow(LOCTEXT("ParticipantNameSearchKey", "Participant Name"));
43
44 ParticipantNamePropertyRow = MakeShared<FDialogueTextPropertyPickList_CustomRowHelper>(DetailWidgetRow, ParticipantNamePropertyHandle);
45 ParticipantNamePropertyRow->SetTextPropertyPickListWidget(
47 .AvailableSuggestions(this, &Self::GetAllDialoguesParticipantNames)
48 .OnTextCommitted(this, &Self::HandleTextCommitted)
49 .HasContextCheckbox(bHasDialogue)
50 .IsContextCheckBoxChecked(true)
51 .CurrentContextAvailableSuggestions(this, &Self::GetCurrentDialogueParticipantNames)
52 )
53 .Update();
54 }
55
56 // Text
57 {
58 TextPropertyHandle = StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FDlgSpeechSequenceEntry, Text));
59 FDetailWidgetRow* DetailWidgetRow = &StructBuilder.AddCustomRow(LOCTEXT("TextSearchKey", "Text"));
60
61 TextPropertyRow = MakeShared<FDialogueMultiLineEditableTextBox_CustomRowHelper>(DetailWidgetRow, TextPropertyHandle);
62 TextPropertyRow->SetPropertyUtils(StructCustomizationUtils.GetPropertyUtilities());
63 TextPropertyRow->Update();
64 }
65
66
67 // Edge Text
68 {
69 EdgeTextPropertyHandle = StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FDlgSpeechSequenceEntry, EdgeText));
70 FDetailWidgetRow* DetailWidgetRow = &StructBuilder.AddCustomRow(LOCTEXT("EdgeTextSearchKey", "Edge Text"));
71
72 EdgeTextPropertyRow = MakeShared<FDialogueMultiLineEditableTextBox_CustomRowHelper>(DetailWidgetRow, EdgeTextPropertyHandle);
73 EdgeTextPropertyRow->SetPropertyUtils(StructCustomizationUtils.GetPropertyUtilities());
74 EdgeTextPropertyRow->Update();
75 }
76
77 //
78 // Data
79 //
80
81 // Speaker State
82 {
83 const TSharedPtr<IPropertyHandle> SpeakerStatePropertyHandle =
84 StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FDlgSpeechSequenceEntry, SpeakerState));
85
86 FDetailWidgetRow* DetailWidgetRow = &StructBuilder.AddCustomRow(LOCTEXT("SpeakerStateSearchKey", "Speaker State"));
87
88 SpeakerStatePropertyRow = MakeShared<FDialogueTextPropertyPickList_CustomRowHelper>(DetailWidgetRow, SpeakerStatePropertyHandle);
89 SpeakerStatePropertyRow->SetTextPropertyPickListWidget(
91 .AvailableSuggestions(this, &Self::GetAllDialoguesSpeakerStates)
92 .OnTextCommitted(this, &Self::HandleTextCommitted)
93 .HasContextCheckbox(false)
94 )
96 .Update();
97 }
98
99 // Node Data that can be anything set by the user
100 NodeDataPropertyRow = &StructBuilder.AddProperty(
101 StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FDlgSpeechSequenceEntry, NodeData)).ToSharedRef());
103
104 // SoundWave
105 VoiceSoundWavePropertyRow = &StructBuilder.AddProperty(
106 StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FDlgSpeechSequenceEntry, VoiceSoundWave)).ToSharedRef());
108
109 // DialogueWave
110 VoiceDialogueWavePropertyRow = &StructBuilder.AddProperty(
111 StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FDlgSpeechSequenceEntry, VoiceDialogueWave)).ToSharedRef());
113
114 // Generic Data, can be FMOD sound
115 GenericDataPropertyRow = &StructBuilder.AddProperty(
116 StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FDlgSpeechSequenceEntry, GenericData)).ToSharedRef());
118}
119
120#undef LOCTEXT_NAMESPACE
static const TCHAR * META_ShowOnlyInnerProperties
#define CREATE_VISIBILITY_CALLBACK_STATIC(_StaticMethod)
IDetailPropertyRow * NodeDataPropertyRow
TSharedPtr< IPropertyHandle > EdgeTextPropertyHandle
IDetailPropertyRow * VoiceDialogueWavePropertyRow
TSharedPtr< IPropertyHandle > StructPropertyHandle
IDetailPropertyRow * VoiceSoundWavePropertyRow
IDetailPropertyRow * GenericDataPropertyRow
TArray< FName > GetAllDialoguesSpeakerStates() const
TSharedPtr< FDialogueTextPropertyPickList_CustomRowHelper > SpeakerStatePropertyRow
TSharedPtr< FDialogueTextPropertyPickList_CustomRowHelper > ParticipantNamePropertyRow
TArray< FName > GetAllDialoguesParticipantNames() const
TSharedPtr< IPropertyHandle > TextPropertyHandle
TSharedPtr< FDialogueMultiLineEditableTextBox_CustomRowHelper > TextPropertyRow
void CustomizeHeader(TSharedRef< IPropertyHandle > StructPropertyHandle, FDetailWidgetRow &HeaderRow, IPropertyTypeCustomizationUtils &StructCustomizationUtils) override
UDlgDialogue * Dialogue
void HandleTextCommitted(const FText &InSearchText, ETextCommit::Type CommitInfo) const
void CustomizeChildren(TSharedRef< IPropertyHandle > StructPropertyHandle, IDetailChildrenBuilder &StructBuilder, IPropertyTypeCustomizationUtils &StructCustomizationUtils) override
TArray< FName > GetCurrentDialogueParticipantNames() const
TSharedPtr< FDialogueMultiLineEditableTextBox_CustomRowHelper > EdgeTextPropertyRow
static EVisibility GetVoiceSoundWaveVisibility()
static EVisibility GetNodeGenericDataVisibility()
static EVisibility GetNodeDataVisibility()
static UDlgDialogue * GetDialogueFromPropertyHandle(const TSharedRef< IPropertyHandle > &PropertyHandle)
static EVisibility GetVoiceDialogueWaveVisibility()
static EVisibility GetSpeakerStateNodeVisibility()
USTRUCT(BlueprintType)