TSharedPtr< SWidget > FConfigPropertyCustomColumn::CreateColumnLabel(const TSharedRef< IPropertyTableColumn >& Column, const TSharedRef< IPropertyTableUtilities >& Utilities, const FName& Style) const { if (Column->GetDataSource()->IsValid()) { TSharedPtr< FPropertyPath > PropertyPath = Column->GetDataSource()->AsPropertyPath(); if (PropertyPath.IsValid() && PropertyPath->GetNumProperties() > 0) { return SNew(STextBlock) .Text(EditProperty->GetDisplayNameText()); } } return SNullWidget::NullWidget; }
TSharedRef< FObjectPropertyNode > FPropertyTable::GetObjectPropertyNode( const TSharedRef< IPropertyTableColumn >& Column, const TSharedRef< IPropertyTableRow >& Row ) { TWeakObjectPtr< UObject > Object; if( Orientation == EPropertyTableOrientation::AlignPropertiesInColumns ) { Object = Row->GetDataSource()->AsUObject(); } else { Object = Column->GetDataSource()->AsUObject(); } return GetObjectPropertyNode( Object ); }
bool FConfigPropertyCustomColumn::Supports(const TSharedRef< IPropertyTableColumn >& Column, const TSharedRef< IPropertyTableUtilities >& Utilities) const { bool IsSupported = false; if (Column->GetDataSource()->IsValid()) { TSharedPtr< FPropertyPath > PropertyPath = Column->GetDataSource()->AsPropertyPath(); if (PropertyPath.IsValid() && PropertyPath->GetNumProperties() > 0) { const FPropertyInfo& PropertyInfo = PropertyPath->GetRootProperty(); UProperty* Property = PropertyInfo.Property.Get(); IsSupported = Property->GetFName() == TEXT("ExternalProperty"); } } return IsSupported; }
bool FDeviceProfileTextureLODSettingsColumn::Supports(const TSharedRef< IPropertyTableColumn >& Column, const TSharedRef< IPropertyTableUtilities >& Utilities) const { if( Column->GetDataSource()->IsValid() ) { TSharedPtr< FPropertyPath > PropertyPath = Column->GetDataSource()->AsPropertyPath(); if( PropertyPath.IsValid() && PropertyPath->GetNumProperties() > 0 ) { const FPropertyInfo& PropertyInfo = PropertyPath->GetRootProperty(); UProperty* Property = PropertyInfo.Property.Get(); if (Property->GetName() == TEXT("TextureLODGroups") && Property->IsA(UArrayProperty::StaticClass())) { return true; } } } return false; }
bool FCustomFontColumn::Supports( const TSharedRef< IPropertyTableColumn >& Column, const TSharedRef< IPropertyTableUtilities >& Utilities ) const { bool IsSupported = false; if( Column->GetDataSource()->IsValid() ) { TSharedPtr< FPropertyPath > PropertyPath = Column->GetDataSource()->AsPropertyPath(); if( PropertyPath.IsValid() && PropertyPath->GetNumProperties() > 0 ) { const FPropertyInfo& PropertyInfo = PropertyPath->GetRootProperty(); UProperty* Property = PropertyInfo.Property.Get(); if (SupportedProperties.Contains(Property)) { IsSupported = true; } } } return IsSupported; }
void FPropertyTable::GetSelectedObjects( TArray< TWeakObjectPtr< UObject > >& OutSelectedObjects) const { for( auto RowIter = SelectedRows.CreateConstIterator(); RowIter; ++RowIter ) { const TSharedRef< IPropertyTableRow > Row = *RowIter; const TWeakObjectPtr< UObject > Object = Row->GetDataSource()->AsUObject(); if ( Object.IsValid() ) { OutSelectedObjects.Add( Object ); } } }
void FPropertyEditorToolkit::ToggleColumnForProperty( const TSharedPtr< FPropertyPath >& PropertyPath ) { if ( !PropertyPath.IsValid() ) { return; } TSharedRef< FPropertyPath > NewPath = PropertyPath->TrimRoot( PropertyTable->GetRootPath()->GetNumProperties() ); const TSet< TSharedRef< IPropertyTableRow > > SelectedRows = PropertyTable->GetSelectedRows(); for( auto RowIter = SelectedRows.CreateConstIterator(); RowIter; ++RowIter ) { NewPath = NewPath->TrimRoot( (*RowIter)->GetPartialPath()->GetNumProperties() ); break; } if ( NewPath->GetNumProperties() == 0 ) { return; } TSharedPtr< IPropertyTableColumn > ExistingColumn; for( auto ColumnIter = PropertyTable->GetColumns().CreateConstIterator(); ColumnIter; ++ColumnIter ) { TSharedRef< IPropertyTableColumn > Column = *ColumnIter; const TSharedPtr< FPropertyPath > Path = Column->GetDataSource()->AsPropertyPath(); if ( Path.IsValid() && FPropertyPath::AreEqual( Path.ToSharedRef(), NewPath ) ) { ExistingColumn = Column; } } if ( ExistingColumn.IsValid() ) { PropertyTable->RemoveColumn( ExistingColumn.ToSharedRef() ); const TSharedRef< FPropertyPath > ColumnPath = ExistingColumn->GetDataSource()->AsPropertyPath().ToSharedRef(); for (int Index = PropertyPathsAddedAsColumns.Num() - 1; Index >= 0 ; Index--) { if ( FPropertyPath::AreEqual( ColumnPath, PropertyPathsAddedAsColumns[ Index ] ) ) { PropertyPathsAddedAsColumns.RemoveAt( Index ); } } } else { PropertyTable->AddColumn( NewPath ); PropertyPathsAddedAsColumns.Add( NewPath ); } }
void FPropertyTable::RemoveRow( const TSharedRef< class IPropertyTableRow >& Row ) { //@todo Consider encapsulating the logic for this check [12/7/2012 Justin.Sargent] if ( !Row->HasChildren() && !Row->GetDataSource()->AsPropertyPath().IsValid() ) { const TWeakObjectPtr< UObject > Object = Row->GetDataSource()->AsUObject(); SourceObjectPropertyNodes.Remove( Object ); if ( !Object.IsValid() ) { PurgeInvalidObjectNodes(); } } // Update the selection to exclude cells in the row we are removing TSet<TSharedRef<IPropertyTableCell>> NewSelectedCells; for(const TSharedRef<IPropertyTableCell>& CurrentSelectedCell : SelectedCells) { if(CurrentSelectedCell->GetRow() != Row) { NewSelectedCells.Add(CurrentSelectedCell); } } Rows.Remove( Row ); RowsChanged.Broadcast(); for( const TSharedRef< IPropertyTableColumn >& Column : Columns ) { Column->RemoveCellsForRow( Row ); } if(NewSelectedCells.Num() != SelectedCells.Num()) { SetSelectedCells(NewSelectedCells); } }
void FPropertyEditorToolkit::TableColumnsChanged() { PropertyPathsAddedAsColumns.Empty(); for( auto ColumnIter = PropertyTable->GetColumns().CreateConstIterator(); ColumnIter; ++ColumnIter ) { TSharedRef< IPropertyTableColumn > Column = *ColumnIter; TSharedPtr< FPropertyPath > ColumnPath = Column->GetDataSource()->AsPropertyPath(); if ( ColumnPath.IsValid() && ColumnPath->GetNumProperties() > 0 ) { PropertyPathsAddedAsColumns.Add( ColumnPath.ToSharedRef() ); } } }
void FStaticMeshLightingInfoStatsPage::SetMappingMethodOnSelectedComponents(TWeakPtr<IStatsViewer> InParentStatsViewer, bool bInTextureMapping, int32 InStaticLightingResolution) const { if(InParentStatsViewer.IsValid()) { const FScopedBusyCursor BusyCursor; // first get the selected objects in the table TArray<UStaticMeshLightingInfo*> SelectedObjects; TSharedPtr<IPropertyTable> PropertyTable = InParentStatsViewer.Pin()->GetPropertyTable(); const TSet< TSharedRef<IPropertyTableRow> >& Rows = PropertyTable->GetSelectedRows(); for(auto RowIt = Rows.CreateConstIterator(); RowIt; ++RowIt) { TSharedRef<IPropertyTableRow> Row = *RowIt; UStaticMeshLightingInfo* Entry = Cast<UStaticMeshLightingInfo>( Row->GetDataSource()->AsUObject().Get() ); SelectedObjects.Add(Entry); } if (SelectedObjects.Num() > 0) { const FScopedTransaction Transaction( LOCTEXT("StaticMeshLightingInfoSet", "DlgStaticMeshLightingInfo:Set") ); bool bRefresh = false; for (int32 CompIdx = 0; CompIdx < SelectedObjects.Num(); CompIdx++) { UStaticMeshLightingInfo* Entry = SelectedObjects[CompIdx]; if (Entry->StaticMeshActor.IsValid()) { Entry->StaticMeshActor->Modify(); } if ( Entry->StaticMeshComponent.IsValid()) { Entry->StaticMeshComponent->Modify(); Entry->StaticMeshComponent->SetStaticLightingMapping(bInTextureMapping, InStaticLightingResolution); Entry->StaticMeshComponent->InvalidateLightingCache(); Entry->StaticMeshComponent->ReregisterComponent(); } bRefresh = true; } if (bRefresh) { InParentStatsViewer.Pin()->Refresh(); } } } }
void FPropertyTableCell::Refresh() { const TSharedRef< IPropertyTableColumn > ColumnRef = Column.Pin().ToSharedRef(); const TSharedRef< IPropertyTableRow > RowRef = Row.Pin().ToSharedRef(); bIsBound = false; ObjectNode = GetTable()->GetObjectPropertyNode( ColumnRef, RowRef ); if ( !ObjectNode.IsValid() ) { return; } TSharedRef< IDataSource > ColumnBoundData = ColumnRef->GetDataSource(); TSharedRef< IDataSource > RowBoundData = RowRef->GetDataSource(); if ( !ColumnBoundData->IsValid() || !RowBoundData->IsValid() ) { return; } TSharedPtr< FPropertyPath > PropertyPath; TWeakObjectPtr< UObject > Item; Item = ColumnBoundData->AsUObject(); if ( !Item.IsValid() ) { Item = RowBoundData->AsUObject(); } if ( !Item.IsValid() ) { // Must have a valid non-UProperty UObject bound to the column or row return; } PropertyPath = ColumnBoundData->AsPropertyPath(); if ( !PropertyPath.IsValid() ) { PropertyPath = RowBoundData->AsPropertyPath(); } if ( !PropertyPath.IsValid() ) { // By this point a valid PropertyPath must have been found or created return; } PropertyNode = FPropertyNode::FindPropertyNodeByPath( GetTable()->GetRootPath(), ObjectNode.ToSharedRef() ); if ( !PropertyNode.IsValid() ) { return; } PropertyNode = FPropertyNode::FindPropertyNodeByPath( RowRef->GetPartialPath(), PropertyNode.ToSharedRef() ); if ( !PropertyNode.IsValid() ) { return; } PropertyNode = FPropertyNode::FindPropertyNodeByPath( ColumnRef->GetPartialPath(), PropertyNode.ToSharedRef() ); if ( !PropertyNode.IsValid() ) { return; } PropertyNode = FPropertyNode::FindPropertyNodeByPath( PropertyPath, PropertyNode.ToSharedRef() ); if ( PropertyNode.IsValid() ) { bIsBound = true; PropertyEditor = FPropertyEditor::Create( PropertyNode.ToSharedRef(), GetTable() ); } }