mirror of
https://github.com/godotengine/godot.git
synced 2024-11-28 23:22:38 +00:00
Add support for _to_string virtual function overwrite in Pluginscript
This commit is contained in:
parent
a82765a464
commit
9761bab753
@ -56,6 +56,7 @@ typedef struct {
|
||||
int p_argcount, godot_variant_call_error *r_error);
|
||||
|
||||
void (*notification)(godot_pluginscript_instance_data *p_data, int p_notification);
|
||||
godot_string (*to_string)(godot_pluginscript_instance_data *p_data, godot_bool *r_valid);
|
||||
|
||||
//this is used by script languages that keep a reference counter of their own
|
||||
//you can make make Ref<> not die when it reaches zero, so deleting the reference
|
||||
|
@ -93,6 +93,13 @@ void PluginScriptInstance::notification(int p_notification) {
|
||||
_desc->notification(_data, p_notification);
|
||||
}
|
||||
|
||||
String PluginScriptInstance::to_string(bool *r_valid) {
|
||||
godot_string ret = _desc->to_string(_data, r_valid);
|
||||
String str_ret = *(String *)&ret;
|
||||
godot_string_destroy(&ret);
|
||||
return str_ret;
|
||||
}
|
||||
|
||||
Vector<ScriptNetData> PluginScriptInstance::get_rpc_methods() const {
|
||||
return _script->get_rpc_methods();
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error);
|
||||
|
||||
virtual void notification(int p_notification);
|
||||
virtual String to_string(bool *r_valid);
|
||||
|
||||
virtual Ref<Script> get_script() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user