Merge pull request #51186 from lawnjelly/portals_fix_ui_default

This commit is contained in:
Rémi Verschelde 2021-08-02 17:20:52 +02:00 committed by GitHub
commit 8f3ec04811
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 19 deletions

View file

@ -4319,6 +4319,8 @@ void SpatialEditor::show_advanced_portal_tools(bool p_show) {
} }
void SpatialEditor::update_portal_tools() { void SpatialEditor::update_portal_tools() {
// just some protection against calling null pointers, hopefully not needed
if (view_menu && view_menu->get_popup()) {
// the view portal culling toggle // the view portal culling toggle
int view_portal_item_index = view_menu->get_popup()->get_item_index(MENU_VIEW_PORTAL_CULLING); int view_portal_item_index = view_menu->get_popup()->get_item_index(MENU_VIEW_PORTAL_CULLING);
if (RoomManager::active_room_manager) { if (RoomManager::active_room_manager) {
@ -4342,6 +4344,7 @@ void SpatialEditor::update_portal_tools() {
for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) {
viewports[i]->_update_name(); viewports[i]->_update_name();
} }
}
} }
void SpatialEditor::update_transform_gizmo() { void SpatialEditor::update_transform_gizmo() {
@ -6593,6 +6596,10 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
EDITOR_DEF("editors/3d/navigation/show_viewport_rotation_gizmo", true); EDITOR_DEF("editors/3d/navigation/show_viewport_rotation_gizmo", true);
over_gizmo_handle = -1; over_gizmo_handle = -1;
// make sure the portal tools are off by default
// (when no RoomManager is present)
update_portal_tools();
} }
SpatialEditor::~SpatialEditor() { SpatialEditor::~SpatialEditor() {

View file

@ -652,7 +652,7 @@ private:
MenuButton *transform_menu; MenuButton *transform_menu;
PopupMenu *gizmos_menu; PopupMenu *gizmos_menu;
MenuButton *view_menu; MenuButton *view_menu = nullptr;
AcceptDialog *accept; AcceptDialog *accept;