本文整理汇总了C++中TObjectIterator::UpdateCollisionProfile方法的典型用法代码示例。如果您正苦于以下问题:C++ TObjectIterator::UpdateCollisionProfile方法的具体用法?C++ TObjectIterator::UpdateCollisionProfile怎么用?C++ TObjectIterator::UpdateCollisionProfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TObjectIterator
的用法示例。
在下文中一共展示了TObjectIterator::UpdateCollisionProfile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadProfileConfig
//.........这里部分代码省略.........
int32 TraceTypeEnumIndex = 0;
// first go through fill up ObjectType Enum
for ( int32 EnumIndex=0; EnumIndex<NumEnum; ++EnumIndex )
{
// if not hidden
const FString& Hidden = Enum->GetMetaData(*HiddenMeta, EnumIndex);
if ( Hidden.IsEmpty() )
{
const FString& DisplayName = Enum->GetMetaData(*KeyName, EnumIndex);
if ( !DisplayName.IsEmpty() )
{
// find out trace type or object type
if (Enum->GetMetaData(*TraceType, EnumIndex) == TraceValue)
{
TraceTypeEnum->RemoveMetaData(*HiddenMeta, TraceTypeEnumIndex);
TraceTypeEnum->SetMetaData(*KeyName, *DisplayName, TraceTypeEnumIndex);
++TraceTypeEnumIndex;
}
else
{
ObjectTypeEnum->RemoveMetaData(*HiddenMeta, ObjectTypeEnumIndex);
ObjectTypeEnum->SetMetaData(*KeyName, *DisplayName, ObjectTypeEnumIndex);
++ObjectTypeEnumIndex;
}
}
}
}
// make sure TraceTypeEnumIndex matches TraceTypeMapping
check (TraceTypeMapping.Num() == TraceTypeEnumIndex);
check (ObjectTypeMapping.Num() == ObjectTypeEnumIndex);
#endif
// collision redirector has to be loaded before profile
CollisionChannelRedirectsMap.Empty();
for(auto Iter = CollisionChannelRedirects.CreateConstIterator(); Iter; ++Iter)
{
FName OldName = Iter->OldName;
FName NewName = Iter->NewName;
// at least we need to have OldName
if(OldName!= NAME_None && NewName != NAME_None)
{
// add to pair
CollisionChannelRedirectsMap.Add(OldName, NewName);
}
else
{
// print error
UE_LOG(LogCollisionProfile, Warning, TEXT("CollisionChannel Redirects : Name Can't be none (%s: %s)"), *OldName.ToString(), *NewName.ToString());
}
}
// 2. Second loads all set up back to ResponseToChannels
// this does a lot of iteration, but this only happens once loaded, so it's better to be convenient than efficient
// fill up Profiles data
FillProfileData(Profiles, Enum, KeyName, EditProfiles);
// 3. It loads redirect data - now time to load profile redirect
ProfileRedirectsMap.Empty();
// handle profile redirect here
for(auto Iter = ProfileRedirects.CreateConstIterator(); Iter; ++Iter)
{
FName OldName = Iter->OldName;
FName NewName = Iter->NewName;
// at least we need to have OldName
if(OldName!= NAME_None && NewName != NAME_None)
{
FCollisionResponseTemplate Template;
// make sure the template exists
if(FindProfileData(Profiles, NewName, Template))
{
// add to pair
ProfileRedirectsMap.Add(OldName, NewName);
}
else
{
// print error
UE_LOG(LogCollisionProfile, Warning, TEXT("ProfileRedirect (%s : %s) - New Name (\'%s\') isn't found "),
*OldName.ToString(), *NewName.ToString(), *NewName.ToString());
}
}
}
#if WITH_EDITOR
if (bForceInit)
{
// go through objects, and see if we can reinitialize profile
for(TObjectIterator<UPrimitiveComponent> PrimIt; PrimIt; ++PrimIt)
{
PrimIt->UpdateCollisionProfile();
}
}
#endif
}