TheDuckCow / godot-road-generator

A godot plugin for creating 3D highways and streets.
MIT License
313 stars 16 forks source link

Workaround for godot empty array synced bug #87

Closed TheDuckCow closed 1 year ago

TheDuckCow commented 1 year ago

Appears to be working when copied into the wheel steal project. The match lane issue was happening when they were properly de-synced but then zero array length, hence failing on reference [0].

Closes https://github.com/TheDuckCow/godot-road-generator/issues/86

bdog2112 commented 1 year ago

What are the steps to re-create the problem that you're addressing? (It may be a different problem than the one I am thinking.)

Using the following testing steps, the arrays are still synced:

To implement a non-holistic fix simply change the number of lanes from the defaults, save, and re-open. Then, the individual RoadPoints will behave as expected (as long as they don't have the default values).

A holistic fix entails one of two possible solutions:

  1. Fix Godot ;-)
  2. Insure that RoadGen ALWAYS saves all the elements of RoadPoint arrays to Scene files. (This rule probably also applies to arrays in all other classes, as well.)
TheDuckCow commented 1 year ago

Note to self: move default export vars out of the export var def, and move into init, and verify that default values are saved to the scene files when used.

bdog2112 commented 1 year ago

Just wanted to add that this post appears related to the synced array problem and further supports the potential effectiveness of the proposed fix.

TheDuckCow commented 1 year ago

Great work investigating this - I've made the change, found I could not reproduce following your instructions here (a sign the fix worked), and then when reverting the change, I found it immediately occurred just as you described. So I'm pretty confident this is working with this update!