mirror of
https://github.com/Relintai/mono.git
synced 2024-11-08 10:12:16 +01:00
Implemented proper StringName* to variant conversion in the generated binds.
This commit is contained in:
parent
37ac19fe0b
commit
2001f6acbe
@ -93,6 +93,8 @@
|
|||||||
#define C_METHOD_MANAGED_FROM_VARIANT C_NS_MONOMARSHAL "::variant_to_mono_object"
|
#define C_METHOD_MANAGED_FROM_VARIANT C_NS_MONOMARSHAL "::variant_to_mono_object"
|
||||||
#define C_METHOD_MONOSTR_TO_GODOT C_NS_MONOMARSHAL "::mono_string_to_godot"
|
#define C_METHOD_MONOSTR_TO_GODOT C_NS_MONOMARSHAL "::mono_string_to_godot"
|
||||||
#define C_METHOD_MONOSTR_FROM_GODOT C_NS_MONOMARSHAL "::mono_string_from_godot"
|
#define C_METHOD_MONOSTR_FROM_GODOT C_NS_MONOMARSHAL "::mono_string_from_godot"
|
||||||
|
#define C_METHOD_STRING_NAME_PTR_TO_VARIANT C_NS_MONOMARSHAL "::string_name_ptr_to_variant"
|
||||||
|
//#define C_METHOD_STRING_NAME_PTR_FROM_VARIANT C_NS_MONOMARSHAL "::variant_to_string_name_ptr"
|
||||||
#define C_METHOD_MONOARRAY_TO(m_type) C_NS_MONOMARSHAL "::mono_array_to_" #m_type
|
#define C_METHOD_MONOARRAY_TO(m_type) C_NS_MONOMARSHAL "::mono_array_to_" #m_type
|
||||||
#define C_METHOD_MONOARRAY_FROM(m_type) C_NS_MONOMARSHAL "::" #m_type "_to_mono_array"
|
#define C_METHOD_MONOARRAY_FROM(m_type) C_NS_MONOMARSHAL "::" #m_type "_to_mono_array"
|
||||||
|
|
||||||
@ -3133,6 +3135,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
|
|||||||
itype.name = "StringName";
|
itype.name = "StringName";
|
||||||
itype.cname = itype.name;
|
itype.cname = itype.name;
|
||||||
itype.proxy_name = "StringName";
|
itype.proxy_name = "StringName";
|
||||||
|
itype.c_in = "\t%0 %1_in = " C_METHOD_STRING_NAME_PTR_TO_VARIANT "(%1);\n";
|
||||||
itype.c_out = "\treturn memnew(StringName(%1));\n";
|
itype.c_out = "\treturn memnew(StringName(%1));\n";
|
||||||
itype.c_type = itype.name;
|
itype.c_type = itype.name;
|
||||||
itype.c_type_in = itype.c_type + "*";
|
itype.c_type_in = itype.c_type + "*";
|
||||||
|
@ -1372,6 +1372,14 @@ Variant mono_object_to_variant_no_err(MonoObject *p_obj, const ManagedType &p_ty
|
|||||||
return mono_object_to_variant_impl(p_obj, p_type, /* fail_with_err: */ false);
|
return mono_object_to_variant_impl(p_obj, p_type, /* fail_with_err: */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Variant string_name_ptr_to_variant(StringName *p_obj) {
|
||||||
|
if (!p_obj) {
|
||||||
|
return Variant();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Variant(*p_obj);
|
||||||
|
}
|
||||||
|
|
||||||
String mono_object_to_variant_string(MonoObject *p_obj, MonoException **r_exc) {
|
String mono_object_to_variant_string(MonoObject *p_obj, MonoException **r_exc) {
|
||||||
if (p_obj == nullptr) {
|
if (p_obj == nullptr) {
|
||||||
return String("null");
|
return String("null");
|
||||||
|
@ -143,6 +143,8 @@ Variant mono_object_to_variant(MonoObject *p_obj);
|
|||||||
Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type);
|
Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type);
|
||||||
Variant mono_object_to_variant_no_err(MonoObject *p_obj, const ManagedType &p_type);
|
Variant mono_object_to_variant_no_err(MonoObject *p_obj, const ManagedType &p_type);
|
||||||
|
|
||||||
|
Variant string_name_ptr_to_variant(StringName *p_obj);
|
||||||
|
|
||||||
/// Tries to convert the MonoObject* to Variant and then convert the Variant to String.
|
/// Tries to convert the MonoObject* to Variant and then convert the Variant to String.
|
||||||
/// If the MonoObject* cannot be converted to Variant, then 'ToString()' is called instead.
|
/// If the MonoObject* cannot be converted to Variant, then 'ToString()' is called instead.
|
||||||
String mono_object_to_variant_string(MonoObject *p_obj, MonoException **r_exc);
|
String mono_object_to_variant_string(MonoObject *p_obj, MonoException **r_exc);
|
||||||
@ -467,8 +469,7 @@ struct M_Projection {
|
|||||||
return Projection(M_Vector4::convert_to(p_from.matrix[0]),
|
return Projection(M_Vector4::convert_to(p_from.matrix[0]),
|
||||||
M_Vector4::convert_to(p_from.matrix[1]),
|
M_Vector4::convert_to(p_from.matrix[1]),
|
||||||
M_Vector4::convert_to(p_from.matrix[2]),
|
M_Vector4::convert_to(p_from.matrix[2]),
|
||||||
M_Vector4::convert_to(p_from.matrix[3])
|
M_Vector4::convert_to(p_from.matrix[3]));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static _FORCE_INLINE_ M_Projection convert_from(const Projection &p_from) {
|
static _FORCE_INLINE_ M_Projection convert_from(const Projection &p_from) {
|
||||||
|
Loading…
Reference in New Issue
Block a user