Skip to content

API changes for v0.6 #1596

Description

@Bromeon

Smaller API changes collected in one issue:

  1. IAudioStream::instantiate_playback(&self) -> (&mut self)

  2. GDExtensionManager API should be mostly unsafe

  3. We have AnyDictionary::cast_dictionary but no AnyArray::cast_array.

    • Either add or remove both. Also needs ⚠️ sign.
  4. Gd::is_dynamic_class_of::<T> could get T: Inherits<Self> bound, to rule out impossible checks at compile time.

    • Possibly also see if there's a difference to gd.try_cast::<T>().is_ok() and if yes, document it; if no, see if method is still useful.
  5. ClassId can implement GodotStringExt in favor of inherent methods.

  6. Consider #[non_exhaustive] for some enums

    • InitLevel (InitStage already has it)
  7. global module type safety + organization.
    Make sure to mention in mapping list on top of global module and to create #[doc(alias)] (also for existing map entries).

    • type_convert should take VariantType instead of i64. Maybe consider move to Variant::to_dynamic_or_default() or so?
    • rid_allocate_id should return Rid or potentially be associated fn on Rid type.
    • error_string should be moved to Error
    • hash -- move to Variant? Has already hash_u32, is this the same?
    • rid_from_int64 -- move to Rid?
    • typeof_ -- remove; already present as Variant::get_type.
    • rand_from_seed() -- PackedArray<i64> but always 2 elements, could be tuple
  8. Rename global::Error -> global::GError (too generic of a name, also with Rust's Error trait)

  9. Node::notify_thread_safe should have same signature as notify

    • or consider unified notify_ex with reversed + thread_safe flags (mutually exclusive?)
    • similar: Node::propagate_notification
  10. OS::is_keycode_unicode(u32) -> Key parameter

  11. Several APIs could use InstanceId

    PhysicsServer2D::area_attach_object_instance_id(..., id: u64)
    PhysicsServer2D::area_get_object_instance_id(...) -> u64
    
    PhysicsServer2D::body_attach_object_instance_id(...)
    PhysicsServer3D::body_attach_object_instance_id(...)
    
    KinematicCollision2D::get_collider_id() -> u64
    KinematicCollision3D::get_collider_id() -> u64

APIs that are not nice, but changing has perf impacts (array copies):

  1. IP::get_resolve_item_addresses() -> Array<Variant>

    • could be PackedStringArray, like get_local_addresses
  2. EditorExportPlatform::get_current_presets() -> Array<Variant>

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking-changeRequires SemVer bumpquality-of-lifeNo new functionality, but improves ergonomics/internals

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions