-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't print warning messages for DisplayServer functions in headless mode #90549
Don't print warning messages for DisplayServer functions in headless mode #90549
Conversation
4087f86
to
c0c40a6
Compare
Sorry, wouldn't it be simpler to just implement Edit: oops I said "stub method" but I meant like, stubs in general. |
I agree; this breaks encapsulation principle if the parent / base class has special logic for one of its derived class. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added feedback in comments.
c0c40a6
to
a6300ca
Compare
Done. I've tested the MRP again and I get the same output as before (in both headless and non-headless mode). |
a6300ca
to
46c8b04
Compare
…mode DisplayServer methods that only have a cosmetic effect print a warning (instead of an error). These warnings can be silenced in headless mode, as it's assumed that the cosmetic effect is undesired in headless mode anyway (e.g. changing mouse cursor shape). This prevents spurious warnings from appearing when running the editor in headless mode, e.g. on CI to export a project. Methods that print an error will continue to do so, as their returned value may not match expectations and have cascading consequences on the project (e.g. clipboard data not being retrievable).
46c8b04
to
c3a4b4c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't my area and I haven't tested it but the change is very straightforward and looks good to me.
I'm not against adding stubs, but at least some of those may need to be guarded with So it might be worth reviewing places in the engine that call some of those APIs without guarding with the proper feature check. For example:
Shouldn't happen anymore already after e6d0bf3.
|
If someone wants to look into which checks may actually be missing in the core engine before merging this (see my above comment), that could be good. But otherwise I'm also fine merging this as is if there's no objection from @bruvzg on making these no-ops (so end users won't know why they don't work on platforms that don't support them, and we need to make sure the docs flag those properly). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding stubs to the headless DS should be fine.
Thanks! |
DisplayServer methods that only have a cosmetic effect print a warning (instead of an error). These warnings can be silenced in headless mode, as it's assumed that the cosmetic effect is undesired in headless mode anyway (e.g. changing mouse cursor shape).
This prevents spurious warnings from appearing when running the editor in headless mode, e.g. on CI to export a project.
Methods that print an error will continue to do so, as their returned value may not match expectations and have cascading consequences on the project (e.g. clipboard data not being retrievable).
Testing project: test_headless_methods.zip
Run with and without
--headless
from a terminal and compare output.Preview
Before
After
Non-headless output for comparison
This is left unchanged in this PR.