X Tutup
Skip to content

Fix drag and drop @export variable assignment when script has errors#110761

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
fkeyzuwu:assign-export-value-bug
Nov 17, 2025
Merged

Fix drag and drop @export variable assignment when script has errors#110761
Repiteo merged 1 commit intogodotengine:masterfrom
fkeyzuwu:assign-export-value-bug

Conversation

@fkeyzuwu
Copy link
Contributor

@fkeyzuwu fkeyzuwu commented Sep 21, 2025

Closes #110735

Might be a bit slow with a combination of long file system paths(string comparision), lots of errors and adding a lot of export variables at once, but that's a very extreme case. Although if anyone has an idea on how to do this better in terms of time complexity, feel free to suggest changes. But overall should work fine.

@fkeyzuwu fkeyzuwu requested a review from a team as a code owner September 21, 2025 22:08
@fkeyzuwu fkeyzuwu force-pushed the assign-export-value-bug branch 2 times, most recently from 09c0864 to 78bf6aa Compare September 21, 2025 22:14
@AThousandShips AThousandShips added this to the 4.6 milestone Sep 22, 2025
@fkeyzuwu fkeyzuwu force-pushed the assign-export-value-bug branch from 78bf6aa to 9b359fc Compare September 24, 2025 12:32
@fkeyzuwu fkeyzuwu force-pushed the assign-export-value-bug branch from 9b359fc to 18abe89 Compare October 8, 2025 09:14
@fkeyzuwu
Copy link
Contributor Author

fkeyzuwu commented Oct 8, 2025

Tested a bit more, seems to work well. Should be merged into 4.6 since it fixes a bug for a feature that was just merged. #106341

@fkeyzuwu fkeyzuwu force-pushed the assign-export-value-bug branch from 18abe89 to 2270586 Compare October 28, 2025 23:29
@fkeyzuwu fkeyzuwu force-pushed the assign-export-value-bug branch from 2270586 to 3978feb Compare November 8, 2025 12:24
@fkeyzuwu
Copy link
Contributor Author

fkeyzuwu commented Nov 8, 2025

just rebased, will work on this soon

@fkeyzuwu
Copy link
Contributor Author

fkeyzuwu commented Nov 9, 2025

I have managed to fix the initial "bug" with saving the class name of the variable in the DraggedExport struct and checking it against the property type hint.

While this does work, like you said it seems to be a separate problem. If you also change the type of the @export variable, it does not reset the value and keeps it assigned. Fixing this would have to be done in a separate PR since it doesn't have to do with drag-n-drop export variables, its just how export variables work in general.

There is an issue and PR about it: #104323, #104338
The change was introduced here: #84446

Anyways, updated to fix the original bug that this exposes with the name collision. Changing the type while the name collision error is happening does work correctly so I think it's fine. Don't like how it adds yet another for loop where if its a giant class it will run through a lot of properties, but I don't see a work around. It does only run once when the script doesn't have errors anymore though, so I think its fine.

@fkeyzuwu fkeyzuwu force-pushed the assign-export-value-bug branch from 3978feb to 9dba414 Compare November 9, 2025 15:34
@fkeyzuwu fkeyzuwu force-pushed the assign-export-value-bug branch from 9dba414 to 0dfa815 Compare November 11, 2025 21:51
Copy link
Contributor

@kitbdev kitbdev left a comment

Choose a reason for hiding this comment

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

Looks good.

@Repiteo Repiteo changed the title Fix drag and drop @export variable assignment when script has errors Fix drag and drop @export variable assignment when script has errors Nov 17, 2025
@Repiteo Repiteo merged commit d787256 into godotengine:master Nov 17, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 17, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drag and drop @export variable into scripts with errors does not assign value

4 participants

X Tutup