Skip to content

Proposal for changes in GDNative for Godot 4.0 #35467

@touilleMan

Description

@touilleMan

While working on Godot-Python, I've encountered my share of quirks in the GDNative API, I guess it's time to fix them for Godot 4.0 ;-)

Issues in api.json:

  • methods parameters of type StringName are exposed as String.
  • BulletPhysicsServer not marked as singleton but inherits PhysicsServer
  • Object.free is virtual (should use godot_object_destroy instead of calling it directly), but not info about it in api.json
  • field instanciable renamed into instantiable ?
  • missing Script.has_property, Script.has_method and Script.has_script_signal
  • Some properties has / in there name to indicate they need an additional parameter (provided by the "index" field, which is set to -1 when the value is not needed...). Would be better to provide a additional_arguments parameter that take a list, or have a boolean has_index_argument field (in the style of the has_default_value boolean field)
  • Object.set/get doesn't return a boolean to indicate if the operation couldn't succeed if the property doesn't exists
  • default values are... strange. This is due to the fact they are formatted by there operator String() which often lack clarity (and is subject of innocent modifications breaking the api.json format !). It would be better to define those informations throught a custom string (this is already done in the doc xml files). Exemple of strange values:
    • [Object:null] and Null
    • [RID]
    • ((1, 0), (0, 1), (0, 0)) (should be Vector3((1, 0), (0, 1), (0, 0)))
    • PoolColorArray displayed as [PoolColorArray] but PoolVector2Array displayed as []
    • 1, 0, 0, 0, 1, 0, 0, 0, 1 - 0, 0, 0 for Transform here the - is especially misleading :/
  • property PrimitiveMesh.material has type SpatialMaterial,ShaderMaterial. This is fine from a documentation point of view, but given the documentation already overwrite fields in it xml files, I guess it would be better to replace that by a simplerMaterial value
  • missing Object.get_class_name (which returns a StringName, useful for fast retrieval of a wrapper class when getting a generic object from variant). This would bring a bit of confusion with Object.get_class though, I guess we could rename that into String Object.get_class_name() and StringName Object.get_class_name_as_string_name()

Issues in gdnative api:

  • godot_quat_new_with_axis_angle inconsistent with godot_basis_new_with_axis_and_angle
  • missing godot_basis_get_column (but oddly godot_basis_get_row is present)
  • missing godot_array_operator_equal & godot_pool_x_array_operator_equal
  • missing Transform2D origin/axis getter/setter
  • missing godot_basis_axis (unlike godot_vector3_axis which is present)
  • missing Transform2D(Transform)
  • missing Transform(Basis)
  • missing Transform(Transform2D)
  • pluginscript api use godot_string everywhere where most of the time godot_string_name would be better suited (e.g. godot_bool godot_pluginscript_instance_desc_set_prop(godot_pluginscript_instance_data* p_data, godot_string* p_name, godot_variant* p_value)) (Use StringName in pluginscript's set/get_prop and add_global_constant #35812)
  • ScriptLanguage::add_named_global_constant (exposed by pluginscript) api is weird: global constant can only be integer, but the function takes a variant as parameter
  • missing pluginscript binding of ScriptLanguage::add_named_global_constant and ScriptLanguage::remove_named_global_constant. On top of that add_named_global and add_global_constant have misleading names (from what I understand, the difference between them is the later can have any type of value where the former is only an integer...)
  • get_rpc_mode and get_rset_mode fields in godot_pluginscript_instance_desc are never used and should be removed (Remove useless pluginscript godot_pluginscript_script_desc.get_rpc/rset_mode fields #35811)
  • godot_dictionary_operator_equal doesn't do key/value comparison but only test if the underlying hashmap is the same (Modify Array/Dictionary::operator== to do real key/value comparison #35816)
  • Remove deprecated GDNative wrapper code (Is GDNATIVE_API_INIT & GDnative wrapper lib still used ? #27054)

Issues in ptrcall:

That's a big wishlist I guess ! I guess I've already found what I'll be working on at next week's GodotCon sprints ^^

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions