-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Live view panel #29136
Live view panel #29136
Conversation
3b93927
to
9515f06
Compare
9515f06
to
5b100e5
Compare
5b100e5
to
1fce53d
Compare
@@ -318,7 +318,7 @@ def configure(env): | |||
|
|||
env.Prepend(CPPPATH=['#platform/x11']) | |||
env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED']) | |||
env.Append(LIBS=['GL', 'pthread']) | |||
env.Append(LIBS=['GL', 'pthread', 'rt']) |
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.
@akien-mga, @hpvb, I think this has implications for CI and build containers.
EDIT: I'm referring to the added lib.
Doesn't this then require that the game be running? How useful is this exactly if by running the game it brings itself to focus as a separate window anyway? |
The main idea is using it for live scene editing and debugging without having to switch back and forth between the game and the editor. |
Is this for 2D only or 3D, too? |
beautiful code but I don't get why is this needed. Is there anywhere any discussion about it to read? |
@Zireael07, it's for both. It mirrors anything displayed in the root (builtin) viewport. @santouits, you're right in that it's not needed, but that doesn't mean users cannot benefit from it. I'm not sure there's a thread somewhere about it. I just know several users requested it during spoken conversations. Then we talked about it during the Godot Sprint and decided to include it in the roadmap. Thanks for your words about the code. |
Hey @RandomShaper, I compiled it in a Mac and I see an static image after hitting play and closing the game, I don't know if this the expected behaviour :) |
If I'm reading it correctly, game must be running for it to work, so if you close it, it won't work. |
Oh, right, it shows when I give focus back to the editor, but is's still static. I can't seem to be able to interact with it and the animations are not playing. |
@AinaSG, thank you very much for testing! Yes, as it is currently this is quite basic, but actually being able to mirror the game image into the editor was the hardest part. I think I'm marking this PR as work-in-progress, because I will do some improvements to make it more useful. |
Thank you for making this! I switch between the game and the editor very often, so this will be very useful. |
Cool feature. But what kind of performance repercussions will be there? I mean I saw from my quick look that it's locked at 15 fps by default, and I am assuming it needs to redraw the editor or can it just work by redrawing the dock separately in a different thread? |
@swarnimarun, the editor is redrawn on every frame. That's why by default it will be in stand by while the game window is focused, to avoid disrupting normal game performance. When you focus the editor back, with the game still running, then a slight FPS drop is not as important since you are then focusing on fixing/editing/debugging. |
@AinaSG Does this occur if you disable fullscreen in the Project Settings? Maybe alt-tabbing out of a fullscreen project causes the renderer to stop outputting new frames (as the result won't be visible in an usual situation). |
@RandomShaper That's nice, actually really awesome. 👍 |
4ddc7d6
to
5acfdda
Compare
Clicking on the preview to freeze/unfreeze the preview would be cool. |
core/os/shared_memory.h
Outdated
class SharedMemory { | ||
|
||
protected: | ||
static const char *const ERR_STR_ALREADY_OPEN; |
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.
We know build with -std=c++11
so I think you could move the definitions in the header (at last!).
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.
Done, as well as other C++11-related improvements.
3970a7e
to
c2160f9
Compare
Optimize nearest neighbor scaling and expose the function to process raw buffers. Allow non-COW access to image data.
c2160f9
to
3ed12e5
Compare
Is this editor only or can it work as good minimap inside the game? |
Editor-only. The mechanism used to transfer the image from the game to the editor would be cumbersome for in-game use. |
But unless I miss something, you don't need this feature at all in game. You already have a unified scene tree and you can use Viewports to achieve this kind of result, without having to bother with a cross-process communication channel. |
Closing because:
|
I was under impression OP was directly hired by Godot to implement this? |
I wasn't. I did this because of an informal request for it, so to speak. It turned out to be a huge waste of time. I hope that at some point shared memory is wanted for something else and at least that part can be used. |
On top of some non-breaking changes to
Image
and a cross-platform implementation of shared memory, this is a dock that shows a small view of the running game.After a lot of thought and given the current limitations of the Godot editor UI, I've concluded that making it a dock was the best option.To avoid it taking editor space when it isn't in use, in the default layout, it will be beneath the file system tab. It also has settings (enabled by default) to auto-switch to it and back to whatever other tab was active before running the game.Also by default, it's enabled the option that makes it stand by while the editor is not focused. That is good because it prevents it from stealing performance from the running game and anyway you don't need to look at a small view in the editor while the game window is the focused one. Nonetheless any user wanting to do so will be able to.
It has a maximum FPS limit to keep it's load light, set to 15 by default. Someone using this on a powerful enough system will be able to raise it.
Furthermore, whenever it's not visible
(because another dock in the same tab group is active), it is effectively disabled.Given that the framebuffer data is transferred via shared memory, this only works when both the game and the editor are running on the same host.
I've not been able to confirm image capture is working on Mac. If anyone could test and report, that'd be great.UPDATE: It seems it does!UPDATE:
I'm marking this as work-in-progress because I will add some more pieces of functionality to make it more useful. However, the trickiest part is done and testing is welcome.UPDATE 2:
No longer work-in-progress. I've moved it to the output dock. Additional functionality will come in future PRs.