-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Add a few buttons in Remote Scene Tree #65118
Add a few buttons in Remote Scene Tree #65118
Conversation
6c6687e
to
fbc1849
Compare
Looks good to me, but I wonder if the Visible icon should actually be functional. |
I think making the eye icon functional shouldn't be difficult to do. It could just toggle btw why is the instance button gray if it's clickable? |
From the proposal itself:
The idea probably was to make it less eye-catching, and to further distinguish it from the Local Tree. When I was working on the PR I believed it suited it nicely, too. Perhaps a different colour could suit more, since this symbol is typically associated with them being disabled in the UX, so long as it would stand out less. |
The proposal is weird on that one, because it also says (about the eye icon)
which implies that the scene button shouldn't be clickable either 🤷♂️
It's expected. When you inspect scene, you want to see it. |
fbc1849
to
5272f6d
Compare
I'm trying hard to figure out what to send to the Debugger to have the visibility toggle, to absolutely no avail. Something about the RemoteDebugger, peers, messages... For now I could rip the eye icon out of this PR to have something complete, but I don't know if I should... |
Grayed-out unclickable icon is ok for now. |
5272f6d
to
b71e579
Compare
fe30b85
to
1bd96c0
Compare
The PR looks good overall, but the serialization is really messy. struct RemoteNode {
int child_count = 0;
String name;
String type_name;
ObjectID id;
String scene_file_path; // Empty when not present
int visible = 0; // 0 = no "is_visibile", 1 = "is_visible", -1 = NOT "is_visible"
bool visible_in_tree = false;
}; |
That's alright! The less code smells the merrier. However, I feel like I cannot use anything that isn't a Variant for this, because it needs to be passed around, serialised and deserialized in SceneDebuggerTree. |
Object types come with significant overhead; see #61273. |
Ok, no, Yeah... So what is the idea? How to improve the code quality, without having to reconsider how data is passed between running project and editor just for this PR? Perhaps I could still serialize it as Dictionary? Then when passed to the editor it could be converted to the struct? |
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.
Looks ok on the editor side.
Not sure about the serialization problem.
1bd96c0
to
18eeecc
Compare
No, I was suggesting you use a string, an int, and a boolean. int idx = 0;
while (p_arr.size() > idx) {
ERR_FAIL_COND(p_arr.size() < 7);
CHECK_TYPE(p_arr[idx], INT); // "child_count"
CHECK_TYPE(p_arr[idx + 1], STRING); // "name".
CHECK_TYPE(p_arr[idx + 2], STRING); // "type_name".
CHECK_TYPE(p_arr[idx + 3], INT); // "id".
CHECK_TYPE(p_arr[idx + 4], STRING); // "scene_file_path".
CHECK_TYPE(p_arr[idx + 5], INT); // "visible".
CHECK_TYPE(p_arr[idx + 6], BOOL); // "is_visible_in_tree".
nodes.push_back(RemoteNode(p_arr[idx], p_arr[idx + 1], p_arr[idx + 2], p_arr[idx + 3], p_arr[idx + 4], p_arr[idx + 5], p_arr[idx + 6]));
idx += 7;
} |
Why int? |
My understanding was that we needed a tri-state for it (i.e. has visibility method, visible = true, and visible = false), so like mentioned above: |
Or we could go further and reuse the same int for |
I'd prefer the 3-state solution, so you could do
I'd rather use 3 bools in place of a 5-state int without a proper enum (or use an enum, but then you need casting and it gets a bit more complicated than it needs to be I think). |
Though I guess using an enum and a couple of casts is also okay actually. |
So be it, then. If it's no bother to add all of those parameters, it can be done similarly to that way. Hopefully it doesn't have much of any memory drawbacks, other than having to expand onto it if more properties are going to be necessary. I can get to it in these upcoming days. |
2662d80
to
0f6b0c1
Compare
Updated this PR based on the small discussion above. Another review is greatly appreciated! @Faless |
A Scene button to any scene instantiated from file. When clicked, it opens the original PackedScene. A toggle visibility button is also available.
0f6b0c1
to
809dad9
Compare
Thank you for the kind patching! Applied successfully, and verified that it didn't cause any behavior unintended by me. |
Thanks! |
Implements... closes godotengine/godot-proposals#5267.
This PR adds two buttons to the remote SceneTree displayed in the Editor:
A Scene button to any scene root Node instantiated from file. When clicked, it opens the original PackedScene it comes from and switches off the remote Tree display.
A Visibility Toggle button. Enough said. Clicking on it toggles the remote Node's visibility.
I would like to ask a few questions regarding this PR's implementation:
open
(akin to SceneTreeEditor) has been added to the EditorDebuggerTree , emitted when the Scene button is pressed. However, the all of the "pressed" answering logic is present in EditorDebuggerNode. Because of this, the enum storing the button ids is public, and EditorDebuggerNode emits the signal for the remote tree. This all feels odd to me, but I only did it because other "remote tree manipulating" methods were there. I wouldn't want these classes to be more cryptic than they are already, should the logic be moved to to EditorDebuggerTree?