本文整理汇总了C++中GetTransientPackage函数的典型用法代码示例。如果您正苦于以下问题:C++ GetTransientPackage函数的具体用法?C++ GetTransientPackage怎么用?C++ GetTransientPackage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetTransientPackage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReplaceStructWithTempDuplicate
static void ReplaceStructWithTempDuplicate(
UUserDefinedStruct* StructureToReinstance,
TSet<UBlueprint*>& BlueprintsToRecompile,
TArray<UUserDefinedStruct*>& ChangedStructs)
{
if (StructureToReinstance)
{
UUserDefinedStruct* DuplicatedStruct = NULL;
{
const FString ReinstancedName = FString::Printf(TEXT("STRUCT_REINST_%s"), *StructureToReinstance->GetName());
const FName UniqueName = MakeUniqueObjectName(GetTransientPackage(), UUserDefinedStruct::StaticClass(), FName(*ReinstancedName));
TGuardValue<bool> IsDuplicatingClassForReinstancing(GIsDuplicatingClassForReinstancing, true);
DuplicatedStruct = (UUserDefinedStruct*)StaticDuplicateObject(StructureToReinstance, GetTransientPackage(), *UniqueName.ToString(), ~RF_Transactional);
}
DuplicatedStruct->Guid = StructureToReinstance->Guid;
DuplicatedStruct->Bind();
DuplicatedStruct->StaticLink(true);
DuplicatedStruct->PrimaryStruct = StructureToReinstance;
DuplicatedStruct->Status = EUserDefinedStructureStatus::UDSS_Duplicate;
DuplicatedStruct->SetFlags(RF_Transient);
DuplicatedStruct->AddToRoot();
CastChecked<UUserDefinedStructEditorData>(DuplicatedStruct->EditorData)->RecreateDefaultInstance();
for (auto StructProperty : TObjectRange<UStructProperty>(RF_ClassDefaultObject | RF_PendingKill))
{
if (StructProperty && (StructureToReinstance == StructProperty->Struct))
{
if (auto OwnerClass = Cast<UBlueprintGeneratedClass>(StructProperty->GetOwnerClass()))
{
if (UBlueprint* FoundBlueprint = Cast<UBlueprint>(OwnerClass->ClassGeneratedBy))
{
BlueprintsToRecompile.Add(FoundBlueprint);
StructProperty->Struct = DuplicatedStruct;
}
}
else if (auto OwnerStruct = Cast<UUserDefinedStruct>(StructProperty->GetOwnerStruct()))
{
check(OwnerStruct != DuplicatedStruct);
const bool bValidStruct = (OwnerStruct->GetOutermost() != GetTransientPackage())
&& !OwnerStruct->HasAnyFlags(RF_PendingKill)
&& (EUserDefinedStructureStatus::UDSS_Duplicate != OwnerStruct->Status.GetValue());
if (bValidStruct)
{
ChangedStructs.AddUnique(OwnerStruct);
StructProperty->Struct = DuplicatedStruct;
}
}
else
{
UE_LOG(LogK2Compiler, Error, TEXT("ReplaceStructWithTempDuplicate unknown owner"));
}
}
}
DuplicatedStruct->RemoveFromRoot();
}
}
示例2: SetFlags
/**
* Marks/Unmarks the package's bDirty flag
*/
void UPackage::SetDirtyFlag( bool bIsDirty )
{
if ( GetOutermost() != GetTransientPackage() )
{
if ( GUndo != NULL
// PIE world objects should never end up in the transaction buffer as we cannot undo during gameplay.
&& !(GetOutermost()->PackageFlags & (PKG_PlayInEditor|PKG_ContainsScript)) )
{
// make sure we're marked as transactional
SetFlags(RF_Transactional);
// don't call Modify() since it calls SetDirtyFlag()
GUndo->SaveObject( this );
}
// Update dirty bit
bDirty = bIsDirty;
if( GIsEditor // Only fire the callback in editor mode
&& !(PackageFlags & PKG_ContainsScript) // Skip script packages
&& !(PackageFlags & PKG_PlayInEditor) // Skip packages for PIE
&& GetTransientPackage() != this ) // Skip the transient package
{
// Package is changing dirty state, let the editor know so we may prompt for source control checkout
PackageDirtyStateChangedEvent.Broadcast(this);
}
}
}
示例3: TEXT
UMaterialShaderQualitySettings* UMaterialShaderQualitySettings::Get()
{
if( RenderQualitySingleton == nullptr )
{
static const TCHAR* SettingsContainerName = TEXT("MaterialShaderQualitySettingsContainer");
RenderQualitySingleton = FindObject<UMaterialShaderQualitySettings>(GetTransientPackage(), SettingsContainerName);
if (RenderQualitySingleton == nullptr)
{
RenderQualitySingleton = NewObject<UMaterialShaderQualitySettings>(GetTransientPackage(), UMaterialShaderQualitySettings::StaticClass(), SettingsContainerName);
RenderQualitySingleton->AddToRoot();
}
RenderQualitySingleton->CurrentPlatformSettings = RenderQualitySingleton->GetShaderPlatformQualitySettings(FPlatformProperties::PlatformName());
// LegacyShaderPlatformToShaderFormat(EShaderPlatform)
// GShaderPlatformForFeatureLevel
// GMaxRHIFeatureLevel
// populate shader platforms
RenderQualitySingleton->CurrentPlatformSettings = RenderQualitySingleton->GetShaderPlatformQualitySettings(FPlatformProperties::PlatformName());
}
return RenderQualitySingleton;
}
示例4: GetTransientPackage
void ARadiantWebViewActor::BindDynamicMaterial()
{
if ((GetNetMode() != NM_DedicatedServer) && MeshComponent && (WebViewRenderComponent->WebView->WebViewCanvas))
{
if (OldMeshMaterial)
{
MeshComponent->SetMaterial(OldMaterialIndex, OldMeshMaterial);
}
OldMeshMaterial = MeshComponent->GetMaterial(MaterialIndex);
if (WebViewMID)
{
WebViewMID->MarkPendingKill();
}
if (ReplaceMaterial)
{
WebViewMID = UMaterialInstanceDynamic::Create(ReplaceMaterial, GetTransientPackage());
}
else if (OldMeshMaterial)
{
WebViewMID = UMaterialInstanceDynamic::Create(OldMeshMaterial, GetTransientPackage());
}
if (WebViewMID)
{
WebViewMID->SetTextureParameterValue(TEXT("WebViewTexture"), WebViewRenderComponent->WebView->WebViewCanvas->RenderTargetTexture);
}
}
}
示例5: PreviewWorld
FPreviewScene::FPreviewScene(FPreviewScene::ConstructionValues CVS)
: PreviewWorld(NULL)
, bForceAllUsedMipsResident(CVS.bForceMipsResident)
{
PreviewWorld = NewObject<UWorld>();
PreviewWorld->WorldType = EWorldType::Preview;
if (CVS.bTransactional)
{
PreviewWorld->SetFlags(RF_Transactional);
}
FWorldContext& WorldContext = GEngine->CreateNewWorldContext(EWorldType::Preview);
WorldContext.SetCurrentWorld(PreviewWorld);
PreviewWorld->InitializeNewWorld(UWorld::InitializationValues()
.AllowAudioPlayback(CVS.bAllowAudioPlayback)
.CreatePhysicsScene(CVS.bCreatePhysicsScene)
.RequiresHitProxies(false)
.CreateNavigation(false)
.CreateAISystem(false)
.ShouldSimulatePhysics(CVS.bShouldSimulatePhysics)
.SetTransactional(CVS.bTransactional));
PreviewWorld->InitializeActorsForPlay(FURL());
GetScene()->UpdateDynamicSkyLight(FLinearColor::White * CVS.SkyBrightness, FLinearColor::Black);
DirectionalLight = NewObject<UDirectionalLightComponent>(GetTransientPackage());
DirectionalLight->Intensity = CVS.LightBrightness;
DirectionalLight->LightColor = FColor::White;
AddComponent(DirectionalLight, FTransform(CVS.LightRotation));
LineBatcher = NewObject<ULineBatchComponent>(GetTransientPackage());
AddComponent(LineBatcher, FTransform::Identity);
}
示例6: Init
void FTexAlignTools::Init()
{
// Create the list of aligners.
Aligners.Empty();
Aligners.Add(NewObject<UTexAlignerDefault>(GetTransientPackage(), NAME_None, RF_Public | RF_RootSet | RF_Standalone));
Aligners.Add(NewObject<UTexAlignerPlanar>(GetTransientPackage(), NAME_None, RF_Public | RF_RootSet | RF_Standalone));
Aligners.Add(NewObject<UTexAlignerBox>(GetTransientPackage(), NAME_None, RF_Public | RF_RootSet | RF_Standalone));
Aligners.Add(NewObject<UTexAlignerFit>(GetTransientPackage(), NAME_None, RF_Public | RF_RootSet | RF_Standalone));
FEditorDelegates::FitTextureToSurface.AddRaw(this, &FTexAlignTools::OnEditorFitTextureToSurface);
}
示例7: MakeUniqueObjectName
UObject* FEditorObjectTracker::GetEditorObjectForClass( UClass* EdClass )
{
UObject *Obj = (EditorObjMap.Contains(EdClass) ? *EditorObjMap.Find(EdClass) : NULL);
if(Obj == NULL)
{
FString ObjName = MakeUniqueObjectName(GetTransientPackage(), EdClass).ToString();
ObjName += "_EdObj";
Obj = StaticConstructObject(EdClass, GetTransientPackage(), FName(*ObjName), RF_Public|RF_Standalone|RF_Transient);
EditorObjMap.Add(EdClass,Obj);
}
return Obj;
}
示例8: Modify
void UChildActorComponent::PostEditChangeChainProperty(FPropertyChangedChainEvent& PropertyChangedEvent)
{
if (PropertyChangedEvent.Property && PropertyChangedEvent.Property->GetFName() == GET_MEMBER_NAME_CHECKED(UChildActorComponent, ChildActorClass))
{
if (IsTemplate())
{
if (ChildActorClass)
{
if (ChildActorTemplate == nullptr || (ChildActorTemplate->GetClass() != ChildActorClass))
{
Modify();
AActor* NewChildActorTemplate = NewObject<AActor>(GetTransientPackage(), ChildActorClass, NAME_None, RF_ArchetypeObject | RF_Transactional | RF_Public);
if (ChildActorTemplate)
{
UEngine::CopyPropertiesForUnrelatedObjects(ChildActorTemplate, NewChildActorTemplate);
ChildActorTemplate->Rename(nullptr, GetTransientPackage(), REN_DontCreateRedirectors);
}
ChildActorTemplate = NewChildActorTemplate;
// Record initial object state in case we're in a transaction context.
ChildActorTemplate->Modify();
// Now set the actual name and outer to the BPGC.
const FString TemplateName = FString::Printf(TEXT("%s_%s_CAT"), *GetName(), *ChildActorClass->GetName());
ChildActorTemplate->Rename(*TemplateName, this, REN_DoNotDirty | REN_DontCreateRedirectors | REN_ForceNoResetLoaders);
}
}
else if (ChildActorTemplate)
{
Modify();
ChildActorTemplate->Rename(nullptr, GetTransientPackage(), REN_DontCreateRedirectors);
ChildActorTemplate = nullptr;
}
}
else
{
ChildActorTemplate = CastChecked<UChildActorComponent>(GetArchetype())->ChildActorTemplate;
}
}
Super::PostEditChangeChainProperty(PropertyChangedEvent);
}
示例9: TEXT
// Called when the game starts
void UTestLoadCSVComponent::BeginPlay()
{
Super::BeginPlay();
// ...
// 加载csv,并且显示第一行数据
UDataTable* csv = LoadObject<UDataTable>(NULL, TEXT("DataTable'/Game/csv/test1.test1'"));
if (csv != NULL && csv->GetRowNames().Num() > 0)
{
// 获取id=1的那行的数据
FTestDataRow* row = csv->FindRow<FTestDataRow>(TEXT("1"), TEXT(""));
if (row != NULL)
{
Debug(FString::Printf(TEXT("csv, row time="), row->time));
}
}
// 动态读取csv文件,不过,这个只能在Editor模式运行,如果需要在发布版中运行,那么自己新建一个类
FString FilePath = FPaths::ConvertRelativePathToFull(FPaths::GameDir()) + FString::Printf(TEXT("csv/test1.csv"));
FString Data;
if (FFileHelper::LoadFileToString(Data, *FilePath))
{
UDataTable* DataTable = NewObject<UDataTable>(GetTransientPackage(), FName(TEXT("CSV_Test")));
DataTable->RowStruct = FTestDataRow::StaticStruct();
DataTable->CreateTableFromCSVString(Data);
Debug(FString::Printf(TEXT("%d"), DataTable->GetRowNames().Num()));
}
}
示例10: GetTransientPackage
FAISenseID UAISense_Blueprint::UpdateSenseID()
{
#if WITH_EDITOR
// ignore skeleton and "old version"-classes
if (FKismetEditorUtilities::IsClassABlueprintSkeleton(GetClass()) || GetClass()->HasAnyClassFlags(CLASS_NewerVersionExists)
|| (GetOutermost() == GetTransientPackage()))
{
return FAISenseID::InvalidID();
}
#endif
if (GetClass()->HasAnyClassFlags(CLASS_Abstract) == false)
{
const NAME_INDEX NameIndex = GetClass()->GetFName().GetDisplayIndex();
const FAISenseID* StoredID = BPSenseToSenseID.Find(NameIndex);
if (StoredID != nullptr)
{
ForceSenseID(*StoredID);
}
else
{
const FAISenseID NewSenseID = FAISenseID(GetFName());
ForceSenseID(NewSenseID);
BPSenseToSenseID.Add(NameIndex, GetSenseID());
}
}
return GetSenseID();
}
示例11: GetTransientPackage
// Clones (deep copies) a UEdGraph, including all of it's nodes and pins and their links,
// maintaining a mapping from the clone to the source nodes (even across multiple clonings)
UEdGraph* FEdGraphUtilities::CloneGraph(UEdGraph* InSource, UObject* NewOuter, FCompilerResultsLog* MessageLog, bool bCloningForCompile)
{
// Duplicate the graph, keeping track of what was duplicated
TMap<UObject*, UObject*> DuplicatedObjectList;
UObject* UseOuter = (NewOuter != NULL) ? NewOuter : GetTransientPackage();
FObjectDuplicationParameters Parameters(InSource, UseOuter);
Parameters.CreatedObjects = &DuplicatedObjectList;
if (bCloningForCompile || (NewOuter == NULL))
{
Parameters.ApplyFlags |= RF_Transient;
}
UEdGraph* ClonedGraph = CastChecked<UEdGraph>(StaticDuplicateObjectEx(Parameters));
// Store backtrack links from each duplicated object to the original source object
if (MessageLog != NULL)
{
for (TMap<UObject*, UObject*>::TIterator It(DuplicatedObjectList); It; ++It)
{
UObject* const Source = It.Key();
UObject* const Dest = It.Value();
MessageLog->NotifyIntermediateObjectCreation(Dest, Source);
}
}
return ClonedGraph;
}
示例12: GetTransientPackage
//------------------------------------------------------------------------------
UBlueprintEventNodeSpawner* UBlueprintEventNodeSpawner::Create(TSubclassOf<UK2Node_Event> NodeClass, FName CustomEventName, UObject* Outer/* = nullptr*/)
{
if (Outer == nullptr)
{
Outer = GetTransientPackage();
}
UBlueprintEventNodeSpawner* NodeSpawner = NewObject<UBlueprintEventNodeSpawner>(Outer);
NodeSpawner->NodeClass = NodeClass;
NodeSpawner->CustomEventName = CustomEventName;
FBlueprintActionUiSpec& MenuSignature = NodeSpawner->DefaultMenuSignature;
if (CustomEventName.IsNone())
{
MenuSignature.MenuName = LOCTEXT("AddCustomEvent", "Add Custom Event...");
MenuSignature.IconName = TEXT("GraphEditor.CustomEvent_16x");
}
else
{
FText const EventName = FText::FromName(CustomEventName);
MenuSignature.MenuName = FText::Format(LOCTEXT("EventWithSignatureName", "Event {0}"), EventName);
MenuSignature.IconName = TEXT("GraphEditor.Event_16x");
}
//MenuSignature.Category, will be pulled from the node template
//MenuSignature.Tooltip, will be pulled from the node template
//MenuSignature.Keywords, will be pulled from the node template
return NodeSpawner;
}
示例13: LoadDecks
bool UDeckListModel::LoadDecks(UCardListModel* CardListModel, UHeroListModel* HeroListModel)
{
TArray<UCardDeckModel*> Result;
UParagonSaveGame* LoadedSaveGame = Cast<UParagonSaveGame>(UGameplayStatics::CreateSaveGameObject(UParagonSaveGame::StaticClass()));
LoadedSaveGame = Cast<UParagonSaveGame>(UGameplayStatics::LoadGameFromSlot(TEXT("DefaultSaveGameSlot"), 0));
if (!LoadedSaveGame)
{
return false;
}
auto Importer = NewObject<UCardDeckImporterJSON>(GetTransientPackage(), NAME_None);
for (auto& DeckAsJSON : LoadedSaveGame->DecksAsJSON)
{
if (DeckAsJSON.IsEmpty())
{
Result.Add(nullptr);
}
else
{
TArray<FString> ImportErrors;
UCardDeckModel* CardDeckModel = Importer->ImportDeckModel(DeckAsJSON, CardListModel, HeroListModel, ImportErrors);
if (!CardDeckModel)
{
return false;
}
Result.Add(CardDeckModel);
}
}
DeckSlots = Result;
return true;
}
示例14: AddReferencedObjects
void FAnimMontageInstance::AddReferencedObjects( FReferenceCollector& Collector )
{
if (Montage && Montage->GetOuter() == GetTransientPackage())
{
Collector.AddReferencedObject(Montage);
}
}
示例15: check
//------------------------------------------------------------------------------
UBlueprintComponentNodeSpawner* UBlueprintComponentNodeSpawner::Create(TSubclassOf<UActorComponent> const ComponentClass, UObject* Outer/* = nullptr*/)
{
check(ComponentClass != nullptr);
if (Outer == nullptr)
{
Outer = GetTransientPackage();
}
UBlueprintComponentNodeSpawner* NodeSpawner = NewObject<UBlueprintComponentNodeSpawner>(Outer);
NodeSpawner->ComponentClass = ComponentClass;
NodeSpawner->NodeClass = UK2Node_AddComponent::StaticClass();
FBlueprintActionUiSpec& MenuSignature = NodeSpawner->DefaultMenuSignature;
FText const ComponentTypeName = FText::FromName(ComponentClass->GetFName());
MenuSignature.MenuName = FText::Format(LOCTEXT("AddComponentMenuName", "Add {0}"), ComponentTypeName);
MenuSignature.Category = BlueprintComponentNodeSpawnerImpl::GetDefaultMenuCategory(ComponentClass);
MenuSignature.Tooltip = FText::Format(LOCTEXT("AddComponentTooltip", "Spawn a {0}"), ComponentTypeName);
MenuSignature.Keywords = ComponentClass->GetMetaData(FBlueprintMetadata::MD_FunctionKeywords);
// add at least one character, so that PrimeDefaultMenuSignature() doesn't
// attempt to query the template node
MenuSignature.Keywords.AppendChar(TEXT(' '));
MenuSignature.IconName = FClassIconFinder::FindIconNameForClass(ComponentClass);
return NodeSpawner;
}