本文整理汇总了C++中TWeakObjectPtr::GetClass方法的典型用法代码示例。如果您正苦于以下问题:C++ TWeakObjectPtr::GetClass方法的具体用法?C++ TWeakObjectPtr::GetClass怎么用?C++ TWeakObjectPtr::GetClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TWeakObjectPtr
的用法示例。
在下文中一共展示了TWeakObjectPtr::GetClass方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
FORCEINLINE bool operator()( const TWeakObjectPtr< UObject >& Lhs, const TWeakObjectPtr< UObject >& Rhs ) const
{
const bool LhsObjectValid = Lhs.IsValid();
if ( !LhsObjectValid )
{
return true;
}
const bool RhsObjectValid = Rhs.IsValid();
if ( !RhsObjectValid )
{
return false;
}
const UStruct* const PropertyTargetType = Property->GetOwnerStruct();
const UClass* const LhsClass = Lhs->GetClass();
if ( !LhsClass->IsChildOf( PropertyTargetType ) )
{
return true;
}
const UClass* const RhsClass = Rhs->GetClass();
if ( !RhsClass->IsChildOf( PropertyTargetType ) )
{
return false;
}
typename UPropertyType::TCppType LhsValue = Property->GetPropertyValue_InContainer(Lhs.Get());
typename UPropertyType::TCppType RhsValue = Property->GetPropertyValue_InContainer(Rhs.Get());
return ComparePropertyValue( LhsValue, RhsValue );
}
示例2: IsActorValidForLayer
bool FLayers::IsActorValidForLayer( const TWeakObjectPtr< AActor >& Actor )
{
if( !Actor.IsValid() || Actor->GetClass() == nullptr || Actor->GetWorld() == nullptr)
{
return false;
}
const bool bIsBuilderBrush = FActorEditorUtils::IsABuilderBrush(Actor.Get());
const bool bIsHidden = ( Actor->GetClass()->GetDefaultObject<AActor>()->bHiddenEd == true );
const bool bIsInEditorWorld = ( Actor->GetWorld()->WorldType == EWorldType::Editor );
const bool bIsValid = !bIsHidden && !bIsBuilderBrush && bIsInEditorWorld;
return bIsValid;
}
示例3: RemoveActorFromStats
void FLayers::RemoveActorFromStats( const TWeakObjectPtr< ULayer >& Layer, const TWeakObjectPtr< AActor >& Actor )
{
if( !Actor.IsValid() )
{
return;
}
UClass* ActorClass = Actor->GetClass();
bool bFoundClassStats = false;
for (int StatsIndex = 0; StatsIndex < Layer->ActorStats.Num() ; StatsIndex++)
{
FLayerActorStats& Stats = Layer->ActorStats[ StatsIndex ];
if( Stats.Type == ActorClass )
{
bFoundClassStats = true;
--Stats.Total;
if( Stats.Total == 0 )
{
Layer->ActorStats.RemoveAt( StatsIndex );
}
break;
}
}
if( bFoundClassStats )
{
LayersChanged.Broadcast( ELayersAction::Modify, Layer, TEXT( "ActorStats" ) );
}
}
示例4: AddActorToStats
void FLayers::AddActorToStats( const TWeakObjectPtr< ULayer >& Layer, const TWeakObjectPtr< AActor >& Actor )
{
if( !Actor.IsValid() )
{
return;
}
UClass* ActorClass = Actor->GetClass();
bool bFoundClassStats = false;
for( auto StatsIt = Layer->ActorStats.CreateIterator(); StatsIt; ++StatsIt )
{
FLayerActorStats& Stats = *StatsIt;
if( Stats.Type == ActorClass )
{
Stats.Total++;
bFoundClassStats = true;
break;
}
}
if( !bFoundClassStats )
{
FLayerActorStats NewActorStats;
NewActorStats.Total = 1;
NewActorStats.Type = ActorClass;
Layer->ActorStats.Add( NewActorStats );
}
LayersChanged.Broadcast( ELayersAction::Modify, Layer, TEXT( "ActorStats" ) );
}
示例5: FindIconForActors
const FSlateBrush* FClassIconFinder::FindIconForActors(const TArray< TWeakObjectPtr<AActor> >& InActors, UClass*& CommonBaseClass)
{
// Get the common base class of the selected actors
const FSlateBrush* CommonIcon = nullptr;
for( int32 ActorIdx = 0; ActorIdx < InActors.Num(); ++ActorIdx )
{
TWeakObjectPtr<AActor> Actor = InActors[ActorIdx];
UClass* ObjClass = Actor->GetClass();
if (!CommonBaseClass)
{
CommonBaseClass = ObjClass;
}
while (!ObjClass->IsChildOf(CommonBaseClass))
{
CommonBaseClass = CommonBaseClass->GetSuperClass();
}
const FSlateBrush* ActorIcon = FindIconForActor(Actor);
if (!CommonIcon)
{
CommonIcon = ActorIcon;
}
if (CommonIcon != ActorIcon)
{
CommonIcon = FindIconForClass(CommonBaseClass);
}
}
return CommonIcon;
}
示例6: operator
FORCEINLINE bool operator()(const TWeakObjectPtr<AActor>& A) const
{
if (A.IsValid())
{
bool IsChild = A->GetClass()->IsChildOf(ClassFilter);
return Negate ? !IsChild : IsChild;
}
return true; // Default to removal
}
示例7: SNew
TSharedRef< SWidget > SDetailNameArea::BuildObjectNameArea( const TArray< TWeakObjectPtr<UObject> >& SelectedObjects )
{
// Get the common base class of the selected objects
UClass* BaseClass = NULL;
for( int32 ObjectIndex = 0; ObjectIndex < SelectedObjects.Num(); ++ObjectIndex )
{
TWeakObjectPtr<UObject> ObjectWeakPtr = SelectedObjects[ObjectIndex];
if( ObjectWeakPtr.IsValid() )
{
UClass* ObjClass = ObjectWeakPtr->GetClass();
if (!BaseClass)
{
BaseClass = ObjClass;
}
while (!ObjClass->IsChildOf(BaseClass))
{
BaseClass = BaseClass->GetSuperClass();
}
}
}
TSharedRef< SHorizontalBox > ObjectNameArea = SNew( SHorizontalBox );
if (BaseClass)
{
// Get selection icon based on actor(s) classes and add before the selection label
const FSlateBrush* ActorIcon = FClassIconFinder::FindIconForClass(BaseClass);
ObjectNameArea->AddSlot()
.AutoWidth()
.HAlign(HAlign_Left)
.VAlign(VAlign_Center)
.Padding(0,0,6,0)
[
SNew(SImage)
.Image(ActorIcon)
.ToolTip(FEditorClassUtils::GetTooltip(BaseClass))
];
}
// Add the selected object(s) type name, along with buttons for either opening C++ code or editing blueprints
const int32 NumSelectedSurfaces = AssetSelectionUtils::GetNumSelectedSurfaces( GWorld );
if( SelectedObjects.Num() > 0 )
{
if ( bShowActorLabel )
{
FEditorWidgetsModule& EdWidgetsModule = FModuleManager::LoadModuleChecked<FEditorWidgetsModule>(TEXT("EditorWidgets"));
TSharedRef<IObjectNameEditableTextBox> ObjectNameBox = EdWidgetsModule.CreateObjectNameEditableTextBox(SelectedObjects);
ObjectNameArea->AddSlot()
.AutoWidth()
.Padding(0, 0, 3, 0)
[
SNew(SBox)
.WidthOverride(200.0f)
.VAlign(VAlign_Center)
[
ObjectNameBox
]
];
}
const TWeakObjectPtr< UObject > ObjectWeakPtr = SelectedObjects.Num() == 1 ? SelectedObjects[0] : NULL;
BuildObjectNameAreaSelectionLabel( ObjectNameArea, ObjectWeakPtr, SelectedObjects.Num() );
if( bShowLockButton )
{
ObjectNameArea->AddSlot()
.HAlign(HAlign_Right)
.FillWidth(1.0f)
[
SNew( SButton )
.ButtonStyle( FEditorStyle::Get(), "NoBorder" )
.OnClicked( OnLockButtonClicked )
.ToolTipText( LOCTEXT("LockSelectionButton_ToolTip", "Locks the current selection into the Details panel") )
[
SNew( SImage )
.Image( this, &SDetailNameArea::OnGetLockButtonImageResource )
]
];
}
}
else
{
if ( SelectionTip.Get() && NumSelectedSurfaces == 0 )
{
ObjectNameArea->AddSlot()
.FillWidth( 1.0f )
.HAlign( HAlign_Center )
.Padding( 2.0f, 24.0f, 2.0f, 2.0f )
[
SNew( STextBlock )
.Text( LOCTEXT("NoObjectsSelected", "Select an object to view details.") )
];
}
else
{
//.........这里部分代码省略.........