/// <summary> /// Gets the name of the function when exposed to a scripting system (e.g. Python) /// </summary> public bool GetScriptName(string originalName, out string name) { string scriptFunctionName = originalName; bool hasScriptFunctionName = false; string scriptName = this.GetMetaData(MDFunc.ScriptName); if (!string.IsNullOrEmpty(scriptName)) { scriptFunctionName = scriptName; hasScriptFunctionName = true; } else { // Remove the K2_ prefix (do it in a loop just incase there are multiple K2_ prefixes) IntPtr ownerClass = Native_UField.GetOwnerClass(Address); if (ownerClass != IntPtr.Zero && Native_UClass.HasAnyClassFlags(ownerClass, EClassFlags.Native)) { while (scriptFunctionName.StartsWith("K2_")) { scriptFunctionName = scriptFunctionName.Substring(3); hasScriptFunctionName = true; } } } name = scriptFunctionName; return(hasScriptFunctionName); }
private IntPtr FindFirstNativeParentClass(IntPtr unrealClass) { IntPtr sharpStaticClass = Native_USharpClass.StaticClass(); while (unrealClass != IntPtr.Zero && (!Native_UClass.HasAnyClassFlags(unrealClass, EClassFlags.Native) || Native_UObjectBaseUtility.IsA(unrealClass, sharpStaticClass))) { unrealClass = Native_UClass.GetSuperClass(unrealClass); } return(unrealClass); }
/// <summary> /// Gets the UClass address holding the interface information for the given path (e.g. "/Script/MovieScene.MovieSceneEasingFunction") /// </summary> /// <param name="path">The path of the interface</param> /// <returns>The address of the UClass interface information for the given path</returns> public static IntPtr GetInterfaceClassAddress(string path) { IntPtr address = GetClassAddress(path); // Restrict this to just interfaces if (address != IntPtr.Zero && Native_UClass.HasAnyClassFlags(address, EClassFlags.Interface)) { return(address); } return(IntPtr.Zero); }
/// <summary> /// Used to safely check whether the passed in flag is set. /// </summary> /// <param name="flagsToCheck">Class flag to check for</param> /// <returns>true if the passed in flag is set, false otherwise /// (including no flag passed in, unless the FlagsToCheck is CLASS_AllFlags)</returns> public bool HasAnyClassFlags(EClassFlags flagsToCheck) { return(Native_UClass.HasAnyClassFlags(Address, flagsToCheck)); }