-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Compile certain CanvasItem._edit_*()
functions with DEBUG_ENABLED
#98736
base: master
Are you sure you want to change the base?
Compile certain CanvasItem._edit_*()
functions with DEBUG_ENABLED
#98736
Conversation
This should only be exposing the functions that need to be exposed. Its bad enough that we have editor code in our scene functions, we shouldn't make the situation worse by unconditionally exposing editor code. I would limit this PR to just the functions that are breaking builds currently. |
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.
Thanks!
This is compiling for me now on Android. I also tested using the game editor feature with "Remote Debug" to my phone, and it worked great!
I chose to make the entire
CanvasItem._edit_*()
family of functions be compiled withDEBUG_ENABLED
instead ofTOOLS_ENABLED
, as it's cleaner code-wise. If this is considered too much, I can change this so only the stated functions are affected.
I'm personally OK with this. It makes sense to me that more editor-only functionality is needed in game to allow this tighter integration between the game and editor.
But it would be good to get input from folks who work on the editor more.
It not quite unconditionally: this is only for debug builds. But I don't do too much work in the editor, so I'm not the one to say whether or not including these functions in debug builds is problematic. |
Its not that it will be problematic at run time. The problem is that this reinforces the coupling between the editor and the scene system. Ideally we would have no editor-only code in the scene code. We made compromises for specific functions, but we protected them behind an editor check. Now we are removing that check and exposing them more widely. A new contributor may now unknowingly use these functions elsewhere. Then we may see requests to expose this code to runtime. Then we end up with bloat and technical debt. Ideally in cases like this we would provide an API through the scene system that allows moving all the editor logic into the editor rather than piling on editor logic into the scene system. A good illustration of this problem is in our best practices guideline. Prefer Local Solutions: |
a401812
to
acfdfb8
Compare
CanvasItem._edit_*()
functions with DEBUG_ENABLED
CanvasItem._edit_*()
functions with DEBUG_ENABLED
@clayjohn Understood, changes made. |
I think something needs to be done for this one:
Maybe changing to:
Otherwise, I'm seeing an error about missing EDIT: Not for this PR, but CI doesn't appear to be making any |
acfdfb8
to
5e6412c
Compare
@dsnopek Missed that one, thank you. Strangely, my compiler didn't spit any errors about this while also compiling with |
It's building for me again! Just in case, I also re-tested using the "Game" editor with "Remote Debug" and an Android app, and that's still working fine. |
This fixes the errors while compiling using
target=template_debug
which were introduced with #97257.The functions that PR makes use of are:
_edit_is_selected_on_click()
_edit_use_rect()
_edit_get_rect()
But after some talk with other members of the dev team, I chose to make the entireOnly the functions specified now useCanvasItem._edit_*()
family of functions be compiled withDEBUG_ENABLED
instead ofTOOLS_ENABLED
, as it's cleaner code-wise. If this is considered too much, I can change this so only the stated functions are affected.DEBUG_ENABLED
.