Backported:

6c2bd12031
c2c0c8067d
62fa80afd7
fd968157a4
c0bd05762e
72837b8ecd

From godot.
This commit is contained in:
Relintai 2022-03-16 18:18:23 +01:00
parent c9673a73fa
commit ced4ae75a5
5 changed files with 42 additions and 10 deletions

View File

@ -69,7 +69,9 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
// The map name and value definition format should be kept synced with the regex.
capitalize_string_remaps["2d"] = "2D";
capitalize_string_remaps["3d"] = "3D";
capitalize_string_remaps["Aa"] = "AA";
capitalize_string_remaps["Adb"] = "ADB";
capitalize_string_remaps["Ao"] = "AO";
capitalize_string_remaps["Bptc"] = "BPTC";
capitalize_string_remaps["Bvh"] = "BVH";
capitalize_string_remaps["Csg"] = "CSG";
@ -81,21 +83,28 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
capitalize_string_remaps["Fbx"] = "FBX";
capitalize_string_remaps["Fps"] = "FPS";
capitalize_string_remaps["Fov"] = "FOV";
capitalize_string_remaps["Fsr"] = "FSR";
capitalize_string_remaps["Fs"] = "FS";
capitalize_string_remaps["Fxaa"] = "FXAA";
capitalize_string_remaps["Ggx"] = "GGX";
capitalize_string_remaps["Gi"] = "GI";
capitalize_string_remaps["Gdscript"] = "GDScript";
capitalize_string_remaps["Gles 2"] = "GLES2";
capitalize_string_remaps["Gles 3"] = "GLES3";
capitalize_string_remaps["Gi Probe"] = "GI Probe";
capitalize_string_remaps["Gpu"] = "GPU";
capitalize_string_remaps["Gui"] = "GUI";
capitalize_string_remaps["Hdr"] = "HDR";
capitalize_string_remaps["Hidpi"] = "hiDPI";
capitalize_string_remaps["Http"] = "HTTP";
capitalize_string_remaps["Ik"] = "IK";
capitalize_string_remaps["Ios"] = "iOS";
capitalize_string_remaps["Kb"] = "KB";
capitalize_string_remaps["Lod"] = "LOD";
capitalize_string_remaps["Msaa"] = "MSAA";
capitalize_string_remaps["Macos"] = "macOS";
capitalize_string_remaps["Opentype"] = "OpenType";
capitalize_string_remaps["Openxr"] = "OpenXR";
capitalize_string_remaps["Png"] = "PNG";
capitalize_string_remaps["Pvs"] = "PVS";
capitalize_string_remaps["Pvrtc"] = "PVRTC";
@ -103,17 +112,23 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
capitalize_string_remaps["Sdfgi"] = "SDFGI";
capitalize_string_remaps["Srgb"] = "sRGB";
capitalize_string_remaps["Ssao"] = "SSAO";
capitalize_string_remaps["Ssl"] = "SSL";
capitalize_string_remaps["Ssil"] = "SSIL";
capitalize_string_remaps["Ssh"] = "SSH";
capitalize_string_remaps["Sdf"] = "SDF";
capitalize_string_remaps["Sdk"] = "SDK";
capitalize_string_remaps["Tcp"] = "TCP";
capitalize_string_remaps["Url"] = "URL";
capitalize_string_remaps["Uv 1"] = "UV1";
capitalize_string_remaps["Uv 2"] = "UV2";
capitalize_string_remaps["Uv"] = "UV";
capitalize_string_remaps["Uwp"] = "UWP";
capitalize_string_remaps["Vram"] = "VRAM";
capitalize_string_remaps["Vsync"] = "V-Sync";
capitalize_string_remaps["Vector 2"] = "Vector2";
capitalize_string_remaps["Webp"] = "WebP";
capitalize_string_remaps["Webrtc"] = "WebRTC";
capitalize_string_remaps["Websocket"] = "WebSocket";
capitalize_string_remaps["Xr"] = "XR";
}
EditorPropertyNameProcessor::~EditorPropertyNameProcessor() {

View File

@ -175,7 +175,7 @@ int detect_prime() {
close(fdset[0]);
} else {
// In child, killing this process will not quit the engine.
// In child, exit() here will not quit the engine.
char string[201];
@ -203,7 +203,7 @@ int detect_prime() {
print_verbose("Couldn't write vendor/renderer string.");
}
close(fdset[1]);
raise(SIGINT);
exit(0);
}
}

View File

@ -414,7 +414,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
cw = tab_size * font->get_char_size(' ').width;
}
if (end > 0 && fw + cw + begin > p_width) {
if (end > 0 && w + cw + begin > p_width) {
break; //don't allow lines longer than assigned width
}
@ -437,12 +437,13 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
was_separatable = separatable;
just_breaked_in_middle = false;
w += cw;
fw += cw;
end++;
}
CHECK_HEIGHT(fh);
ENSURE_WIDTH(fw);
ENSURE_WIDTH(w);
line_ascent = MAX(line_ascent, ascent);
line_descent = MAX(line_descent, descent);
@ -466,6 +467,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
}
{
float line_length = 0.0f;
float ofs = 0.0f - backtrack;
for (int i = 0; i < end; i++) {
@ -578,16 +580,16 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
if (visible) {
line_is_blank = false;
w += font->get_char_size(c[i], c[i + 1]).x;
}
if (c[i] == '\t') {
visible = false;
}
const float current_char_width = font->get_char_size(fx_char, c[i + 1]).x;
if (visible) {
if (selected) {
cw = font->get_char_size(fx_char, c[i + 1]).x;
cw = current_char_width;
draw_rect(Rect2(p_ofs.x + pofs, p_ofs.y + y, cw, lh), selection_bg);
}
@ -611,7 +613,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
cw = drawer.draw_char(ci, p_ofs + Point2(align_ofs + pofs, y + lh - line_descent) + fx_offset, fx_char, c[i + 1], char_color);
}
} else if (previously_visible && c[i] != '\t') {
backtrack += font->get_char_size(fx_char, c[i + 1]).x;
backtrack += current_char_width;
}
p_char_count++;
@ -635,7 +637,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
const int line_y = y + lh - (line_descent - 2);
const Point2 from = p_ofs + Point2(align_ofs + wofs, line_y);
const Point2 to = from + Point2(w + (is_at_line_wrap ? 0 : align_spacing), 0);
const Point2 to = from + Point2(line_length + (is_at_line_wrap ? 0 : align_spacing), 0);
VS::get_singleton()->canvas_item_add_line(ci, from, to, uc, line_width);
}
if (strikethrough) {
@ -644,7 +646,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
const int line_y = y + lh - (line_ascent + line_descent) / 2;
const Point2 from = p_ofs + Point2(align_ofs + wofs, line_y);
const Point2 to = from + Point2(w + (is_at_line_wrap ? 0 : align_spacing), 0);
const Point2 to = from + Point2(line_length + (is_at_line_wrap ? 0 : align_spacing), 0);
VS::get_singleton()->canvas_item_add_line(ci, from, to, uc, line_width);
}
}

View File

@ -2492,6 +2492,17 @@ List<Control *>::Element *Viewport::_gui_add_root_control(Control *p_control) {
return gui.roots.push_back(p_control);
}
void Viewport::_gui_cleanup_internal_state(Ref<InputEvent> p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid()) {
if (!mb->is_pressed()) {
gui.mouse_focus_mask &= ~(1 << (mb->get_button_index() - 1)); // Remove from mask.
}
}
}
List<Control *>::Element *Viewport::_gui_add_subwindow_control(Control *p_control) {
p_control->connect("visibility_changed", this, "_subwindow_visibility_changed");
@ -2835,7 +2846,10 @@ void Viewport::input(const Ref<InputEvent> &p_event) {
if (!is_input_handled()) {
_gui_input_event(p_event);
} else {
_gui_cleanup_internal_state(p_event);
}
//get_tree()->call_group(SceneTree::GROUP_CALL_REVERSE|SceneTree::GROUP_CALL_REALTIME|SceneTree::GROUP_CALL_MULIILEVEL,gui_input_group,"_gui_input",p_event); //special one for GUI, as controls use their own process check
}

View File

@ -339,6 +339,7 @@ private:
Control *_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_global, const Transform2D &p_xform, Transform2D &r_inv_xform);
void _gui_input_event(Ref<InputEvent> p_event);
void _gui_cleanup_internal_state(Ref<InputEvent> p_event);
void update_worlds();