本文整理汇总了C++中TSharedRef::AsPropertyPath方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedRef::AsPropertyPath方法的具体用法?C++ TSharedRef::AsPropertyPath怎么用?C++ TSharedRef::AsPropertyPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSharedRef
的用法示例。
在下文中一共展示了TSharedRef::AsPropertyPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateColumns
void FPropertyTable::UpdateColumns()
{
if( Orientation == EPropertyTableOrientation::AlignPropertiesInColumns)
{
TMultiMap< UProperty*, TSharedRef< IPropertyTableColumn > > ColumnsMap;
for (int ColumnIdx = 0; ColumnIdx < Columns.Num(); ++ColumnIdx)
{
TSharedRef< IDataSource > DataSource = Columns[ColumnIdx]->GetDataSource();
TSharedPtr< FPropertyPath > PropertyPath = DataSource->AsPropertyPath();
if( PropertyPath.IsValid() && PropertyPath->GetNumProperties() > 0 )
{
ColumnsMap.Add(PropertyPath->GetRootProperty().Property.Get(), Columns[ColumnIdx]);
}
}
Columns.Empty();
if ( ShowRowHeader )
{
TSharedRef< IPropertyTableColumn > NewColumn = MakeShareable( new FPropertyTableRowHeaderColumn( SharedThis( this ) ) );
Columns.Add( NewColumn );
}
if ( ShowObjectName )
{
TSharedRef< IPropertyTableColumn > NewColumn = MakeShareable( new FPropertyTableObjectNameColumn( SharedThis( this ) ) );
NewColumn->SetFrozen( true );
Columns.Add( NewColumn );
}
TArray< TWeakObjectPtr< UStruct > > UniqueTypes;
TArray< int > TypeCounter;
for( auto ObjectIter = SourceObjects.CreateConstIterator(); ObjectIter; ++ObjectIter )
{
auto Object = *ObjectIter;
if( !Object.IsValid() )
{
continue;
}
const TSharedRef< FObjectPropertyNode > RootObjectNode = GetObjectPropertyNode( Object );
TWeakObjectPtr< UStruct > Type;
if ( RootPath->GetNumProperties() == 0 )
{
Type = RootObjectNode->GetObjectBaseClass();
}
else
{
const TSharedPtr< FPropertyNode > PropertyNode = FPropertyNode::FindPropertyNodeByPath( RootPath, RootObjectNode );
if ( !PropertyNode.IsValid() )
{
continue;
}
const TWeakObjectPtr< UProperty > Property = PropertyNode->GetProperty();
if ( !Property.IsValid() || !Property->IsA( UStructProperty::StaticClass() ) )
{
continue;
}
UStructProperty* StructProperty = Cast< UStructProperty >( Property.Get() );
Type = StructProperty->Struct;
}
if ( !Type.IsValid() )
{
continue;
}
int FoundIndex = -1;
if ( UniqueTypes.Find( Type, /*OUT*/FoundIndex ) )
{
TypeCounter[ FoundIndex ] = TypeCounter[ FoundIndex ] + 1;
continue;
}
UniqueTypes.Add( Type );
TypeCounter.Add( 1 );
}
if ( UniqueTypes.Num() > 0 )
{
int HighestCountIndex = 0;
int HighestCount = 0;
for (int Index = 0; Index < TypeCounter.Num(); Index++)
{
if ( TypeCounter[Index] > HighestCount )
{
HighestCountIndex = Index;
HighestCount = TypeCounter[Index];
}
}
TWeakObjectPtr< UStruct > PrimaryType = UniqueTypes[ HighestCountIndex ];
//.........这里部分代码省略.........
示例2: 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() );
}
}