void FPersonaAssetFamily::RecordAssetOpened(const FAssetData& InAssetData) { if (IsAssetCompatible(InAssetData)) { UClass* Class = InAssetData.GetClass(); if (Class) { if (Class->IsChildOf<USkeleton>()) { Skeleton = Cast<USkeleton>(InAssetData.GetAsset()); } else if (Class->IsChildOf<UAnimationAsset>()) { AnimationAsset = Cast<UAnimationAsset>(InAssetData.GetAsset()); } else if (Class->IsChildOf<USkeletalMesh>()) { Mesh = Cast<USkeletalMesh>(InAssetData.GetAsset()); } else if (Class->IsChildOf<UAnimBlueprint>()) { AnimBlueprint = Cast<UAnimBlueprint>(InAssetData.GetAsset()); } } OnAssetOpened.Broadcast(InAssetData.GetAsset()); } }
bool FPersonaAssetFamily::IsAssetCompatible(const FAssetData& InAssetData) const { UClass* Class = InAssetData.GetClass(); if (Class) { if (Class->IsChildOf<USkeleton>()) { return FAssetData(Skeleton.Get()) == InAssetData; } else if (Class->IsChildOf<UAnimationAsset>() || Class->IsChildOf<USkeletalMesh>()) { const FString* TargetSkeleton = InAssetData.TagsAndValues.Find("Skeleton"); if (TargetSkeleton) { return *TargetSkeleton == FAssetData(Skeleton.Get()).GetExportTextName(); } } else if (Class->IsChildOf<UAnimBlueprint>()) { const FString* TargetSkeleton = InAssetData.TagsAndValues.Find("TargetSkeleton"); if (TargetSkeleton) { return *TargetSkeleton == FAssetData(Skeleton.Get()).GetExportTextName(); } } } return false; }
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; } }
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; } }
bool FStringAssetReferenceCustomization::OnShouldFilterAsset( const FAssetData& InAssetData ) const { // Only bound if we have classes to filter on, so we don't need to test for an empty array here UClass* const AssetClass = InAssetData.GetClass(); for(auto It = CustomClassFilters.CreateConstIterator(); It; ++It) { UClass* const FilterClass = *It; const bool bMatchesFilter = (bExactClass) ? AssetClass == FilterClass : AssetClass->IsChildOf(FilterClass); if(bMatchesFilter) { return false; } } return true; }
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; } }
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; }
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; }
bool FAssetDeleteModel::CanReplaceReferencesWith( const FAssetData& InAssetData ) const { // First make sure that it's not an object we're preparing to delete if ( IsAssetInPendingDeletes( InAssetData.PackageName ) ) { return true; } const UClass* FirstPendingDelete = PendingDeletes[0]->GetObject()->GetClass(); const UClass* AssetDataClass = InAssetData.GetClass(); // If the class isn't loaded we can't compare them, so just return true that we'll be // filtering it from the list. if ( AssetDataClass == nullptr ) { return true; } // Only show objects that are of replaceable because their classes are compatible. return !ObjectTools::AreClassesInterchangeable( FirstPendingDelete, AssetDataClass ); }
bool FAnimMontageSegmentDetails::OnShouldFilterAnimAsset(const FAssetData& AssetData) const { return AssetData.GetClass() == UAnimMontage::StaticClass(); }