2022-11-30 17:13:25 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2022-11-30 15:06:09 -05:00
# include "OpenVDBImportWindow.h"
# include "Widgets/Input/SButton.h"
# include "SPrimaryButton.h"
# include "Widgets/Layout/SBorder.h"
# include "Widgets/Layout/SBox.h"
# include "Widgets/Layout/SUniformGridPanel.h"
# include "Widgets/SBoxPanel.h"
# include "Widgets/Text/STextBlock.h"
# include "IDocumentation.h"
# include "Editor.h"
# include "SparseVolumeTextureOpenVDBUtility.h"
2022-12-01 19:25:56 -05:00
# include "SparseVolumeTexture/SparseVolumeTexture.h"
2023-01-31 01:11:48 -05:00
# include "OpenVDBImportOptions.h"
2022-11-30 15:06:09 -05:00
# define LOCTEXT_NAMESPACE "SOpenVDBImportWindow"
2023-01-30 11:48:00 -05:00
# define VDB_GRID_ROW_NAME_GRID_INDEX TEXT("GridIndex")
# define VDB_GRID_ROW_NAME_GRID_TYPE TEXT("GridType")
# define VDB_GRID_ROW_NAME_GRID_NAME TEXT("GridName")
# define VDB_GRID_ROW_NAME_GRID_DIMS TEXT("GridDims")
2023-01-10 15:51:23 -05:00
static FText GetGridComboBoxItemText ( TSharedPtr < FOpenVDBGridComponentInfo > InItem )
2022-11-30 15:06:09 -05:00
{
return InItem ? FText : : FromString ( InItem - > DisplayString ) : LOCTEXT ( " NoneGrid " , " <None> " ) ;
} ;
2023-01-31 01:11:48 -05:00
static FText GetFormatComboBoxItemText ( TSharedPtr < ESparseVolumeAttributesFormat > InItem )
2022-12-01 19:25:56 -05:00
{
const TCHAR * FormatStr = TEXT ( " <None> " ) ;
if ( InItem )
{
switch ( * InItem )
{
2023-01-31 01:11:48 -05:00
case ESparseVolumeAttributesFormat : : Unorm8 : FormatStr = TEXT ( " 8bit unorm " ) ; break ;
case ESparseVolumeAttributesFormat : : Float16 : FormatStr = TEXT ( " 16bit float " ) ; break ;
case ESparseVolumeAttributesFormat : : Float32 : FormatStr = TEXT ( " 32bit float " ) ; break ;
2022-12-01 19:25:56 -05:00
}
}
return FText : : FromString ( FormatStr ) ;
}
2022-11-30 15:06:09 -05:00
void SOpenVDBImportWindow : : Construct ( const FArguments & InArgs )
{
2023-01-31 01:11:48 -05:00
ImportOptions = InArgs . _ImportOptions ;
DefaultImportOptions = InArgs . _DefaultImportOptions ;
2023-01-30 11:48:00 -05:00
bIsSequence = InArgs . _NumFoundFiles > 1 ;
OpenVDBGridInfo = InArgs . _OpenVDBGridInfo ;
2023-01-10 15:51:23 -05:00
OpenVDBGridComponentInfo = InArgs . _OpenVDBGridComponentInfo ;
2022-12-01 19:25:56 -05:00
OpenVDBSupportedTargetFormats = InArgs . _OpenVDBSupportedTargetFormats ;
2022-11-30 15:06:09 -05:00
WidgetWindow = InArgs . _WidgetWindow ;
TSharedPtr < SBox > ImportTypeDisplay ;
TSharedPtr < SHorizontalBox > OpenVDBHeaderButtons ;
TSharedPtr < SBox > InspectorBox ;
this - > ChildSlot
[
SNew ( SBox )
. MaxDesiredHeight ( InArgs . _MaxWindowHeight )
. MaxDesiredWidth ( InArgs . _MaxWindowWidth )
[
SNew ( SVerticalBox )
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( 2 )
[
SAssignNew ( ImportTypeDisplay , SBox )
]
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( 2 )
[
SNew ( SBorder )
. Padding ( FMargin ( 3 ) )
. BorderImage ( FAppStyle : : GetBrush ( " ToolPanel.GroupBorder " ) )
[
SNew ( SHorizontalBox )
+ SHorizontalBox : : Slot ( )
. AutoWidth ( )
[
SNew ( STextBlock )
. Text ( LOCTEXT ( " Import_CurrentFileTitle " , " Current Asset: " ) )
]
+ SHorizontalBox : : Slot ( )
. Padding ( 5 , 0 , 0 , 0 )
. AutoWidth ( )
. VAlign ( VAlign_Center )
[
SNew ( STextBlock )
. Text ( InArgs . _FullPath )
. ToolTipText ( InArgs . _FullPath )
]
]
]
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( 2 )
[
SAssignNew ( InspectorBox , SBox )
. MaxDesiredHeight ( 650.0f )
. WidthOverride ( 400.0f )
]
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( 2 )
[
SNew ( SUniformGridPanel )
. SlotPadding ( 2 )
+ SUniformGridPanel : : Slot ( 1 , 0 )
[
SAssignNew ( ImportButton , SPrimaryButton )
. Text ( LOCTEXT ( " OpenVDBImportWindow_Import " , " Import " ) )
. IsEnabled ( this , & SOpenVDBImportWindow : : CanImport )
. OnClicked ( this , & SOpenVDBImportWindow : : OnImport )
]
+ SUniformGridPanel : : Slot ( 2 , 0 )
[
SNew ( SButton )
. HAlign ( HAlign_Center )
. Text ( LOCTEXT ( " OpenVDBImportWindow_Cancel " , " Cancel " ) )
. ToolTipText ( LOCTEXT ( " OpenVDBImportWindow_Cancel_ToolTip " , " Cancels importing this OpenVDB file " ) )
. OnClicked ( this , & SOpenVDBImportWindow : : OnCancel )
]
]
]
] ;
InspectorBox - > SetContent (
SNew ( SVerticalBox )
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( 2 )
2023-01-24 21:44:51 -05:00
[
SNew ( SHorizontalBox )
+ SHorizontalBox : : Slot ( )
. VAlign ( VAlign_Center )
. HAlign ( HAlign_Right )
. AutoWidth ( )
. Padding ( 2.0f )
[
SNew ( STextBlock )
. Text ( LOCTEXT ( " ImportAsSequenceCheckBoxLabel " , " Import Sequence " ) )
]
+ SHorizontalBox : : Slot ( )
. VAlign ( VAlign_Center )
. HAlign ( HAlign_Right )
. AutoWidth ( )
. Padding ( 2.0f )
[
SAssignNew ( ImportAsSequenceCheckBox , SCheckBox )
. ToolTipText ( LOCTEXT ( " ImportAsSequenceCheckBoxTooltip " , " Import multiple sequentially labeled .vdb files as a single animated SparseVirtualTexture sequence. " ) )
2023-01-30 11:48:00 -05:00
. IsChecked ( bIsSequence )
]
+ SHorizontalBox : : Slot ( )
. VAlign ( VAlign_Center )
. HAlign ( HAlign_Right )
. AutoWidth ( )
. Padding ( 2.0f )
[
SNew ( STextBlock )
. Text ( FText : : FromString ( FString : : Format ( TEXT ( " Found {0} File(s) " ) , { InArgs . _NumFoundFiles } ) ) )
2023-01-24 21:44:51 -05:00
]
]
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( 2 )
2022-11-30 15:06:09 -05:00
[
2023-01-31 01:11:48 -05:00
SAssignNew ( AttributesAConfigurator , SOpenVDBAttributesConfigurator )
. AttributesDesc ( & ImportOptions - > Attributes [ 0 ] )
2023-01-10 15:51:23 -05:00
. OpenVDBGridComponentInfo ( OpenVDBGridComponentInfo )
2022-12-01 19:25:56 -05:00
. OpenVDBSupportedTargetFormats ( OpenVDBSupportedTargetFormats )
2023-01-31 01:11:48 -05:00
. AttributesName ( LOCTEXT ( " OpenVDBImportWindow_AttributesA " , " Attributes A " ) )
2022-11-30 15:06:09 -05:00
]
2023-01-11 20:56:20 -05:00
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( 2 )
[
2023-01-31 01:11:48 -05:00
SAssignNew ( AttributesBConfigurator , SOpenVDBAttributesConfigurator )
. AttributesDesc ( & ImportOptions - > Attributes [ 1 ] )
2023-01-11 20:56:20 -05:00
. OpenVDBGridComponentInfo ( OpenVDBGridComponentInfo )
. OpenVDBSupportedTargetFormats ( OpenVDBSupportedTargetFormats )
2023-01-31 01:11:48 -05:00
. AttributesName ( LOCTEXT ( " OpenVDBImportWindow_AttributesB " , " Attributes B " ) )
2023-01-11 20:56:20 -05:00
]
2023-01-24 21:44:51 -05:00
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( 2 )
[
SNew ( STextBlock )
. Text ( LOCTEXT ( " OpenVDBImportWindow_FileInfo " , " Source File Grid Info " ) )
]
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( 2 )
[
SNew ( SBorder )
. Padding ( FMargin ( 3 ) )
. BorderImage ( FAppStyle : : GetBrush ( " ToolPanel.GroupBorder " ) )
[
2023-01-30 11:48:00 -05:00
SNew ( SListView < TSharedPtr < FOpenVDBGridInfo > > )
. ItemHeight ( 24 )
. ScrollbarVisibility ( EVisibility : : Visible )
. ListItemsSource ( OpenVDBGridInfo )
. OnGenerateRow ( this , & SOpenVDBImportWindow : : GenerateGridInfoItemRow )
. HeaderRow
(
SNew ( SHeaderRow )
+ SHeaderRow : : Column ( VDB_GRID_ROW_NAME_GRID_INDEX ) . DefaultLabel ( LOCTEXT ( " GridIndex " , " Index " ) ) . FillWidth ( 0.05f )
+ SHeaderRow : : Column ( VDB_GRID_ROW_NAME_GRID_NAME ) . DefaultLabel ( LOCTEXT ( " GridName " , " Name " ) ) . FillWidth ( 0.15f )
+ SHeaderRow : : Column ( VDB_GRID_ROW_NAME_GRID_TYPE ) . DefaultLabel ( LOCTEXT ( " GridType " , " Type " ) ) . FillWidth ( 0.1f )
+ SHeaderRow : : Column ( VDB_GRID_ROW_NAME_GRID_DIMS ) . DefaultLabel ( LOCTEXT ( " GridDims " , " Dimensions " ) ) . FillWidth ( 0.25f )
)
2023-01-24 21:44:51 -05:00
]
]
2022-11-30 15:06:09 -05:00
) ;
SetDefaultGridAssignment ( ) ;
ImportTypeDisplay - > SetContent (
SNew ( SBorder )
. Padding ( FMargin ( 3 ) )
. BorderImage ( FAppStyle : : GetBrush ( " ToolPanel.GroupBorder " ) )
[
SNew ( SHorizontalBox )
+ SHorizontalBox : : Slot ( )
. AutoWidth ( )
. VAlign ( VAlign_Center )
[
SNew ( STextBlock )
. Text ( this , & SOpenVDBImportWindow : : GetImportTypeDisplayText )
]
+ SHorizontalBox : : Slot ( )
. VAlign ( VAlign_Center )
. AutoWidth ( )
[
IDocumentation : : Get ( ) - > CreateAnchor ( FString ( " Engine/Content/OpenVDB/ImportWindow " ) )
]
+ SHorizontalBox : : Slot ( )
. HAlign ( HAlign_Right )
[
SAssignNew ( OpenVDBHeaderButtons , SHorizontalBox )
+ SHorizontalBox : : Slot ( )
. AutoWidth ( )
. Padding ( FMargin ( 2.0f , 0.0f ) )
[
SNew ( SButton )
. Text ( LOCTEXT ( " OpenVDBImportWindow_ResetOptions " , " Reset to Default " ) )
. OnClicked ( this , & SOpenVDBImportWindow : : OnResetToDefaultClick )
]
]
]
) ;
RegisterActiveTimer ( 0.f , FWidgetActiveTimerDelegate : : CreateSP ( this , & SOpenVDBImportWindow : : SetFocusPostConstruct ) ) ;
}
FReply SOpenVDBImportWindow : : OnImport ( )
{
bShouldImport = true ;
if ( WidgetWindow . IsValid ( ) )
{
WidgetWindow . Pin ( ) - > RequestDestroyWindow ( ) ;
}
return FReply : : Handled ( ) ;
}
FReply SOpenVDBImportWindow : : OnCancel ( )
{
bShouldImport = false ;
if ( WidgetWindow . IsValid ( ) )
{
WidgetWindow . Pin ( ) - > RequestDestroyWindow ( ) ;
}
return FReply : : Handled ( ) ;
}
bool SOpenVDBImportWindow : : ShouldImport ( ) const
{
return bShouldImport ;
}
2023-01-24 21:44:51 -05:00
bool SOpenVDBImportWindow : : ShouldImportAsSequence ( ) const
{
return ImportAsSequenceCheckBox - > IsChecked ( ) ;
}
2022-11-30 15:06:09 -05:00
EActiveTimerReturnType SOpenVDBImportWindow : : SetFocusPostConstruct ( double InCurrentTime , float InDeltaTime )
{
if ( ImportButton . IsValid ( ) )
{
FSlateApplication : : Get ( ) . SetKeyboardFocus ( ImportButton , EFocusCause : : SetDirectly ) ;
}
return EActiveTimerReturnType : : Stop ;
}
2023-01-30 11:48:00 -05:00
TSharedRef < ITableRow > SOpenVDBImportWindow : : GenerateGridInfoItemRow ( TSharedPtr < FOpenVDBGridInfo > Item , const TSharedRef < STableViewBase > & OwnerTable )
{
return SNew ( SOpenVDBGridInfoTableRow , OwnerTable ) . OpenVDBGridInfo ( Item ) ;
}
2022-11-30 15:06:09 -05:00
bool SOpenVDBImportWindow : : CanImport ( ) const
{
2023-01-31 01:11:48 -05:00
for ( const FOpenVDBSparseVolumeAttributesDesc & AttributesDesc : ImportOptions - > Attributes )
2022-12-01 19:25:56 -05:00
{
2023-01-31 01:11:48 -05:00
for ( const FOpenVDBSparseVolumeComponentMapping & Mapping : AttributesDesc . Mappings )
2023-01-11 20:56:20 -05:00
{
2023-01-31 01:11:48 -05:00
if ( Mapping . SourceGridIndex ! = INDEX_NONE & & Mapping . SourceComponentIndex ! = INDEX_NONE )
{
return true ;
}
2023-01-11 20:56:20 -05:00
}
2022-12-01 19:25:56 -05:00
}
return false ;
2022-11-30 15:06:09 -05:00
}
FReply SOpenVDBImportWindow : : OnResetToDefaultClick ( )
{
SetDefaultGridAssignment ( ) ;
return FReply : : Handled ( ) ;
}
FText SOpenVDBImportWindow : : GetImportTypeDisplayText ( ) const
{
2023-01-24 21:44:51 -05:00
return ShouldImportAsSequence ( ) ? LOCTEXT ( " OpenVDBImportWindow_ImportTypeAnimated " , " Import OpenVDB animation " ) : LOCTEXT ( " OpenVDBImportWindow_ImportTypeStatic " , " Import static OpenVDB " ) ;
2022-11-30 15:06:09 -05:00
}
void SOpenVDBImportWindow : : SetDefaultGridAssignment ( )
{
2023-01-10 15:51:23 -05:00
check ( OpenVDBGridComponentInfo ) ;
2022-11-30 15:06:09 -05:00
2023-01-31 01:11:48 -05:00
* ImportOptions = * DefaultImportOptions ;
2022-11-30 15:06:09 -05:00
2023-01-30 11:48:00 -05:00
ImportAsSequenceCheckBox - > SetIsChecked ( bIsSequence ? ECheckBoxState : : Checked : ECheckBoxState : : Unchecked ) ;
2023-01-31 01:11:48 -05:00
AttributesAConfigurator - > RefreshUIFromData ( ) ;
AttributesBConfigurator - > RefreshUIFromData ( ) ;
2022-11-30 15:06:09 -05:00
}
2022-12-01 19:25:56 -05:00
void SOpenVDBComponentPicker : : Construct ( const FArguments & InArgs )
2022-11-30 15:06:09 -05:00
{
2023-01-31 01:11:48 -05:00
AttributesDesc = InArgs . _AttributesDesc ;
2022-12-01 19:25:56 -05:00
ComponentIndex = InArgs . _ComponentIndex ;
2023-01-10 15:51:23 -05:00
OpenVDBGridComponentInfo = InArgs . _OpenVDBGridComponentInfo ;
2022-12-01 19:25:56 -05:00
check ( ComponentIndex < 4 ) ;
2023-04-25 07:50:06 -04:00
const TCHAR * ComponentLabels [ ] = { TEXT ( " R " ) , TEXT ( " G " ) , TEXT ( " B " ) , TEXT ( " A " ) } ;
2022-11-30 15:06:09 -05:00
2022-12-01 19:25:56 -05:00
this - > ChildSlot
2022-11-30 15:06:09 -05:00
[
2022-12-01 19:25:56 -05:00
SNew ( SHorizontalBox )
+ SHorizontalBox : : Slot ( )
. VAlign ( VAlign_Center )
. FillWidth ( 1.0f )
. Padding ( 2.0f )
2022-11-30 15:06:09 -05:00
[
2022-12-01 19:25:56 -05:00
SNew ( STextBlock )
. Text ( FText : : FromString ( ComponentLabels [ ComponentIndex ] ) )
]
+ SHorizontalBox : : Slot ( )
. FillWidth ( 1.0f )
. VAlign ( VAlign_Center )
. Padding ( 2.0f )
[
SNew ( SBox )
. WidthOverride ( 300.0f )
2022-11-30 15:06:09 -05:00
[
2023-01-10 15:51:23 -05:00
SAssignNew ( GridComboBox , SComboBox < TSharedPtr < FOpenVDBGridComponentInfo > > )
. OptionsSource ( OpenVDBGridComponentInfo )
. OnGenerateWidget_Lambda ( [ ] ( TSharedPtr < FOpenVDBGridComponentInfo > InItem )
2022-11-30 15:06:09 -05:00
{
2022-12-01 19:25:56 -05:00
return SNew ( STextBlock )
. Text ( GetGridComboBoxItemText ( InItem ) ) ;
2022-11-30 15:06:09 -05:00
} )
2023-01-10 15:51:23 -05:00
. OnSelectionChanged_Lambda ( [ this ] ( TSharedPtr < FOpenVDBGridComponentInfo > InItem , ESelectInfo : : Type )
2022-12-01 19:25:56 -05:00
{
2023-01-31 01:11:48 -05:00
AttributesDesc - > Mappings [ ComponentIndex ] . SourceGridIndex = InItem ? InItem - > Index : INDEX_NONE ;
AttributesDesc - > Mappings [ ComponentIndex ] . SourceComponentIndex = InItem ? InItem - > ComponentIndex : INDEX_NONE ;
2022-12-01 19:25:56 -05:00
} )
[
SNew ( STextBlock )
. Text_Lambda ( [ this ] ( )
{
return GetGridComboBoxItemText ( GridComboBox - > GetSelectedItem ( ) ) ;
} )
]
2022-11-30 15:06:09 -05:00
]
]
] ;
}
2022-12-01 19:25:56 -05:00
void SOpenVDBComponentPicker : : RefreshUIFromData ( )
{
2023-01-10 15:51:23 -05:00
for ( const TSharedPtr < FOpenVDBGridComponentInfo > & Grid : * OpenVDBGridComponentInfo )
2022-12-01 19:25:56 -05:00
{
2023-01-31 01:11:48 -05:00
if ( Grid - > Index = = AttributesDesc - > Mappings [ ComponentIndex ] . SourceGridIndex & & Grid - > ComponentIndex = = AttributesDesc - > Mappings [ ComponentIndex ] . SourceComponentIndex )
2022-12-01 19:25:56 -05:00
{
GridComboBox - > SetSelectedItem ( Grid ) ;
break ;
}
}
}
2023-01-31 01:11:48 -05:00
void SOpenVDBAttributesConfigurator : : Construct ( const FArguments & InArgs )
2022-12-01 19:25:56 -05:00
{
2023-01-31 01:11:48 -05:00
AttributesDesc = InArgs . _AttributesDesc ;
2022-12-01 19:25:56 -05:00
OpenVDBSupportedTargetFormats = InArgs . _OpenVDBSupportedTargetFormats ;
for ( uint32 ComponentIndex = 0 ; ComponentIndex < 4 ; + + ComponentIndex )
{
ComponentPickers [ ComponentIndex ] =
SNew ( SOpenVDBComponentPicker )
2023-01-31 01:11:48 -05:00
. AttributesDesc ( AttributesDesc )
2022-12-01 19:25:56 -05:00
. ComponentIndex ( ComponentIndex )
2023-01-10 15:51:23 -05:00
. OpenVDBGridComponentInfo ( InArgs . _OpenVDBGridComponentInfo ) ;
2022-12-01 19:25:56 -05:00
}
this - > ChildSlot
[
SNew ( SVerticalBox )
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( 2 )
[
SNew ( SHorizontalBox )
+ SHorizontalBox : : Slot ( )
. VAlign ( VAlign_Center )
. FillWidth ( 1.0f )
. Padding ( 2.0f )
[
SNew ( STextBlock )
2023-01-31 01:11:48 -05:00
. Text ( InArgs . _AttributesName )
2022-12-01 19:25:56 -05:00
]
+ SHorizontalBox : : Slot ( )
2023-04-25 07:50:06 -04:00
. FillWidth ( 0.5f )
2022-12-01 19:25:56 -05:00
. VAlign ( VAlign_Center )
. Padding ( 2.0f )
[
SNew ( SBox )
. WidthOverride ( 50.0f )
[
2023-01-31 01:11:48 -05:00
SAssignNew ( FormatComboBox , SComboBox < TSharedPtr < ESparseVolumeAttributesFormat > > )
2022-12-01 19:25:56 -05:00
. OptionsSource ( OpenVDBSupportedTargetFormats )
2023-01-31 01:11:48 -05:00
. OnGenerateWidget_Lambda ( [ ] ( TSharedPtr < ESparseVolumeAttributesFormat > InItem )
2022-12-01 19:25:56 -05:00
{
return SNew ( STextBlock )
. Text ( GetFormatComboBoxItemText ( InItem ) ) ;
} )
2023-01-31 01:11:48 -05:00
. OnSelectionChanged_Lambda ( [ this ] ( TSharedPtr < ESparseVolumeAttributesFormat > InItem , ESelectInfo : : Type )
2022-12-01 19:25:56 -05:00
{
2023-01-31 01:11:48 -05:00
AttributesDesc - > Format = InItem ? * InItem : ESparseVolumeAttributesFormat : : Float32 ;
2022-12-01 19:25:56 -05:00
} )
[
SNew ( STextBlock )
. Text_Lambda ( [ this ] ( )
{
return GetFormatComboBoxItemText ( FormatComboBox - > GetSelectedItem ( ) ) ;
} )
]
]
]
]
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( 2 )
[
SNew ( SBorder )
. Padding ( FMargin ( 3 ) )
. BorderImage ( FAppStyle : : GetBrush ( " ToolPanel.GroupBorder " ) )
[
SNew ( SVerticalBox )
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( 2 )
[
ComponentPickers [ 0 ] - > AsShared ( )
]
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( 2 )
[
ComponentPickers [ 1 ] - > AsShared ( )
]
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( 2 )
[
ComponentPickers [ 2 ] - > AsShared ( )
]
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( 2 )
[
ComponentPickers [ 3 ] - > AsShared ( )
]
]
]
] ;
}
2023-01-31 01:11:48 -05:00
void SOpenVDBAttributesConfigurator : : RefreshUIFromData ( )
2022-12-01 19:25:56 -05:00
{
for ( auto & Format : * OpenVDBSupportedTargetFormats )
{
2023-01-31 01:11:48 -05:00
if ( * Format = = AttributesDesc - > Format )
2022-12-01 19:25:56 -05:00
{
FormatComboBox - > SetSelectedItem ( Format ) ;
break ;
}
}
for ( uint32 i = 0 ; i < 4 ; + + i )
{
ComponentPickers [ i ] - > RefreshUIFromData ( ) ;
}
}
2023-01-30 11:48:00 -05:00
void SOpenVDBGridInfoTableRow : : Construct ( const FArguments & InArgs , const TSharedRef < STableViewBase > & OwnerTableView )
{
OpenVDBGridInfo = InArgs . _OpenVDBGridInfo ;
SMultiColumnTableRow < TSharedPtr < FOpenVDBGridInfo > > : : Construct ( FSuperRowType : : FArguments ( ) , OwnerTableView ) ;
}
TSharedRef < SWidget > SOpenVDBGridInfoTableRow : : GenerateWidgetForColumn ( const FName & ColumnName )
{
if ( ColumnName = = VDB_GRID_ROW_NAME_GRID_INDEX )
{
return SNew ( SBox ) . Padding ( 2 ) . VAlign ( VAlign_Center )
[
SNew ( STextBlock ) . Text ( FText : : FromString ( FString : : Format ( TEXT ( " {0}. " ) , { OpenVDBGridInfo - > Index } ) ) )
] ;
}
else if ( ColumnName = = VDB_GRID_ROW_NAME_GRID_TYPE )
{
return SNew ( SBox ) . Padding ( 2 ) . VAlign ( VAlign_Center )
[
SNew ( STextBlock ) . Text ( FText : : FromString ( OpenVDBGridTypeToString ( OpenVDBGridInfo - > Type ) ) )
] ;
}
else if ( ColumnName = = VDB_GRID_ROW_NAME_GRID_NAME )
{
return SNew ( SBox ) . Padding ( 2 ) . VAlign ( VAlign_Center )
[
SNew ( STextBlock ) . Text ( FText : : FromString ( OpenVDBGridInfo - > Name ) )
] ;
}
else if ( ColumnName = = VDB_GRID_ROW_NAME_GRID_DIMS )
{
return SNew ( SBox ) . Padding ( 2 ) . VAlign ( VAlign_Center )
[
SNew ( STextBlock ) . Text ( FText : : FromString ( OpenVDBGridInfo - > VolumeActiveDim . ToString ( ) ) )
] ;
}
return SNullWidget : : NullWidget ;
}
# undef LOCTEXT_NAMESPACE