本文整理汇总了C++中UPackage类的典型用法代码示例。如果您正苦于以下问题:C++ UPackage类的具体用法?C++ UPackage怎么用?C++ UPackage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UPackage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Get
TSharedPtr<SWidget> Get(const FActorTreeItem& ActorItem) const override
{
if (AActor* Actor = ActorItem.Actor.Get())
{
if (UClass* ActorClass = Actor->GetClass())
{
// Always show blueprints
const bool bIsBlueprintClass = UBlueprint::GetBlueprintFromClass(ActorClass) != nullptr;
// Also show game or game plugin native classes (but not engine classes as that makes the scene outliner pretty noisy)
bool bIsGameClass = false;
if (!bIsBlueprintClass)
{
UPackage* Package = ActorClass->GetOutermost();
const FString ModuleName = FPackageName::GetShortName(Package->GetFName());
FModuleStatus PackageModuleStatus;
if (FModuleManager::Get().QueryModule(*ModuleName, /*out*/ PackageModuleStatus))
{
bIsGameClass = PackageModuleStatus.bIsGameModule;
}
}
if (bIsBlueprintClass || bIsGameClass)
{
return FEditorClassUtils::GetSourceLink(ActorClass, Actor);
}
}
}
return nullptr;
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:32,代码来源:SceneOutlinerActorInfoColumn.cpp
示例2: LOCTEXT
void FAssetTypeActions_EditorUtilityBlueprint::ExecuteNewDerivedBlueprint(TWeakObjectPtr<UEditorUtilityBlueprint> InObject)
{
if (auto Object = InObject.Get())
{
// The menu option should ONLY be available if there is only one blueprint selected, validated by the menu creation code
UBlueprint* TargetBP = Object;
UClass* TargetClass = TargetBP->GeneratedClass;
if (!FKismetEditorUtilities::CanCreateBlueprintOfClass(TargetClass))
{
FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("InvalidClassToMakeBlueprintFrom", "Invalid class with which to make a Blueprint."));
return;
}
FString Name;
FString PackageName;
CreateUniqueAssetName(Object->GetOutermost()->GetName(), TEXT("_Child"), PackageName, Name);
UPackage* Package = CreatePackage(NULL, *PackageName);
if (ensure(Package))
{
// Create and init a new Blueprint
if (UBlueprint* NewBP = FKismetEditorUtilities::CreateBlueprint(TargetClass, Package, FName(*Name), BPTYPE_Normal, UEditorUtilityBlueprint::StaticClass(), UBlueprintGeneratedClass::StaticClass()))
{
FAssetEditorManager::Get().OpenEditorForAsset(NewBP);
// Notify the asset registry
FAssetRegistryModule::AssetCreated(NewBP);
// Mark the package dirty...
Package->MarkPackageDirty();
}
}
}
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:35,代码来源:AssetTypeActions_EditorUtilityBlueprint.cpp
示例3: LoadPackage
UClass* FClassData::GetClass()
{
UClass* RetClass = Class.Get();
if (RetClass == NULL && GeneratedClassPackage.Len())
{
GWarn->BeginSlowTask(LOCTEXT("LoadPackage", "Loading Package..."), true);
UPackage* Package = LoadPackage(NULL, *GeneratedClassPackage, LOAD_NoRedirects);
if (Package)
{
Package->FullyLoad();
UObject* Object = FindObject<UObject>(Package, *AssetName);
GWarn->EndSlowTask();
UBlueprint* BlueprintOb = Cast<UBlueprint>(Object);
RetClass = BlueprintOb ? *BlueprintOb->GeneratedClass : Object->GetClass();
Class = RetClass;
}
else
{
GWarn->EndSlowTask();
FMessageLog EditorErrors("EditorErrors");
EditorErrors.Error(LOCTEXT("PackageLoadFail", "Package Load Failed"));
EditorErrors.Info(FText::FromString(GeneratedClassPackage));
EditorErrors.Notify(LOCTEXT("PackageLoadFail", "Package Load Failed"));
}
}
return RetClass;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:33,代码来源:BehaviorTreeEditorTypes.cpp
示例4: GetPackageNamesInSelectedPaths
void FPathContextMenu::ExecuteSaveFolder()
{
// Get a list of package names in the selected paths
TArray<FString> PackageNames;
GetPackageNamesInSelectedPaths(PackageNames);
// Form a list of packages from the assets
TArray<UPackage*> Packages;
for (int32 PackageIdx = 0; PackageIdx < PackageNames.Num(); ++PackageIdx)
{
UPackage* Package = FindPackage(NULL, *PackageNames[PackageIdx]);
// Only save loaded and dirty packages
if ( Package != NULL && Package->IsDirty() )
{
Packages.Add(Package);
}
}
// Save all packages that were found
if ( Packages.Num() )
{
ContentBrowserUtils::SavePackages(Packages);
}
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:25,代码来源:PathContextMenu.cpp
示例5: LoadPackage
bool FEditTextureLatentCommand::Update()
{
// make a minor edit to the texture in the package we are passed
UPackage* Package = LoadPackage(NULL, *PackageName, LOAD_None);
if(Package != NULL)
{
UTexture2D* Texture = FindObject<UTexture2D>(Package, TEXT("SourceControlTest"));
check(Texture);
Texture->AdjustBrightness = FMath::FRand();
Package->SetDirtyFlag(true);
if(!UPackage::SavePackage(Package, NULL, RF_Standalone, *FPackageName::LongPackageNameToFilename(PackageName, FPackageName::GetAssetPackageExtension())))
{
UE_LOG(LogSourceControl, Error, TEXT("Could not save package: '%s'"), *PackageName);
}
TArray<UPackage*> Packages;
Packages.Add(Package);
PackageTools::UnloadPackages(Packages);
}
else
{
UE_LOG(LogSourceControl, Error, TEXT("Could not find package for edit: '%s'"), *PackageName);
}
return true;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:25,代码来源:SourceControlTests.cpp
示例6: SaveOpenAssetEditors
void FAssetEditorManager::SaveOpenAssetEditors(bool bOnShutdown)
{
if(!bSavingOnShutdown)
{
TArray<FString> OpenAssets;
// Don't save a list of assets to restore if we are running under a debugger
if(!FPlatformMisc::IsDebuggerPresent())
{
for (auto EditorPair : OpenedEditors)
{
IAssetEditorInstance* Editor = EditorPair.Key;
if (Editor != NULL)
{
UObject* EditedObject = EditorPair.Value;
if(EditedObject != NULL)
{
// only record assets that have a valid saved package
UPackage* Package = EditedObject->GetOutermost();
if(Package != NULL && Package->GetFileSize() != 0)
{
OpenAssets.Add(EditedObject->GetPathName());
}
}
}
}
}
GConfig->SetArray(TEXT("AssetEditorManager"), TEXT("OpenAssetsAtExit"), OpenAssets, GEditorPerProjectIni);
GConfig->SetBool(TEXT("AssetEditorManager"), TEXT("CleanShutdown"), bOnShutdown, GEditorPerProjectIni);
GConfig->Flush(false, GEditorPerProjectIni);
}
}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:33,代码来源:AssetEditorManager.cpp
示例7: OnLevelPostLoad
void UWorldComposition::OnLevelPostLoad(ULevel* InLevel)
{
UPackage* LevelPackage = Cast<UPackage>(InLevel->GetOutermost());
if (LevelPackage && InLevel->OwningWorld)
{
FWorldTileInfo Info;
UWorld* World = InLevel->OwningWorld;
if (World->WorldComposition)
{
// Assign WorldLevelInfo previously loaded by world composition
FWorldCompositionTile* Tile = World->WorldComposition->FindTileByName(LevelPackage->GetFName());
if (Tile)
{
Info = Tile->Info;
}
}
else
{
#if WITH_EDITOR
// Preserve FWorldTileInfo in case sub-level was loaded in the editor outside of world composition
FString PackageFilename = FPackageName::LongPackageNameToFilename(LevelPackage->GetName(), FPackageName::GetMapPackageExtension());
FWorldTileInfo::Read(PackageFilename, Info);
#endif //WITH_EDITOR
}
const bool bIsDefault = (Info == FWorldTileInfo());
if (!bIsDefault)
{
LevelPackage->WorldTileInfo = new FWorldTileInfo(Info);
}
}
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:33,代码来源:WorldComposition.cpp
示例8: DeleteRedirectors
void FAssetFixUpRedirectors::DeleteRedirectors(TArray<FRedirectorRefs>& RedirectorsToFix) const
{
TArray<UObject*> ObjectsToDelete;
for ( auto RedirectorIt = RedirectorsToFix.CreateIterator(); RedirectorIt; ++RedirectorIt )
{
FRedirectorRefs& RedirectorRefs = *RedirectorIt;
if ( RedirectorRefs.bRedirectorValidForFixup )
{
// Add all redirectors found in this package to the redirectors to delete list.
// All redirectors in this package should be fixed up.
UPackage* RedirectorPackage = RedirectorRefs.Redirector->GetOutermost();
TArray<UObject*> AssetsInRedirectorPackage;
GetObjectsWithOuter(RedirectorPackage, AssetsInRedirectorPackage, /*bIncludeNestedObjects=*/false);
UMetaData* PackageMetaData = NULL;
bool bContainsAtLeastOneOtherAsset = false;
for ( auto ObjIt = AssetsInRedirectorPackage.CreateConstIterator(); ObjIt; ++ObjIt )
{
if ( UObjectRedirector* Redirector = Cast<UObjectRedirector>(*ObjIt) )
{
Redirector->RemoveFromRoot();
ObjectsToDelete.Add(Redirector);
}
else if ( UMetaData* MetaData = Cast<UMetaData>(*ObjIt) )
{
PackageMetaData = MetaData;
}
else
{
bContainsAtLeastOneOtherAsset = true;
}
}
if ( !bContainsAtLeastOneOtherAsset )
{
RedirectorPackage->RemoveFromRoot();
ULinkerLoad* Linker = ULinkerLoad::FindExistingLinkerForPackage(RedirectorPackage);
if ( Linker )
{
Linker->RemoveFromRoot();
}
// @todo we shouldnt be worrying about metadata objects here, ObjectTools::CleanUpAfterSuccessfulDelete should
if ( PackageMetaData )
{
PackageMetaData->RemoveFromRoot();
ObjectsToDelete.Add(PackageMetaData);
}
}
// This redirector will be deleted, NULL the reference here
RedirectorRefs.Redirector = NULL;
}
}
if ( ObjectsToDelete.Num() > 0 )
{
ObjectTools::DeleteObjects(ObjectsToDelete);
}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:59,代码来源:AssetFixUpRedirectors.cpp
示例9: IsTemplateOuter
//------------------------------------------------------------------------------
bool BlueprintNodeTemplateCacheImpl::IsTemplateOuter(UEdGraph* ParentGraph)
{
if (ParentGraph->HasAnyFlags(RF_Transactional))
{
UPackage* GraphPackage = ParentGraph->GetOutermost();
UMetaData* PackageMetadata = GraphPackage->GetMetaData();
return PackageMetadata->HasValue(ParentGraph, TemplateGraphMetaTag);
}
return false;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:11,代码来源:BlueprintNodeTemplateCache.cpp
示例10: FindPackage
bool FFrontendFilter_Modified::PassesFilter(FAssetFilterType InItem) const
{
UPackage* Package = FindPackage(NULL, *InItem.PackageName.ToString());
if ( Package != NULL )
{
return Package->IsDirty();
}
return false;
}
开发者ID:PopCap,项目名称:GameIdea,代码行数:11,代码来源:FrontendFilters.cpp
示例11: SlowTask
void FAssetFixUpRedirectors::LoadReferencingPackages(TArray<FRedirectorRefs>& RedirectorsToFix, TArray<UPackage*>& OutReferencingPackagesToSave) const
{
FScopedSlowTask SlowTask( RedirectorsToFix.Num(), LOCTEXT( "LoadingReferencingPackages", "Loading Referencing Packages..." ) );
SlowTask.MakeDialog();
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
// Load all packages that reference each redirector, if possible
for ( auto RedirectorRefsIt = RedirectorsToFix.CreateIterator(); RedirectorRefsIt; ++RedirectorRefsIt )
{
SlowTask.EnterProgressFrame(1);
FRedirectorRefs& RedirectorRefs = *RedirectorRefsIt;
if ( ISourceControlModule::Get().IsEnabled() )
{
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(RedirectorRefs.Redirector->GetOutermost(), EStateCacheUsage::Use);
const bool bValidSCCState = !SourceControlState.IsValid() || SourceControlState->IsAdded() || SourceControlState->IsCheckedOut() || SourceControlState->CanCheckout() || !SourceControlState->IsSourceControlled() || SourceControlState->IsIgnored();
if ( !bValidSCCState )
{
RedirectorRefs.bRedirectorValidForFixup = false;
RedirectorRefs.FailureReason = LOCTEXT("RedirectorFixupFailed_BadSCC", "Redirector could not be checked out or marked for delete");
}
}
// Load all referencers
for ( auto PackageNameIt = RedirectorRefs.ReferencingPackageNames.CreateConstIterator(); PackageNameIt; ++PackageNameIt )
{
const FString PackageName = (*PackageNameIt).ToString();
// Find the package in memory. If it is not in memory, try to load it
UPackage* Package = FindPackage(NULL, *PackageName);
if ( !Package )
{
Package = LoadPackage(NULL, *PackageName, LOAD_None);
}
if ( Package )
{
if ( Package->HasAnyPackageFlags(PKG_CompiledIn) )
{
// This is a script reference
RedirectorRefs.bRedirectorValidForFixup = false;
RedirectorRefs.FailureReason = FText::Format(LOCTEXT("RedirectorFixupFailed_CodeReference", "Redirector is referenced by code. Package: {0}"), FText::FromString(PackageName));
}
else
{
// If we found a valid package, mark it for save
OutReferencingPackagesToSave.AddUnique(Package);
}
}
}
}
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:54,代码来源:AssetFixUpRedirectors.cpp
示例12: OnAssetLoaded
void FChunkManifestGenerator::OnAssetLoaded(UObject* Asset)
{
if (Asset != NULL)
{
UPackage* AssetPackage = CastChecked<UPackage>(Asset->GetOutermost());
if (!AssetsLoadedWithLastPackage.Contains(AssetPackage->GetFName()))
{
AssetsLoadedWithLastPackage.Add(AssetPackage->GetFName());
}
}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:11,代码来源:ChunkManifestGenerator.cpp
示例13: CTOResinstancer
// Rename a class and it's CDO into the transient package, and clear RF_Public on both of them
void FKismetCompilerUtilities::ConsignToOblivion(UClass* OldClass, bool bForceNoResetLoaders)
{
if (OldClass != NULL)
{
// Use the Kismet class reinstancer to ensure that the CDO and any existing instances of this class are cleaned up!
FBlueprintCompileReinstancer CTOResinstancer(OldClass);
UPackage* OwnerOutermost = OldClass->GetOutermost();
if( OldClass->ClassDefaultObject )
{
// rename to a temp name, move into transient package
OldClass->ClassDefaultObject->ClearFlags(RF_Public);
OldClass->ClassDefaultObject->SetFlags(RF_Transient);
OldClass->ClassDefaultObject->RemoveFromRoot(); // make sure no longer in root set
}
OldClass->SetMetaData(FBlueprintMetadata::MD_IsBlueprintBase, TEXT("false"));
OldClass->ClearFlags(RF_Public);
OldClass->SetFlags(RF_Transient);
OldClass->ClassFlags |= CLASS_Deprecated|CLASS_NewerVersionExists;
OldClass->RemoveFromRoot(); // make sure no longer in root set
// Invalidate the export for all old properties, to make sure they don't get partially reloaded and corrupt the class
for( TFieldIterator<UProperty> It(OldClass,EFieldIteratorFlags::ExcludeSuper); It; ++It )
{
UProperty* Current = *It;
InvalidatePropertyExport(Current);
}
for( TFieldIterator<UFunction> ItFunc(OldClass,EFieldIteratorFlags::ExcludeSuper); ItFunc; ++ItFunc )
{
UFunction* CurrentFunc = *ItFunc;
ULinkerLoad::InvalidateExport(CurrentFunc);
for( TFieldIterator<UProperty> It(CurrentFunc,EFieldIteratorFlags::ExcludeSuper); It; ++It )
{
UProperty* Current = *It;
InvalidatePropertyExport(Current);
}
}
const FString BaseName = FString::Printf(TEXT("DEADCLASS_%s_C_%d"), *OldClass->ClassGeneratedBy->GetName(), ConsignToOblivionCounter++);
OldClass->Rename(*BaseName, GetTransientPackage(), (REN_DontCreateRedirectors|REN_NonTransactional|(bForceNoResetLoaders ? REN_ForceNoResetLoaders : 0)));
// Make sure MetaData doesn't have any entries to the class we just renamed out of package
OwnerOutermost->GetMetaData()->RemoveMetaDataOutsidePackage();
}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:49,代码来源:KismetCompilerMisc.cpp
示例14: CreateSoundClass
void FSoundClassEditor::CreateSoundClass(UEdGraphPin* FromPin, const FVector2D& Location, FString Name)
{
// If we have a valid name
if (!Name.IsEmpty())
{
FName NewClassName = *Name;
UPackage* Package = SoundClass->GetOutermost();
USoundClass* NewSoundClass = NewObject<USoundClass>(Package, NewClassName, RF_Public);
SoundClass->SoundClassGraph->AddNewSoundClass(FromPin, NewSoundClass, Location.X, Location.Y);
Package->MarkPackageDirty();
NewSoundClass->PostEditChange();
}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:16,代码来源:SoundClassEditor.cpp
示例15: PrepareToDelete
void FAssetDeleteModel::PrepareToDelete(UObject* InObject)
{
if ( InObject->IsA<UObjectRedirector>() )
{
// Add all redirectors found in this package to the redirectors to delete list.
// All redirectors in this package should be fixed up.
UPackage* RedirectorPackage = InObject->GetOutermost();
TArray<UObject*> AssetsInRedirectorPackage;
GetObjectsWithOuter(RedirectorPackage, AssetsInRedirectorPackage, /*bIncludeNestedObjects=*/false);
UMetaData* PackageMetaData = NULL;
bool bContainsAtLeastOneOtherAsset = false;
for ( auto ObjIt = AssetsInRedirectorPackage.CreateConstIterator(); ObjIt; ++ObjIt )
{
if ( UObjectRedirector* Redirector = Cast<UObjectRedirector>(*ObjIt) )
{
Redirector->RemoveFromRoot();
}
else if ( UMetaData* MetaData = Cast<UMetaData>(*ObjIt) )
{
PackageMetaData = MetaData;
}
else
{
bContainsAtLeastOneOtherAsset = true;
}
}
if ( !bContainsAtLeastOneOtherAsset )
{
RedirectorPackage->RemoveFromRoot();
ULinkerLoad* Linker = ULinkerLoad::FindExistingLinkerForPackage(RedirectorPackage);
if ( Linker )
{
Linker->RemoveFromRoot();
}
// @todo we shouldnt be worrying about metadata objects here, ObjectTools::CleanUpAfterSuccessfulDelete should
if ( PackageMetaData )
{
PackageMetaData->RemoveFromRoot();
PendingDeletes.AddUnique(MakeShareable(new FPendingDelete(PackageMetaData)));
}
}
}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:47,代码来源:AssetDeleteModel.cpp
示例16: CreateFlipBook
UPaperFlipbook* UHGGifFactory::CreateFlipBook(const TArray<UPaperSprite*>& AllSprites, FName BaseName)
{
if (AllSprites.Num() == 0)
return nullptr;
const FString& FlipbookName = BaseName.ToString();
TArray<UPaperSprite*> Sprites = AllSprites; // Not Reference, for Save Pacakge
UPackage* OuterPackage = Sprites[0]->GetOutermost();
const FString SpritePathName = OuterPackage->GetPathName();
const FString LongPackagePath = FPackageName::GetLongPackagePath(OuterPackage->GetPathName());
UPaperFlipbookFactory* FlipbookFactory = NewObject<UPaperFlipbookFactory>();
for (UPaperSprite* Sprite : Sprites)
{
if (Sprite != nullptr)
{
FPaperFlipbookKeyFrame* KeyFrame = new (FlipbookFactory->KeyFrames) FPaperFlipbookKeyFrame();
KeyFrame->Sprite = Sprite;
KeyFrame->FrameRun = 1;
}
}
const FString NewFlipBookDefaultPath = LongPackagePath + TEXT("/") + FlipbookName;
FString DefaultSuffix;
FString AssetName;
FString PackageName;
FAssetToolsModule& AssetToolsModule = FModuleManager::Get().LoadModuleChecked<FAssetToolsModule>("AssetTools");
AssetToolsModule.Get().CreateUniqueAssetName(NewFlipBookDefaultPath, DefaultSuffix, /*out*/ PackageName, /*out*/ AssetName);
const FString PackagePath = FPackageName::GetLongPackagePath(PackageName);
TArray<UObject*> ObjectsToSync;
UPaperFlipbook* NewFlipBook = nullptr;
NewFlipBook = Cast<UPaperFlipbook>(AssetToolsModule.Get().CreateAsset(AssetName, PackagePath, UPaperFlipbook::StaticClass(), FlipbookFactory));
if (NewFlipBook)
{
ObjectsToSync.Add(NewFlipBook);
FContentBrowserModule& ContentBrowserModule = FModuleManager::LoadModuleChecked<FContentBrowserModule>("ContentBrowser");
ContentBrowserModule.Get().SyncBrowserToAssets(ObjectsToSync);
}
return NewFlipBook;
}
开发者ID:SeongHoJu,项目名称:HGGifImporter,代码行数:46,代码来源:HGGifFactory.cpp
示例17: PrivateRemoveLevelFromWorld
/**
* Removes a level from the world. Returns true if the level was removed successfully.
*
* @param Level The level to remove from the world.
* @return true if the level was removed successfully, false otherwise.
*/
bool PrivateRemoveLevelFromWorld(ULevel* Level)
{
if ( !Level || Level->IsPersistentLevel() )
{
return false;
}
if ( FLevelUtils::IsLevelLocked(Level) )
{
FMessageDialog::Open( EAppMsgType::Ok, NSLOCTEXT("UnrealEd", "Error_OperationDisallowedOnLockedLevelRemoveLevelFromWorld", "RemoveLevelFromWorld: The requested operation could not be completed because the level is locked.") );
return false;
}
int32 StreamingLevelIndex = INDEX_NONE;
for( int32 LevelIndex = 0 ; LevelIndex < Level->OwningWorld->StreamingLevels.Num() ; ++LevelIndex )
{
ULevelStreaming* StreamingLevel = Level->OwningWorld->StreamingLevels[ LevelIndex ];
if( StreamingLevel && StreamingLevel->GetLoadedLevel() == Level )
{
StreamingLevelIndex = LevelIndex;
break;
}
}
if (StreamingLevelIndex != INDEX_NONE)
{
Level->OwningWorld->StreamingLevels[StreamingLevelIndex]->MarkPendingKill();
Level->OwningWorld->StreamingLevels.RemoveAt( StreamingLevelIndex );
Level->OwningWorld->RefreshStreamingLevels();
}
else if (Level->bIsVisible)
{
Level->OwningWorld->RemoveFromWorld(Level);
check(Level->bIsVisible == false);
}
const bool bSuccess = EditorDestroyLevel(Level);
// Since we just removed all the actors from this package, we do not want it to be saved out now
// and the user was warned they would lose any changes from before removing, so we're good to clear
// the dirty flag
UPackage* LevelPackage = Level->GetOutermost();
LevelPackage->SetDirtyFlag(false);
return bSuccess;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:52,代码来源:EditorLevelUtils.cpp
示例18: GetOutermost
/**
* Finds the outermost package and marks it dirty
*/
bool UObjectBaseUtility::MarkPackageDirty() const
{
// since transient objects will never be saved into a package, there is no need to mark a package dirty
// if we're transient
if ( !HasAnyFlags(RF_Transient) )
{
UPackage* Package = GetOutermost();
if( Package != NULL )
{
// It is against policy to dirty a map or package during load in the Editor, to enforce this policy
// we explicitly disable the ability to dirty a package or map during load. Commandlets can still
// set the dirty state on load.
if( IsRunningCommandlet() ||
(GIsEditor && !GIsEditorLoadingPackage && !GIsPlayInEditorWorld && !IsInAsyncLoadingThread()
#if WITH_HOT_RELOAD
&& !GIsHotReload
#endif // WITH_HOT_RELOAD
#if WITH_EDITORONLY_DATA
&& !Package->bIsCookedForEditor // Cooked packages can't be modified nor marked as dirty
#endif
))
{
const bool bIsDirty = Package->IsDirty();
// We prevent needless re-dirtying as this can be an expensive operation.
if( !bIsDirty )
{
Package->SetDirtyFlag(true);
}
// Always call PackageMarkedDirtyEvent, even when the package is already dirty
Package->PackageMarkedDirtyEvent.Broadcast(Package, bIsDirty);
return true;
}
else
{
// notify the caller that the request to mark the package as dirty was suppressed
return false;
}
}
}
return true;
}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:48,代码来源:UObjectBaseUtility.cpp
示例19: DeleteAsset
/**
* Deletes the asset
*/
void DeleteAsset()
{
if (CreatedAsset)
{
bool bSuccessful = false;
bSuccessful = ObjectTools::DeleteSingleObject(CreatedAsset, false);
//If we failed to delete this object manually clear any references and try again
if (!bSuccessful)
{
//Clear references to the object so we can delete it
AutomationEditorCommonUtils::NullReferencesToObject(CreatedAsset);
bSuccessful = ObjectTools::DeleteSingleObject(CreatedAsset, false);
}
//Delete the package
if (bSuccessful)
{
FString PackageFilename;
if (FPackageName::DoesPackageExist(AssetPackage->GetName(), NULL, &PackageFilename))
{
TArray<UPackage*> PackagesToDelete;
PackagesToDelete.Add(AssetPackage);
// Let the package auto-saver know that it needs to ignore the deleted packages
GUnrealEd->GetPackageAutoSaver().OnPackagesDeleted(PackagesToDelete);
AssetPackage->SetDirtyFlag(false);
// Unload the packages and collect garbage.
PackageTools::UnloadPackages(PackagesToDelete);
IFileManager::Get().Delete(*PackageFilename);
TestStats->NumDeleted++;
UE_LOG(LogEditorAssetAutomationTests, Display, TEXT("Deleted asset %s (%s)"), *AssetName, *Class->GetName());
}
}
else
{
UE_LOG(LogEditorAssetAutomationTests, Error, TEXT("Unable to delete asset: %s (%s)"), *AssetName, *Class->GetName());
}
}
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:48,代码来源:EditorAssetAutomationTests.cpp
示例20: LoadPackage
void FAssetEditorManager::OpenEditorForAsset(const FString& AssetPathName)
{
// An asset needs loading
UPackage* Package = LoadPackage(NULL, *AssetPathName, LOAD_NoRedirects);
if (Package)
{
Package->FullyLoad();
FString AssetName = FPaths::GetBaseFilename(AssetPathName);
UObject* Object = FindObject<UObject>(Package, *AssetName);
if (Object != NULL)
{
OpenEditorForAsset(Object);
}
}
}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:18,代码来源:AssetEditorManager.cpp
注:本文中的UPackage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论