mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
Preference section, tools delay/hotkeys.
This commit is contained in:
parent
16e0819389
commit
cb3566cee7
12 changed files with 264 additions and 96 deletions
|
@ -16,6 +16,8 @@ event_inherited();
|
||||||
dialog_h_min = ui(480);
|
dialog_h_min = ui(480);
|
||||||
|
|
||||||
onResize = function() {
|
onResize = function() {
|
||||||
|
sp_page.resize(page_width - ui(4), dialog_h - ui(title_height + padding));
|
||||||
|
|
||||||
sp_pref.resize(dialog_w - ui(padding + padding + page_width), dialog_h - ui(title_height + padding));
|
sp_pref.resize(dialog_w - ui(padding + padding + page_width), dialog_h - ui(title_height + padding));
|
||||||
sp_hotkey.resize(dialog_w - ui(padding + padding + page_width), dialog_h - ui(title_height + padding));
|
sp_hotkey.resize(dialog_w - ui(padding + padding + page_width), dialog_h - ui(title_height + padding));
|
||||||
sp_colors.resize(dialog_w - ui(padding + padding + page_width), dialog_h - (title_height + ui(padding + 40)));
|
sp_colors.resize(dialog_w - ui(padding + padding + page_width), dialog_h - (title_height + ui(padding + 40)));
|
||||||
|
@ -31,6 +33,64 @@ event_inherited();
|
||||||
|
|
||||||
section_current = "";
|
section_current = "";
|
||||||
sections = array_create(array_length(page));
|
sections = array_create(array_length(page));
|
||||||
|
|
||||||
|
sp_page = new scrollPane(page_width - ui(4), dialog_h - ui(title_height + padding), function(_y, _m, _r) {
|
||||||
|
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
||||||
|
var ww = sp_page.surface_w;
|
||||||
|
var hh = 0;
|
||||||
|
|
||||||
|
var yl = _y;
|
||||||
|
var hg = line_get_height(f_p0, 16);
|
||||||
|
var hs = line_get_height(f_p1, 8);
|
||||||
|
|
||||||
|
for(var i = 0; i < array_length(page); i++) {
|
||||||
|
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
|
||||||
|
if(i == page_current) {
|
||||||
|
draw_sprite_stretched(THEME.ui_panel_bg, 0, 0, yl, ww, hg);
|
||||||
|
} else if(sHOVER && point_in_rectangle(_m[0], _m[1], 0, yl, ww, yl + hg)) {
|
||||||
|
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, yl, ww, hg, c_white, 0.75);
|
||||||
|
if(mouse_click(mb_left, sFOCUS))
|
||||||
|
page_current = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
draw_text_add(ui(8), yl + hg / 2, page[i]);
|
||||||
|
yl += hg;
|
||||||
|
hh += hg;
|
||||||
|
|
||||||
|
if(i == page_current && sections[i] != 0) {
|
||||||
|
for( var j = 0, m = array_length(sections[i]); j < m; j++ ) {
|
||||||
|
var sect = sections[i][j];
|
||||||
|
|
||||||
|
draw_set_text(f_p1, fa_left, fa_center, section_current == sect[0]? COLORS._main_text : COLORS._main_text_sub);
|
||||||
|
|
||||||
|
if(sHOVER && point_in_rectangle(_m[0], _m[1], 0, yl, ww, yl + hs - 1)) {
|
||||||
|
if(mouse_press(mb_left, sFOCUS))
|
||||||
|
sect[1].scroll_y_to = -sect[2];
|
||||||
|
|
||||||
|
draw_set_color(COLORS._main_text);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _xx = ui(8 + 16);
|
||||||
|
var sect_title = sect[0];
|
||||||
|
var sp = string_split(sect_title, " ");
|
||||||
|
if(sp[0] == "-") {
|
||||||
|
_xx += ui(16);
|
||||||
|
sect_title = string_replace(sect_title, "- ", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
draw_text_add(_xx, yl + hs / 2, sect_title);
|
||||||
|
|
||||||
|
yl += hs;
|
||||||
|
hh += hs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hh;
|
||||||
|
});
|
||||||
|
|
||||||
|
sp_page.always_scroll = true;
|
||||||
|
sp_page.show_scroll = false;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region general
|
#region general
|
||||||
|
@ -357,6 +417,7 @@ event_inherited();
|
||||||
var category = "";
|
var category = "";
|
||||||
|
|
||||||
var sect = [];
|
var sect = [];
|
||||||
|
var psect = "";
|
||||||
|
|
||||||
for( var i = 0, n = array_length(COLOR_KEYS); i < n; i++ ) {
|
for( var i = 0, n = array_length(COLOR_KEYS); i < n; i++ ) {
|
||||||
var key = COLOR_KEYS[i];
|
var key = COLOR_KEYS[i];
|
||||||
|
@ -373,11 +434,12 @@ event_inherited();
|
||||||
var _sect = string_title(category);
|
var _sect = string_title(category);
|
||||||
|
|
||||||
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_sub);
|
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_sub);
|
||||||
draw_text(ui(16), yy, _sect);
|
draw_text_add(ui(8), yy - ui(4), _sect);
|
||||||
|
|
||||||
array_push(sect, [ _sect, sp_colors, hh ]);
|
array_push(sect, [ _sect, sp_colors, hh + ui(12) ]);
|
||||||
if(yy > 0 && section_current == "")
|
if(yy >= 0 && section_current == "")
|
||||||
section_current = _sect;
|
section_current = psect;
|
||||||
|
psect = _sect;
|
||||||
|
|
||||||
yy += string_height(category) + ui(8);
|
yy += string_height(category) + ui(8);
|
||||||
hh += string_height(category) + ui(8);
|
hh += string_height(category) + ui(8);
|
||||||
|
@ -392,7 +454,7 @@ event_inherited();
|
||||||
keyStr = string_title(keyStr);
|
keyStr = string_title(keyStr);
|
||||||
|
|
||||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
||||||
draw_text(ui(8), yy + th / 2, keyStr);
|
draw_text_add(ui(24), yy + th / 2, keyStr);
|
||||||
|
|
||||||
var b = buttonInstant(THEME.button, cx, yy + ui(2), cw, ch, _m, sFOCUS, sHOVER && sp_colors.hover);
|
var b = buttonInstant(THEME.button, cx, yy + ui(2), cw, ch, _m, sFOCUS, sHOVER && sp_colors.hover);
|
||||||
draw_sprite_stretched_ext(THEME.color_picker_sample, 0, cx + ui(2), yy + ui(2 + 2), cw - ui(4), ch - ui(4), val, 1);
|
draw_sprite_stretched_ext(THEME.color_picker_sample, 0, cx + ui(2), yy + ui(2 + 2), cw - ui(4), ch - ui(4), val, 1);
|
||||||
|
@ -457,7 +519,8 @@ event_inherited();
|
||||||
|
|
||||||
var yy = _y + ui(8);
|
var yy = _y + ui(8);
|
||||||
var ind = 0;
|
var ind = 0;
|
||||||
var sect = [];
|
var sect = [];
|
||||||
|
var psect = "";
|
||||||
|
|
||||||
for( var i = 0, n = ds_list_size(pref_hot); i < n; i++ ) {
|
for( var i = 0, n = ds_list_size(pref_hot); i < n; i++ ) {
|
||||||
var _pref = pref_hot[| i];
|
var _pref = pref_hot[| i];
|
||||||
|
@ -475,7 +538,7 @@ event_inherited();
|
||||||
sp_hotkey.surface_w, th + padd * 2, COLORS.dialog_preference_prop_bg, 1);
|
sp_hotkey.surface_w, th + padd * 2, COLORS.dialog_preference_prop_bg, 1);
|
||||||
|
|
||||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||||
draw_text(ui(16), yy + hh, _pref[0]);
|
draw_text_add(ui(24), yy + hh, _pref[0]);
|
||||||
|
|
||||||
_pref[2].setFocusHover(sFOCUS, sHOVER && sp_hotkey.hover);
|
_pref[2].setFocusHover(sFOCUS, sHOVER && sp_hotkey.hover);
|
||||||
|
|
||||||
|
@ -513,11 +576,12 @@ event_inherited();
|
||||||
|
|
||||||
var _grp = group == ""? __txt("Global") : group;
|
var _grp = group == ""? __txt("Global") : group;
|
||||||
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_sub);
|
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_sub);
|
||||||
draw_text(ui(16), yy + hh, _grp);
|
draw_text_add(ui(8), yy + hh, _grp);
|
||||||
|
|
||||||
array_push(sect, [ _grp, sp_hotkey, hh ]);
|
array_push(sect, [ _grp, sp_hotkey, hh + ui(12) ]);
|
||||||
if(yy > 0 && section_current == "")
|
if(yy + hh >= 0 && section_current == "")
|
||||||
section_current = _grp;
|
section_current = psect;
|
||||||
|
psect = _grp;
|
||||||
|
|
||||||
hh += string_height("l") + ui(16);
|
hh += string_height("l") + ui(16);
|
||||||
currGroup = group;
|
currGroup = group;
|
||||||
|
@ -529,7 +593,7 @@ event_inherited();
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||||
draw_text(ui(16), yy + hh, name);
|
draw_text_add(ui(24), yy + hh, name);
|
||||||
|
|
||||||
var dk = key_get_name(key.key, key.modi);
|
var dk = key_get_name(key.key, key.modi);
|
||||||
var kw = string_width(dk);
|
var kw = string_width(dk);
|
||||||
|
@ -600,6 +664,8 @@ event_inherited();
|
||||||
if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, sFOCUS, sHOVER && sp_hotkey.hover, __txt("Reset"), THEME.refresh_s) == 2) {
|
if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, sFOCUS, sHOVER && sp_hotkey.hover, __txt("Reset"), THEME.refresh_s) == 2) {
|
||||||
key.key = dkey;
|
key.key = dkey;
|
||||||
key.modi = dmod;
|
key.modi = dmod;
|
||||||
|
|
||||||
|
PREF_SAVE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -607,22 +673,100 @@ event_inherited();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(modified) {
|
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_sub);
|
||||||
var bx = x1 - ui(32);
|
draw_text_add(ui(8), yy + hh, "Nodes (Single key only)");
|
||||||
var by = yy + ui(2);
|
array_push(sect, [ "Nodes", sp_hotkey, hh + ui(12) ]);
|
||||||
if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, sFOCUS, sHOVER && sp_hotkey.hover, __txt("Reset all"), THEME.refresh_s) == 2) {
|
hh += string_height("l") + ui(16);
|
||||||
for(var j = 0; j < ds_list_size(HOTKEY_CONTEXT); j++) {
|
|
||||||
var ll = HOTKEYS[? HOTKEY_CONTEXT[| j]];
|
var keys = struct_get_names(HOTKEYS_CUSTOM);
|
||||||
for(var i = 0; i < ds_list_size(ll); i++) {
|
for( var i = 0, n = array_length(keys); i < n; i++ ) {
|
||||||
var key = ll[| i];
|
var _key = keys[i];
|
||||||
key.key = key.dKey;
|
var hotkeys = struct_get_names(HOTKEYS_CUSTOM[$ _key]);
|
||||||
key.modi = key.dModi;
|
|
||||||
|
var _key_t = string_title(string_replace(_key, "Node_", ""));
|
||||||
|
|
||||||
|
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_sub);
|
||||||
|
draw_text_add(ui(8), yy + hh, _key_t);
|
||||||
|
array_push(sect, [ "- " + _key_t, sp_hotkey, hh + ui(12) ]);
|
||||||
|
if(yy + hh >= 0 && section_current == "")
|
||||||
|
section_current = psect;
|
||||||
|
psect = "- " + _key_t;
|
||||||
|
hh += string_height("l") + ui(16);
|
||||||
|
|
||||||
|
for( var j = 0, m = array_length(hotkeys); j < m; j++ ) {
|
||||||
|
var _hotkey = hotkeys[j];
|
||||||
|
var hotkey = HOTKEYS_CUSTOM[$ _key][$ _hotkey];
|
||||||
|
|
||||||
|
var name = __txt(_hotkey);
|
||||||
|
var pkey = hotkey.key;
|
||||||
|
if(pkey == "") pkey = "None";
|
||||||
|
|
||||||
|
if(j % 2 == 0)
|
||||||
|
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, yy + hh - padd, sp_hotkey.surface_w, th + padd * 2, COLORS.dialog_preference_prop_bg, 1);
|
||||||
|
|
||||||
|
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||||
|
draw_text_add(ui(24), yy + hh, name);
|
||||||
|
|
||||||
|
var kw = string_width(pkey);
|
||||||
|
var bx = key_x1 - ui(40) - kw;
|
||||||
|
var key = hotkey;
|
||||||
|
|
||||||
|
if(hk_editing == key) {
|
||||||
|
if(keyboard_check_pressed(vk_escape)) {
|
||||||
|
key.key = "";
|
||||||
|
PREF_SAVE();
|
||||||
|
} else if(keyboard_check_pressed(vk_anykey)) {
|
||||||
|
key.key = string_upper(keyboard_lastchar);
|
||||||
|
PREF_SAVE();
|
||||||
|
}
|
||||||
|
|
||||||
|
draw_sprite_stretched(THEME.button_hide, 2, key_x1 - ui(40) - kw, yy + hh - ui(6), kw + ui(32), th + ui(12));
|
||||||
|
} else {
|
||||||
|
var bx = key_x1 - ui(40) - kw;
|
||||||
|
var by = yy + hh - ui(6);
|
||||||
|
if(buttonInstant(THEME.button_hide, bx, by, kw + ui(32), th + ui(12), _m, sFOCUS, sHOVER && sp_hotkey.hover) == 2) {
|
||||||
|
hk_editing = key;
|
||||||
|
keyboard_lastchar = pkey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var cc = (hotkey.key == "")? COLORS._main_text_sub : COLORS._main_text;
|
||||||
|
if(hk_editing == key) cc = COLORS._main_text_accent;
|
||||||
|
|
||||||
|
draw_set_text(f_p0, fa_right, fa_top, cc);
|
||||||
|
draw_text(key_x1 - ui(24), yy + hh, pkey);
|
||||||
|
|
||||||
|
if(key.key != key.dkey) {
|
||||||
|
modified = true;
|
||||||
|
var bx = x1 - ui(32);
|
||||||
|
var by = yy + hh;
|
||||||
|
if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, sFOCUS, sHOVER && sp_hotkey.hover, __txt("Reset"), THEME.refresh_s) == 2) {
|
||||||
|
key.key = key.dkey;
|
||||||
|
|
||||||
|
PREF_SAVE();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hh += th + padd * 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if(modified) {
|
||||||
|
// var bx = x1 - ui(32);
|
||||||
|
// var by = yy + ui(2);
|
||||||
|
// if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, sFOCUS, sHOVER && sp_hotkey.hover, __txt("Reset all"), THEME.refresh_s) == 2) {
|
||||||
|
// for(var j = 0; j < ds_list_size(HOTKEY_CONTEXT); j++) {
|
||||||
|
// var ll = HOTKEYS[? HOTKEY_CONTEXT[| j]];
|
||||||
|
// for(var i = 0; i < ds_list_size(ll); i++) {
|
||||||
|
// var key = ll[| i];
|
||||||
|
// key.key = key.dKey;
|
||||||
|
// key.modi = key.dModi;
|
||||||
|
|
||||||
|
// PREF_SAVE();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
sections[3] = sect;
|
sections[3] = sect;
|
||||||
|
|
||||||
|
|
|
@ -17,44 +17,8 @@ if !ready exit;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region page
|
#region page
|
||||||
var xx = dialog_x + ui(padding + 8);
|
sp_page.setFocusHover(sFOCUS, sHOVER);
|
||||||
var yy = dialog_y + ui(title_height);
|
sp_page.draw(dialog_x + ui(padding), dialog_y + ui(title_height));
|
||||||
var yl = yy - ui(8);
|
|
||||||
var hg = line_get_height(f_p0, 16);
|
|
||||||
var hs = line_get_height(f_p1, 8);
|
|
||||||
|
|
||||||
for(var i = 0; i < array_length(page); i++) {
|
|
||||||
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
|
|
||||||
if(i == page_current) {
|
|
||||||
draw_sprite_stretched(THEME.ui_panel_bg, 0, dialog_x + ui(padding) - ui(8), yl, page_width + ui(8), hg);
|
|
||||||
} else if(sHOVER && point_in_rectangle(mouse_mx, mouse_my, dialog_x, yl, dialog_x + page_width + ui(padding + 8), yl + hg)) {
|
|
||||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, dialog_x + ui(padding) - ui(8), yl, page_width + ui(8), hg, c_white, 0.5);
|
|
||||||
if(mouse_click(mb_left, sFOCUS))
|
|
||||||
page_current = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
draw_text(xx, yl + hg / 2, page[i]);
|
|
||||||
yl += hg;
|
|
||||||
|
|
||||||
if(i == page_current && sections[i] != 0) {
|
|
||||||
for( var j = 0, m = array_length(sections[i]); j < m; j++ ) {
|
|
||||||
var sect = sections[i][j];
|
|
||||||
|
|
||||||
draw_set_text(f_p1, fa_left, fa_center, section_current == sect[0]? COLORS._main_text : COLORS._main_text_sub);
|
|
||||||
|
|
||||||
if(sHOVER && point_in_rectangle(mouse_mx, mouse_my, dialog_x, yl, dialog_x + page_width + ui(padding + 8), yl + hs - 1)) {
|
|
||||||
if(mouse_press(mb_left, sFOCUS))
|
|
||||||
sect[1].scroll_y_to = -sect[2];
|
|
||||||
|
|
||||||
draw_set_color(COLORS._main_text);
|
|
||||||
}
|
|
||||||
|
|
||||||
draw_text(xx + ui(16), yl + hs / 2, sect[0]);
|
|
||||||
|
|
||||||
yl += hs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region draw
|
#region draw
|
||||||
|
@ -89,7 +53,7 @@ if !ready exit;
|
||||||
var _x = dialog_x + dialog_w - ui(8);
|
var _x = dialog_x + dialog_w - ui(8);
|
||||||
var bx = _x - ui(48);
|
var bx = _x - ui(48);
|
||||||
var _txt = __txtx("pref_reset_color", "Reset colors");
|
var _txt = __txtx("pref_reset_color", "Reset colors");
|
||||||
var b = buttonInstant(THEME.button_hide, bx, yy, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, _txt, THEME.refresh);
|
var b = buttonInstant(THEME.button_hide, bx, py, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, _txt, THEME.refresh);
|
||||||
if(b == 2) {
|
if(b == 2) {
|
||||||
var path = DIRECTORY + "themes/" + PREF_MAP[? "theme"] + "/override.json";
|
var path = DIRECTORY + "themes/" + PREF_MAP[? "theme"] + "/override.json";
|
||||||
if(file_exists(path)) file_delete(path);
|
if(file_exists(path)) file_delete(path);
|
||||||
|
@ -100,9 +64,9 @@ if !ready exit;
|
||||||
var x2 = _x - ui(32);
|
var x2 = _x - ui(32);
|
||||||
|
|
||||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
||||||
draw_text(x1 + ui(8), yy + _h / 2, __txt("Theme"));
|
draw_text(x1 + ui(8), py + _h / 2, __txt("Theme"));
|
||||||
sb_theme.setFocusHover(sFOCUS, sHOVER);
|
sb_theme.setFocusHover(sFOCUS, sHOVER);
|
||||||
sb_theme.draw(x2 - ui(24) - _w, yy, _w, _h, PREF_MAP[? "theme"]);
|
sb_theme.draw(x2 - ui(24) - _w, py, _w, _h, PREF_MAP[? "theme"]);
|
||||||
|
|
||||||
sp_colors.setFocusHover(sFOCUS, sHOVER);
|
sp_colors.setFocusHover(sFOCUS, sHOVER);
|
||||||
sp_colors.draw(px, py + ui(40));
|
sp_colors.draw(px, py + ui(40));
|
||||||
|
|
|
@ -39,9 +39,9 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ---- tools ----
|
#region ---- tools ----
|
||||||
tool_pos = new NodeTool( "Transform", THEME.tools_3d_transform );
|
tool_pos = new NodeTool( "Transform", THEME.tools_3d_transform, "Node_3D_Object" );
|
||||||
tool_rot = new NodeTool( "Rotate", THEME.tools_3d_rotate );
|
tool_rot = new NodeTool( "Rotate", THEME.tools_3d_rotate, "Node_3D_Object" );
|
||||||
tool_sca = new NodeTool( "Scale", THEME.tools_3d_scale );
|
tool_sca = new NodeTool( "Scale", THEME.tools_3d_scale, "Node_3D_Object" );
|
||||||
tools = [ tool_pos, tool_rot, tool_sca ];
|
tools = [ tool_pos, tool_rot, tool_sca ];
|
||||||
|
|
||||||
tool_axis_edit = new scrollBox([ "local", "global" ], function(val) { tool_attribute.context = val; });
|
tool_axis_edit = new scrollBox([ "local", "global" ], function(val) { tool_attribute.context = val; });
|
||||||
|
|
|
@ -8,13 +8,58 @@
|
||||||
"Rectangle": new hotkeySimple("N"),
|
"Rectangle": new hotkeySimple("N"),
|
||||||
"Ellipse": new hotkeySimple("M"),
|
"Ellipse": new hotkeySimple("M"),
|
||||||
"Fill": new hotkeySimple("F"),
|
"Fill": new hotkeySimple("F"),
|
||||||
}
|
},
|
||||||
|
"Node_Mesh_Warp": {
|
||||||
|
"Edit control point": new hotkeySimple("V"),
|
||||||
|
"Pin mesh": new hotkeySimple("P"),
|
||||||
|
"Mesh edit": new hotkeySimple("M"),
|
||||||
|
"Anchor remove": new hotkeySimple("E"),
|
||||||
|
},
|
||||||
|
"Node_Armature": {
|
||||||
|
"Move": new hotkeySimple("V"),
|
||||||
|
"Scale": new hotkeySimple("S"),
|
||||||
|
"Add bones": new hotkeySimple("A"),
|
||||||
|
"Remove bones": new hotkeySimple("E"),
|
||||||
|
"Detach bones": new hotkeySimple("D"),
|
||||||
|
"IK": new hotkeySimple("K"),
|
||||||
|
},
|
||||||
|
"Node_Path": {
|
||||||
|
"Transform": new hotkeySimple("T"),
|
||||||
|
"Anchor add / remove": new hotkeySimple("A"),
|
||||||
|
"Edit Control point": new hotkeySimple("C"),
|
||||||
|
"Draw path": new hotkeySimple("B"),
|
||||||
|
"Rectangle path": new hotkeySimple("N"),
|
||||||
|
"Circle path": new hotkeySimple("M"),
|
||||||
|
},
|
||||||
|
"Node_Rigid_Object": {
|
||||||
|
"Mesh edit": new hotkeySimple("A"),
|
||||||
|
"Anchor remove": new hotkeySimple("E"),
|
||||||
|
},
|
||||||
|
"Node_Strand_Create": {
|
||||||
|
"Push": new hotkeySimple("P"),
|
||||||
|
"Comb": new hotkeySimple("C"),
|
||||||
|
"Stretch": new hotkeySimple("S"),
|
||||||
|
"Shorten": new hotkeySimple("D"),
|
||||||
|
"Grab": new hotkeySimple("G"),
|
||||||
|
},
|
||||||
|
"Node_Path_Anchor": {
|
||||||
|
"Adjust control point": new hotkeySimple("A"),
|
||||||
|
},
|
||||||
|
"Node_3D_Object": {
|
||||||
|
"Transform": new hotkeySimple("G"),
|
||||||
|
"Rotate": new hotkeySimple("R"),
|
||||||
|
"Scale": new hotkeySimple("S"),
|
||||||
|
},
|
||||||
|
"Node_3D_Camera": {
|
||||||
|
"Move Target": new hotkeySimple("T"),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region hotkeys
|
#region hotkeys
|
||||||
function hotkeySimple(_key) constructor {
|
function hotkeySimple(_key) constructor {
|
||||||
self.key = _key;
|
self.key = _key;
|
||||||
|
dkey = _key;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hotkeyObject(_context, _name, _key, _mod = MOD_KEY.none, _action = noone) constructor {
|
function hotkeyObject(_context, _name, _key, _mod = MOD_KEY.none, _action = noone) constructor {
|
||||||
|
@ -76,9 +121,10 @@
|
||||||
function getHotkey(_group, _key, _def = "") {
|
function getHotkey(_group, _key, _def = "") {
|
||||||
gml_pragma("forceinline");
|
gml_pragma("forceinline");
|
||||||
|
|
||||||
if(!struct_has(HOTKEYS_CUSTOM, _group)) return def;
|
if(!struct_has(HOTKEYS_CUSTOM, _group)) return _def;
|
||||||
|
|
||||||
var _grp = HOTKEYS_CUSTOM[$ _group];
|
var _grp = HOTKEYS_CUSTOM[$ _group];
|
||||||
return struct_try_get(_grp, _key, _def);
|
if(!struct_has(_grp, _key)) return _def;
|
||||||
|
return _grp[$ _key].key;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
|
@ -408,7 +408,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
||||||
|
|
||||||
mouse_holding = false;
|
mouse_holding = false;
|
||||||
|
|
||||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||||
mouse_cur_x = round((_mx - _x) / _s - 0.5);
|
mouse_cur_x = round((_mx - _x) / _s - 0.5);
|
||||||
mouse_cur_y = round((_my - _y) / _s - 0.5);
|
mouse_cur_y = round((_my - _y) / _s - 0.5);
|
||||||
|
|
||||||
|
@ -758,9 +758,9 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
||||||
draw_rectangle(_x0, _y0, _x1 - 1, _y1 - 1, true);
|
draw_rectangle(_x0, _y0, _x1 - 1, _y1 - 1, true);
|
||||||
|
|
||||||
previewing = 1;
|
previewing = 1;
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
static update = function(frame = PROJECT.animator.current_frame) {
|
static update = function(frame = PROJECT.animator.current_frame) { #region
|
||||||
var _dim = getInputData(0);
|
var _dim = getInputData(0);
|
||||||
var _bg = getInputData(8);
|
var _bg = getInputData(8);
|
||||||
var _bga = getInputData(9);
|
var _bga = getInputData(9);
|
||||||
|
@ -779,17 +779,17 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
||||||
surface_reset_shader();
|
surface_reset_shader();
|
||||||
|
|
||||||
outputs[| 0].setValue(_outSurf);
|
outputs[| 0].setValue(_outSurf);
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
static doSerialize = function(_map) {
|
static doSerialize = function(_map) { #region
|
||||||
surface_store_buffer();
|
surface_store_buffer();
|
||||||
var comp = buffer_compress(canvas_buffer, 0, buffer_get_size(canvas_buffer));
|
var comp = buffer_compress(canvas_buffer, 0, buffer_get_size(canvas_buffer));
|
||||||
var enc = buffer_base64_encode(comp, 0, buffer_get_size(comp));
|
var enc = buffer_base64_encode(comp, 0, buffer_get_size(comp));
|
||||||
|
|
||||||
_map.surface = enc;
|
_map.surface = enc;
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
static doApplyDeserialize = function() {
|
static doApplyDeserialize = function() { #region
|
||||||
if(!struct_has(load_map, "surface")) return;
|
if(!struct_has(load_map, "surface")) return;
|
||||||
var buff = buffer_base64_decode(load_map.surface);
|
var buff = buffer_base64_decode(load_map.surface);
|
||||||
canvas_buffer = buffer_decompress(buff);
|
canvas_buffer = buffer_decompress(buff);
|
||||||
|
@ -800,9 +800,9 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
||||||
canvas_surface = surface_create_from_buffer(_dim[0], _dim[1], canvas_buffer);
|
canvas_surface = surface_create_from_buffer(_dim[0], _dim[1], canvas_buffer);
|
||||||
|
|
||||||
apply_surface();
|
apply_surface();
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
static onCleanUp = function() {
|
static onCleanUp = function() { #region
|
||||||
surface_free(canvas_surface);
|
surface_free(canvas_surface);
|
||||||
}
|
} #endregion
|
||||||
}
|
}
|
|
@ -1278,10 +1278,10 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var _tool = PANEL_PREVIEW.tool_current;
|
var _tool = PANEL_PREVIEW.tool_current;
|
||||||
if(_tool == noone)
|
if(_tool == noone) //not using any tool
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(index == undefined)
|
if(index == undefined) //using any tool
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(is_real(index) && _tool != tools[index])
|
if(is_real(index) && _tool != tools[index])
|
||||||
|
|
|
@ -49,7 +49,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
|
|
||||||
tools = [
|
tools = [
|
||||||
new NodeTool( "Transform", THEME.path_tools_transform ),
|
new NodeTool( "Transform", THEME.path_tools_transform ),
|
||||||
new NodeTool( "Anchor add / remove (+ Shift)", THEME.path_tools_add ),
|
new NodeTool( "Anchor add / remove", THEME.path_tools_add ),
|
||||||
new NodeTool( "Edit Control point", THEME.path_tools_anchor ),
|
new NodeTool( "Edit Control point", THEME.path_tools_anchor ),
|
||||||
tool_pathDrawer,
|
tool_pathDrawer,
|
||||||
new NodeTool( "Rectangle path", THEME.path_tools_rectangle ),
|
new NodeTool( "Rectangle path", THEME.path_tools_rectangle ),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function NodeTool(name, spr) constructor {
|
function NodeTool(name, spr, context = instanceof(other)) constructor {
|
||||||
node = other;
|
ctx = context;
|
||||||
self.name = name;
|
self.name = name;
|
||||||
self.spr = spr;
|
self.spr = spr;
|
||||||
|
|
||||||
|
@ -11,13 +11,17 @@ function NodeTool(name, spr) constructor {
|
||||||
static checkHotkey = function() {
|
static checkHotkey = function() {
|
||||||
gml_pragma("forceinline");
|
gml_pragma("forceinline");
|
||||||
|
|
||||||
return getHotkey(instanceof(node), name);
|
return getHotkey(ctx, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static getName = function(index = 0) {
|
static getName = function(index = 0) {
|
||||||
|
return is_array(name)? array_safe_get(name, index, "") : name;
|
||||||
|
}
|
||||||
|
|
||||||
|
static getDisplayName = function(index = 0) {
|
||||||
var _key = checkHotkey();
|
var _key = checkHotkey();
|
||||||
|
|
||||||
var _nme = is_array(name)? array_safe_get(name, index, "") : name;
|
var _nme = getName(index);
|
||||||
if(_key != "") _nme += $" ({_key})";
|
if(_key != "") _nme += $" ({_key})";
|
||||||
|
|
||||||
return _nme;
|
return _nme;
|
||||||
|
|
|
@ -57,8 +57,9 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
_preview_sequence = preview_sequence;
|
_preview_sequence = preview_sequence;
|
||||||
preview_rate = 10;
|
preview_rate = 10;
|
||||||
|
|
||||||
right_menu_y = 8;
|
right_menu_y = 8;
|
||||||
mouse_on_preview = false;
|
mouse_on_preview = 0;
|
||||||
|
_mouse_on_preview = 0;
|
||||||
|
|
||||||
resetViewOnDoubleClick = true;
|
resetViewOnDoubleClick = true;
|
||||||
|
|
||||||
|
@ -1003,7 +1004,7 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
var _xx = tool_side_drawing * ui(40);
|
var _xx = tool_side_drawing * ui(40);
|
||||||
var xx = _xx + preview_x + ui(8);
|
var xx = _xx + preview_x + ui(8);
|
||||||
var yy = h - toolbar_height - prev_size - ui(8);
|
var yy = h - toolbar_height - prev_size - ui(8);
|
||||||
if(my > yy) mouse_on_preview = false;
|
if(my > yy) mouse_on_preview = 0;
|
||||||
var hoverable = pHOVER && point_in_rectangle(mx, my, _xx, ui(32), w, h - toolbar_height);
|
var hoverable = pHOVER && point_in_rectangle(mx, my, _xx, ui(32), w, h - toolbar_height);
|
||||||
|
|
||||||
for(var i = 0; i < array_length(pseq); i++) {
|
for(var i = 0; i < array_length(pseq); i++) {
|
||||||
|
@ -1070,7 +1071,7 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
function drawNodeTools(active, _node) { #region
|
function drawNodeTools(active, _node) { #region
|
||||||
var _mx = mx;
|
var _mx = mx;
|
||||||
var _my = my;
|
var _my = my;
|
||||||
var isHover = pHOVER && mouse_on_preview;
|
var isHover = pHOVER && mouse_on_preview == 1;
|
||||||
var tool_width = ui(40);
|
var tool_width = ui(40);
|
||||||
var tool_size = ui(32);
|
var tool_size = ui(32);
|
||||||
|
|
||||||
|
@ -1082,7 +1083,7 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
|
|
||||||
if(_node.tools != -1 && point_in_rectangle(_mx, _my, 0, 0, tool_width, h)) {
|
if(_node.tools != -1 && point_in_rectangle(_mx, _my, 0, 0, tool_width, h)) {
|
||||||
isHover = false;
|
isHover = false;
|
||||||
mouse_on_preview = false;
|
mouse_on_preview = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var overlayHover = tool_hovering == noone;
|
var overlayHover = tool_hovering == noone;
|
||||||
|
@ -1152,7 +1153,7 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
var _sy1 = _syy + tool_size / 2;
|
var _sy1 = _syy + tool_size / 2;
|
||||||
|
|
||||||
if(point_in_rectangle(_mx, _my, _sx0, _sy0 + 1, _sx1, _sy1 - 1)) {
|
if(point_in_rectangle(_mx, _my, _sx0, _sy0 + 1, _sx1, _sy1 - 1)) {
|
||||||
TOOLTIP = tool.getName(j);
|
TOOLTIP = tool.getDisplayName(j);
|
||||||
draw_sprite_stretched(THEME.button_hide, 1, _sx0 + pd, _sy0 + pd, tool_size - pd * 2, tool_size - pd * 2);
|
draw_sprite_stretched(THEME.button_hide, 1, _sx0 + pd, _sy0 + pd, tool_size - pd * 2, tool_size - pd * 2);
|
||||||
|
|
||||||
if(mouse_press(mb_left, pFOCUS))
|
if(mouse_press(mb_left, pFOCUS))
|
||||||
|
@ -1173,7 +1174,7 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
} else { #region single tools
|
} else { #region single tools
|
||||||
if(tool_hovering == tool) {
|
if(tool_hovering == tool) {
|
||||||
draw_sprite_stretched(THEME.button_hide, 1, _x0 + pd, _y0 + pd, tool_size - pd * 2, tool_size - pd * 2);
|
draw_sprite_stretched(THEME.button_hide, 1, _x0 + pd, _y0 + pd, tool_size - pd * 2, tool_size - pd * 2);
|
||||||
TOOLTIP = tool.getName();
|
TOOLTIP = tool.getDisplayName();
|
||||||
|
|
||||||
if(mouse_press(mb_left, pFOCUS))
|
if(mouse_press(mb_left, pFOCUS))
|
||||||
tool.toggle();
|
tool.toggle();
|
||||||
|
@ -1387,6 +1388,7 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
|
|
||||||
function drawContent(panel) { #region >>>>>>>>>>>>>>>>>>>> MAIN DRAW <<<<<<<<<<<<<<<<<<<<
|
function drawContent(panel) { #region >>>>>>>>>>>>>>>>>>>> MAIN DRAW <<<<<<<<<<<<<<<<<<<<
|
||||||
mouse_on_preview = pHOVER && point_in_rectangle(mx, my, 0, toolbar_height, w, h - toolbar_height);
|
mouse_on_preview = pHOVER && point_in_rectangle(mx, my, 0, toolbar_height, w, h - toolbar_height);
|
||||||
|
|
||||||
var _prev_node = getNodePreview();
|
var _prev_node = getNodePreview();
|
||||||
|
|
||||||
d3_active = _prev_node != noone && _prev_node.is_3D;
|
d3_active = _prev_node != noone && _prev_node.is_3D;
|
||||||
|
@ -1422,9 +1424,10 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
var tool = noone;
|
var tool = noone;
|
||||||
if(inspect_node) {
|
if(inspect_node) {
|
||||||
tool = inspect_node.getTool();
|
tool = inspect_node.getTool();
|
||||||
if(tool) drawNodeTools(pFOCUS, tool);
|
if(tool) drawNodeTools(_mouse_on_preview, tool);
|
||||||
} else
|
} else
|
||||||
tool_current = noone;
|
tool_current = noone;
|
||||||
|
_mouse_on_preview = pFOCUS;
|
||||||
|
|
||||||
if(do_fullView) {
|
if(do_fullView) {
|
||||||
do_fullView = false;
|
do_fullView = false;
|
||||||
|
|
|
@ -167,6 +167,8 @@
|
||||||
|
|
||||||
json_save_struct(DIRECTORY + "Nodes/fav.json", global.FAV_NODES);
|
json_save_struct(DIRECTORY + "Nodes/fav.json", global.FAV_NODES);
|
||||||
json_save_struct(DIRECTORY + "Nodes/recent.json", global.RECENT_NODES);
|
json_save_struct(DIRECTORY + "Nodes/recent.json", global.RECENT_NODES);
|
||||||
|
|
||||||
|
json_save_struct(DIRECTORY + "key_nodes.json", HOTKEYS_CUSTOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
function PREF_LOAD() {
|
function PREF_LOAD() {
|
||||||
|
@ -197,6 +199,9 @@
|
||||||
|
|
||||||
if(!directory_exists(DIRECTORY + "Themes/" + PREF_MAP[? "theme"]))
|
if(!directory_exists(DIRECTORY + "Themes/" + PREF_MAP[? "theme"]))
|
||||||
PREF_MAP[? "theme"] = "default";
|
PREF_MAP[? "theme"] = "default";
|
||||||
|
|
||||||
|
var f = json_load_struct(DIRECTORY + "key_nodes.json");
|
||||||
|
struct_override(HOTKEYS_CUSTOM, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
function PREF_APPLY() {
|
function PREF_APPLY() {
|
||||||
|
|
|
@ -16,6 +16,7 @@ function scrollPane(_w, _h, ondraw) : widget() constructor {
|
||||||
content_h = 0;
|
content_h = 0;
|
||||||
is_scroll = true;
|
is_scroll = true;
|
||||||
always_scroll = false;
|
always_scroll = false;
|
||||||
|
show_scroll = true;
|
||||||
|
|
||||||
scroll_step = 64;
|
scroll_step = 64;
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ function scrollPane(_w, _h, ondraw) : widget() constructor {
|
||||||
if(mouse_wheel_up()) scroll_y_to += scroll_step * SCROLL_SPEED;
|
if(mouse_wheel_up()) scroll_y_to += scroll_step * SCROLL_SPEED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(abs(content_h) > 0 || always_scroll) {
|
if(show_scroll && (abs(content_h) > 0 || always_scroll)) {
|
||||||
var scr_w = sprite_get_width(THEME.ui_scrollbar);
|
var scr_w = sprite_get_width(THEME.ui_scrollbar);
|
||||||
draw_scroll(x + w - scr_w, y + ui(6), true, surface_h - ui(12), -scroll_y / content_h, surface_h / (surface_h + content_h),
|
draw_scroll(x + w - scr_w, y + ui(6), true, surface_h - ui(12), -scroll_y / content_h, surface_h / (surface_h + content_h),
|
||||||
COLORS.scrollbar_bg, COLORS.scrollbar_idle, COLORS.scrollbar_hover, x + _mx, y + _my);
|
COLORS.scrollbar_bg, COLORS.scrollbar_idle, COLORS.scrollbar_hover, x + _mx, y + _my);
|
||||||
|
|
|
@ -30,6 +30,7 @@ function string_splice(str, delim = " ", keep = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function string_title(str) {
|
function string_title(str) {
|
||||||
|
str = string_replace_all(str, "_", " ");
|
||||||
var ch = string_char_at(str, 1);
|
var ch = string_char_at(str, 1);
|
||||||
ch = string_upper(ch);
|
ch = string_upper(ch);
|
||||||
var rs = string_copy(str, 2, string_length(str) - 1);
|
var rs = string_copy(str, 2, string_length(str) - 1);
|
||||||
|
|
Loading…
Reference in a new issue