- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 23.5k
 
          Refactor editor EditorBottomPanel to be a TabContainer
          #106164
        
          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
base: master
Are you sure you want to change the base?
Conversation
EditorBottomPanel to be a TabContainer
      | 
           Does this change anything for the user, like functionality or UI?  | 
    
          
 Nothing intended in this PR. Any visual changes are likely bugs. This is just scaffolding for future PRs that would be able to integrate the bottom panel more tightly with the dock system. That would be when the users start to see a difference Edit: This is no longer true, due to how the refactor needs to be implemented. See below for more details but the essence is that this is now a theme of the tabbar and so is limited by the theming options of said tabbar.  | 
    
7701aa9    to
    80db82d      
    Compare
  
    80db82d    to
    f594b7b      
    Compare
  
    | 
           I looked at the new BottomPanel's structure and it's basically the same... Still has internal PanelContainer and a ScrollContainer with Buttons. The TabContainer's TabBar is hidden and unused. That looks hacky to me with no clear benefit. What complexity did you remove if you had to replace TabContainer's default behavior?  | 
    
          
 It didn't do anything more than toggling visibility, no? I think if you want to refactor the bottom panel into TabContainer, it should become actual TabContainer. You can add a TabBar theme variation that makes it look like the current bottom panel's bar. Although that sounds like a change that should be discussed more. Removing the buttons would also be useful if we eventually decided to improve docking system and allow moving tabs between docks and bottom panel.  | 
    
| 
           Ok. I tried to create a theme that mimicked the look of the bottom panel and it does look good, the one constraint that I ran into is that the  I think I agree that the theme override is the way to go now. I can draft a proposal once the theme is ready and I'm sure that this is feasible and able to accommodate for the buttons on the right side.  | 
    
fa798ca    to
    30556fb      
    Compare
  
    
          
 More options for individual tabs is important to keep it the same, since it is already used for the Output and Debugger to show more information: The tab bar and tab container bug fixes can be moved to a new PR, it would be easier to get them merged and keeps this one more focused.  | 
    
04210d6    to
    6de4a8b      
    Compare
  
    6de4a8b    to
    6f7f8f4      
    Compare
  
    | 
           Also tabs open on mouse press, not on release event. It feels strange (maybe not proper word, I'm not native English speaker. Maybe it would be more accurate to call it "unusual.")  | 
    
EditorBottomPanel to be a TabContainerEditorBottomPanel to be a TabContainer
      d2744dd    to
    e3aa094      
    Compare
  
    e3aa094    to
    60deaf5      
    Compare
  
    | 
           Pulled from the updated #106263. I fixed the sizing issues by setting a minimum size to something that I thought was reasonable. I also realized that there was a hack remaining (overriding  With regards to events on mouse pressed vs mouse released, I see what you mean about it being different than before, but that's how   | 
    
          
 I would prefer a more adaptive solution, but it's ok for now. Found another bug – panel layout breaks when using Arabic (right-to-left language).  | 
    
          
 I fixed the issue in #108592 but didn't want to rebase over it just yet when this solution exists. The main reason why this issue surfaces is because the Output panel has an unusually small minimum width compared to the other panels. I can remove the minimum size line when that PR is merged  | 
    
8b463f1    to
    58f7bd9      
    Compare
  
    58f7bd9    to
    4f5e20d      
    Compare
  
    4f5e20d    to
    0652ee9      
    Compare
  
    | 
           Needs final (?) rebase. Also shouldn't the commits be squashed?  | 
    
0652ee9    to
    d23e5f2      
    Compare
  
    | 
           So I'm updating #108647 and I have a problem with the rightside BoxContainer:  
For whatever reason the TabBar ends perfectly before the icons, but I need more space due to menu icon. I can't figure out what ensures the TabBar size. It can be a coincidence 🙃  | 
    
| 
           I ran into this same issue when writing #106426, and I solved it with this snippet: void EditorBottomPanel::_theme_changed() {
	Ref<StyleBox> bottom_tabbar_style = get_theme_stylebox("tabbar_background", "BottomPanel")->duplicate();
	bottom_tabbar_style->set_content_margin(SIDE_RIGHT, bottom_hbox->get_minimum_size().x + bottom_tabbar_style->get_content_margin(SIDE_LEFT));
	add_theme_style_override("tabbar_background", bottom_tabbar_style);It's been a while since I wrote it but essentially I modified the margins of  Also relevant: #108647 (comment) edit: this snippet is already part of this PR, I misremembered what it did.  | 
    
          
 Wait, so this PR has no such code? How does it even work? The TabBar already takes the icons into account, so it should be a matter of increasing the margin or whatever. 
 It would be better if the menu button was stil part of the TabContainer, so that all dock TabContainers are consistent. 
 No, ideally this PR should not get any changes until merging. I already rebased my branch xd  | 
    
| 
           It works by adding the button hbox as a child of the  bottom_hbox->set_anchors_and_offsets_preset(Control::PRESET_RIGHT_WIDE); | 
    
| 
           I think the core reason why this works is that nodes that aren't containers don't take their child positions and sizes into account when updating their minimum size. The hbox can be added as a child and repositioned to be at the far right of the tab_bar growing to the right, while not affecting the tab_bar size. Then it uses that code snippet I pasted earlier to move the far right of the tab_bar to be exactly the size of the hbox left, allowing the hbox to not be clipped and visible. So the TabContainer technically doesn't know that the hbox exists, the bottom_panel just has code to update the margins based on the size of the hbox.  | 
    
| 
           Found it. It's this code in  Ref<StyleBox> bottom_tabbar_style = get_theme_stylebox("tabbar_background", "BottomPanel")->duplicate();
bottom_tabbar_style->set_content_margin(SIDE_RIGHT, bottom_hbox->get_minimum_size().x + bottom_tabbar_style->get_content_margin(SIDE_LEFT));
add_theme_style_override("tabbar_background", bottom_tabbar_style);EDIT:  | 
    
| 
           I can't find if this has already been said, but clicking the 3-dot button causes the editor to freeze and crush.  | 
    
| 
           The crash (I think it's the one): 
 I know I said it'd be better if you didn't make more changes, but this should be fixed, and tbh rebasing won't really be a problem.  | 
    
| 
           Does that crash occur in this PR? I thought the 3-dot button was disabled in this one. About that, if the bottom dock is closed, should it be allowed to show the popup? The popup is meant to rearrange the currently selected tab but if there is none then what tab would it rearrange? It could rearrange the previous tab but that's also not guaranteed to return a non-null pointer.  | 
    
          
 Oops, sorry 😅 I downloaded PR artifacts from this PR and #108647 and looks like I mixed up everything. Silly me.  | 
    
| 
           The version button bug I mentioned in #106164 (comment) could be fixed though.  | 
    







See: godotengine/godot-proposals#12430, godotengine/godot-proposals#12402
Depends on #106263, #103478, #107395
Currently the Bottom Panel inherits from PanelContainer. This makes it hard to integrate with systems like the editor docks that need to make exceptions everywhere in their code for the bottom panel. This PR converts the type of
EditorBottomPanelto aTabContainer. This removes some complexity inside the class as it essentially re-implemented the functionality, but more importantly allows future integrations with the dock system to be much more painless.