TSharedRef<IPropertyHandle> FDetailLayoutBuilderImpl::GetPropertyHandle( TSharedPtr<FPropertyNode> PropertyNodePtr ) { TSharedPtr<IPropertyHandle> PropertyHandle; if( PropertyNodePtr.IsValid() ) { TSharedRef<FPropertyNode> PropertyNode = PropertyNodePtr.ToSharedRef(); FNotifyHook* NotifyHook = GetPropertyUtilities()->GetNotifyHook(); PropertyHandle = PropertyEditorHelpers::GetPropertyHandle( PropertyNode, NotifyHook, PropertyDetailsUtilities ); } else { // Invalid handle PropertyHandle = MakeShareable( new FPropertyHandleBase( NULL, NULL, NULL) ); } return PropertyHandle.ToSharedRef(); }
void FDetailPropertyRow::MakeValueWidget( FDetailWidgetRow& Row, const TSharedPtr<FDetailWidgetRow> InCustomRow, bool bAddWidgetDecoration ) const { EVerticalAlignment VerticalAlignment = VAlign_Center; EHorizontalAlignment HorizontalAlignment = HAlign_Left; TOptional<float> MinWidth; TOptional<float> MaxWidth; if( InCustomRow.IsValid() ) { VerticalAlignment = InCustomRow->ValueWidget.VerticalAlignment; HorizontalAlignment = InCustomRow->ValueWidget.HorizontalAlignment; } TAttribute<bool> IsEnabledAttrib = CustomIsEnabledAttrib; if( HasEditCondition() ) { IsEnabledAttrib.Bind( this, &FDetailPropertyRow::GetEnabledState ); } TSharedRef<SHorizontalBox> ValueWidget = SNew( SHorizontalBox ) .IsEnabled( IsEnabledAttrib ); if( InCustomRow.IsValid() ) { MinWidth = InCustomRow->ValueWidget.MinWidth; MaxWidth = InCustomRow->ValueWidget.MaxWidth; ValueWidget->AddSlot() [ InCustomRow->ValueWidget.Widget ]; } else { TSharedPtr<SPropertyValueWidget> PropertyValue; ValueWidget->AddSlot() .Padding( 0.0f, 0.0f, 4.0f, 0.0f ) [ SAssignNew( PropertyValue, SPropertyValueWidget, PropertyEditor, GetPropertyUtilities() ) .ShowPropertyButtons( false ) // We handle this ourselves ]; MinWidth = PropertyValue->GetMinDesiredWidth(); MaxWidth = PropertyValue->GetMaxDesiredWidth(); } if(bAddWidgetDecoration) { if( bShowPropertyButtons ) { TArray< TSharedRef<SWidget> > RequiredButtons; PropertyEditorHelpers::MakeRequiredPropertyButtons( PropertyEditor.ToSharedRef(), /*OUT*/RequiredButtons ); for( int32 ButtonIndex = 0; ButtonIndex < RequiredButtons.Num(); ++ButtonIndex ) { ValueWidget->AddSlot() .AutoWidth() .HAlign(HAlign_Left) .VAlign(VAlign_Center) .Padding(2.0f, 1.0f) [ RequiredButtons[ButtonIndex] ]; } } if (PropertyHandle->HasMetaData(TEXT("ConfigHierarchyEditable"))) { ValueWidget->AddSlot() .AutoWidth() .VAlign(VAlign_Center) .HAlign(HAlign_Left) .Padding(0.0f, 0.0f, 4.0f, 0.0f) [ PropertyCustomizationHelpers::MakeEditConfigHierarchyButton(FSimpleDelegate::CreateSP(PropertyEditor.ToSharedRef(), &FPropertyEditor::EditConfigHierarchy)) ]; } if (!PropertyHandle->HasMetaData(TEXT("NoResetToDefault"))) { ValueWidget->AddSlot() .Padding( 2.0f, 0.0f ) .AutoWidth() .VAlign(VAlign_Center) .HAlign(HAlign_Left) [ SNew( SResetToDefaultPropertyEditor, PropertyEditor.ToSharedRef() ) .IsEnabled( IsEnabledAttrib ) .CustomResetToDefault(CustomResetToDefault) ]; } } Row.ValueContent() .HAlign( HorizontalAlignment ) .VAlign( VerticalAlignment ) .MinDesiredWidth( MinWidth ) .MaxDesiredWidth( MaxWidth ) [ ValueWidget ]; }