export template preview

This commit is contained in:
Tanasart 2023-08-13 13:10:20 +02:00
parent 83f2ea53bf
commit c43e93f092
14 changed files with 778 additions and 671 deletions

View file

@ -204,6 +204,7 @@
{"name":"sh_noise_grid_hex","order":2,"path":"shaders/sh_noise_grid_hex/sh_noise_grid_hex.yy",},
{"name":"node_3d_obj","order":8,"path":"scripts/node_3d_obj/node_3d_obj.yy",},
{"name":"__path","order":1,"path":"scripts/__path/__path.yy",},
{"name":"draw_text_path","order":25,"path":"scripts/draw_text_path/draw_text_path.yy",},
{"name":"sh_brush_outline","order":7,"path":"shaders/sh_brush_outline/sh_brush_outline.yy",},
{"name":"s_node_grid_tri_noise","order":22,"path":"sprites/s_node_grid_tri_noise/s_node_grid_tri_noise.yy",},
{"name":"o_dialog_menubox","order":1,"path":"objects/o_dialog_menubox/o_dialog_menubox.yy",},

View file

@ -718,6 +718,7 @@
{"id":{"name":"sh_noise_grid_hex","path":"shaders/sh_noise_grid_hex/sh_noise_grid_hex.yy",},},
{"id":{"name":"node_3d_obj","path":"scripts/node_3d_obj/node_3d_obj.yy",},},
{"id":{"name":"__path","path":"scripts/__path/__path.yy",},},
{"id":{"name":"draw_text_path","path":"scripts/draw_text_path/draw_text_path.yy",},},
{"id":{"name":"sh_brush_outline","path":"shaders/sh_brush_outline/sh_brush_outline.yy",},},
{"id":{"name":"s_node_grid_tri_noise","path":"sprites/s_node_grid_tri_noise/s_node_grid_tri_noise.yy",},},
{"id":{"name":"o_dialog_menubox","path":"objects/o_dialog_menubox/o_dialog_menubox.yy",},},

View file

@ -12,7 +12,7 @@ function draw_text_delimiter(ch_x, ch_y, _str) {
} else
draw_set_color(cc);
draw_text(_x, _y, ch);
draw_text_add(_x, _y, ch);
_x += string_width(ch);
}
}

View file

@ -120,8 +120,8 @@ function __string_width_ext(text, sep, w) {
#macro _string_height_ext string_height_ext
#macro string_height_ext __string_height_ext
function __string_height_ext(text, sep, w) {
if(!LOCALE.config.per_character_line_break)
function __string_height_ext(text, sep, w, _break = LOCALE.config.per_character_line_break) {
if(!_break)
return _string_height_ext(text, sep, w);
var lw = 0;

View file

@ -0,0 +1,42 @@
function draw_text_path(_x, _y, _text) {
draw_set_text(font == noone? f_p0 : font, fa_left, fa_top, color);
var _x0 = _x, ch = "", len = string_length(_text), i = 1;
var cc = draw_get_color();
var str = "", _comm = false;
while(i <= len) {
ch = string_char_at(_text, i);
if(ch == "%")
_comm = true;
if(!_comm) {
draw_text_add(_x0, _y, ch);
_x0 += string_width(ch);
} else {
str += ch;
switch(ch) {
case "d" : draw_set_color(COLORS.widget_text_dec_d); break;
case "n" : draw_set_color(COLORS.widget_text_dec_n); break;
case "e" : draw_set_color(COLORS.widget_text_dec_e); break;
case "f" : draw_set_color(COLORS.widget_text_dec_f); break;
case "i" : draw_set_color(COLORS.widget_text_dec_i); break;
}
switch(ch) {
case "d" : case "n" : case "e" : case "f" : case "i" :
draw_text_add(_x0, _y, str);
_x0 += string_width(str);
_comm = false;
str = "";
draw_set_color(cc);
break;
}
}
i++;
}
draw_text_add(_x0, _y, str);
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "draw_text_path",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "draw",
"path": "folders/functions/draw.yy",
},
}

View file

@ -58,7 +58,7 @@ function draw_code(_x, _y, str) {
if(i < amo - 1) word += "\"";
draw_set_color(COLORS.lua_highlight_string);
draw_text(tx, ty, word);
draw_text_add(tx, ty, word);
tx += string_width(word);
continue;
}
@ -81,7 +81,7 @@ function draw_code(_x, _y, str) {
draw_set_color(COLORS.lua_highlight_function);
}
draw_text(tx, ty, word);
draw_text_add(tx, ty, word);
tx += string_width(word);
}
}

View file

@ -59,6 +59,8 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[| 2] = nodeValue("Template", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "%d%n")
.rejectArray();
inputs[| 2].editWidget.format = TEXT_AREA_FORMAT.path_template;
inputs[| 2].editWidget.auto_update = true;
format_single = ["Single image", "Image sequence", "Animation"];
format_array = ["Multiple images", "Image sequences", "Animation"];
@ -112,8 +114,86 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
outputs[| 1] = nodeValue("Preview", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone)
.setVisible(false);
template_guide = [
["%d", "Directory"],
["%1d", "Goes up 1 level"],
["%n", "File name"],
["%f", "Frame"],
["%i", "Array index"],
];
export_template = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
var _tx = _x + ui(10);
var _ty = _y;
var _tw = _w - ui(8);
var rawpath = inputs[| 1].getValue(,,, true);
if(is_array(rawpath)) rawpath = array_safe_get(rawpath, 0, "");
var _ext = inputs[| 9].getValue(,,, true);
var path = pathString(rawpath);
var pathA = pathString(rawpath,, true);
path = string_replace(path, ".png", array_safe_get(inputs[| 9].display_data, _ext, ""));
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text);
var _th = ui(12) + string_height_ext(path, -1, _tw - ui(16), true);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _tx, _ty, _tw, _th, COLORS.node_composite_bg_blend, 1);
var lw = 0;
var lx = _tx + ui(8);
var ly = _ty + ui(6);
draw_set_alpha(0.9);
for( var i = 0, n = array_length(pathA); i < n; i++ ) {
var _txt = pathA[i];
if(is_array(_txt)) {
switch(_txt[0]) {
case "d" : draw_set_color(COLORS.widget_text_dec_d); break;
case "n" : draw_set_color(COLORS.widget_text_dec_n); break;
case "f" : draw_set_color(COLORS.widget_text_dec_f); break;
case "i" : draw_set_color(COLORS.widget_text_dec_i); break;
case "ext" : draw_set_color(COLORS._main_text_sub); break;
}
_txt = _txt[1];
} else
draw_set_color(COLORS._main_text);
for( var j = 1; j <= string_length(_txt); j++ ) {
var ch = string_char_at(_txt, j);
var ww = string_width(ch);
if(lw + ww > _tw - ui(16)) {
lw = 0;
lx = _tx + ui(8);
ly += string_height("M");
}
draw_text(lx, ly, ch);
lw += ww;
lx += ww;
}
}
draw_set_alpha(1);
var hh = _th + ui(116);
var _cy = _y + _th + ui(8);
for( var i = 0, n = array_length(template_guide); i < n; i++ ) {
var _yy = _cy + ui(20) * i;
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text_sub);
draw_text_add(_x + ui(16 + 16), _yy, template_guide[i][0]);
draw_set_text(f_p1, fa_right, fa_top, COLORS._main_text_sub);
draw_text_add(_x + _w - ui(4 + 16), _yy, template_guide[i][1]);
}
return hh;
});
input_display_list = [
["Export", false], 0, 1, 2, 4,
["Export", false], 0, 1, 2, export_template,
["Format ", false], 3, 9,
["Settings", false], 12, 8, 5, 6, 7, 10, 11,
];
@ -256,12 +336,18 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
PANEL_MENU.setNotiIcon(THEME.noti_icon_tick);
}
static pathString = function(path, suff, index = 0) {
static pathString = function(path, index = 0, _array = false) {
var suff = inputs[| 2].getValue();
var form = inputs[| 3].getValue();
var strt = inputs[| 11].getValue();
var s = "", i = 1, ch, ch_s;
path = string_replace_all(path, "\\", "/");
var s = _array? [] : "";
var i = 1;
var ch, ch_s;
var len = string_length(suff);
while(i <= len) {
ch = string_char_at(suff, i);
@ -273,40 +359,51 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
ch_s = string_char_at(suff, i);
switch(ch_s) {
case "f" :
var _txt = "";
var float_str = string_digits(str);
if(float_str != "") {
var float_val = string_digits(float_str);
var str_val = max(float_val - string_length(string(PROJECT.animator.current_frame + strt)), 0);
repeat(str_val)
s += "0";
_txt += "0";
}
s += string(PROJECT.animator.current_frame + strt);
_txt += string(PROJECT.animator.current_frame + strt);
if(_array) array_push(s, [ "f", _txt ]);
else s += _txt;
res = true;
break;
case "i" :
s += string(index);
if(_array) array_push(s, [ "i", string(index) ]);
else s += string(index);
res = true;
break;
case "d" :
var dir = filename_dir(path) + "/";
var dir = filename_dir(path) + "/";
var _txt = "";
var float_str = string_digits(str);
if(float_str != "") {
var float_val = string_digits(float_str);
var float_val = toNumber(string_digits(float_str)) + 1;
var dir_s = "";
var sep = string_splice(dir, "/");
for(var j = 0; j < array_length(sep) - float_val; j++) {
var sep = string_splice(dir, "/");
for(var j = 0; j < array_length(sep) - float_val; j++)
dir_s += sep[j] + "/";
}
s += dir_s;
_txt += dir_s;
} else
s += dir;
_txt += dir;
if(_array) array_push(s, [ "d", _txt ]);
else s += _txt;
res = true;
break;
case "n" :
var ext = filename_ext(path);
s += string_replace(filename_name(path), ext, "");
var ext = filename_ext(path);
var _txt = string_replace(filename_name(path), ext, "");
if(_array) array_push(s, [ "n", _txt ]);
else s += _txt;
res = true;
break;
default :
@ -316,12 +413,14 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
i++;
} until(i > string_length(suff) || res);
} else {
s += ch;
if(_array) array_push(s, ch);
else s += ch;
i++;
}
}
s += ".png";
if(_array) array_push(s, ["ext", ".png"]);
else s += ".png";
return s;
}
@ -397,9 +496,9 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
p = directory + "/" + string(i) + "/" + string_lead_zero(PROJECT.animator.current_frame, 5) + ".png";
} else {
if(is_array(path) && array_length(path) == array_length(surf))
p = pathString(path[ safe_mod(i, array_length(path)) ], suff, i);
p = pathString(path[ safe_mod(i, array_length(path)) ], i);
else
p = pathString(path, suff, i);
p = pathString(path, i);
}
p = save_surface(_surf, p);
@ -419,7 +518,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
if(form == NODE_EXPORT_FORMAT.gif)
p = directory + "/" + string_lead_zero(PROJECT.animator.current_frame, 5) + ".png";
else
p = pathString(p, suff);
p = pathString(p);
//print("Exporting " + p);
p = save_surface(surf, p);
@ -545,9 +644,9 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
for(var i = 0; i < array_length(surf); i++) {
temp_path = directory + "/" + string(i) + "/" + "*.png";
if(is_array(path))
target_path = pathString(path[ safe_mod(i, array_length(path)) ], suff, i);
target_path = pathString(path[ safe_mod(i, array_length(path)) ], i);
else
target_path = pathString(path, suff, i);
target_path = pathString(path, i);
if(extd == 0) {
target_path = string_replace(target_path, ".png", ".gif");
@ -558,7 +657,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
}
}
} else {
target_path = pathString(path, suff);
target_path = pathString(path);
if(extd == 0) {
target_path = string_replace(target_path, ".png", ".gif");

View file

@ -76,9 +76,7 @@ enum VALUE_DISPLAY {
path_array,
//Text
export_format,
code,
node_title,
text_array,
//path

File diff suppressed because it is too large Load diff

View file

@ -642,9 +642,10 @@ function Panel_Inspector() : PanelContent() constructor {
tb_node_name.font = f_h5;
tb_node_name.hide = true;
tb_node_name.setFocusHover(pFOCUS, pHOVER);
tb_node_name.align = fa_center;
tb_node_name.align = fa_center;
tb_node_name.format = TEXT_AREA_FORMAT.node_title;
var txt = inspecting.display_name == ""? inspecting.name : inspecting.display_name;
tb_node_name.draw(ui(64), ui(14), w - ui(128), ui(32), txt, [mx, my], VALUE_DISPLAY.node_title);
tb_node_name.draw(ui(64), ui(14), w - ui(128), ui(32), txt, [mx, my]);
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text_sub);
draw_text_add(w / 2 + ui(8), ui(56), inspecting.name);

View file

@ -5,7 +5,7 @@ function Panel_Preview() : PanelContent() constructor {
last_focus = noone;
static initSize = function() {
function initSize() {
canvas_x = w / 2;
canvas_y = h / 2;
}
@ -73,6 +73,9 @@ function Panel_Preview() : PanelContent() constructor {
tileMode = 0;
tb_framerate = new textBox(TEXTBOX_INPUT.number, function(val) { preview_rate = real(val); });
#region ++++ toolbars & actions ++++
toolbar_height = ui(40);
toolbars = [
[
@ -149,9 +152,9 @@ function Panel_Preview() : PanelContent() constructor {
],
]
#endregion
tb_framerate = new textBox(TEXTBOX_INPUT.number, function(val) { preview_rate = real(val); });
#region ++++ hotkey ++++
addHotkey("Preview", "Focus content", "F", MOD_KEY.none, function() { PANEL_PREVIEW.fullView(); });
addHotkey("Preview", "Save current frame", "S", MOD_KEY.shift, function() { PANEL_PREVIEW.saveCurrentFrame(); });
addHotkey("Preview", "Save all current frame", -1, MOD_KEY.none, function() { PANEL_PREVIEW.saveAllCurrentFrames(); });
@ -166,28 +169,29 @@ function Panel_Preview() : PanelContent() constructor {
if(PREF_MAP[? "alt_picker"]) return;
PANEL_PREVIEW.canvas_zooming_key = true;
});
#endregion
function setNodePreview(node) {
function setNodePreview(node) { #region
if(resetViewOnDoubleClick)
do_fullView = true;
preview_node[splitView? splitSelection : 0] = node;
}
} #endregion
function removeNodePreview(node) {
function removeNodePreview(node) { #region
if(preview_node[0] == node) preview_node[0] = noone;
if(preview_node[1] == node) preview_node[1] = noone;
}
} #endregion
function resetNodePreview() {
function resetNodePreview() { #region
preview_node = [ noone, noone ];
}
} #endregion
function getNodePreview() { return preview_node[splitView? splitSelection : 0]; }
function getNodePreviewSurface() { return preview_surface[splitView? splitSelection : 0]; }
function getNodePreviewSequence() { return preview_sequence[splitView? splitSelection : 0]; }
function getPreviewData() {
function getPreviewData() { #region
preview_surface = [ 0, 0 ];
preview_sequence = [ 0, 0 ];
@ -227,11 +231,11 @@ function Panel_Preview() : PanelContent() constructor {
canvas_w = surface_get_width(prevS);
canvas_h = surface_get_height(prevS);
}
}
} #endregion
function onFocusBegin() { PANEL_PREVIEW = self; }
function dragCanvas() {
function dragCanvas() { #region
if(canvas_dragging) {
if(!MOUSE_WRAPPING) {
var dx = mx - canvas_drag_mx;
@ -322,9 +326,9 @@ function Panel_Preview() : PanelContent() constructor {
canvas_dragging_key = false;
canvas_zooming_key = false;
canvas_hover = point_in_rectangle(mx, my, 0, toolbar_height, w, h - toolbar_height);
}
} #endregion
function fullView() {
function fullView() { #region
var node = getNodePreview();
if(node == noone) {
canvas_s = 1;
@ -345,18 +349,18 @@ function Panel_Preview() : PanelContent() constructor {
canvas_s = ss;
canvas_x = w / 2 - bbox.w * canvas_s / 2 - bbox.x0 * canvas_s + (tool_side_drawing * 40 / 2);
canvas_y = h / 2 - bbox.h * canvas_s / 2 - bbox.y0 * canvas_s;
}
} #endregion
sbChannel = new scrollBox([], function(index) {
sbChannel = new scrollBox([], function(index) { #region
var node = getNodePreview();
if(node == noone) return;
node.preview_channel = array_safe_get(sbChannelIndex, index);
});
}); #endregion
sbChannelIndex = [];
sbChannel.align = fa_left;
function drawNodeChannel(_x, _y) {
function drawNodeChannel(_x, _y) { #region
var _node = getNodePreview();
if(_node == noone) return;
if(ds_list_size(_node.outputs) < 2) return;
@ -381,16 +385,9 @@ function Panel_Preview() : PanelContent() constructor {
sbChannel.draw(_x - ww, _y - hh / 2, ww, hh, currName, [mx, my], x, y);
right_menu_y += ui(40);
}
} #endregion
/**
* Function Description
* @param {Struct.Node} node Description
* @param {any*} psx Description
* @param {any*} psy Description
* @param {any*} ss Description
*/
function drawOnionSkin(node, psx, psy, ss) {
function drawOnionSkin(node, psx, psy, ss) { #region
var _surf = preview_surface[0];
var _rang = PROJECT.onion_skin.range;
@ -423,9 +420,9 @@ function Panel_Preview() : PanelContent() constructor {
}
if(_top) draw_surface_ext_safe(_surf, psx, psy, ss, ss);
}
} #endregion
function drawNodePreview() {
function drawNodePreview() { #region
var ss = canvas_s;
var psx = 0, psy = 0;
var psw = 0, psh = 0;
@ -590,9 +587,9 @@ function Panel_Preview() : PanelContent() constructor {
draw_set_color(COLORS.panel_preview_surface_outline);
draw_rectangle(psx, psy, psx + pswd - 1, psy + pshd - 1, true);
}
}
} #endregion
function drawPreviewOverlay() {
function drawPreviewOverlay() { #region
right_menu_y = toolbar_height - ui(4);
toolbar_draw = false;
@ -705,12 +702,12 @@ function Panel_Preview() : PanelContent() constructor {
}
draw_sprite_ui_uniform(THEME.sequence_control, 0, bx + ui(20), by + ui(20), 1, COLORS._main_accent, .75);
}
}
} #endregion
tool_hovering = false;
tool_side_drawing = false;
function drawNodeTools(active, _node) {
function drawNodeTools(active, _node) { #region
var _mx = mx;
var _my = my;
var isHover = pHOVER && mouse_on_preview;
@ -823,9 +820,9 @@ function Panel_Preview() : PanelContent() constructor {
}
} else
tool_current = noone;
}
} #endregion
function drawToolBar(_node) {
function drawToolBar(_node) { #region
toolbar_height = ui(40);
var ty = h - toolbar_height;
//draw_sprite_stretched_ext(THEME.toolbar_shadow, 0, 0, ty - 12 + 4, w, 12, c_white, 0.5);
@ -942,9 +939,9 @@ function Panel_Preview() : PanelContent() constructor {
draw_set_color(COLORS.panel_toolbar_separator);
draw_line_width(tbx + ui(12), tby - toolbar_height / 2 + ui(8), tbx + ui(12), tby + toolbar_height / 2 - ui(8), 2);
drawNodeChannel(tbx, tby);
}
} #endregion
function drawSplitView() {
function drawSplitView() { #region
if(splitView == 0) return;
draw_set_color(COLORS.panel_preview_split_line);
@ -1004,9 +1001,9 @@ function Panel_Preview() : PanelContent() constructor {
splitSelection = 1;
}
}
}
} #endregion
function drawContent(panel) {
function drawContent(panel) { #region >>>>>>>>>>>>>>>>>>>> MAIN DRAW <<<<<<<<<<<<<<<<<<<<
mouse_on_preview = pHOVER && point_in_rectangle(mx, my, 0, toolbar_height, w, h - toolbar_height);
draw_clear(COLORS.panel_bg_clear);
@ -1056,9 +1053,9 @@ function Panel_Preview() : PanelContent() constructor {
drawSplitView();
drawToolBar(tool);
}
} #endregion
function copyCurrentFrame() {
function copyCurrentFrame() { #region
var prevS = getNodePreviewSurface();
if(!is_surface(prevS)) return;
@ -1075,9 +1072,9 @@ function Panel_Preview() : PanelContent() constructor {
surface_free(s);
clipboard_set_bitmap(buffer_get_address(buff), surface_get_width(prevS), surface_get_height(prevS));
}
} #endregion
function saveCurrentFrame() {
function saveCurrentFrame() { #region
var prevS = getNodePreviewSurface();
if(!is_surface(prevS)) return;
@ -1087,9 +1084,9 @@ function Panel_Preview() : PanelContent() constructor {
if(filename_ext(path) != ".png") path += ".png";
surface_save_safe(prevS, path);
}
} #endregion
function saveAllCurrentFrames() {
function saveAllCurrentFrames() { #region
var path = get_save_filename(".png", "export");
key_release();
if(path == "") return;
@ -1106,5 +1103,5 @@ function Panel_Preview() : PanelContent() constructor {
surface_save_safe(prev, _name);
ind++;
}
}
} #endregion
}

View file

@ -1,7 +1,9 @@
enum TEXT_AREA_FORMAT {
_default,
code,
delimiter
delimiter,
path_template,
node_title,
}
function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onModify, _extras) constructor {
@ -514,11 +516,13 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
_str = _input_text_line[i];
if(format == TEXT_AREA_FORMAT._default)
draw_text(ch_x, ch_y, _str);
draw_text_add(ch_x, ch_y, _str);
else if(format == TEXT_AREA_FORMAT.code)
draw_code(ch_x, ch_y, _str);
else if(format == TEXT_AREA_FORMAT.delimiter)
draw_text_delimiter(ch_x, ch_y, _str);
else if(format == TEXT_AREA_FORMAT.path_template)
draw_text_path(ch_x, ch_y, _str);
ch_y += line_get_height();
}

View file

@ -9,6 +9,7 @@ function textBox(_input, _onModify, _extras = noone) : textInput(_input, _onModi
font = noone;
color = COLORS._main_text;
boxColor = c_white;
format = TEXT_AREA_FORMAT._default;
no_empty = true;
auto_update = false;
@ -22,8 +23,8 @@ function textBox(_input, _onModify, _extras = noone) : textInput(_input, _onModi
starting_char = 1;
_current_text = "";
_input_text = "";
_last_text = "";
_input_text = "";
_last_text = "";
current_value = "";
cursor = 0;
@ -226,61 +227,19 @@ function textBox(_input, _onModify, _extras = noone) : textInput(_input, _onModi
apply();
}
static display_text = function(_x, _y, _text, _w, _format, _m = -1) {
static display_text = function(_x, _y, _text, _w, _m = -1) {
_text = string_real(_text);
BLEND_OVERRIDE;
if(!interactable) draw_set_alpha(0.5);
switch(_format) {
case VALUE_DISPLAY._default :
switch(format) {
case TEXT_AREA_FORMAT._default :
draw_set_text(font == noone? f_p0 : font, fa_left, fa_top, color);
draw_text(_x + disp_x, _y, _text);
draw_text_add(_x + disp_x, _y, _text);
break;
case VALUE_DISPLAY.export_format :
case TEXT_AREA_FORMAT.node_title :
draw_set_text(font == noone? f_p0 : font, fa_left, fa_top, color);
var _x0 = _x + disp_x, ch = "", len = string_length(_text), i = 1;
var cc = draw_get_color();
var str = "", _comm = false;
while(i <= len) {
ch = string_char_at(_text, i);
if(ch == "%")
_comm = true;
if(!_comm) {
draw_text(_x0, 0, ch);
_x0 += string_width(ch);
} else {
str += ch;
switch(ch) {
case "d" : draw_set_color(COLORS.widget_text_dec_d); break;
case "n" : draw_set_color(COLORS.widget_text_dec_n); break;
case "e" : draw_set_color(COLORS.widget_text_dec_e); break;
case "f" : draw_set_color(COLORS.widget_text_dec_f); break;
case "i" : draw_set_color(COLORS.widget_text_dec_i); break;
}
switch(ch) {
case "d" : case "n" : case "e" : case "f" : case "i" :
draw_text(_x0, 0, str);
_x0 += string_width(str);
_comm = false;
str = "";
draw_set_color(cc);
break;
}
}
i++;
}
draw_text(_x0, _y, str);
break;
case VALUE_DISPLAY.node_title :
draw_set_text(font == noone? f_p0 : font, fa_left, fa_top, color);
draw_text(_x + disp_x, _y, _text);
draw_text_add(_x + disp_x, _y, _text);
break;
}
@ -318,10 +277,10 @@ function textBox(_input, _onModify, _extras = noone) : textInput(_input, _onModi
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m,, params.halign, params.valign);
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.halign, params.valign);
}
static draw = function(_x, _y, _w, _h, _text = "", _m = mouse_ui, _format = VALUE_DISPLAY._default, halign = fa_left, valign = fa_top) {
static draw = function(_x, _y, _w, _h, _text = "", _m = mouse_ui, halign = fa_left, valign = fa_top) {
x = _x;
y = _y;
w = _w;
@ -496,7 +455,7 @@ function textBox(_input, _onModify, _extras = noone) : textInput(_input, _onModi
surface_set_target(text_surface);
DRAW_CLEAR
display_text(tx - tb_surf_x, _h / 2 - th / 2, txt, _w - ui(4), _format, _mx);
display_text(tx - tb_surf_x, _h / 2 - th / 2, txt, _w - ui(4), _mx);
surface_reset_target();
draw_surface(text_surface, tb_surf_x, tb_surf_y);
@ -560,7 +519,7 @@ function textBox(_input, _onModify, _extras = noone) : textInput(_input, _onModi
//draw_set_color(c_black);
//draw_line(0, _h / 2 - th / 2, 9999, _h / 2 - th / 2);
display_text(tx - tb_surf_x, _h / 2 - th / 2, _display_text, _w - ui(4), _format);
display_text(tx - tb_surf_x, _h / 2 - th / 2, _display_text, _w - ui(4));
surface_reset_target();
draw_surface(text_surface, tb_surf_x, tb_surf_y);
}