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);
        }
Exemplo n.º 2
0
 public static bool GetBoolMetaDataHierarchical <TEnum>(this UStruct unrealStruct, TEnum key) where TEnum : struct
 {
     return(unrealStruct.GetBoolMetaDataHierarchical(new FName(UMeta.GetKey(key))));
 }