MCPcopy Create free account
hub / github.com/MothCocoon/FlowGraph / AddAsset

Method AddAsset

Source/FlowEditor/Private/Graph/FlowGraphSchema.cpp:1443–1481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1441}
1442
1443void UFlowGraphSchema::AddAsset(const FAssetData& AssetData, const bool bBatch)
1444{
1445 const bool bIsAssetAlreadyKnown =
1446 BlueprintFlowNodes.Contains(AssetData.PackageName) ||
1447 BlueprintFlowNodeAddOns.Contains(AssetData.PackageName);
1448
1449 if (bIsAssetAlreadyKnown)
1450 {
1451 return;
1452 }
1453
1454 const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(AssetRegistryConstants::ModuleName);
1455 if (AssetRegistryModule.Get().IsLoadingAssets())
1456 {
1457 return;
1458 }
1459
1460 bool bAddedToMap = false;
1461 if (ShouldAddToBlueprintFlowNodesMap(AssetData, UFlowNodeBlueprint::StaticClass(), UFlowNode::StaticClass()))
1462 {
1463 BlueprintFlowNodes.Emplace(AssetData.PackageName, AssetData);
1464 bAddedToMap = true;
1465 }
1466 else if (ShouldAddToBlueprintFlowNodesMap(AssetData, UFlowNodeAddOnBlueprint::StaticClass(), UFlowNodeAddOn::StaticClass()))
1467 {
1468 BlueprintFlowNodeAddOns.Emplace(AssetData.PackageName, AssetData);
1469 bAddedToMap = true;
1470 }
1471
1472 if (bAddedToMap && !bBatch)
1473 {
1474 if (UBlueprint* Blueprint = Cast<UBlueprint>(AssetData.GetAsset()))
1475 {
1476 UClass* NodeClass = Blueprint->GeneratedClass;
1477 UpdateGeneratedDisplayName(NodeClass, false);
1478 }
1479 OnNodeListChanged.Broadcast();
1480 }
1481}
1482
1483bool UFlowGraphSchema::ShouldAddToBlueprintFlowNodesMap(const FAssetData& AssetData, const TSubclassOf<UBlueprint>& BlueprintClass, const TSubclassOf<UFlowNodeBase>& FlowNodeBaseClass)
1484{

Callers

nothing calls this directly

Calls 1

GetMethod · 0.80

Tested by

no test coverage detected