本文整理汇总了C++中UActorComponent::HasAnyFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ UActorComponent::HasAnyFlags方法的具体用法?C++ UActorComponent::HasAnyFlags怎么用?C++ UActorComponent::HasAnyFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UActorComponent
的用法示例。
在下文中一共展示了UActorComponent::HasAnyFlags方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMaterialChanged
//.........这里部分代码省略.........
UObject* EditChangeObject = CurrentComponent;
if( CurrentComponent->IsA( UMeshComponent::StaticClass() ) )
{
MaterialProperty = FindField<UProperty>( UMeshComponent::StaticClass(), "OverrideMaterials" );
}
else if( CurrentComponent->IsA( UDecalComponent::StaticClass() ) )
{
MaterialProperty = FindField<UProperty>( UDecalComponent::StaticClass(), "DecalMaterial" );
}
else if( CurrentComponent->IsA( UTextRenderComponent::StaticClass() ) )
{
MaterialProperty = FindField<UProperty>( UTextRenderComponent::StaticClass(), "TextMaterial" );
}
else if (CurrentComponent->IsA<ULandscapeComponent>() )
{
MaterialProperty = FindField<UProperty>( ALandscapeProxy::StaticClass(), "LandscapeMaterial" );
EditChangeObject = CastChecked<ULandscapeComponent>(CurrentComponent)->GetLandscapeProxy();
}
// Add a navigation update lock only if the component world is valid
TSharedPtr<FNavigationLockContext> NavUpdateLock;
UWorld* World = CurrentComponent->GetWorld();
if( World )
{
NavUpdateLock = MakeShareable( new FNavigationLockContext(World, ENavigationLockReason::MaterialUpdate) );
}
EditChangeObject->PreEditChange( MaterialProperty );
if( NotifyHook && MaterialProperty )
{
NotifyHook->NotifyPreChange( MaterialProperty );
}
SwapMaterialLambda( CurrentComponent, It.GetMaterialIndex(), NewMaterial );
FPropertyChangedEvent PropertyChangedEvent( MaterialProperty );
EditChangeObject->PostEditChangeProperty( PropertyChangedEvent );
if( NotifyHook && MaterialProperty )
{
NotifyHook->NotifyPostChange( PropertyChangedEvent, MaterialProperty );
}
// Propagate material change to instances of the edited component template
if( !FApp::IsGame() )
{
TArray<UObject*> ComponentArchetypeInstances;
if( CurrentComponent->HasAnyFlags(RF_ArchetypeObject) )
{
CurrentComponent->GetArchetypeInstances(ComponentArchetypeInstances);
}
else if( UObject* Outer = CurrentComponent->GetOuter() )
{
TArray<UObject*> OuterArchetypeInstances;
Outer->GetArchetypeInstances(OuterArchetypeInstances);
for( auto OuterArchetypeInstance : OuterArchetypeInstances )
{
if( UObject* ArchetypeInstance = static_cast<UObject*>(FindObjectWithOuter(OuterArchetypeInstance, CurrentComponent->GetClass(), CurrentComponent->GetFName())) )
{
ComponentArchetypeInstances.Add(ArchetypeInstance);
}
}
}
for( auto ComponentArchetypeInstance : ComponentArchetypeInstances )
{
CurrentComponent = CastChecked<UActorComponent>( ComponentArchetypeInstance );
if( CurrentComponent->IsA<ULandscapeComponent>() )
{
ComponentArchetypeInstance = CastChecked<ULandscapeComponent>(CurrentComponent)->GetLandscapeProxy();
}
// Reset the navigation update lock if necessary
UWorld* PreviousWorld = World;
World = CurrentComponent->GetWorld();
if( PreviousWorld != World )
{
NavUpdateLock = MakeShareable( new FNavigationLockContext(World, ENavigationLockReason::MaterialUpdate) );
}
ComponentArchetypeInstance->PreEditChange( MaterialProperty );
SwapMaterialLambda( CurrentComponent, It.GetMaterialIndex(), NewMaterial );
ComponentArchetypeInstance->PostEditChangeProperty( PropertyChangedEvent );
}
}
}
}
}
if( bMadeTransaction )
{
// End the transation if we created one
GEditor->EndTransaction();
// Redraw viewports to reflect the material changes
GUnrealEd->RedrawLevelEditingViewports();
}
}