Up to date

This page is up to date for Godot 4.3. If you still find outdated information, please open an issue.

Mise à niveau de Godot 4.0 à Godot 4.1

Pour la plupart des jeux et applications fabriqués en 4.0, il devrait être relativement sûr de migrer à la 4.1. Cette page a l'intention de couvrir tout ce dont vous avez besoin pour faire attention lors de la migration de votre projet.

Breaking changes

If you are migrating from 4.0 to 4.1, the breaking changes listed here might affect you. Changes are grouped by areas/systems.

Avertissement

L'API GDExtension casse complètement la compatibilité en 4.1, donc elle n'est pas inclus dans le tableau ci-dessous. Voir la section Mise à jour de votre GDExtension pour la 4.1 pour plus d'informations.

This article indicates whether each breaking change affects GDScript and whether the C# breaking change is binary compatible or source compatible:

  • Compatible binaire - Les binaires existants vont charger et exécuter avec succès sans recompilation, et le comportement lors de l'exécution ne changera pas.

  • Compatible source - Le code source compilera avec succès sans changement lors de la mise à niveau de Godot.

Core

Modifications

Compatible GDScript

Compatible binaire C#

Compatible source C#

Intégré

Basis

La méthode ook_at ajoute un nouveau paramètre use_model_front optionnel

✔️

✔️

✔️

GH-76082

Object

La méthode get_meta_list change de type de retour de PackedStringArray à Array[StringName]

✔️

GH-76418

Transform3D

La méthode ook_at ajoute un nouveau paramètre use_model_front optionnel

✔️

✔️

✔️

GH-76082

UndoRedo

La méthode create_action ajoute un nouveau paramètre optionnel backward_undo_ops

✔️

|✔️ avec compatibilité|

✔️

GH-76688

WorkerThreadPool

La méthode wait_for_task_completion change de type de retour de void à Error

✔️

✔️

GH-77143

Animation

Modifications

Compatible GDScript

Compatible binaire C#

Compatible source C#

Intégré

AnimationNode

La méthode _process ajoute un nouveau paramètre test_only

GH-75759

La méthode blend_input ajoute un nouveau paramètre test_only

✔️

|✔️ avec compatibilité|

✔️

GH-75759

La méthode blend_node ajoute un nouveau paramètre optionnel test_only

✔️

|✔️ avec compatibilité|

✔️

GH-75759

AnimationNodeStateMachinePlayback

La méthode get_travel_path change de type de retour de PackedStringArray à Array[StringName]

✔️

GH-76418

Nœuds 2D

Modifications

Compatible GDScript

Compatible binaire C#

Compatible source C#

Intégré

PathFollow2D

Propriété``lookahead`` enlevée

GH-72842

Nœuds 3D

Modifications

Compatible GDScript

Compatible binaire C#

Compatible source C#

Intégré

Geometry3D

La méthode segment_intersects_convex changes le type de paramètre de planes de Array en Array[Plane]

✔️

|✔️ avec compatibilité|

GH-76418

MeshInstance3D

La méthode create_multiple_convex_collisions ajoute un nouveau paramètre optionnel settings

✔️

|✔️ avec compatibilité|

✔️

GH-72152

Node3D

La méthode look_at ajoute un nouveau paramètre optionnel use_model_front

✔️

|✔️ avec compatibilité|

✔️

GH-76082

La méthode look_at_from_position ajoute un nouveau paramètre optionnel use_model_front

✔️

|✔️ avec compatibilité|

✔️

GH-76082

Nœuds GUI

Modifications

Compatible GDScript

Compatible binaire C#

Compatible source C#

Intégré

CodeEdit

La méthode add_code_completion_option ajoute un nouveau paramètre optionnel location

✔️

|✔️ avec compatibilité|

✔️

GH-75746

RichTextLabel

La méthode push_list ajoute un nouveau paramètre optionnel bullet

✔️

|✔️ avec compatibilité|

✔️

GH-75017

La méthode push_paragraph ajoute un nouveau paramètre optionnel justification_flags

✔️

|✔️ avec compatibilité|

✔️

GH-75250

La méthode push_paragraph ajoute un nouveau paramètre optionnel tab_stops

✔️

|✔️ avec compatibilité|

✔️

GH-76401

Tree

La méthode edit_sélection ajoute un nouveau paramètre optionnel force_edit

✔️

|✔️ avec compatibilité|

✔️

GH-76794

Physique

Modifications

Compatible GDScript

Compatible binaire C#

Compatible source C#

Intégré

Area2D

La propriété priority change de type, de float à int

GH-72749

Area3D

La propriété priority change de type, de float à int

GH-72749

PhysicsDirectSpaceState2D

La méthode collide_shape change de type de retour de Array[PackedVector2Array] en Array[Vector2]

GH-75260

PhysicsDirectSpaceState3D

La méthode collide_shape change de type de retour de Array[PackedVector3Array] en Array[Vector3]

GH-75260

Rendu

Modifications

Compatible GDScript

Compatible binaire C#

Compatible source C#

Intégré

RDShaderFile

La méthode get_version_list change de type de retour de PackedStringArray en Array[StringName]

✔️

GH-76418

RenderingDevice

La méthode draw_list_begin change le type de paramètre de storage_textures de Array non-typé en Array[RID]

✔️

|✔️ avec compatibilité|

GH-76418

RenderingServer

La méthode global_shader_parameter_get_list change le type de retour de PackedStringArray à Array[StringName]

✔️

GH-76418

SurfaceTool

La méthode add_triangle_fan change le type de paramètre de tangents de Array non-typé à Array[Plane]

✔️

|✔️ avec compatibilité|

GH-76418

Réseau

Modifications

Compatible GDScript

Compatible binaire C#

Compatible source C#

Intégré

WebRTCPeerConnectionExtension

La méthode _create_data_channel change de type de retour de Object à WebRTCDataChannel

✔️

✔️

GH-78237

Extensions pour l'éditeur

Modifications

Compatible GDScript

Compatible binaire C#

Compatible source C#

Intégré

AnimationTrackEditPlugin

Type AnimationTrackEditPlugin supprimé

GH-76413

EditorInterface

Le type EditorInterface change d'héritage de Node à Object

✔️

GH-76176

Méthode set_movie_maker_enabled remplacée par la propriété movie_maker_enabled

✔️

GH-76176

Méthode is_movie_maker_enabled remplacée par la propriété movie_maker_enabled

✔️

GH-76176

EditorResourcePreviewGenerator

La méthode _generate ajoute un nouveau paramètre metadata

GH-64628

La méthode _generate_from_path ajoute un nouveau paramètre metadata

GH-64628

EditorUndoRedoManager

La méthode create_action ajoute un nouveau paramètre optionnel backward_undo_ops

✔️

|✔️ avec compatibilité|

✔️

GH-76688

Changements de comportement

En 4.1 certains changements de comportement ont été introduits, ce qui pourrait vous obliger à ajuster votre projet.

Modifications

Intégré

SubViewportContainer

Lorsque les événements d'entrée doivent atteindre des SubViewports et leurs enfants, SubViewportContainer.mouse_filter doit maintenant être MOUSE_FILTER_STOP ou MOUSE_FILTER_PASS. Voir GH-79271 pour les détails.

GH-57894

Plusieurs couches de nœuds SubViewportContainer, qui devraient tous recevoir des événements d'entrée de la souris, doit maintenant être remplacé par des nœuds Area2D. Voir GH-79128 pour les détails.

GH-57894

Viewport

Viewport nodes, that have Physics Picking enabled, now automatically set InputEvents as handled. See GH-79897 for workarounds.

GH-77595

Mise à jour de votre GDExtension pour la 4.1

GDExtension est toujours en bêta. Jusqu'à ce qu'il soit marqué comme stable, la compatibilité peut se briser lors de la mise à niveau vers une nouvelle version mineure de Godot.

In order to fix a serious bug, in Godot 4.1 we had to break binary compatibility in a big way and source compatibility in a small way.

Cela signifie que les GDExtensions faites pour Godot 4.0 devront être recompilées pour Godot 4.1 (en utilisant la branche 4.1 de godot-cpp), avec un petit changement à leur code source.

Dans Godot 4.0, votre fonction "entry_symbol" ressemble à ceci :

GDExtensionBool GDE_EXPORT example_library_init(const GDExtensionInterface *p_interface, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
    godot::GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);

    init_obj.register_initializer(initialize_example_module);
    init_obj.register_terminator(uninitialize_example_module);
    init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);

    return init_obj.init();
}

Cependant, pour Godot 4.1, il devrait ressembler à :

GDExtensionBool GDE_EXPORT example_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
    godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);

    init_obj.register_initializer(initialize_example_module);
    init_obj.register_terminator(uninitialize_example_module);
    init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);

    return init_obj.init();
}

Il y a deux petits changements :

  1. Le premier argument change de const GDExtension Interface *p_interface à GDExtensionInterfaceGetProcAddress p_get_proc_address

  2. Le constructeur de la variable init_obj reçoit dorénavant p_get_proc_address comme premier paramètre

Vous devez également ajouter une ligne supplémentaire compatibility_minimum à votre fichier .gdextension, de sorte que cela ressemble à :

[configuration]

entry_symbol = "example_library_init"
compatibility_minimum = 4.1

Ça permet à Godot de savoir que votre GDExtension a été mise à jour et est sûre de charger en Godot 4.1.