private bool IsBlueprintVisibleStruct(UStruct unrealStruct) { // All of the available macro tags at: // Engine\Source\Runtime\CoreUObject\Public\UObject\ObjectBase.h // BlueprintType = can use inside a blueprint // Blueprintable = can use as a new blueprint // Blueprintable seems to override NotBlueprintType? // IsBlueprintBase, BlueprintSpawnableComponent // All UBlueprintFunctionLibrary classes are visible in blueprint even if marked as not visible if (unrealStruct.IsChildOf <UBlueprintFunctionLibrary>()) { return(true); } // Action classes are exposed to Blueprint as special nodes. We want the entire class. UClass unrealClass = unrealStruct as UClass; if (unrealClass != null && GetActionFactoryClass(unrealClass) != null) { return(true); } if (unrealStruct.GetBoolMetaDataHierarchical(MDClass.BlueprintSpawnableComponent))// && Struct.IsChildOf<UActorComponent>() { // Are all BlueprintSpawnableComponent classes visible even if marked not? TODO: Check this. return(true); } bool notBlueprintType = false; bool notBlueprintable = false; while (unrealStruct != null) { if (!notBlueprintType && unrealStruct.GetBoolMetaData(MDClass.BlueprintType)) { return(true); } if (!notBlueprintable && unrealStruct.GetBoolMetaData(MDClass.Blueprintable)) { return(true); } if (unrealStruct.GetBoolMetaData(MDClass.NotBlueprintType)) { notBlueprintType = true; } if (unrealStruct.GetBoolMetaData(MDClass.NotBlueprintable)) { notBlueprintable = true; } unrealStruct = unrealStruct.GetSuperStruct(); } return(false); }
/// <summary> /// Determines the "blueprintability" of the given UStruct (BlueprintType / Blueprintable) /// </summary> private void GetBlueprintability(UStruct unrealStruct, out bool blueprintType, out bool blueprintable) { blueprintType = false; blueprintable = false; // See UEdGraphSchema_K2::IsAllowableBlueprintVariableType() // Engine\Source\Editor\BlueprintGraph\Private\EdGraphSchema_K2.cpp // True but not useful for what we are doing //if (unrealStruct.Address == Classes.UObject) //{ // blueprintType = true; // blueprintable = true; // return; //} if (unrealStruct.IsA <UBlueprintFunctionLibrary>()) { // UBlueprintFunctionLibrary functions are always visible (even if marked NotBlueprintType) blueprintType = true; } bool notBlueprintType = false; bool notBlueprintable = false; while (unrealStruct != null) { if (!notBlueprintType && (unrealStruct.GetBoolMetaData(MDClass.BlueprintType) || unrealStruct.GetBoolMetaData(MDClass.BlueprintSpawnableComponent))) { blueprintType = true; if (blueprintable || notBlueprintable) { break; } } if (!notBlueprintable && !blueprintable && unrealStruct.HasMetaData(MDClass.IsBlueprintBase)) { if (unrealStruct.GetBoolMetaData(MDClass.IsBlueprintBase)) { blueprintable = true; } else { notBlueprintable = true; } if (blueprintType || notBlueprintType) { break; } } if (!notBlueprintable && unrealStruct.GetBoolMetaData(MDClass.Blueprintable)) { blueprintable = true; if (blueprintType || notBlueprintType) { break; } } if (!blueprintType && unrealStruct.GetBoolMetaData(MDClass.NotBlueprintType)) { notBlueprintType = true; if (blueprintable || notBlueprintable) { break; } } if (!blueprintable && unrealStruct.GetBoolMetaData(MDClass.NotBlueprintable)) { notBlueprintable = true; if (blueprintType || notBlueprintType) { break; } } unrealStruct = unrealStruct.GetSuperStruct(); } }