mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-23 21:46:17 +01:00
Gradient, Palette save/load bug
This commit is contained in:
parent
2e9534c2b0
commit
9098674d00
6 changed files with 14 additions and 10 deletions
|
@ -73,9 +73,8 @@ if !ready exit;
|
|||
bx -= ui(32);
|
||||
|
||||
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, "Open gradient folder", THEME.folder) == 2) {
|
||||
var _realpath = environment_get_variable("LOCALAPPDATA") + "/Pixels_Composer/Gradients";
|
||||
var _windir = environment_get_variable("WINDIR") + "/explorer.exe";
|
||||
execute_shell(_windir, _realpath);
|
||||
var _realpath = DIRECTORY + "Gradients";
|
||||
shellOpenExplorer(_realpath)
|
||||
}
|
||||
bx -= ui(32);
|
||||
#endregion
|
||||
|
|
|
@ -66,9 +66,8 @@ if palette == 0 exit;
|
|||
bx -= ui(32);
|
||||
|
||||
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, get_text("color_selector_open_palette", "Open palette folder"), THEME.folder) == 2) {
|
||||
var _realpath = environment_get_variable("LOCALAPPDATA") + "/Pixels_Composer/Palettes";
|
||||
var _windir = environment_get_variable("WINDIR") + "/explorer.exe";
|
||||
execute_shell(_windir, _realpath);
|
||||
var _realpath = DIRECTORY + "Palettes";
|
||||
shellOpenExplorer(_realpath)
|
||||
}
|
||||
draw_sprite_ui_uniform(THEME.folder, 0, bx + ui(14), by + ui(14), 1, COLORS._main_icon);
|
||||
bx -= ui(32);
|
||||
|
|
|
@ -37,6 +37,11 @@ function array_safe_get(arr, index, def = 0, overflow = ARRAY_OVERFLOW._default)
|
|||
return arr[index];
|
||||
}
|
||||
|
||||
function array_push_create(arr, val) {
|
||||
if(!is_array(arr)) return [ val ];
|
||||
array_push(arr, val);
|
||||
return arr;
|
||||
}
|
||||
|
||||
function array_exists(arr, val) {
|
||||
for( var i = 0; i < array_length(arr); i++ ) {
|
||||
|
|
|
@ -172,12 +172,12 @@ function loadGradient(path) {
|
|||
|
||||
var _t = file_text_open_read(path);
|
||||
while(!file_text_eof(_t)) {
|
||||
var key = file_text_readln(_t);
|
||||
var key = string_trim(file_text_readln(_t));
|
||||
var _col = 0, _pos = 0;
|
||||
|
||||
if(string_pos(",", key)) {
|
||||
var keys = string_splice(key, ",");
|
||||
if(array_length(keys) != 2) continue;
|
||||
if(array_length(keys) < 2) continue;
|
||||
|
||||
_col = toNumber(keys[0]);
|
||||
_pos = toNumber(keys[1]);
|
||||
|
@ -190,5 +190,6 @@ function loadGradient(path) {
|
|||
array_push(grad.keys, new gradientKey(_pos, _col));
|
||||
}
|
||||
file_text_close(_t);
|
||||
|
||||
return grad;
|
||||
}
|
|
@ -21,7 +21,7 @@ function loadPalette(path) {
|
|||
if(string_char_at(_w, 1) == "#") break;
|
||||
var _c = string_splice(_w, " ");
|
||||
if(array_length(_c) >= 3)
|
||||
pal[_index++] = make_color_rgb(toString(_c[0]), toString(_c[1]), toString(_c[2]));
|
||||
pal[_index++] = make_color_rgb(toNumber(_c[0]), toNumber(_c[1]), toNumber(_c[2]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -330,7 +330,7 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
}
|
||||
|
||||
function refreshContext() {
|
||||
context.scan([".json", ".pxcc"]);
|
||||
context.scan([ ".json", ".pxcc", ".png", ".jpg", ".gif" ]);
|
||||
|
||||
if(STEAM_ENABLED)
|
||||
steamUCGload();
|
||||
|
|
Loading…
Reference in a new issue