You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Portals - Improve UI and add shortcuts
This PR makes the 'convert rooms' button permanently on the toolbar and accessible whichever node is selected, so you can convert rooms without having to select the RoomManager first. It also adds a togglable item 'view portal culling' to the 'View' menu which is a simple way of setting the RoomManager 'active' setting without the RoomManager being the selected node. Both of these have keyboard shortcuts, which should make it much faster to reconvert rooms and edit. In addition there the string in the 'Perspective' Listbox is modified to show [portals active] when portal culling is operational, for visual feedback. This is updated when you change modes, and when the rooms are invalidated.
This commit is contained in:
@@ -32,12 +32,6 @@
|
||||
|
||||
#include "editor/spatial_editor_gizmos.h"
|
||||
|
||||
void RoomManagerEditorPlugin::_rooms_convert() {
|
||||
if (_room_manager) {
|
||||
_room_manager->rooms_convert();
|
||||
}
|
||||
}
|
||||
|
||||
void RoomManagerEditorPlugin::_flip_portals() {
|
||||
if (_room_manager) {
|
||||
_room_manager->rooms_flip_portals();
|
||||
@@ -59,16 +53,15 @@ bool RoomManagerEditorPlugin::handles(Object *p_object) const {
|
||||
|
||||
void RoomManagerEditorPlugin::make_visible(bool p_visible) {
|
||||
if (p_visible) {
|
||||
button_rooms_convert->show();
|
||||
button_flip_portals->show();
|
||||
} else {
|
||||
button_rooms_convert->hide();
|
||||
button_flip_portals->hide();
|
||||
}
|
||||
|
||||
SpatialEditor::get_singleton()->show_advanced_portal_tools(p_visible);
|
||||
}
|
||||
|
||||
void RoomManagerEditorPlugin::_bind_methods() {
|
||||
ClassDB::bind_method("_rooms_convert", &RoomManagerEditorPlugin::_rooms_convert);
|
||||
ClassDB::bind_method("_flip_portals", &RoomManagerEditorPlugin::_flip_portals);
|
||||
}
|
||||
|
||||
@@ -82,13 +75,6 @@ RoomManagerEditorPlugin::RoomManagerEditorPlugin(EditorNode *p_node) {
|
||||
button_flip_portals->connect("pressed", this, "_flip_portals");
|
||||
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, button_flip_portals);
|
||||
|
||||
button_rooms_convert = memnew(ToolButton);
|
||||
button_rooms_convert->set_icon(editor->get_gui_base()->get_icon("RoomGroup", "EditorIcons"));
|
||||
button_rooms_convert->set_text(TTR("Convert Rooms"));
|
||||
button_rooms_convert->hide();
|
||||
button_rooms_convert->connect("pressed", this, "_rooms_convert");
|
||||
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, button_rooms_convert);
|
||||
|
||||
_room_manager = nullptr;
|
||||
|
||||
Ref<RoomGizmoPlugin> room_gizmo_plugin = Ref<RoomGizmoPlugin>(memnew(RoomGizmoPlugin));
|
||||
|
||||
Reference in New Issue
Block a user