本文整理汇总了C++中TSharedPtr类的典型用法代码示例。如果您正苦于以下问题:C++ TSharedPtr类的具体用法?C++ TSharedPtr怎么用?C++ TSharedPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TSharedPtr类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: checkSlow
/**
* Enacts the transaction.
*/
void FTransaction::Apply()
{
checkSlow(Inc==1||Inc==-1);
// Figure out direction.
const int32 Start = Inc==1 ? 0 : Records.Num()-1;
const int32 End = Inc==1 ? Records.Num() : -1;
// Init objects.
TMap<UObject*, TSharedPtr<ITransactionObjectAnnotation>> ChangedObjects;
for( int32 i=Start; i!=End; i+=Inc )
{
FObjectRecord& Record = Records[i];
Record.bRestored = false;
UObject* Object = Record.Object.Get();
if (!ChangedObjects.Contains(Object))
{
Object->CheckDefaultSubobjects();
Object->PreEditUndo();
}
ChangedObjects.Add(Object, Record.ObjectAnnotation);
}
for( int32 i=Start; i!=End; i+=Inc )
{
Records[i].Restore( this );
}
// An Actor's components must always get its PostEditUndo before the owning Actor so do a quick sort
ChangedObjects.KeySort([](UObject& A, UObject& B)
{
UActorComponent* BAsComponent = Cast<UActorComponent>(&B);
return (BAsComponent ? (BAsComponent->GetOwner() != &A) : true);
});
NumModelsModified = 0; // Count the number of UModels that were changed.
for (auto ChangedObjectIt : ChangedObjects)
{
UObject* ChangedObject = ChangedObjectIt.Key;
UModel* Model = Cast<UModel>(ChangedObject);
if (Model && Model->Nodes.Num())
{
FBSPOps::bspBuildBounds(Model);
++NumModelsModified;
}
TSharedPtr<ITransactionObjectAnnotation> ChangedObjectTransactionAnnotation = ChangedObjectIt.Value;
if (ChangedObjectTransactionAnnotation.IsValid())
{
ChangedObject->PostEditUndo(ChangedObjectTransactionAnnotation);
}
else
{
ChangedObject->PostEditUndo();
}
}
// Flip it.
if (bFlip)
{
Inc *= -1;
}
for (auto ChangedObjectIt : ChangedObjects)
{
UObject* ChangedObject = ChangedObjectIt.Key;
ChangedObject->CheckDefaultSubobjects();
}
}
开发者ID:magetron,项目名称:UnrealEngine4-mod,代码行数:71,代码来源:EditorTransaction.cpp
注:本文中的TSharedPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论