Skip to content

Use new initialization for Godot 4.7.#1567

Merged
Yarwin merged 1 commit into
godot-rust:masterfrom
Yarwin:feature/support-new-initialization
May 3, 2026
Merged

Use new initialization for Godot 4.7.#1567
Yarwin merged 1 commit into
godot-rust:masterfrom
Yarwin:feature/support-new-initialization

Conversation

@Yarwin
Copy link
Copy Markdown
Contributor

@Yarwin Yarwin commented Apr 26, 2026

Migrates gdext with API >= 4.7 to use classdb_construct_object3 classdb_register_extension_class6: godotengine/godot#118214.

Tl;dr:

  • In Godot 4.7 initialization layer receives fully initialized base to work with.
  • In Godot 4.7 initializing constructed object is no longer a caller responsibility.

I ran tests against 4.7 && 4.7 + 4.6 API && 4.6 + 4.6 API, all seems to works fine.

I abstracted most stuff so it won't get into way or confuse people - I moved whole init_gd workaround into separate inner module (I think we won't work on it anymore), and added extra function which yield strong/weak pointer of freshly constructed instance from pointer to object. (The former is responsible for 2\3 changes in this PR lmao)

@Yarwin Yarwin added the c: ffi Low-level components and interaction with GDExtension API label Apr 26, 2026
@GodotRust
Copy link
Copy Markdown

API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-1567

@Yarwin Yarwin force-pushed the feature/support-new-initialization branch 3 times, most recently from b231fb1 to 5455692 Compare April 26, 2026 11:47
Copy link
Copy Markdown
Member

@Bromeon Bromeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot, nice change!

There is now quite a bit of #[cfg] pollution, I made a comment with a potential way to refactor this.

Comment thread .github/workflows/full-ci.yml Outdated
Comment thread itest/rust/src/object_tests/base_test.rs Outdated
Comment thread godot-core/src/obj/base.rs Outdated
Comment thread godot-core/src/registry/class.rs Outdated
Comment thread godot-core/src/obj/gd.rs Outdated
@Yarwin Yarwin force-pushed the feature/support-new-initialization branch 6 times, most recently from 2e7d988 to 9bbf416 Compare April 30, 2026 20:45
Copy link
Copy Markdown
Member

@Bromeon Bromeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments not yet addressed, otherwise looks good 👍

Comment thread .github/workflows/full-ci.yml Outdated
Comment thread .github/workflows/minimal-ci.yml Outdated
Comment thread itest/rust/src/object_tests/base_test.rs Outdated
@Yarwin Yarwin force-pushed the feature/support-new-initialization branch 3 times, most recently from 0f42b4a to 679c6cf Compare May 1, 2026 11:19
Comment thread godot-core/src/obj/init_tracker.rs Outdated
Comment thread godot-core/src/obj/base_init_tracker.rs Outdated
Comment thread godot-core/src/obj/base.rs Outdated
@Yarwin Yarwin force-pushed the feature/support-new-initialization branch 13 times, most recently from cf92f84 to 54ae445 Compare May 2, 2026 20:43
Comment thread godot-core/src/obj/base.rs Outdated
@Yarwin Yarwin force-pushed the feature/support-new-initialization branch 3 times, most recently from 49c7ee5 to 8dcc4d8 Compare May 3, 2026 08:09
- In Godot 4.7 initialization layer receives fully initialized base to
  work with.

- In Godot 4.7 initializing constructed object is no longer a caller
  responsibility.
@Yarwin Yarwin force-pushed the feature/support-new-initialization branch from 8dcc4d8 to 3d796c3 Compare May 3, 2026 08:14
Copy link
Copy Markdown
Member

@Bromeon Bromeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this separation looks quite clean!

Assuming that base_weak_initialization.rs contains the same logic as before this commit, this looks good to me.

@Yarwin Yarwin added this pull request to the merge queue May 3, 2026
Merged via the queue into godot-rust:master with commit 5eaf261 May 3, 2026
23 checks passed
@Yarwin Yarwin deleted the feature/support-new-initialization branch May 3, 2026 12:04
@Bromeon Bromeon added the maintenance Internal change, not user-facing, developer QoL. Refactors, dep updates, etc. label May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: ffi Low-level components and interaction with GDExtension API maintenance Internal change, not user-facing, developer QoL. Refactors, dep updates, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants