Commit graph

17 commits

Author SHA1 Message Date
Ruslan Mustakov
d71171026f Dont call nativescript callbacks if lib is not initialized 2017-08-04 21:17:33 +07:00
Thomas Herzog
056b5f9e56 Merge pull request #10060 from endragor/nativescript-frame
Forward frame call to GDNative libraries
2017-08-03 13:52:44 +02:00
Ruslan Mustakov
aaf84129db Forward frame call to GDNative libraries 2017-08-03 14:04:04 +07:00
Karroffel
c143f86968 [GDNative/NativeScript] fix -rdynamic and removed _init call
The _init call was buggy anyway and in the end shouldn't be a
thing that's called via ClassDB, it should be something that's
language specific, so we leave this out for the bindings.

In the commit 66a7763 the SCsub file for GDNative was changed to
use a cloned environment, that bricked -rdynamic which needs to be
passed down to the linker, which didn't happen with the new env.
2017-08-02 14:21:12 +02:00
Karroffel
fc9f5d59b5 [NativeScript] fix signals from base class not being accessible
https://github.com/GodotNativeTools/cpp_bindings/issues/26
2017-07-30 15:04:00 +02:00
Karroffel
3185c9c374 [NativeScript] fixed optional _init call
In 3c53b35 a call to an "_init" function was introduced,
that however was only executed in the `_new` function,
also it *required* that such a function exists.

With this patch the "_init" function will be optionally called on
every instance creation.
2017-07-27 15:30:39 +02:00
Karroffel
aae8accadd [NativeScript] fix mutex double lock
In 3c53b35 a bug got introduced where a mutex gets locked twice
instead of locked and then unlocked.
This path fixes that.
2017-07-27 14:56:47 +02:00
Karroffel
a2795e9531 [NativeScript] call _init on instance creation
This also adds basic locking for the set of owners
to avoid threading problems
2017-07-27 11:12:49 +02:00
Thomas Herzog
18e23ad4dc Merge pull request #9882 from endragor/nativescript-refcount
Forward refcount changes to NativeScriptInstance
2017-07-26 21:29:26 +02:00
Ruslan Mustakov
db9dcbddbc Forward refcount changes to NativeScriptInstance
This also changes Reference::unreference() to always invoke
refcount_decremented. Previously it was not invoked until the count
reached zero due to short-circuit evalution of boolean expressions.
2017-07-26 22:36:57 +07:00
Ruslan Mustakov
7f32023a1a Support multithreading for NativeScriptLanguage
Godot may call property setters from non-main thread when an object is
loaded in the edtior. This means NativeScriptLanguage could be accessed
from different threads, but it was not designed for thread-safety.
Besides, previous behaviour made it so that godot_nativescript_init and
godot_gdnative_init could be invoked from non-main thread, while
godot_gdnative_thread is always invoked on the main thread. This may
not be expected by the binding library.

This commit defers native library initialization to the main thread and
adds godot_nativescript_thread_enter and godot_nativescript_thread_exit
callbacks to make a binding library aware of foreign threads.
2017-07-26 19:39:10 +07:00
sheepandshepherd
bdf2e8c615 Fix typo in NativeScript property getter 2017-07-25 23:03:39 +02:00
Karroffel
cdf1212bee [NativeScript] fix double initialization in editor 2017-07-25 18:18:36 +02:00
Karroffel
3f1e75e89c [NativeScript] bound new to ClassDB 2017-07-25 00:26:37 +02:00
Ramesh Ravone
75b66146ae
GDNative register_property 2017-07-24 22:30:07 +05:30
Karroffel
a1a76bbde4 [NativeScript] fix double free but on exit 2017-07-24 14:07:39 +02:00
Karroffel
534d62d2f4 [GDNative] new GDNative API
This adds GDNative as a separate class type.
It can be used to interface with native libraries by
using "native calls", which can be registered by modules
(and in future other GDNative libraries?).

It also reworks the currently called "GDNativeScript" into a
"NativeScript" that just makes use of the new GDNative instead
of it being the component that implements that functionality.
2017-07-24 04:23:37 +02:00