Class BinaryModule
The scripting assembly container that holds the scripting types information and metadata.
Inheritance
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Scripting/BinaryModule.h
Syntax
public class BinaryModule
Constructors
~BinaryModule()
BinaryModule()
Fields
Locker
Declaration
public static CriticalSection Locker
Field Value
|
CriticalSection
|
TypeNameToTypeIndex
The scripting types cache that maps the full typename to the scripting type index. Build after adding the type to the assembly.
Declaration
public Dictionary<StringAnsi, int32> TypeNameToTypeIndex
Field Value
|
Dictionary<StringAnsi, int32>
|
Types
The scripting types collection that exist in this assembly.
Declaration
public Array<ScriptingType> Types
Field Value
|
Array<ScriptingType>
|
Methods
DeserializeObject(ISerializable::DeserializeStream& stream, ScriptingObject* object, ISerializeModifier* modifier)
Deserialize object from the input stream
Declaration
public virtual void DeserializeObject(ISerializable::DeserializeStream& stream, ScriptingObject* object, ISerializeModifier* modifier)
Parameters
|
ISerializable::DeserializeStream
stream
The input stream. |
|
ScriptingObject
object
The object instance to deserialize. |
|
ISerializeModifier
modifier
The deserialization modifier object. Always valid. |
Destroy(bool isReloading)
Unloads the module (native library and C# assembly and any other scripting data). Unregisters the module.
Declaration
public virtual void Destroy(bool isReloading)
Parameters
|
bool
isReloading
If true module is during reloading and should force release the runtime data. Used for C# assembly to clean up it's runtime data in Mono (or other scripting runtime). |
FindField(const ScriptingTypeHandle& typeHandle, const StringAnsiView& name)
Tries to find a field in a given scripting type by the field name.
Declaration
public virtual void* FindField(const ScriptingTypeHandle& typeHandle, const StringAnsiView& name)
Parameters
|
ScriptingTypeHandle
typeHandle
The type to find field inside it. |
|
StringAnsiView
name
The field name. |
Returns
|
void
The field or null if failed to get it. |
FindMethod(const ScriptingTypeHandle& typeHandle, const ScriptingTypeMethodSignature& signature)
Tries to find a method in a given scripting type by the method signature.
Declaration
public virtual void* FindMethod(const ScriptingTypeHandle& typeHandle, const ScriptingTypeMethodSignature& signature)
Parameters
|
ScriptingTypeHandle
typeHandle
The type to find method inside it. |
|
ScriptingTypeMethodSignature
signature
The method signature. |
Returns
|
void
The method or null if failed to get it. |
FindMethod(const ScriptingTypeHandle& typeHandle, const StringAnsiView& name, int32 numParams = 0)
Tries to find a method in a given scripting type by the method name and parameters count.
If the type contains more than one method of the given name and parameters count the returned value can be non-deterministic (one of the matching methods).
Declaration
public virtual void* FindMethod(const ScriptingTypeHandle& typeHandle, const StringAnsiView& name, int32 numParams = 0)
Parameters
|
ScriptingTypeHandle
typeHandle
The type to find method inside it. |
|
StringAnsiView
name
The method name. |
|
int32
numParams
The method parameters count. |
Returns
|
void
The method or null if failed to get it. |
FindScriptingType(const StringAnsiView& typeName, int32& typeIndex)
Tries to find a given scripting type by the full name.
Declaration
public virtual bool FindScriptingType(const StringAnsiView& typeName, int32& typeIndex)
Parameters
|
StringAnsiView
typeName
The full name of the type eg: System.Int64.MaxInt. |
|
int32
typeIndex
The result type index in Types array of this module. Valid only if method returns true. |
Returns
|
bool
True if found a type, otherwise false. |
GetFields(const ScriptingTypeHandle& typeHandle, Array<void* >& fields)
Gets handles of all fields in a given scripting type.
Declaration
public virtual void GetFields(const ScriptingTypeHandle& typeHandle, Array<void* >& fields)
Parameters
|
ScriptingTypeHandle
typeHandle
The type to find fields inside it. |
|
Array<void >
fields
The output list of field pointers. |
GetFieldSignature(void* field, ScriptingTypeFieldSignature& fieldSignature)
Gets the scripting type field signature metadata.
Declaration
public virtual void GetFieldSignature(void* field, ScriptingTypeFieldSignature& fieldSignature)
Parameters
|
void
field
The field. |
|
ScriptingTypeFieldSignature
fieldSignature
The output field signature info. |
GetFieldValue(void* field, const Variant& instance, Variant& result)
Gets the value of a given scripting field.
Declaration
public virtual bool GetFieldValue(void* field, const Variant& instance, Variant& result)
Parameters
|
void
field
The field. |
|
Variant
instance
The object instance to get its member field. Unused for static fields. |
|
Variant
result
The output field value. |
Returns
|
bool
True if failed, otherwise false. |
GetMethods(const ScriptingTypeHandle& typeHandle, Array<void* >& methods)
Gets handles of all method in a given scripting type.
Declaration
public virtual void GetMethods(const ScriptingTypeHandle& typeHandle, Array<void* >& methods)
Parameters
|
ScriptingTypeHandle
typeHandle
The type to find methods inside it. |
|
Array<void >
methods
The output list of method pointers. |
GetMethodSignature(void* method, ScriptingTypeMethodSignature& signature)
Gets the scripting type method signature metadata.
Declaration
public virtual void GetMethodSignature(void* method, ScriptingTypeMethodSignature& signature)
Parameters
|
void
method
The method. |
|
ScriptingTypeMethodSignature
signature
The output method signature info. |
GetModule(const StringAnsiView& name)
Finds the module by name.
Declaration
public static BinaryModule* GetModule(const StringAnsiView& name)
Parameters
|
StringAnsiView
name
The module name. |
Returns
|
BinaryModule
The found binary module or null if missing. |
GetModules()
The list with all registered binary modules (including external for plugins and other modules).
Declaration
public static BinaryModulesList GetModules()
Returns
|
BinaryModulesList
|
GetName()
Gets the assembly name.
Declaration
public virtual StringAnsi GetName() const = 0
Returns
|
StringAnsi
The assembly name. |
InvokeMethod(void* method, const Variant& instance, Span<Variant> paramValues, Variant& result)
Invokes a given scripting method.
Declaration
public virtual bool InvokeMethod(void* method, const Variant& instance, Span<Variant> paramValues, Variant& result)
Parameters
|
void
method
The method. |
|
Variant
instance
The object instance to call it's member method. Unused for static methods. |
|
Span<Variant>
paramValues
The method parameters array. For output parameters the method writes the values back to the parameters. Length of this list has to match the method arguments amount. |
|
Variant
result
The output value method returned. Not used for void method. |
Returns
|
bool
True if failed, otherwise false. |
IsLoaded()
Returns true if module is loaded, otherwise false (it might not be loaded yet or failed to load).
Declaration
public virtual bool IsLoaded() const = 0
Returns
|
bool
|
OnObjectDeleted(ScriptingObject* object)
Called when object gets removed (inside destructor). Can be used to clear any cached data inside the scripting backend.
Declaration
public virtual void OnObjectDeleted(ScriptingObject* object)
Parameters
|
ScriptingObject
object
The object instance. |
OnObjectIdChanged(ScriptingObject* object, const Guid& oldId)
Called when object ID gets changed. Can be used to synchronize any cache in the scripting backend.
Declaration
public virtual void OnObjectIdChanged(ScriptingObject* object, const Guid& oldId)
Parameters
|
ScriptingObject
object
The object instance. |
|
Guid
oldId
The previous object ID. |
SerializeObject(JsonWriter& stream, ScriptingObject* object, const ScriptingObject* otherObj)
Serializes the scripting object data. Called for objects using IsCustomScriptingType.
Declaration
public virtual void SerializeObject(JsonWriter& stream, ScriptingObject* object, const ScriptingObject* otherObj)
Parameters
|
JsonWriter
stream
The output stream. |
|
ScriptingObject
object
The object instance to serialize. |
|
ScriptingObject
otherObj
The instance of the object to compare with and serialize only the modified properties. If null, then serialize all properties. |
SetFieldValue(void* field, const Variant& instance, Variant& value)
Sets the value of a given scripting field.
Declaration
public virtual bool SetFieldValue(void* field, const Variant& instance, Variant& value)
Parameters
|
void
field
The field. |
|
Variant
instance
The object instance to set its member field. Unused for static fields. |
|
Variant
value
The field value to assign. |
Returns
|
bool
True if failed, otherwise false. |