本文整理汇总了C++中FAssetData::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ FAssetData::IsValid方法的具体用法?C++ FAssetData::IsValid怎么用?C++ FAssetData::IsValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FAssetData
的用法示例。
在下文中一共展示了FAssetData::IsValid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CommitObjectPathForSave
void SAssetDialog::CommitObjectPathForSave()
{
if ( ensure(DialogType == EAssetDialogType::Save) )
{
if ( bLastInputValidityCheckSuccessful )
{
const FString ObjectPath = GetObjectPathForSave();
bool bProceedWithSave = true;
// If we were asked to warn on existing assets, do it now
if ( ExistingAssetPolicy == ESaveAssetDialogExistingAssetPolicy::AllowButWarn )
{
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
FAssetData ExistingAsset = AssetRegistryModule.Get().GetAssetByObjectPath(FName(*ObjectPath));
if ( ExistingAsset.IsValid() && AssetClassNames.Contains(ExistingAsset.AssetClass) )
{
EAppReturnType::Type ShouldReplace = FMessageDialog::Open( EAppMsgType::YesNo, FText::Format(LOCTEXT("ReplaceAssetMessage", "{ExistingAsset} already exists. Do you want to replace it?"), FText::FromString(CurrentlyEnteredAssetName)) );
bProceedWithSave = (ShouldReplace == EAppReturnType::Yes);
}
}
if ( bProceedWithSave )
{
OnObjectPathChosenForSave.ExecuteIfBound(ObjectPath);
CloseDialog();
}
}
}
}
示例2: GenerateActorFactoryMenuItems
void FActorFactoryAssetProxy::GenerateActorFactoryMenuItems( const FAssetData& AssetData, TArray<FMenuItem>* OutMenuItems, bool ExcludeStandAloneFactories )
{
FText UnusedErrorMessage;
const FAssetData NoAssetData;
for ( int32 FactoryIdx = 0; FactoryIdx < GEditor->ActorFactories.Num(); FactoryIdx++ )
{
UActorFactory* Factory = GEditor->ActorFactories[FactoryIdx];
const bool FactoryWorksWithoutAsset = Factory->CanCreateActorFrom( NoAssetData, UnusedErrorMessage );
const bool FactoryWorksWithAsset = AssetData.IsValid() && Factory->CanCreateActorFrom( AssetData, UnusedErrorMessage );
const bool FactoryWorks = FactoryWorksWithAsset || FactoryWorksWithoutAsset;
if ( FactoryWorks )
{
FMenuItem MenuItem = FMenuItem( Factory, NoAssetData );
if ( FactoryWorksWithAsset )
{
MenuItem = FMenuItem( Factory, AssetData );
}
if ( FactoryWorksWithAsset || ( !ExcludeStandAloneFactories && FactoryWorksWithoutAsset ) )
{
OutMenuItems->Add( MenuItem );
}
}
}
}
示例3: OnAssetSelected
void SAssetDialog::OnAssetSelected(const FAssetData& AssetData)
{
CurrentlySelectedAssets = GetCurrentSelectionDelegate.Execute();
if ( AssetData.IsValid() )
{
SetCurrentlySelectedPath(AssetData.PackagePath.ToString());
SetCurrentlyEnteredAssetName(AssetData.AssetName.ToString());
}
}
示例4: CanCreateActorFrom
bool UVoreealBasicVolumeActorFactory::CanCreateActorFrom(const FAssetData& AssetData, FText& OutErrorMsg)
{
if (AssetData.IsValid() && AssetData.GetClass()->IsChildOf(UBasicVolume::StaticClass()))
{
return true;
}
else
{
OutErrorMsg = NSLOCTEXT("Voreeal", "CanCreateActorFrom_NoVoxelVolume", "No voxel volume was specified.");
return false;
}
}
示例5: CanCreateActorFrom
bool UPaperFlipbookActorFactory::CanCreateActorFrom(const FAssetData& AssetData, FText& OutErrorMsg)
{
if (AssetData.IsValid() && AssetData.GetClass()->IsChildOf(UPaperFlipbook::StaticClass()))
{
return true;
}
else
{
OutErrorMsg = NSLOCTEXT("Paper2D", "CanCreateActorFrom_NoFlipbook", "No flipbook was specified.");
return false;
}
}
示例6: CanCreateAnimBlueprint
static bool CanCreateAnimBlueprint(const FAssetData& Skeleton, UClass const * ParentClass)
{
if (Skeleton.IsValid() && ParentClass != NULL)
{
if (UAnimBlueprintGeneratedClass const * GeneratedParent = Cast<const UAnimBlueprintGeneratedClass>(ParentClass))
{
if (Skeleton.GetExportTextName() != FAssetData(GeneratedParent->GetTargetSkeleton()).GetExportTextName())
{
return false;
}
}
}
return true;
}
示例7: OnSetObject
void FPrimaryAssetIdCustomization::OnSetObject(const FAssetData& AssetData)
{
UAssetManager& Manager = UAssetManager::Get();
if (StructPropertyHandle.IsValid() && StructPropertyHandle->IsValidHandle())
{
FPrimaryAssetId AssetId;
if (AssetData.IsValid())
{
AssetId = Manager.GetPrimaryAssetIdForData(AssetData);
ensure(AssetId.IsValid());
}
StructPropertyHandle->SetValueFromFormattedString(AssetId.ToString());
}
}
示例8: CanCreateActorFrom
bool UTerrainSplineActorFactory::CanCreateActorFrom(const FAssetData& AssetData, FText& OutErrorMsg)
{
if (GetDefault<UPaperRuntimeSettings>()->bEnableTerrainSplineEditing)
{
if (AssetData.IsValid() && AssetData.GetClass()->IsChildOf(UPaperTerrainMaterial::StaticClass()))
{
return true;
}
else
{
return Super::CanCreateActorFrom(AssetData, OutErrorMsg);
}
}
else
{
return false;
}
}
示例9: CanSetBasedOnCustomClasses
bool SPropertyEditorAsset::CanSetBasedOnCustomClasses( const FAssetData& InAssetData ) const
{
bool bAllowedToSetBasedOnFilter = true;
if( InAssetData.IsValid() && CustomClassFilters.Num() > 0 )
{
bAllowedToSetBasedOnFilter = false;
UClass* AssetClass = InAssetData.GetClass();
for( const UClass* AllowedClass : CustomClassFilters )
{
if( AssetClass->IsChildOf( AllowedClass ) )
{
bAllowedToSetBasedOnFilter = true;
break;
}
}
}
return bAllowedToSetBasedOnFilter;
}
示例10: HandleHyperlinkNavigate
END_SLATE_FUNCTION_BUILD_OPTIMIZATION
void SReflectorTreeWidgetItem::HandleHyperlinkNavigate()
{
FAssetData AssetData = WidgetInfo->GetWidgetAssetData();
if ( AssetData.IsValid() )
{
if ( OnAccessAsset.IsBound() )
{
AssetData.GetPackage();
OnAccessAsset.Execute(AssetData.GetAsset());
return;
}
}
if ( OnAccessSourceCode.IsBound() )
{
OnAccessSourceCode.Execute(GetWidgetFile(), GetWidgetLineNumber(), 0);
}
}
示例11: CanSetBasedOnCustomClasses
bool SPropertyEditorAsset::CanSetBasedOnCustomClasses( const FAssetData& InAssetData ) const
{
bool bAllowedToSetBasedOnFilter = true;
if( InAssetData.IsValid() && CustomClassFilters.Num() > 0 )
{
bAllowedToSetBasedOnFilter = false;
UClass* AssetClass = InAssetData.GetClass();
for( const UClass* AllowedClass : CustomClassFilters )
{
const bool bAllowedClassIsInterface = AllowedClass->HasAnyClassFlags(CLASS_Interface);
if( AssetClass->IsChildOf( AllowedClass ) || (bAllowedClassIsInterface && AssetClass->ImplementsInterface(AllowedClass)) )
{
bAllowedToSetBasedOnFilter = true;
break;
}
}
}
return bAllowedToSetBasedOnFilter;
}
示例12: if
TArray<FAssetData> ExtractAssetDataFromDrag(const TSharedPtr<FDragDropOperation>& Operation)
{
TArray<FAssetData> DroppedAssetData;
if (!Operation.IsValid())
{
return DroppedAssetData;
}
if (Operation->IsOfType<FExternalDragOperation>())
{
TSharedPtr<FExternalDragOperation> DragDropOp = StaticCastSharedPtr<FExternalDragOperation>(Operation);
if ( DragDropOp->HasText() )
{
TArray<FString> DroppedAssetStrings;
const TCHAR AssetDelimiter[] = { AssetMarshalDefs::AssetDelimiter, TEXT('\0') };
DragDropOp->GetText().ParseIntoArray(DroppedAssetStrings, AssetDelimiter, true);
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
IAssetRegistry& AssetRegistry = AssetRegistryModule.Get();
for (int Index = 0; Index < DroppedAssetStrings.Num(); Index++)
{
// Truncate each string so that it doesn't exceed the maximum allowed length of characters to be converted to an FName
FString TruncatedString = DroppedAssetStrings[ Index ].Left( NAME_SIZE );
FAssetData AssetData = AssetRegistry.GetAssetByObjectPath( FName( *TruncatedString ) );
if ( AssetData.IsValid() )
{
DroppedAssetData.Add( AssetData );
}
}
}
}
else if (Operation->IsOfType<FAssetDragDropOp>())
{
TSharedPtr<FAssetDragDropOp> DragDropOp = StaticCastSharedPtr<FAssetDragDropOp>( Operation );
DroppedAssetData.Append( DragDropOp->AssetData );
}
return DroppedAssetData;
}
示例13: CacheAssetData
void UEdGraphNode_Reference::CacheAssetData(const FAssetData& AssetData)
{
if ( AssetData.IsValid() )
{
bUsesThumbnail = true;
CachedAssetData = AssetData;
}
else
{
CachedAssetData = FAssetData();
bUsesThumbnail = false;
if ( PackageNames.Num() == 1 )
{
const FString PackageNameStr = PackageNames[0].ToString();
if ( FPackageName::IsValidLongPackageName(PackageNameStr, true) )
{
if ( PackageNameStr.StartsWith(TEXT("/Script")) )
{
CachedAssetData.AssetClass = FName(TEXT("Code"));
}
else
{
const FString PotentiallyMapFilename = FPackageName::LongPackageNameToFilename(PackageNameStr, FPackageName::GetMapPackageExtension());
const bool bIsMapPackage = FPlatformFileManager::Get().GetPlatformFile().FileExists(*PotentiallyMapFilename);
if ( bIsMapPackage )
{
CachedAssetData.AssetClass = FName(TEXT("World"));
}
}
}
}
else
{
CachedAssetData.AssetClass = FName(TEXT("Multiple Nodes"));
}
}
}
示例14: if
TArray<FAssetData> ExtractAssetDataFromDrag(const TSharedPtr<FDragDropOperation>& Operation)
{
TArray<FAssetData> DroppedAssetData;
if (!Operation.IsValid())
{
return DroppedAssetData;
}
if (Operation->IsOfType<FExternalDragOperation>())
{
TSharedPtr<FExternalDragOperation> DragDropOp = StaticCastSharedPtr<FExternalDragOperation>(Operation);
if ( DragDropOp->HasText() )
{
TArray<FString> DroppedAssetStrings;
const TCHAR AssetDelimiter[] = { AssetMarshalDefs::AssetDelimiter, TEXT('\0') };
DragDropOp->GetText().ParseIntoArray(DroppedAssetStrings, AssetDelimiter, true);
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
IAssetRegistry& AssetRegistry = AssetRegistryModule.Get();
for (int Index = 0; Index < DroppedAssetStrings.Num(); Index++)
{
FAssetData AssetData = AssetRegistry.GetAssetByObjectPath( *DroppedAssetStrings[ Index ] );
if ( AssetData.IsValid() )
{
DroppedAssetData.Add( AssetData );
}
}
}
}
else if (Operation->IsOfType<FAssetDragDropOp>())
{
TSharedPtr<FAssetDragDropOp> DragDropOp = StaticCastSharedPtr<FAssetDragDropOp>( Operation );
DroppedAssetData.Append( DragDropOp->AssetData );
}
return DroppedAssetData;
}
示例15: OnAssetSelected
void FPropertyEditor::OnAssetSelected( const FAssetData& AssetData )
{
// Set the object found from the asset picker
GetPropertyHandle()->SetValueFromFormattedString( AssetData.IsValid() ? AssetData.GetAsset()->GetPathName() : TEXT("None") );
}