1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +00:00

Add color pickers to script editor

This commit is contained in:
dugramen
2025-04-23 21:44:01 -04:00
parent 80a3d205f1
commit b9f59ae6ca
8 changed files with 458 additions and 5 deletions

View File

@@ -5204,7 +5204,8 @@ bool TextServerAdvanced::_shape_substr(ShapedTextDataAdvanced *p_new_sd, const S
int32_t bidi_run_end = _convert_pos(p_sd, ov_start + start + _bidi_run_start + _bidi_run_length);
for (int j = 0; j < sd_size; j++) {
if ((sd_glyphs[j].start >= bidi_run_start) && (sd_glyphs[j].end <= bidi_run_end)) {
int col_key_off = (sd_glyphs[j].start == sd_glyphs[j].end) ? 1 : 0;
if ((sd_glyphs[j].start >= bidi_run_start) && (sd_glyphs[j].end <= bidi_run_end - col_key_off)) {
// Copy glyphs.
Glyph gl = sd_glyphs[j];
if (gl.span_index >= 0) {
@@ -5994,7 +5995,11 @@ bool TextServerAdvanced::_shaped_text_update_breaks(const RID &p_shaped) {
while (i < span_size) {
String language = sd->spans[i].language;
int r_start = sd->spans[i].start;
while (i + 1 < span_size && language == sd->spans[i + 1].language) {
if (r_start == sd->spans[i].end) {
i++;
continue;
}
while (i + 1 < span_size && (language == sd->spans[i + 1].language || sd->spans[i + 1].start == sd->spans[i + 1].end)) {
i++;
}
int r_end = sd->spans[i].end;
@@ -6122,6 +6127,11 @@ bool TextServerAdvanced::_shaped_text_update_breaks(const RID &p_shaped) {
continue;
}
}
// Do not add extra space for color picker object.
if (((sd_glyphs[i].flags & GRAPHEME_IS_EMBEDDED_OBJECT) == GRAPHEME_IS_EMBEDDED_OBJECT && sd_glyphs[i].start == sd_glyphs[i].end) || (uint32_t(i + 1) < sd->glyphs.size() && (sd_glyphs[i + 1].flags & GRAPHEME_IS_EMBEDDED_OBJECT) == GRAPHEME_IS_EMBEDDED_OBJECT && sd_glyphs[i + 1].start == sd_glyphs[i + 1].end)) {
i += (sd_glyphs[i].count - 1);
continue;
}
Glyph gl;
gl.span_index = sd_glyphs[i].span_index;
gl.start = sd_glyphs[i].start;
@@ -6991,7 +7001,8 @@ bool TextServerAdvanced::_shaped_text_shape(const RID &p_shaped) {
for (int k = spn_from; k != spn_to; k += spn_delta) {
const ShapedTextDataAdvanced::Span &span = sd->spans[k];
if (span.start - sd->start >= script_run_end || span.end - sd->start <= script_run_start) {
int col_key_off = (span.start == span.end) ? 1 : 0;
if (span.start - sd->start >= script_run_end || span.end - sd->start <= script_run_start - col_key_off) {
continue;
}
if (span.embedded_key != Variant()) {