godotengine / godot-cpp

C++ bindings for the Godot script API
MIT License
1.69k stars 526 forks source link

Add default argument processing for `NodePath` #1488

Closed AThousandShips closed 3 months ago

AThousandShips commented 3 months ago

No bindings contain default arguments for NodePath currently but they would break if they were added

AThousandShips commented 3 months ago

Default arguments can currently be bound which cannot be encoded properly, at least without reworking some of the bind code

Will look into checks in the engine to ensure this is handled properly, default arrays and default Packed*Arrays won't work currently which either requires special handling to create the values in the bindings, or blocking them in the engine itself

Edit: will look at adding to the ClassDB tests as an initial safeguard, checking default values so they won't allow non-empty default Array, Dictionary, or Packed*Arrays, to make sure we won't get any unrepresentable values at least until we make it work over here if we want that

dsnopek commented 3 months ago

Cherry-picked for 4.1 in PR https://github.com/godotengine/godot-cpp/pull/1491

dsnopek commented 3 months ago

Cherry-picked for 4.2 in PR https://github.com/godotengine/godot-cpp/pull/1492