Fix "Override UI Font" setting not working.

This commit is contained in:
Tanasart 2025-01-09 10:22:47 +07:00
parent 63038087c1
commit 6f7cd0aca7
17 changed files with 130 additions and 62 deletions

View file

@ -0,0 +1,8 @@
{
"name": "Image",
"internalRef": "Node_Image",
"tooltip": "Load a single image from your computer.",
"io": [ "surface" ],
"build": "Node_create_Image"
}

Binary file not shown.

View file

@ -171,8 +171,8 @@ function __initNodeCustom(list) { #region
root += "/Custom";
directory_verify(root);
if(check_version($"{root}/version"))
zip_unzip("data/Nodes.zip", root);
// if(check_version($"{root}/version"))
// zip_unzip("data/Nodes.zip", root);
var f = file_find_first(root + "/*", fa_directory);

View file

@ -173,7 +173,7 @@ function loadFonts() {
FONT_LIST = {};
if(FONT_DEF || !file_exists_empty(path)) {
if(FONT_DEF) {
f_h1 = _font_load_default("h1", _f_h1);
f_h2 = _font_load_default("h2", _f_h2);
f_h3 = _font_load_default("h3", _f_h3);

View file

@ -16,9 +16,9 @@ function Node_Application_In(_x, _y, _group = noone) : Node(_x, _y, _group) cons
if(!is_surface(s)) return;
surface_set_target(POST_APP_SURF);
BLEND_OVERRIDE
draw_surface_stretched(s, 0, 0, WIN_W, WIN_H);
BLEND_NORMAL
BLEND_OVERRIDE
draw_surface_stretched(s, 0, 0, WIN_W, WIN_H);
BLEND_NORMAL
surface_reset_target();
}
}

View file

@ -1,7 +1,7 @@
globalvar APP_SURF, PRE_APP_SURF, POST_APP_SURF, APP_SURF_OVERRIDE;
APP_SURF = surface_create(1, 1);
PRE_APP_SURF = surface_create(1, 1);
POST_APP_SURF = surface_create(1, 1);
APP_SURF = -1;
PRE_APP_SURF = -1;
POST_APP_SURF = -1;
APP_SURF_OVERRIDE = false;
function Node_Application_Out(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {

View file

@ -105,8 +105,6 @@ If set, then strength value control how many times the effect applies on itself.
var _sep = _data[16];
var _map2 = _data[17];
print(attributes.oversample);
var _mode = _data[5];
if(!is_surface(_map) || (_sep && !is_surface(_map2))) {
surface_set_shader(_outSurf);

View file

@ -32,11 +32,11 @@ function Node_Feedback_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) con
}
static scanJunc = function() {
var node_in = PROJECT.nodeMap[? attributes.junc_in[0]];
var node_out = PROJECT.nodeMap[? attributes.junc_out[0]];
var node_i = PROJECT.nodeMap[? attributes.junc_in[0]];
var node_o = PROJECT.nodeMap[? attributes.junc_out[0]];
junc_in = node_in? node_in.inputs[attributes.junc_in[1]] : noone;
junc_out = node_out? node_out.outputs[attributes.junc_out[1]] : noone;
junc_in = node_i? node_i.inputs[attributes.junc_in[1]] : noone;
junc_out = node_o? node_o.outputs[attributes.junc_out[1]] : noone;
if(junc_in) junc_in.value_from_loop = self;
if(junc_out) array_push(junc_out.value_to_loop, self);

View file

@ -152,20 +152,26 @@ function __initNodeData() {
if(check_version($"{nodeDir}version")) {
zip_unzip("data/Tooltip.zip", nodeDir);
file_delete(nodeDir + "nodes.json");
file_copy_override("data/nodes.json", nodeDir + "nodes.json");
file_delete($"{nodeDir}nodes.json");
file_copy_override("data/nodes.json", $"{nodeDir}nodes.json");
}
var dir = $"{nodeDir}Related/";
directory_verify(dir);
if(check_version($"{dir}version")) {
var _relFrom = $"data/related_node.json";
var _relTo = $"{dir}default.json";
file_copy_override(_relFrom, _relTo);
}
var dir = $"{nodeDir}Data/";
directory_verify(dir);
if(check_version($"{dir}version")) {
zip_unzip("data/Nodes/Internal.zip", nodeDir);
}
__initNodeReleated();
}

View file

@ -18,30 +18,24 @@ function Node_Monitor_Capture(_x, _y, _group = noone) : Node(_x, _y, _group) con
surface = -1;
static step = function() { #region
static step = function() {
LIVE_UPDATE = true;
var _mode = getInputData(0);
inputs[1].setVisible(_mode == 0);
inputs[2].setVisible(_mode == 1);
} #endregion
}
static update = function() { #region
static update = function() {
var _mode = getInputData(0);
var _moni = getInputData(1);
var _regi = getInputData(2);
switch(_mode) {
case 0 :
var _mon = monitors[_moni];
surface = display_capture_surface_part(_mon[0], _mon[1], _mon[2], _mon[3], surface);
break;
case 1 :
surface = display_capture_surface_part(_regi[0], _regi[1], _regi[2], _regi[3], surface);
break;
}
var _reg = _mode == 0? monitors[_moni] : _regi;
surface = surface_verify(surface, _reg[2], _reg[3]);
display_capture_surface_part(_reg[0], _reg[1], _reg[2], _reg[3], surface);
outputs[0].setValue(surface);
} #endregion
}
}

View file

@ -304,6 +304,24 @@ function addNodePCXCatagory( name, list, filter = []) { ds_list_a
////- Nodes
function __read_node_folder(dir) {
var _name = filename_name_only(dir);
var _info = dir + "/info.json";
if(!file_exists(_info)) {
print($"NODE ERROR: Cannot find info.json for {dir}.");
return;
}
var _data = json_load_struct(_info);
var _name = _data[$ "name"];
var _iref = _data[$ "internalRef"];
var _iref = _data[$ "internalRef"];
addNodeObject(input, "Image", Node_Image, "Load a single image from your computer.")
.setIO(VALUE_TYPE.surface).setBuild(Node_create_Image);
}
function __initNodes() {
global.__currPage = "";
global.__startPage = 0;
@ -324,7 +342,29 @@ function __initNodes() {
NODE_PAGE_DEFAULT = ds_list_size(NODE_CATEGORY);
ADD_NODE_PAGE = NODE_PAGE_DEFAULT;
// NODE DATA
var dir = $"{DIRECTORY}Nodes/Data/Internal/";
if(directory_exists(dir)) {
var _dirs = [];
var _f = file_find_first(dir + "*", 0);
var f, p;
while(_f != "") {
f = _f;
p = dir + f;
_f = file_find_next();
if(!directory_exists(p)) continue;
array_push(_dirs, p);
}
file_find_close();
array_foreach(_dirs, function(d) /*=>*/ {return __read_node_folder(d)});
}
// NODE LIST
var fav = ds_list_create();
@ -651,9 +691,11 @@ function __initNodes() {
.setIO(VALUE_TYPE.surface);
addNodeObject(input, "Array to Anim", Node_Sequence_Anim, "Convert array of images into animation.")
.setIO(VALUE_TYPE.surface);
addNodeObject(input, "Cache Array", Node_Cache_Array)
if(!DEMO) {
ds_list_add(input, "/Exporters");
addNodeObject(input, "Export", Node_Export, "Export image, image array to file, image sequence, animation.")
addNodeObject(input, "Export", Node_Export, "Export image to file(s).")
.setIO(VALUE_TYPE.surface).setBuild(Node_create_Export);
}

View file

@ -1285,7 +1285,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(value_from_loop && value_from_loop.bypassConnection() && value_from_loop.junc_out) {
value_from_loop.getValue(arr);
arr[@ 0] = surface_array_clone(arr[0]);
arr[@ 0] = arr[0];
}
else if(value_from && value_from != self)
@ -1712,7 +1712,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
}
if(_valueFrom == noone) return removeFrom();
if(isConnectable(_valueFrom, checkRecur, log) < 0) return conn;
var conn = isConnectable(_valueFrom, checkRecur, log);
if(conn < 0) return conn;
run_in(2, function() /*=>*/ { updateColor(getValue()); });

View file

@ -1168,7 +1168,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(view_pan_tool)
_hv = true;
draw_circle_ui(_d3x, _d3y, d3_view_wz, _hv? 0 : 0.04, COLORS._main_icon, 0.3);
draw_circle_ui(_d3x, _d3y, d3_view_wz, _hv? 0 : 0.02, COLORS._main_icon, 0.3);
draw_sprite_ui(THEME.view_pan, 0, _d3x, _d3y, 1, 1, 0, view_pan_tool? COLORS._main_accent : COLORS._main_icon, 1);
_d3x += (d3_view_wz + ui(4) + d3_view_wz) * _side;
@ -1186,14 +1186,14 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
graph_zoom_m = my;
graph_zoom_s = graph_s;
view_zoom_tool = true;
view_zoom_tool = true;
}
}
if(view_zoom_tool)
_hv = true;
draw_circle_ui(_d3x, _d3y, d3_view_wz, _hv? 0 : 0.04, COLORS._main_icon, 0.3);
draw_circle_ui(_d3x, _d3y, d3_view_wz, _hv? 0 : 0.02, COLORS._main_icon, 0.3);
draw_sprite_ui(THEME.view_zoom, 0, _d3x, _d3y, 1, 1, 0, view_zoom_tool? COLORS._main_accent : COLORS._main_icon, 1);
if(view_hovering && mouse_press(mb_right, pFOCUS)) {

View file

@ -1230,6 +1230,8 @@ function Panel_Inspector() : PanelContent() constructor {
if(buttonInstant(THEME.button_hide_fill, lx, ly, ui(16), ui(16), [mx, my], pHOVER, pFOCUS, __txt("Lock"), THEME.lock_12, !locked, locked? COLORS._main_icon_light : COLORS._main_icon) == 2)
locked = !locked;
if(buttonInstant(THEME.button_hide_fill, bx, by, ui(32), ui(32), [mx, my], pHOVER, pFOCUS, __txt("Presets"), THEME.preset, 1) == 2)
dialogPanelCall(new Panel_Presets(inspecting), x + bx, y + by + ui(36));
} else {

View file

@ -334,6 +334,7 @@ function Panel_Preference() : PanelContent() constructor {
__txtx("pref_interface_language", "Interface Language*"),
"local",
new scrollBox(locals, function(str) /*=>*/ {
should_restart = true;
if(str < 0) return;
PREFERENCES.local = locals[str];
PREF_SAVE();
@ -343,7 +344,7 @@ function Panel_Preference() : PanelContent() constructor {
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_ui_font", "Overwrite UI font") + "*",
"font_overwrite",
new textBox(TEXTBOX_INPUT.text, function(txt) /*=>*/ { PREFERENCES.font_overwrite = txt; PREF_SAVE(); })
new textBox(TEXTBOX_INPUT.text, function(txt) /*=>*/ { PREFERENCES.font_overwrite = txt; should_restart = true; PREF_SAVE(); })
.setSideButton(button(function() /*=>*/ { PREFERENCES.font_overwrite = get_open_filename_pxc("Font files (.ttf, .otf)|*.ttf;*.otf", ""); PREF_SAVE(); }, THEME.button_path_icon))
.setFont(f_p2).setEmpty()
));
@ -663,6 +664,19 @@ function Panel_Preference() : PanelContent() constructor {
_y += _h + ui(8 + 4);
hh += _h + ui(8 + 4);
// Font override
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text);
draw_text_add(ui(8), _y + _h / 2, __txt("Font Override"));
var _ovr = PREFERENCES.font_overwrite == ""? "None" : filename_name_only(PREFERENCES.font_overwrite);
draw_set_text(f_p3, fa_right, fa_center, COLORS._main_text_sub);
draw_text_add(ww - _h - ui(4), _y + _h / 2, _ovr);
_y += _h + ui(8 + 4);
hh += _h + ui(8 + 4);
// Metadata box
var _mh = themeCurrent == noone? ui(16) : ui(8 + 4 + 20 * 4);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, 0, _y, ww, _mh, COLORS._main_icon_light);
@ -1099,8 +1113,11 @@ function Panel_Preference() : PanelContent() constructor {
draw_text_add(ui(32), yc, _key);
if(font_exists(_font)) {
var _name = font_get_fontname(_font);
_name = filename_name_only(_name);
draw_set_text(_font, fa_right, fa_center, COLORS._main_text);
draw_text_add(ww - ui(16), yc, $"Pixel Composer");
draw_text_add(ww - ui(16), yc, _name);
}
}
@ -1514,27 +1531,13 @@ function Panel_Preference() : PanelContent() constructor {
panel_height = h - padding * 2;
hotkey_height = panel_height - hotkey_cont_h - ui(32);
sp_pref.resize( panel_width, panel_height);
sp_pref.resize( panel_width, panel_height - 1);
sp_hotkey.resize(panel_width, hotkey_height);
}
function drawContent(panel) {
draw_clear_alpha(COLORS.panel_bg_clear, 1);
// if(should_restart) {
// var _txt = "Restart recommended";
// var _rx = ui(168);
// var _ry = ui(20);
// draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text_accent);
// var _rw = string_width(_txt);
// var _rh = string_height(_txt);
// draw_sprite_stretched_ext(THEME.box_r5_clr, 0, _rx - ui(8), _ry - ui(4), _rw + ui(16), _rh + ui(8), COLORS._main_accent, 1);
// draw_text(_rx, _ry, _txt);
// }
tb_search.setFocusHover(pFOCUS, pHOVER);
tb_search.draw(padding, padding, page_width - padding * 2 - ui(4), ui(24), search_text, [ mx, my ]);
@ -1542,6 +1545,19 @@ function Panel_Preference() : PanelContent() constructor {
sp_page.setFocusHover(pFOCUS, pHOVER);
sp_page.drawOffset(padding, padding + ui(32), mx, my);
if(should_restart) {
var _txt = "Restart recommended";
draw_set_text(f_p2b, fa_center, fa_center, COLORS._main_text_accent);
var _rw = page_width - ui(8);
var _rh = string_height_ext(_txt, -1, _rw - ui(16)) + ui(8);
var _rx = ui(2);
var _ry = h - ui(2) - _rh;
draw_sprite_stretched_ext(THEME.box_r5_clr, 0, _rx, _ry, _rw, _rh, COLORS._main_accent, 1);
draw_text_ext_add(_rx + _rw / 2, _ry + _rh / 2, _txt, -1, _rw - ui(16));
}
section_current = "";
var px = padding + page_width;
var py = padding;
@ -1766,6 +1782,7 @@ function Panel_Preference() : PanelContent() constructor {
sp_hotkey.drawOffset(px, _ppy + ui(32), mx, my);
break;
}
}
static onClose = function() {

View file

@ -507,7 +507,7 @@ function Panel_Preview() : PanelContent() constructor {
function() /*=>*/ {return 0},
],
[
THEME.node_goto,
THEME.node_goto_thin,
new tooltipHotkey(__txtx("panel_preview_windows", "Pop up as Preview window"), "Preview", "Popup"),
function() /*=>*/ { create_preview_window(PANEL_PREVIEW.getNodePreview()); },
function() /*=>*/ {return 0},
@ -1642,7 +1642,7 @@ function Panel_Preview() : PanelContent() constructor {
if(view_pan_tool)
_hv = true;
draw_circle_ui(_d3x, _d3y, d3_view_wr, _hv? 0 : 0.02, COLORS._main_icon, 0.3);
draw_circle_ui(_d3x, _d3y, d3_view_wr, _hv? 0 : 0.01, COLORS._main_icon, 0.3);
var _qview = new BBMOD_Quaternion().FromEuler(d3_view_camera.focus_angle_y, -d3_view_camera.focus_angle_x, 0);
var _as = [
@ -1678,7 +1678,7 @@ function Panel_Preview() : PanelContent() constructor {
if(view_zoom_tool)
_hv = true;
draw_circle_ui(_d3x, _d3y, d3_view_wz, _hv? 0 : 0.04, COLORS._main_icon, 0.3);
draw_circle_ui(_d3x, _d3y, d3_view_wz, _hv? 0 : 0.02, COLORS._main_icon, 0.3);
draw_sprite_ui(THEME.view_zoom, 0, _d3x, _d3y, 1, 1, 0, view_zoom_tool? COLORS._main_accent : COLORS._main_icon, 1);
} else {
@ -1707,7 +1707,7 @@ function Panel_Preview() : PanelContent() constructor {
if(view_pan_tool)
_hv = true;
draw_circle_ui(_d3x, _d3y, d3_view_wz, _hv? 0 : 0.04, COLORS._main_icon, 0.3);
draw_circle_ui(_d3x, _d3y, d3_view_wz, _hv? 0 : 0.02, COLORS._main_icon, 0.3);
draw_sprite_ui(THEME.view_pan, 0, _d3x, _d3y, 1, 1, 0, view_pan_tool? COLORS._main_accent : COLORS._main_icon, 1);
_d3x += (d3_view_wz + ui(4) + d3_view_wz) * _side;
@ -1733,7 +1733,7 @@ function Panel_Preview() : PanelContent() constructor {
if(view_zoom_tool)
_hv = true;
draw_circle_ui(_d3x, _d3y, d3_view_wz, _hv? 0 : 0.04, COLORS._main_icon, 0.3);
draw_circle_ui(_d3x, _d3y, d3_view_wz, _hv? 0 : 0.02, COLORS._main_icon, 0.3);
draw_sprite_ui(THEME.view_zoom, 0, _d3x, _d3y, 1, 1, 0, view_zoom_tool? COLORS._main_accent : COLORS._main_icon, 1);
}

View file

@ -331,7 +331,7 @@
LOCALE_DEF = PREFERENCES.local == "en";
THEME_DEF = PREFERENCES.theme == "default";
FONT_DEF = PREFERENCES.theme == "default" && PREFERENCES.local == "en" && PREFERENCES.display_scaling == 1;
FONT_DEF = PREFERENCES.theme == "default" && PREFERENCES.local == "en" && PREFERENCES.display_scaling == 1 && PREFERENCES.font_overwrite == "";
directory_verify(filepath_resolve(PREFERENCES.temp_path));