Example #1
0
        private void UpdateAvailableTypes()
        {
            availableTypes.Clear();

            if (Settings.ExportMode == CodeGeneratorSettings.CodeExportMode.All)
            {
                return;
            }

            foreach (UStruct unrealStruct in UObject.GetObjects <UStruct>())
            {
                if (!unrealStruct.IsA <UFunction>() && IsBlueprintVisibleStruct(unrealStruct))
                {
                    UpdateAvailableTypes(unrealStruct);
                }
            }

            foreach (UEnum unrealEnum in UObject.GetObjects <UEnum>())
            {
                if (CanExportEnum(unrealEnum) && IsBlueprintVisibleEnum(unrealEnum))
                {
                    UpdateAvailableTypes(unrealEnum);
                }
            }

            // cache UPackage class
            UClass packageClass = UClass.GetClass <UPackage>();

            if (Settings.ExportMode == CodeGeneratorSettings.CodeExportMode.Referenced)
            {
                // Get struct refs from global functions (delegates)
                // - Should we check if the delegate is even referenced?
                foreach (UFunction function in UObject.GetObjects <UFunction>())
                {
                    bool isGlobal = function.GetOuter().GetClass() == packageClass;
                    if (isGlobal && function.HasAnyFunctionFlags(EFunctionFlags.Delegate | EFunctionFlags.MulticastDelegate))
                    {
                        UpdateAvailableTypes(function);
                    }
                }
            }
        }