@@ -724,6 +724,9 @@ typedef struct {
724724
725725} GDExtensionScriptInstanceInfo3;
726726
727+ typedef void (*GDExtensionWorkerThreadPoolGroupTask)(void *, uint32_t );
728+ typedef void (*GDExtensionWorkerThreadPoolTask)(void *);
729+
727730/* INITIALIZATION */
728731
729732typedef enum {
@@ -734,15 +737,18 @@ typedef enum {
734737 GDEXTENSION_MAX_INITIALIZATION_LEVEL,
735738} GDExtensionInitializationLevel;
736739
740+ typedef void (*GDExtensionInitializeCallback)(void *p_userdata, GDExtensionInitializationLevel p_level);
741+ typedef void (*GDExtensionDeinitializeCallback)(void *p_userdata, GDExtensionInitializationLevel p_level);
742+
737743typedef struct {
738744 /* Minimum initialization level required.
739745 * If Core or Servers, the extension needs editor or game restart to take effect */
740746 GDExtensionInitializationLevel minimum_initialization_level;
741747 /* Up to the user to supply when initializing */
742748 void *userdata;
743749 /* This function will be called multiple times for each initialization level. */
744- void (* initialize)( void *userdata, GDExtensionInitializationLevel p_level) ;
745- void (* deinitialize)( void *userdata, GDExtensionInitializationLevel p_level) ;
750+ GDExtensionInitializeCallback initialize;
751+ GDExtensionDeinitializeCallback deinitialize;
746752} GDExtensionInitialization;
747753
748754typedef void (*GDExtensionInterfaceFunctionPtr)();
@@ -1039,7 +1045,7 @@ typedef void (*GDExtensionInterfaceVariantCall)(GDExtensionVariantPtr p_self, GD
10391045 *
10401046 * Calls a static method on a Variant.
10411047 *
1042- * @param p_self A pointer to the Variant .
1048+ * @param p_type The variant type .
10431049 * @param p_method A pointer to a StringName identifying the method.
10441050 * @param p_args A pointer to a C array of Variant.
10451051 * @param p_argument_count The number of arguments.
@@ -1325,7 +1331,7 @@ typedef GDExtensionVariantType (*GDExtensionInterfaceVariantGetType)(GDExtension
13251331 * @param p_self A pointer to the Variant.
13261332 * @param p_method A pointer to a StringName with the method name.
13271333 *
1328- * @return
1334+ * @return true if the variant has the given method; otherwise false.
13291335 */
13301336typedef GDExtensionBool (*GDExtensionInterfaceVariantHasMethod)(GDExtensionConstVariantPtr p_self, GDExtensionConstStringNamePtr p_method);
13311337
@@ -1338,7 +1344,7 @@ typedef GDExtensionBool (*GDExtensionInterfaceVariantHasMethod)(GDExtensionConst
13381344 * @param p_type The Variant type.
13391345 * @param p_member A pointer to a StringName with the member name.
13401346 *
1341- * @return
1347+ * @return true if the variant has the given method; otherwise false.
13421348 */
13431349typedef GDExtensionBool (*GDExtensionInterfaceVariantHasMember)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_member);
13441350
@@ -1509,7 +1515,7 @@ typedef GDExtensionPtrDestructor (*GDExtensionInterfaceVariantGetPtrDestructor)(
15091515 * Constructs a Variant of the given type, using the first constructor that matches the given arguments.
15101516 *
15111517 * @param p_type The Variant type.
1512- * @param p_base A pointer to a Variant to store the constructed value.
1518+ * @param r_base A pointer to a Variant to store the constructed value.
15131519 * @param p_args A pointer to a C array of Variant pointers representing the arguments for the constructor.
15141520 * @param p_argument_count The number of arguments to pass to the constructor.
15151521 * @param r_error A pointer the structure which will be updated with error information.
@@ -1732,7 +1738,7 @@ typedef GDExtensionInt (*GDExtensionInterfaceStringNewWithUtf8CharsAndLen2)(GDEx
17321738 *
17331739 * @param r_dest A pointer to a Variant to hold the newly created String.
17341740 * @param p_contents A pointer to a UTF-16 encoded C string.
1735- * @param p_size The number of characters (not bytes).
1741+ * @param p_char_count The number of characters (not bytes).
17361742 */
17371743typedef void (*GDExtensionInterfaceStringNewWithUtf16CharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const char16_t *p_contents, GDExtensionInt p_char_count);
17381744
@@ -1744,7 +1750,7 @@ typedef void (*GDExtensionInterfaceStringNewWithUtf16CharsAndLen)(GDExtensionUni
17441750 *
17451751 * @param r_dest A pointer to a Variant to hold the newly created String.
17461752 * @param p_contents A pointer to a UTF-16 encoded C string.
1747- * @param p_size The number of characters (not bytes).
1753+ * @param p_char_count The number of characters (not bytes).
17481754 * @param p_default_little_endian If true, UTF-16 use little endian.
17491755 *
17501756 * @return Error code signifying if the operation successful.
@@ -1759,7 +1765,7 @@ typedef GDExtensionInt (*GDExtensionInterfaceStringNewWithUtf16CharsAndLen2)(GDE
17591765 *
17601766 * @param r_dest A pointer to a Variant to hold the newly created String.
17611767 * @param p_contents A pointer to a UTF-32 encoded C string.
1762- * @param p_size The number of characters (not bytes).
1768+ * @param p_char_count The number of characters (not bytes).
17631769 */
17641770typedef void (*GDExtensionInterfaceStringNewWithUtf32CharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const char32_t *p_contents, GDExtensionInt p_char_count);
17651771
@@ -1771,7 +1777,7 @@ typedef void (*GDExtensionInterfaceStringNewWithUtf32CharsAndLen)(GDExtensionUni
17711777 *
17721778 * @param r_dest A pointer to a Variant to hold the newly created String.
17731779 * @param p_contents A pointer to a wide C string.
1774- * @param p_size The number of characters (not bytes).
1780+ * @param p_char_count The number of characters (not bytes).
17751781 */
17761782typedef void (*GDExtensionInterfaceStringNewWithWideCharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const wchar_t *p_contents, GDExtensionInt p_char_count);
17771783
@@ -2088,6 +2094,7 @@ typedef const uint8_t *(*GDExtensionInterfaceImagePtr)(GDExtensionObjectPtr p_in
20882094 * @param p_instance A pointer to a WorkerThreadPool object.
20892095 * @param p_func A pointer to a function to run in the thread pool.
20902096 * @param p_userdata A pointer to arbitrary data which will be passed to p_func.
2097+ * @param p_elements The number of element needed in the group.
20912098 * @param p_tasks The number of tasks needed in the group.
20922099 * @param p_high_priority Whether or not this is a high priority task.
20932100 * @param p_description A pointer to a String with the task description.
@@ -2096,7 +2103,7 @@ typedef const uint8_t *(*GDExtensionInterfaceImagePtr)(GDExtensionObjectPtr p_in
20962103 *
20972104 * @see WorkerThreadPool::add_group_task()
20982105 */
2099- typedef int64_t (*GDExtensionInterfaceWorkerThreadPoolAddNativeGroupTask)(GDExtensionObjectPtr p_instance, void (* p_func)( void *, uint32_t ) , void *p_userdata, int p_elements, int p_tasks, GDExtensionBool p_high_priority, GDExtensionConstStringPtr p_description);
2106+ typedef int64_t (*GDExtensionInterfaceWorkerThreadPoolAddNativeGroupTask)(GDExtensionObjectPtr p_instance, GDExtensionWorkerThreadPoolGroupTask p_func, void *p_userdata, int p_elements, int p_tasks, GDExtensionBool p_high_priority, GDExtensionConstStringPtr p_description);
21002107
21012108/* *
21022109 * @name worker_thread_pool_add_native_task
@@ -2112,7 +2119,7 @@ typedef int64_t (*GDExtensionInterfaceWorkerThreadPoolAddNativeGroupTask)(GDExte
21122119 *
21132120 * @return The task ID.
21142121 */
2115- typedef int64_t (*GDExtensionInterfaceWorkerThreadPoolAddNativeTask)(GDExtensionObjectPtr p_instance, void (* p_func)( void *) , void *p_userdata, GDExtensionBool p_high_priority, GDExtensionConstStringPtr p_description);
2122+ typedef int64_t (*GDExtensionInterfaceWorkerThreadPoolAddNativeTask)(GDExtensionObjectPtr p_instance, GDExtensionWorkerThreadPoolTask p_func, void *p_userdata, GDExtensionBool p_high_priority, GDExtensionConstStringPtr p_description);
21162123
21172124/* INTERFACE: Packed Array */
21182125
@@ -2530,10 +2537,10 @@ typedef GDExtensionObjectPtr (*GDExtensionInterfaceGlobalGetSingleton)(GDExtensi
25302537 * Gets a pointer representing an Object's instance binding.
25312538 *
25322539 * @param p_o A pointer to the Object.
2533- * @param p_library A token the library received by the GDExtension's entry point function.
2540+ * @param p_token A token the library received by the GDExtension's entry point function.
25342541 * @param p_callbacks A pointer to a GDExtensionInstanceBindingCallbacks struct.
25352542 *
2536- * @return
2543+ * @return A pointer to the instance binding.
25372544 */
25382545typedef void *(*GDExtensionInterfaceObjectGetInstanceBinding)(GDExtensionObjectPtr p_o, void *p_token, const GDExtensionInstanceBindingCallbacks *p_callbacks);
25392546
@@ -2544,7 +2551,7 @@ typedef void *(*GDExtensionInterfaceObjectGetInstanceBinding)(GDExtensionObjectP
25442551 * Sets an Object's instance binding.
25452552 *
25462553 * @param p_o A pointer to the Object.
2547- * @param p_library A token the library received by the GDExtension's entry point function.
2554+ * @param p_token A token the library received by the GDExtension's entry point function.
25482555 * @param p_binding A pointer to the instance binding.
25492556 * @param p_callbacks A pointer to a GDExtensionInstanceBindingCallbacks struct.
25502557 */
@@ -2557,7 +2564,7 @@ typedef void (*GDExtensionInterfaceObjectSetInstanceBinding)(GDExtensionObjectPt
25572564 * Free an Object's instance binding.
25582565 *
25592566 * @param p_o A pointer to the Object.
2560- * @param p_library A token the library received by the GDExtension's entry point function.
2567+ * @param p_token A token the library received by the GDExtension's entry point function.
25612568 */
25622569typedef void (*GDExtensionInterfaceObjectFreeInstanceBinding)(GDExtensionObjectPtr p_o, void *p_token);
25632570
@@ -2567,11 +2574,13 @@ typedef void (*GDExtensionInterfaceObjectFreeInstanceBinding)(GDExtensionObjectP
25672574 *
25682575 * Sets an extension class instance on a Object.
25692576 *
2577+ * `p_classname` should be a registered extension class and should extend the `p_o` Object's class.
2578+ *
25702579 * @param p_o A pointer to the Object.
25712580 * @param p_classname A pointer to a StringName with the registered extension class's name.
25722581 * @param p_instance A pointer to the extension class instance.
25732582 */
2574- typedef void (*GDExtensionInterfaceObjectSetInstance)(GDExtensionObjectPtr p_o, GDExtensionConstStringNamePtr p_classname, GDExtensionClassInstancePtr p_instance); /* p_classname should be a registered extension class and should extend the p_o object's class. */
2583+ typedef void (*GDExtensionInterfaceObjectSetInstance)(GDExtensionObjectPtr p_o, GDExtensionConstStringNamePtr p_classname, GDExtensionClassInstancePtr p_instance);
25752584
25762585/* *
25772586 * @name object_get_class_name
@@ -2636,7 +2645,7 @@ typedef GDObjectInstanceID (*GDExtensionInterfaceObjectGetInstanceId)(GDExtensio
26362645 * @param p_object A pointer to the Object.
26372646 * @param p_method A pointer to a StringName identifying the method.
26382647 *
2639- * @returns true if the object has a script and that script has a method with the given name. Returns false if the object has no script.
2648+ * @return true if the object has a script and that script has a method with the given name. Returns false if the object has no script.
26402649 */
26412650typedef GDExtensionBool (*GDExtensionInterfaceObjectHasScriptMethod)(GDExtensionConstObjectPtr p_object, GDExtensionConstStringNamePtr p_method);
26422651
@@ -2817,6 +2826,8 @@ typedef void (*GDExtensionInterfaceCallableCustomCreate2)(GDExtensionUninitializ
28172826 *
28182827 * @param p_callable A pointer to a Callable.
28192828 * @param p_token A pointer to an address that uniquely identifies the GDExtension.
2829+ *
2830+ * @return The userdata pointer given when creating this custom Callable.
28202831 */
28212832typedef void *(*GDExtensionInterfaceCallableCustomGetUserData)(GDExtensionConstTypePtr p_callable, void *p_token);
28222833
@@ -3072,10 +3083,12 @@ typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassSignal)(GDExtens
30723083 *
30733084 * Unregisters an extension class in the ClassDB.
30743085 *
3086+ * Unregistering a parent class before a class that inherits it will result in failure. Inheritors must be unregistered first.
3087+ *
30753088 * @param p_library A pointer the library received by the GDExtension's entry point function.
30763089 * @param p_class_name A pointer to a StringName with the class name.
30773090 */
3078- typedef void (*GDExtensionInterfaceClassdbUnregisterExtensionClass)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name); /* Unregistering a parent class before a class that inherits it will result in failure. Inheritors must be unregistered first. */
3091+ typedef void (*GDExtensionInterfaceClassdbUnregisterExtensionClass)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name);
30793092
30803093/* *
30813094 * @name get_library_path
@@ -3158,7 +3171,7 @@ typedef void (*GDExtensionInterfaceEditorRegisterGetClassesUsedCallback)(GDExten
31583171 * Registers callbacks to be called at different phases of the main loop.
31593172 *
31603173 * @param p_library A pointer the library received by the GDExtension's entry point function.
3161- * @param p_callback A pointer to the structure that contains the callbacks.
3174+ * @param p_callbacks A pointer to the structure that contains the callbacks.
31623175 */
31633176typedef void (*GDExtensionInterfaceRegisterMainLoopCallbacks)(GDExtensionClassLibraryPtr p_library, const GDExtensionMainLoopCallbacks *p_callbacks);
31643177
0 commit comments