本文整理汇总了C++中UPackage::MarkPackageDirty方法的典型用法代码示例。如果您正苦于以下问题:C++ UPackage::MarkPackageDirty方法的具体用法?C++ UPackage::MarkPackageDirty怎么用?C++ UPackage::MarkPackageDirty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UPackage
的用法示例。
在下文中一共展示了UPackage::MarkPackageDirty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExecuteNewDerivedBlueprint
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();
}
}
}
}
示例2: 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();
}
}
示例3: OnTileInfoUpdated
void UWorldComposition::OnTileInfoUpdated(const FName& InPackageName, const FWorldTileInfo& InInfo)
{
FWorldCompositionTile* Tile = FindTileByName(InPackageName);
bool PackageDirty = false;
if (Tile)
{
PackageDirty = !(Tile->Info == InInfo);
Tile->Info = InInfo;
}
else
{
PackageDirty = true;
UWorld* OwningWorld = GetWorld();
FWorldCompositionTile NewTile;
NewTile.PackageName = InPackageName;
NewTile.Info = InInfo;
Tiles.Add(NewTile);
TilesStreaming.Add(CreateStreamingLevel(NewTile));
Tile = &Tiles.Last();
}
// Assign info to level package in case package is loaded
UPackage* LevelPackage = Cast<UPackage>(StaticFindObjectFast(UPackage::StaticClass(), NULL, Tile->PackageName));
if (LevelPackage)
{
if (LevelPackage->WorldTileInfo == NULL)
{
LevelPackage->WorldTileInfo = new FWorldTileInfo(Tile->Info);
PackageDirty = true;
}
else
{
*(LevelPackage->WorldTileInfo) = Tile->Info;
}
if (PackageDirty)
{
LevelPackage->MarkPackageDirty();
}
}
}
示例4: CreateAsset
/**
* Creates the new item
*/
void CreateAsset()
{
const FString PackageName = AssetPath + TEXT("/") + AssetName;
AssetPackage = CreatePackage(NULL, *PackageName);
EObjectFlags Flags = RF_Public | RF_Standalone;
CreatedAsset = Factory->FactoryCreateNew(Class, AssetPackage, FName(*AssetName), Flags, NULL, GWarn);
if (CreatedAsset)
{
// Notify the asset registry
FAssetRegistryModule::AssetCreated(CreatedAsset);
// Mark the package dirty...
AssetPackage->MarkPackageDirty();
TestStats->NumCreated++;
UE_LOG(LogEditorAssetAutomationTests, Display, TEXT("Created asset %s (%s)"), *AssetName, *Class->GetName());
}
else
{
UE_LOG(LogEditorAssetAutomationTests, Error, TEXT("Unable to create asset of type %s"), *Class->GetName());
}
}
示例5: OnCreateButtonClicked
FReply FCurveColorCustomization::OnCreateButtonClicked()
{
if (CurveWidget.IsValid())
{
FString DefaultAsset = FPackageName::GetLongPackagePath(Owner->GetOutermost()->GetName()) + TEXT("/") + Owner->GetName() + TEXT("_ExternalCurve");
TSharedRef<SDlgPickAssetPath> NewCurveDlg =
SNew(SDlgPickAssetPath)
.Title(LOCTEXT("NewCurveDialogTitle", "Choose Location for External Curve Asset"))
.DefaultAssetPath(FText::FromString(DefaultAsset));
if (NewCurveDlg->ShowModal() != EAppReturnType::Cancel)
{
FString Package(NewCurveDlg->GetFullAssetPath().ToString());
FString Name(NewCurveDlg->GetAssetName().ToString());
FString Group(TEXT(""));
// Find (or create!) the desired package for this object
UPackage* Pkg = CreatePackage(NULL, *Package);
UPackage* OutermostPkg = Pkg->GetOutermost();
TArray<UPackage*> TopLevelPackages;
TopLevelPackages.Add( OutermostPkg );
if (!PackageTools::HandleFullyLoadingPackages(TopLevelPackages, LOCTEXT("CreateANewObject", "Create a new object")))
{
// User aborted.
return FReply::Handled();
}
if (!PromptUserIfExistingObject(Name, Package, Group, Pkg))
{
return FReply::Handled();
}
// PromptUserIfExistingObject may have GCed and recreated our outermost package - re-acquire it here.
OutermostPkg = Pkg->GetOutermost();
// Create a new asset and set it as the external curve
FName AssetName = *Name;
UCurveLinearColor* NewCurve = Cast<UCurveLinearColor>(CurveWidget->CreateCurveObject(UCurveLinearColor::StaticClass(), Pkg, AssetName));
if( NewCurve )
{
// run through points of editor data and add to external curve
for (int32 Index = 0; Index < 4; Index++)
{
CopyCurveData(&RuntimeCurve->ColorCurves[Index], &NewCurve->FloatCurves[Index]);
}
// Set the new object as the sole selection.
USelection* SelectionSet = GEditor->GetSelectedObjects();
SelectionSet->DeselectAll();
SelectionSet->Select( NewCurve );
// Notify the asset registry
FAssetRegistryModule::AssetCreated(NewCurve);
// Mark the package dirty...
OutermostPkg->MarkPackageDirty();
// Make sure expected type of pointer passed to SetValue, so that it's not interpreted as a bool
ExternalCurveHandle->SetValue(NewCurve);
}
}
}
return FReply::Handled();
}