mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 14:11:15 +00:00
Fix minimap capturing events and improve its theme
Add an editor setting for minimap opacity in visual editors
This commit is contained in:
parent
2d904127d6
commit
a9552cefa2
7 changed files with 41 additions and 5 deletions
|
|
@ -607,6 +607,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
||||||
_initial_set("editors/animation/onion_layers_past_color", Color(1, 0, 0));
|
_initial_set("editors/animation/onion_layers_past_color", Color(1, 0, 0));
|
||||||
_initial_set("editors/animation/onion_layers_future_color", Color(0, 1, 0));
|
_initial_set("editors/animation/onion_layers_future_color", Color(0, 1, 0));
|
||||||
|
|
||||||
|
// Visual editors
|
||||||
|
_initial_set("editors/visual_editors/minimap_opacity", 0.85);
|
||||||
|
hints["editors/visual_editors/minimap_opacity"] = PropertyInfo(Variant::REAL, "editors/visual_editors/minimap_opacity", PROPERTY_HINT_RANGE, "0.0,1.0,0.01", PROPERTY_USAGE_DEFAULT);
|
||||||
|
|
||||||
/* Run */
|
/* Run */
|
||||||
|
|
||||||
// Window placement
|
// Window placement
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ static Ref<Texture> flip_icon(Ref<Texture> p_texture, bool p_flip_y = false, boo
|
||||||
|
|
||||||
Ref<ImageTexture> texture(memnew(ImageTexture));
|
Ref<ImageTexture> texture(memnew(ImageTexture));
|
||||||
Ref<Image> img = p_texture->get_data();
|
Ref<Image> img = p_texture->get_data();
|
||||||
|
img = img->duplicate();
|
||||||
|
|
||||||
if (p_flip_y) {
|
if (p_flip_y) {
|
||||||
img->flip_y();
|
img->flip_y();
|
||||||
|
|
@ -1076,7 +1077,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
||||||
theme->set_constant("bezier_len_neg", "GraphEdit", 160 * EDSCALE);
|
theme->set_constant("bezier_len_neg", "GraphEdit", 160 * EDSCALE);
|
||||||
|
|
||||||
// GraphEditMinimap
|
// GraphEditMinimap
|
||||||
theme->set_stylebox("bg", "GraphEditMinimap", make_flat_stylebox(dark_color_1, 0, 0, 0, 0));
|
Ref<StyleBoxFlat> style_minimap_bg = make_flat_stylebox(dark_color_1, 0, 0, 0, 0);
|
||||||
|
style_minimap_bg->set_border_color(dark_color_3);
|
||||||
|
style_minimap_bg->set_border_width_all(1);
|
||||||
|
theme->set_stylebox("bg", "GraphEditMinimap", style_minimap_bg);
|
||||||
|
|
||||||
Ref<StyleBoxFlat> style_minimap_camera;
|
Ref<StyleBoxFlat> style_minimap_camera;
|
||||||
Ref<StyleBoxFlat> style_minimap_node;
|
Ref<StyleBoxFlat> style_minimap_node;
|
||||||
if (dark_theme) {
|
if (dark_theme) {
|
||||||
|
|
@ -1093,9 +1098,15 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
||||||
theme->set_stylebox("camera", "GraphEditMinimap", style_minimap_camera);
|
theme->set_stylebox("camera", "GraphEditMinimap", style_minimap_camera);
|
||||||
theme->set_stylebox("node", "GraphEditMinimap", style_minimap_node);
|
theme->set_stylebox("node", "GraphEditMinimap", style_minimap_node);
|
||||||
|
|
||||||
Ref<Texture> resizer_icon = theme->get_icon("GuiResizer", "EditorIcons");
|
Ref<Texture> minimap_resizer_icon = theme->get_icon("GuiResizer", "EditorIcons");
|
||||||
theme->set_icon("resizer", "GraphEditMinimap", flip_icon(resizer_icon, true, true));
|
Color minimap_resizer_color;
|
||||||
theme->set_color("resizer_color", "GraphEditMinimap", Color(1, 1, 1, 0.65));
|
if (dark_theme) {
|
||||||
|
minimap_resizer_color = Color(1, 1, 1, 0.65);
|
||||||
|
} else {
|
||||||
|
minimap_resizer_color = Color(0, 0, 0, 0.65);
|
||||||
|
}
|
||||||
|
theme->set_icon("resizer", "GraphEditMinimap", flip_icon(minimap_resizer_icon, true, true));
|
||||||
|
theme->set_color("resizer_color", "GraphEditMinimap", minimap_resizer_color);
|
||||||
|
|
||||||
// GraphNode
|
// GraphNode
|
||||||
const float mv = dark_theme ? 0.0 : 1.0;
|
const float mv = dark_theme ? 0.0 : 1.0;
|
||||||
|
|
|
||||||
|
|
@ -266,6 +266,9 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
|
||||||
|
|
||||||
graph->connect_node(from, 0, to, to_idx);
|
graph->connect_node(from, 0, to, to_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float graph_minimap_opacity = EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity");
|
||||||
|
graph->set_minimap_opacity(graph_minimap_opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationNodeBlendTreeEditor::_file_opened(const String &p_file) {
|
void AnimationNodeBlendTreeEditor::_file_opened(const String &p_file) {
|
||||||
|
|
@ -942,6 +945,8 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
|
||||||
graph->connect("scroll_offset_changed", this, "_scroll_changed");
|
graph->connect("scroll_offset_changed", this, "_scroll_changed");
|
||||||
graph->connect("delete_nodes_request", this, "_delete_nodes_request");
|
graph->connect("delete_nodes_request", this, "_delete_nodes_request");
|
||||||
graph->connect("popup_request", this, "_popup_request");
|
graph->connect("popup_request", this, "_popup_request");
|
||||||
|
float graph_minimap_opacity = EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity");
|
||||||
|
graph->set_minimap_opacity(graph_minimap_opacity);
|
||||||
|
|
||||||
VSeparator *vs = memnew(VSeparator);
|
VSeparator *vs = memnew(VSeparator);
|
||||||
graph->get_zoom_hbox()->add_child(vs);
|
graph->get_zoom_hbox()->add_child(vs);
|
||||||
|
|
|
||||||
|
|
@ -908,6 +908,9 @@ void VisualShaderEditor::_update_graph() {
|
||||||
|
|
||||||
graph->connect_node(itos(from), from_idx, itos(to), to_idx);
|
graph->connect_node(itos(from), from_idx, itos(to), to_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float graph_minimap_opacity = EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity");
|
||||||
|
graph->set_minimap_opacity(graph_minimap_opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualShaderEditor::_add_input_port(int p_node, int p_port, int p_port_type, const String &p_name) {
|
void VisualShaderEditor::_add_input_port(int p_node, int p_port, int p_port_type, const String &p_name) {
|
||||||
|
|
@ -2391,6 +2394,8 @@ VisualShaderEditor::VisualShaderEditor() {
|
||||||
graph->set_h_size_flags(SIZE_EXPAND_FILL);
|
graph->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
main_box->add_child(graph);
|
main_box->add_child(graph);
|
||||||
graph->set_drag_forwarding(this);
|
graph->set_drag_forwarding(this);
|
||||||
|
float graph_minimap_opacity = EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity");
|
||||||
|
graph->set_minimap_opacity(graph_minimap_opacity);
|
||||||
graph->add_valid_right_disconnect_type(VisualShaderNode::PORT_TYPE_SCALAR);
|
graph->add_valid_right_disconnect_type(VisualShaderNode::PORT_TYPE_SCALAR);
|
||||||
graph->add_valid_right_disconnect_type(VisualShaderNode::PORT_TYPE_BOOLEAN);
|
graph->add_valid_right_disconnect_type(VisualShaderNode::PORT_TYPE_BOOLEAN);
|
||||||
graph->add_valid_right_disconnect_type(VisualShaderNode::PORT_TYPE_VECTOR);
|
graph->add_valid_right_disconnect_type(VisualShaderNode::PORT_TYPE_VECTOR);
|
||||||
|
|
|
||||||
|
|
@ -875,6 +875,10 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_update_graph_connections();
|
_update_graph_connections();
|
||||||
|
|
||||||
|
float graph_minimap_opacity = EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity");
|
||||||
|
graph->set_minimap_opacity(graph_minimap_opacity);
|
||||||
|
|
||||||
// use default_func instead of default_func for now I think that should be good stop gap solution to ensure not breaking anything
|
// use default_func instead of default_func for now I think that should be good stop gap solution to ensure not breaking anything
|
||||||
graph->call_deferred("set_scroll_ofs", script->get_function_scroll(default_func) * EDSCALE);
|
graph->call_deferred("set_scroll_ofs", script->get_function_scroll(default_func) * EDSCALE);
|
||||||
updating_graph = false;
|
updating_graph = false;
|
||||||
|
|
@ -4785,6 +4789,8 @@ VisualScriptEditor::VisualScriptEditor() {
|
||||||
graph->connect("duplicate_nodes_request", this, "_on_nodes_duplicate");
|
graph->connect("duplicate_nodes_request", this, "_on_nodes_duplicate");
|
||||||
graph->connect("gui_input", this, "_graph_gui_input");
|
graph->connect("gui_input", this, "_graph_gui_input");
|
||||||
graph->set_drag_forwarding(this);
|
graph->set_drag_forwarding(this);
|
||||||
|
float graph_minimap_opacity = EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity");
|
||||||
|
graph->set_minimap_opacity(graph_minimap_opacity);
|
||||||
graph->hide();
|
graph->hide();
|
||||||
graph->connect("scroll_offset_changed", this, "_graph_ofs_changed");
|
graph->connect("scroll_offset_changed", this, "_graph_ofs_changed");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,10 @@ Vector2 GraphEditMinimap::_convert_to_graph_position(const Vector2 &p_position)
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphEditMinimap::_gui_input(const Ref<InputEvent> &p_ev) {
|
void GraphEditMinimap::_gui_input(const Ref<InputEvent> &p_ev) {
|
||||||
|
if (!ge->is_minimap_enabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_ev;
|
Ref<InputEventMouseButton> mb = p_ev;
|
||||||
Ref<InputEventMouseMotion> mm = p_ev;
|
Ref<InputEventMouseMotion> mm = p_ev;
|
||||||
|
|
||||||
|
|
@ -1799,7 +1803,7 @@ GraphEdit::GraphEdit() {
|
||||||
top_layer->add_child(minimap);
|
top_layer->add_child(minimap);
|
||||||
minimap->set_name("_minimap");
|
minimap->set_name("_minimap");
|
||||||
minimap->set_modulate(Color(1, 1, 1, minimap_opacity));
|
minimap->set_modulate(Color(1, 1, 1, minimap_opacity));
|
||||||
minimap->set_mouse_filter(MOUSE_FILTER_STOP);
|
minimap->set_mouse_filter(MOUSE_FILTER_PASS);
|
||||||
minimap->set_custom_minimum_size(Vector2(50, 50));
|
minimap->set_custom_minimum_size(Vector2(50, 50));
|
||||||
minimap->set_size(minimap_size);
|
minimap->set_size(minimap_size);
|
||||||
minimap->set_anchors_preset(Control::PRESET_BOTTOM_RIGHT);
|
minimap->set_anchors_preset(Control::PRESET_BOTTOM_RIGHT);
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,7 @@ static Ref<Texture> flip_icon(Ref<Texture> p_texture, bool p_flip_y = false, boo
|
||||||
|
|
||||||
Ref<ImageTexture> texture(memnew(ImageTexture));
|
Ref<ImageTexture> texture(memnew(ImageTexture));
|
||||||
Ref<Image> img = p_texture->get_data();
|
Ref<Image> img = p_texture->get_data();
|
||||||
|
img = img->duplicate();
|
||||||
|
|
||||||
if (p_flip_y) {
|
if (p_flip_y) {
|
||||||
img->flip_y();
|
img->flip_y();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue