示例#1
0
 /// <summary>
 /// Construct from FNames that are already expanded
 /// </summary>
 public FCoreRedirectObjectName(FName objectName, FName outerName, FName packageName)
 {
     ObjectName  = objectName;
     OuterName   = outerName;
     PackageName = packageName;
 }
示例#2
0
 /// <summary>
 /// Adds a module to our list of modules, unless it's already known.
 /// </summary>
 /// <param name="moduleName">The base name of the module file.  Should not include path, extension or platform/configuration info.  This is just the "name" part of the module file name.  Names should be globally unique.</param>
 public void AddModule(FName moduleName)
 {
     Native_FModuleManager.AddModule(Address, ref moduleName);
 }
示例#3
0
 /// <summary>
 /// Loads the specified module, checking to ensure it exists.
 /// </summary>
 /// <param name="moduleName">The base name of the module file.  Should not include path, extension or platform/configuration info.  This is just the "module name" part of the module file name.  Names should be globally unique.</param>
 /// <returns>The loaded module, or nullptr if the load operation failed.</returns>
 /// <see cref="AbandonModule, IsModuleLoaded, LoadModuleChecked, LoadModulePtr, LoadModuleWithFailureReason, UnloadModule"/>
 public IntPtr LoadModuleChecked(FName moduleName)
 {
     return(Native_FModuleManager.LoadModuleChecked(Address, ref moduleName));
 }
示例#4
0
 /// <summary>
 /// Searches for the default instanced object (often a component) by name
 /// </summary>
 /// <param name="toFind"></param>
 /// <returns></returns>
 public UObject GetDefaultSubobjectByName(FName toFind)
 {
     return(GCHelper.Find(Native_UClass.GetDefaultSubobjectByName(Address, ref toFind)));
 }
示例#5
0
 /// <summary>
 /// Loads the specified module and returns a result.
 /// </summary>
 /// <param name="moduleName">The base name of the module file.  Should not include path, extension or platform/configuration info.  This is just the "module name" part of the module file name.  Names should be globally unique.</param>
 /// <param name="failureReason">Will contain the result.</param>
 /// <returns>The loaded module (null if the load operation failed).</returns>
 /// <see cref="AbandonModule, IsModuleLoaded, LoadModule, LoadModuleChecked, LoadModulePtr, UnloadModule"/>
 public IntPtr LoadModuleWithFailureReason(FName moduleName, out EModuleLoadResult failureReason)
 {
     return(Native_FModuleManager.LoadModuleWithFailureReason(Address, ref moduleName, out failureReason));
 }
示例#6
0
 public static FMinimalName FromName(FName name)
 {
     return(new FMinimalName(name.ComparisonIndex, name.Number));
 }
示例#7
0
 /// <summary>
 /// Add a function to the function map
 /// </summary>
 /// <param name="function"></param>
 public void AddFunctionToFunctionMap(UFunction function, FName funcName)
 {
     Native_UClass.AddFunctionToFunctionMap(Address, function == null ? IntPtr.Zero : function.Address, ref funcName);
 }
示例#8
0
 public void Bind(IntPtr obj, FName functionName)
 {
     Object.Set(obj);
     FunctionName = functionName;
 }
示例#9
0
        /// <summary>
        /// Create a unique name by combining a base name and an arbitrary number string.
        /// The object name returned is guaranteed not to exist.
        /// </summary>
        /// <param name="outer">the outer for the object that needs to be named</param>
        /// <param name="unrealClass">the class for the object</param>
        /// <param name="baseName">optional base name to use when generating the unique object name; if not specified, the class's name is used</param>
        /// <returns>name is the form BaseName_##, where ## is the number of objects of this
        /// type that have been created since the last time the class was garbage collected.</returns>
        public static FName MakeUniqueObjectName(ObjectOuter outer, UClass unrealClass, FName baseName = default(FName))
        {
            FName result;

            Native_UObjectGlobals.MakeUniqueObjectName(outer.Address,
                                                       unrealClass == null ? IntPtr.Zero : unrealClass.Address,
                                                       ref baseName, out result);
            return(result);
        }
示例#10
0
 public FScriptDelegate(IntPtr obj, FName functionName)
 {
     Object       = new FWeakObjectPtr();
     FunctionName = functionName;
     Object.Set(obj);
 }
示例#11
0
 public FScriptDelegate(FWeakObjectPtr obj, FName functionName)
 {
     Object       = obj;
     FunctionName = functionName;
 }
示例#12
0
 public bool Contains(IntPtr obj, FName functionName)
 {
     return(IndexOf(obj, functionName) >= 0);
 }
示例#13
0
 public void Clear()
 {
     Object.Set(IntPtr.Zero);
     FunctionName = FName.None;
 }
示例#14
0
 public UProperty FindPropertyByName(FName name)
 {
     return(GCHelper.Find <UProperty>(Native_UStruct.FindPropertyByName(Address, ref name)));
 }
示例#15
0
 public FSoftObjectPath(FName assetPathName, string subPathString)
 {
     AssetPathName = assetPathName;
     SubPathString = subPathString;
 }
示例#16
0
        /// <summary>
        /// Create a new instance of an object or replace an existing object.  If both an Outer and Name are specified, and there is an object already in memory with the same Class, Outer, and Name, the
        /// existing object will be destructed, and the new object will be created in its place.
        /// </summary>
        /// <param name="unrealClass">the class of the object to create</param>
        /// <param name="outer">the object to create this object within (the Outer property for the new object will be set to the value specified here).</param>
        /// <param name="name">the name to give the new object. If no value (NAME_None) is specified, the object will be given a unique name in the form of ClassName_#.</param>
        /// <param name="outReusedSubobject">flag indicating if the object is a subobject that has already been created (in which case further initialization is not necessary).</param>
        /// <param name="setFlags">the ObjectFlags to assign to the new object. some flags can affect the behavior of constructing the object.</param>
        /// <param name="internalSetFlags">the InternalObjectFlags to assign to the new object. some flags can affect the behavior of constructing the object.</param>
        /// <param name="canReuseSubobjects">if set to true, SAO will not attempt to destroy a subobject if it already exists in memory.</param>
        /// <returns>a pointer to a fully initialized object of the specified class.</returns>
        public static UObject StaticAllocateObject(UClass unrealClass, ObjectOuter outer, FName name, out bool outReusedSubobject,
                                                   EObjectFlags setFlags, EInternalObjectFlags internalSetFlags, bool canReuseSubobjects = false)
        {
            csbool  outReusedSubobjectTemp;
            UObject result = GCHelper.Find(Native_UObjectGlobals.StaticAllocateObject(
                                               unrealClass == null ? IntPtr.Zero : unrealClass.Address,
                                               outer.Address, ref name, setFlags, internalSetFlags, canReuseSubobjects, out outReusedSubobjectTemp));

            outReusedSubobject = outReusedSubobjectTemp;
            return(result);
        }
示例#17
0
 public FSoftClassPath(FName assetPathName, string subPathString)
 {
     ObjectPath = new FSoftObjectPath(assetPathName, subPathString);
 }
示例#18
0
 private static bool HasMetaData(IntPtr metadata, IntPtr obj, FName key)
 {
     return(Native_UMetaData.HasValueFName(metadata, obj, ref key));
 }
示例#19
0
 /// <summary>
 /// Determines if the specified function has been implemented in a Blueprint
 /// </summary>
 /// <param name="inFunctionName">The name of the function to test</param>
 /// <returns>True if the specified function exists and is implemented in a blueprint generated class</returns>
 public bool IsFunctionImplementedInBlueprint(FName inFunctionName)
 {
     return(Native_UClass.IsFunctionImplementedInBlueprint(Address, ref inFunctionName));
 }
示例#20
0
        /// <summary>
        /// Searches the class hierarchy to find the original owner of the given function (by function name)
        /// </summary>
        private UClass GetOriginalFunctionOwnerInternal(UFunction function, out UFunction originalFunction,
                                                        out bool isInterfaceImplementation)
        {
            // Interfaces really mess up this function. Two interfaces could potentially provide the same function
            // in the class hierarchy. Or a class up the chain could provide a function but also an interface with
            // the same function name could exist. None of this maps to C# well in terms of ensuring this is all handled
            // properly AND with name conflict resolution (which is what GetOriginalFunctionOwner is partially used for).
            // - We ALWAYS want use the first interface found with the same function name in order to produce valid C#.
            //   (even if this then technically isn't necessarily the original function / owner).
            // - We should log when we find this type of situation where there are functions are redefined in a
            //   class / interface combo (regular class:class conflict should be fine).
            // - TODO: Handle interface hierarchy

            FName functionName = function.GetFName();

            isInterfaceImplementation = false;

            originalFunction = function;
            UClass owner = function.GetOwnerClass();

            if (owner != null)
            {
                // First check the interfaces of THIS class.
                foreach (FImplementedInterface implementedInterface in owner.Interfaces)
                {
                    UClass interfaceClass = implementedInterface.InterfaceClass;
                    if (interfaceClass != null)
                    {
                        UFunction interfaceFunction = interfaceClass.FindFunctionByName(functionName, false);
                        if (interfaceFunction != null)
                        {
                            originalFunction = interfaceFunction;
                            ValidateNoInterfaceFunctionConflict(owner, originalFunction, interfaceClass, true);

                            // We found the original function directly within one of the implemented interfaces.
                            // This means the input function is an implementation for one of the interfaces.
                            isInterfaceImplementation = true;
                            return(interfaceClass);
                        }
                    }
                }

                UClass parentClass = owner.GetSuperClass();
                while (parentClass != null)
                {
                    // Check the interfaces of the parent class.
                    foreach (FImplementedInterface implementedInterface in parentClass.Interfaces)
                    {
                        UClass interfaceClass = implementedInterface.InterfaceClass;
                        if (interfaceClass != null)
                        {
                            UFunction interfaceFunction = interfaceClass.FindFunctionByName(functionName, false);
                            if (interfaceFunction != null)
                            {
                                originalFunction = interfaceFunction;
                                ValidateNoInterfaceFunctionConflict(parentClass, originalFunction, interfaceClass, false);
                                return(interfaceClass);
                            }
                        }
                    }

                    UFunction parentFunction = parentClass.FindFunctionByName(functionName, false);
                    if (parentFunction == null)
                    {
                        break;
                    }
                    originalFunction = parentFunction;
                    owner            = parentClass;
                    parentClass      = parentClass.GetSuperClass();
                }
            }
            return(owner);
        }
示例#21
0
 public UFunction FindFunctionByName(FName name, bool includeSuper = true)
 {
     return(GCHelper.Find <UFunction>(Native_UClass.FindFunctionByName(Address, ref name, includeSuper)));
 }
示例#22
0
 /// <summary>
 /// Remove any entry with the supplied Key form the Property's metadata
 /// </summary>
 /// <param name="obj">the object to clear the metadata for</param>
 /// <param name="key">A key to clear the data for</param>
 public void RemoveValue(UObject obj, FName key)
 {
     Native_UMetaData.RemoveValueFName(Address, obj == null ? IntPtr.Zero : obj.Address, ref key);
 }
示例#23
0
 /// <summary>
 /// Looks for a given function name
 /// </summary>
 public UFunction FindFunctionChecked(FName name)
 {
     return(GCHelper.Find <UFunction>(Native_UObject.FindFunctionChecked(Address, ref name)));
 }
示例#24
0
 /// <summary>
 /// Return whether or not the Key is in the meta data
 /// </summary>
 /// <param name="obj">the object to lookup the metadata for</param>
 /// <param name="key">The key to query for existence</param>
 /// <returns>true if found</returns>
 public bool HasValue(UObject obj, FName key)
 {
     return(Native_UMetaData.HasValueFName(Address, obj == null ? IntPtr.Zero : obj.Address, ref key));
 }
示例#25
0
 /// <summary>
 /// Determines whether the specified module contains UObjects.  The module must already be loaded into
 /// memory before calling this function.
 /// </summary>
 /// <param name="moduleName">ModuleName Name of the loaded module to check.</param>
 /// <returns>True if the module was found to contain UObjects, or false if it did not (or wasn't loaded.)</returns>
 public bool DoesLoadedModuleHaveUObjects(FName moduleName)
 {
     return(Native_FModuleManager.DoesLoadedModuleHaveUObjects(Address, ref moduleName));
 }
示例#26
0
 public FSoftObjectPathUnsafe(FName assetPathName, string subPathString)
 {
     this.assetPathName = assetPathName;
     this.subPathString = default(FScriptArray);
     FStringMarshaler.ToArray(ref this.subPathString, subPathString);
 }
示例#27
0
 /// <summary>
 /// Checks whether the specified module is currently loaded.
 ///
 /// This is an O(1) operation.
 /// </summary>
 /// <param name="moduleName">The base name of the module file.  Should not include path, extension or platform/configuration info.  This is just the "module name" part of the module file name.  Names should be globally unique.</param>
 /// <returns>true if module is currently loaded, false otherwise.</returns>
 /// <see cref="AbandonModule, LoadModule, LoadModuleWithFailureReason, UnloadModule"/>
 public bool IsModuleLoaded(FName moduleName)
 {
     return(Native_FModuleManager.IsModuleLoaded(Address, ref moduleName));
 }
示例#28
0
 public void Dispose()
 {
     assetPathName = FName.None;
     subPathString.Destroy();
 }
示例#29
0
 /// <summary>
 /// Loads a module in memory then calls PostLoad.
 /// </summary>
 /// <param name="moduleName">The name of the module to load.</param>
 /// <returns>true on success, false otherwise.</returns>
 /// <see cref="UnloadOrAbandonModuleWithCallback"/>
 public bool LoadModuleWithCallback(FName moduleName)
 {
     return(Native_FModuleManager.LoadModuleWithCallback(Address, ref moduleName, IntPtr.Zero));
 }
示例#30
0
 /// <summary>
 /// Goes from the containing package and name of the type to the type flag
 /// </summary>
 public static ECoreRedirectFlags GetFlagsForTypeName(FName packageName, FName typeName)
 {
     return(Native_FCoreRedirects.GetFlagsForTypeName(ref packageName, ref typeName));
 }