mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-23 03:18:03 +01:00
context menu hotkey
This commit is contained in:
parent
3c165588d3
commit
5644cffee8
86 changed files with 1614 additions and 1302 deletions
|
@ -1171,6 +1171,7 @@
|
|||
{"name":"node_value_palette","order":2,"path":"scripts/node_value_palette/node_value_palette.yy",},
|
||||
{"name":"node_value_particle","order":4,"path":"scripts/node_value_particle/node_value_particle.yy",},
|
||||
{"name":"node_value_path_anchor","order":18,"path":"scripts/node_value_path_anchor/node_value_path_anchor.yy",},
|
||||
{"name":"node_value_path","order":34,"path":"scripts/node_value_path/node_value_path.yy",},
|
||||
{"name":"node_value_pathnode","order":5,"path":"scripts/node_value_pathnode/node_value_pathnode.yy",},
|
||||
{"name":"node_value_quarterion","order":19,"path":"scripts/node_value_quarterion/node_value_quarterion.yy",},
|
||||
{"name":"node_value_range","order":2,"path":"scripts/node_value_range/node_value_range.yy",},
|
||||
|
|
|
@ -1777,6 +1777,7 @@
|
|||
{"id":{"name":"node_value_palette","path":"scripts/node_value_palette/node_value_palette.yy",},},
|
||||
{"id":{"name":"node_value_particle","path":"scripts/node_value_particle/node_value_particle.yy",},},
|
||||
{"id":{"name":"node_value_path_anchor","path":"scripts/node_value_path_anchor/node_value_path_anchor.yy",},},
|
||||
{"id":{"name":"node_value_path","path":"scripts/node_value_path/node_value_path.yy",},},
|
||||
{"id":{"name":"node_value_pathnode","path":"scripts/node_value_pathnode/node_value_pathnode.yy",},},
|
||||
{"id":{"name":"node_value_quarterion","path":"scripts/node_value_quarterion/node_value_quarterion.yy",},},
|
||||
{"id":{"name":"node_value_range","path":"scripts/node_value_range/node_value_range.yy",},},
|
||||
|
|
|
@ -12,8 +12,8 @@ event_inherited();
|
|||
show_graph = false;
|
||||
|
||||
menu = [
|
||||
menuItem("Toggle double click bar", function() /*=>*/ { show_doubleclick = !show_doubleclick; }),
|
||||
menuItem("Toggle graph", function() /*=>*/ { show_graph = !show_graph; }),
|
||||
menuItemAction("Toggle double click bar", function() /*=>*/ { show_doubleclick = !show_doubleclick; }),
|
||||
menuItemAction("Toggle graph", function() /*=>*/ { show_graph = !show_graph; }),
|
||||
];
|
||||
|
||||
extra_keys = [
|
||||
|
|
|
@ -60,21 +60,25 @@ event_inherited();
|
|||
category_width = maxLen + ui(56);
|
||||
#endregion
|
||||
|
||||
function trigger_favourite() {
|
||||
if(node_menu_selecting == noone) return;
|
||||
|
||||
var _node = node_menu_selecting.node;
|
||||
if(!is_array(global.FAV_NODES)) global.FAV_NODES = [];
|
||||
|
||||
if(array_exists(global.FAV_NODES, _node)) array_remove(global.FAV_NODES, _node);
|
||||
else array_push(global.FAV_NODES, _node);
|
||||
}
|
||||
|
||||
registerFunction("Add Node", "Trigger Favourite", "", MOD_KEY.none, trigger_favourite);
|
||||
|
||||
function rightClick(node) {
|
||||
if(!is_instanceof(node, NodeObject)) return;
|
||||
|
||||
node_menu_selecting = node;
|
||||
var fav = array_exists(global.FAV_NODES, node.node);
|
||||
var menu = [
|
||||
menuItem(fav? __txtx("add_node_remove_favourite", "Remove from favourite") : __txtx("add_node_add_favourite", "Add to favourite"),
|
||||
function() {
|
||||
if(!is_array(global.FAV_NODES)) global.FAV_NODES = [];
|
||||
|
||||
if(array_exists(global.FAV_NODES, node_menu_selecting.node))
|
||||
array_remove(global.FAV_NODES, node_menu_selecting.node);
|
||||
else
|
||||
array_push(global.FAV_NODES, node_menu_selecting.node);
|
||||
}, THEME.star)
|
||||
menuItemAction(fav? __txtx("add_node_remove_favourite", "Remove from favourite") : __txtx("add_node_add_favourite", "Add to favourite"), trigger_favourite, THEME.star)
|
||||
];
|
||||
|
||||
menuCall("add_node_window_manu",,, menu,, node_menu_selecting);
|
||||
|
|
|
@ -101,10 +101,10 @@ event_inherited();
|
|||
hovering = pal;
|
||||
|
||||
menuCall("palette_window_preset_menu",,, [
|
||||
menuItem(__txtx("palette_editor_set_default", "Set as default"), function() {
|
||||
menuItemAction(__txtx("palette_editor_set_default", "Set as default"), function() {
|
||||
PROJECT.setPalette(array_clone(hovering.palette));
|
||||
}),
|
||||
menuItem(__txtx("palette_editor_delete", "Delete palette"), function() {
|
||||
menuItemAction(__txtx("palette_editor_delete", "Delete palette"), function() {
|
||||
file_delete(hovering.path);
|
||||
__initPalette();
|
||||
}),
|
||||
|
|
|
@ -138,7 +138,7 @@ event_inherited();
|
|||
if(mouse_press(mb_right, interactable && sFOCUS)) {
|
||||
hovering_name = _gradient.path;
|
||||
menuCall("gradient_window_preset_menu",,, [
|
||||
menuItem(__txtx("gradient_editor_delete", "Delete gradient"), function() {
|
||||
menuItemAction(__txtx("gradient_editor_delete", "Delete gradient"), function() {
|
||||
file_delete(hovering_name);
|
||||
__initGradient();
|
||||
})
|
||||
|
@ -227,7 +227,7 @@ event_inherited();
|
|||
hovering = pal;
|
||||
|
||||
menuCall("palette_window_preset_menu",,, [
|
||||
menuItem(__txtx("gradient_set_palette", "Convert to Gradient"), function() {
|
||||
menuItemAction(__txtx("gradient_set_palette", "Convert to Gradient"), function() {
|
||||
var _p = hovering.palette;
|
||||
if(array_length(_p) < 2) return;
|
||||
|
||||
|
|
|
@ -100,11 +100,11 @@ if !ready exit;
|
|||
|
||||
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, __txtx("gradient_editor_key_blend", "Key blending"), THEME.grad_blend) == 2) {
|
||||
menuCall("gradient_window_blend_menu", bx + ui(32), by, [
|
||||
menuItem(__txtx("gradient_editor_blend_hard", "Solid"), function() { gradient.type = 1; onApply(gradient); }),
|
||||
menuItem(__txtx("gradient_editor_blend_RGB", "RGB"), function() { gradient.type = 0; onApply(gradient); }),
|
||||
menuItem(__txtx("gradient_editor_blend_sRGB", "sRGB"), function() { gradient.type = 4; onApply(gradient); }),
|
||||
menuItem(__txtx("gradient_editor_blend_HSV", "HSV"), function() { gradient.type = 2; onApply(gradient); }),
|
||||
menuItem(__txtx("gradient_editor_blend_OKLAB", "OKLAB"), function() { gradient.type = 3; onApply(gradient); }),
|
||||
menuItemAction(__txtx("gradient_editor_blend_hard", "Solid"), function() { gradient.type = 1; onApply(gradient); }),
|
||||
menuItemAction(__txtx("gradient_editor_blend_RGB", "RGB"), function() { gradient.type = 0; onApply(gradient); }),
|
||||
menuItemAction(__txtx("gradient_editor_blend_sRGB", "sRGB"), function() { gradient.type = 4; onApply(gradient); }),
|
||||
menuItemAction(__txtx("gradient_editor_blend_HSV", "HSV"), function() { gradient.type = 2; onApply(gradient); }),
|
||||
menuItemAction(__txtx("gradient_editor_blend_OKLAB", "OKLAB"), function() { gradient.type = 3; onApply(gradient); }),
|
||||
],, gradient);
|
||||
}
|
||||
bx -= ui(32);
|
||||
|
|
|
@ -112,7 +112,7 @@ event_inherited();
|
|||
|
||||
if(menu > -1) {
|
||||
menuCall("image_array_edit_menu",,, [
|
||||
menuItem(__txt("Remove"), function() {
|
||||
menuItemAction(__txt("Remove"), function() {
|
||||
var arr = target.getValue();
|
||||
array_delete(arr, menuOn, 1);
|
||||
|
||||
|
|
|
@ -2,17 +2,15 @@
|
|||
event_inherited();
|
||||
|
||||
#region data
|
||||
menu_id = "";
|
||||
|
||||
destroy_on_click_out = false;
|
||||
draggable = false;
|
||||
mouse_inside = false;
|
||||
mouse_init_inside = false;
|
||||
selecting = -1;
|
||||
|
||||
menu_id = "";
|
||||
alarm[0] = -1;
|
||||
menu = 1;
|
||||
hght = ui(36);
|
||||
|
||||
tooltips = [];
|
||||
show_icon = false;
|
||||
context = noone;
|
||||
|
@ -22,6 +20,10 @@ event_inherited();
|
|||
|
||||
setFocus(self.id);
|
||||
|
||||
remove_parents = true;
|
||||
selecting_menu = noone;
|
||||
hk_editing = noone;
|
||||
|
||||
function setMenu(_menu, align = fa_left) {
|
||||
with(_p_dialog) { if(on_top) continue; other.depth = min(depth - 1, other.depth); }
|
||||
|
||||
|
@ -45,6 +47,13 @@ event_inherited();
|
|||
continue;
|
||||
}
|
||||
|
||||
if(is_string(_menuItem)) {
|
||||
draw_set_font(f_p3);
|
||||
dialog_w = max(dialog_w, string_width(_menuItem) + ui(24));
|
||||
dialog_h += string_height(_menuItem) + ui(8);
|
||||
continue;
|
||||
}
|
||||
|
||||
draw_set_font(f_p0);
|
||||
var ww = string_width(_menuItem.name) + ui(64);
|
||||
|
||||
|
@ -85,7 +94,7 @@ event_inherited();
|
|||
case fa_right: dialog_x = round(max(dialog_x - dialog_w, 2)); break;
|
||||
}
|
||||
|
||||
mouse_inside = point_in_rectangle(mouse_mx, mouse_my, dialog_x, dialog_y, dialog_x + dialog_w, dialog_y + dialog_h);
|
||||
mouse_init_inside = point_in_rectangle(mouse_mx, mouse_my, dialog_x, dialog_y, dialog_x + dialog_w, dialog_y + dialog_h);
|
||||
ready = true;
|
||||
}
|
||||
#endregion
|
|
@ -3,16 +3,26 @@ if(!ready) exit;
|
|||
|
||||
#region draw
|
||||
var yy = dialog_y;
|
||||
var _lclick = sFOCUS && (!mouse_init_inside && mouse_release(mb_left)) || (keyboard_check_pressed(vk_enter) && hk_editing == noone);
|
||||
var _rclick = sFOCUS && (!mouse_init_inside && mouse_release(mb_right));
|
||||
|
||||
draw_sprite_stretched(THEME.s_box_r2_clr, 0, dialog_x, dialog_y, dialog_w, dialog_h);
|
||||
|
||||
for(var i = 0; i < array_length(menu); i++) {
|
||||
var _menuItem = menu[i];
|
||||
|
||||
if(is_string(_menuItem)) {
|
||||
draw_set_text(f_p3, fa_left, fa_top, COLORS._main_text_sub);
|
||||
draw_text(dialog_x + ui(8), yy + ui(4), _menuItem);
|
||||
|
||||
yy += string_height(_menuItem) + ui(8);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(is_instanceof(_menuItem, MenuItem) && _menuItem.shiftMenu != noone && key_mod_press(SHIFT))
|
||||
_menuItem = _menuItem.shiftMenu;
|
||||
|
||||
if(_menuItem == -1) { #region
|
||||
if(_menuItem == -1) {
|
||||
var bx = dialog_x + ui(8);
|
||||
var bw = dialog_w - ui(16);
|
||||
draw_set_color(CDEF.main_mdblack);
|
||||
|
@ -20,11 +30,13 @@ if(!ready) exit;
|
|||
yy += ui(8);
|
||||
|
||||
continue;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
var label = _menuItem.name;
|
||||
var _h = is_instanceof(_menuItem, MenuItemGroup)? hght * 2 : hght;
|
||||
var cc = struct_try_get(_menuItem, "color", c_white);
|
||||
var _key = _menuItem.hotkey != noone? find_hotkey(_menuItem.hotkey[0], _menuItem.hotkey[1]) : noone;
|
||||
_menuItem.hoykeyObject = _key;
|
||||
|
||||
if(sHOVER && point_in_rectangle(mouse_mx, mouse_my, dialog_x, yy + 1, dialog_x + dialog_w, yy + _h - 1)) {
|
||||
selecting = i;
|
||||
|
@ -38,10 +50,9 @@ if(!ready) exit;
|
|||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, _hc, _ha);
|
||||
|
||||
var _click = sFOCUS && (!mouse_inside && mouse_release(mb_left)) || keyboard_check_released(vk_enter);
|
||||
|
||||
if(_hovering_ch && is_instanceof(_menuItem, MenuItem) && _menuItem.active && _click) {
|
||||
if(is_instanceof(_menuItem, MenuItem) && _menuItem.active && _hovering_ch) {
|
||||
|
||||
if(_lclick) {
|
||||
var _dat = {
|
||||
_x: dialog_x,
|
||||
x: dialog_x + dialog_w,
|
||||
|
@ -54,9 +65,38 @@ if(!ready) exit;
|
|||
};
|
||||
|
||||
var _res = _menuItem.func(_dat);
|
||||
if(_menuItem.isShelf) array_push(children, _res.id);
|
||||
else instance_destroy(o_dialog_menubox);
|
||||
if(_menuItem.isShelf) array_push(children, _res.id); // open child
|
||||
else if(remove_parents) instance_destroy(o_dialog_menubox); // close all
|
||||
else instance_destroy(); // close self
|
||||
}
|
||||
|
||||
if(_key && _rclick) {
|
||||
var _dat = {
|
||||
_x: dialog_x,
|
||||
x: mouse_mx + ui(4),
|
||||
y: mouse_my + ui(4),
|
||||
depth: depth,
|
||||
name: _menuItem.name,
|
||||
index: i,
|
||||
context: context,
|
||||
params: _menuItem.params,
|
||||
};
|
||||
|
||||
selecting_menu = _menuItem;
|
||||
var _loadKey = $"{_key.context}.{_key.name}";
|
||||
|
||||
var context_menu_settings = [
|
||||
_loadKey,
|
||||
menuItemAction("Edit hotkey", function() /*=>*/ {
|
||||
hk_editing = selecting_menu;
|
||||
keyboard_lastchar = hk_editing.hoykeyObject.key;
|
||||
}),
|
||||
];
|
||||
|
||||
with(o_dialog_menubox) { if(!remove_parents) instance_destroy(); }
|
||||
var _menu = submenuCall(_dat, context_menu_settings);
|
||||
_menu.remove_parents = false;
|
||||
}
|
||||
}
|
||||
} else if(cc != c_white)
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, cc, 0.5);
|
||||
|
@ -92,6 +132,7 @@ if(!ready) exit;
|
|||
|
||||
_sw = string_width(_str) + ui(12);
|
||||
_sh = string_height(_str) + ui(8);
|
||||
|
||||
} else {
|
||||
if(is_array(_sprs)) {
|
||||
_spr = _sprs[0];
|
||||
|
@ -120,6 +161,7 @@ if(!ready) exit;
|
|||
if(_str != "")
|
||||
draw_text(_bx, _by, _str);
|
||||
}
|
||||
|
||||
} else {
|
||||
if(_menuItem.spr != noone) {
|
||||
var spr = is_array(_menuItem.spr)? _menuItem.spr[0] : _menuItem.spr;
|
||||
|
@ -140,21 +182,47 @@ if(!ready) exit;
|
|||
|
||||
if(_menuItem.isShelf) {
|
||||
draw_sprite_ui_uniform(THEME.arrow, 0, dialog_x + dialog_w - ui(20), yy + hght / 2, 1, COLORS._main_icon);
|
||||
} else if(_menuItem.hotkey != noone) {
|
||||
var _key = find_hotkey(_menuItem.hotkey[0], _menuItem.hotkey[1]);
|
||||
|
||||
if(_key) {
|
||||
} else if(_key) {
|
||||
var _hx = dialog_x + dialog_w - ui(16);
|
||||
var _hy = yy + hght / 2 + ui(2);
|
||||
hotkey_draw(key_get_name(_key.key, _key.modi), _hx, _hy);
|
||||
|
||||
draw_set_font(f_p1);
|
||||
|
||||
var _ktxt = key_get_name(_key.key, _key.modi);
|
||||
var _tw = string_width(_ktxt);
|
||||
var _th = line_get_height();
|
||||
|
||||
var _bx = _hx - _tw - ui(4);
|
||||
var _by = _hy - _th / 2 - ui(3);
|
||||
var _bw = _tw + ui(8);
|
||||
var _bh = _th + ui(3);
|
||||
|
||||
if(hk_editing == _menuItem) {
|
||||
draw_set_text(f_p1, fa_right, fa_center, COLORS._main_accent);
|
||||
draw_sprite_stretched_ext(THEME.ui_panel, 1, _bx, _by, _bw, _bh, COLORS._main_text_accent);
|
||||
|
||||
} else if(_ktxt != "") {
|
||||
draw_set_text(f_p1, fa_right, fa_center, COLORS._main_text_sub);
|
||||
draw_sprite_stretched_ext(THEME.ui_panel, 1, _bx, _by, _bw, _bh, CDEF.main_dkgrey);
|
||||
}
|
||||
|
||||
draw_text(_hx, _hy, _ktxt);
|
||||
}
|
||||
}
|
||||
|
||||
yy += _h;
|
||||
}
|
||||
|
||||
if(sFOCUS) {
|
||||
if(hk_editing != noone) {
|
||||
if(keyboard_check_pressed(vk_enter))
|
||||
hk_editing = noone;
|
||||
else if(keyboard_check_pressed(vk_escape))
|
||||
hk_editing = noone;
|
||||
else
|
||||
hotkey_editing(hk_editing.hoykeyObject);
|
||||
|
||||
} else if(sFOCUS) {
|
||||
if(keyboard_check_pressed(vk_up)) {
|
||||
selecting--;
|
||||
if(selecting < 0) selecting = array_length(menu) - 1;
|
||||
|
@ -169,7 +237,7 @@ if(!ready) exit;
|
|||
|
||||
draw_sprite_stretched(THEME.s_box_r2_clr, 1, dialog_x, dialog_y, dialog_w, dialog_h);
|
||||
|
||||
if(mouse_inside && (mouse_release(mb_left) || mouse_release(mb_right))) mouse_inside = false;
|
||||
if(mouse_init_inside && (mouse_release(mb_left) || mouse_release(mb_right))) mouse_init_inside = false;
|
||||
#endregion
|
||||
|
||||
#region debug
|
||||
|
|
|
@ -122,10 +122,10 @@ event_inherited();
|
|||
hovering = pal;
|
||||
|
||||
menuCall("palette_window_preset_menu",,, [
|
||||
menuItem(__txtx("palette_editor_set_default", "Set as default"), function() {
|
||||
menuItemAction(__txtx("palette_editor_set_default", "Set as default"), function() {
|
||||
PROJECT.setPalette(array_clone(hovering.palette));
|
||||
}),
|
||||
menuItem(__txtx("palette_editor_delete", "Delete palette"), function() {
|
||||
menuItemAction(__txtx("palette_editor_delete", "Delete palette"), function() {
|
||||
file_delete(hovering.path);
|
||||
__initPalette();
|
||||
}),
|
||||
|
|
|
@ -87,12 +87,12 @@ if palette == 0 exit;
|
|||
if(b) mouse_draggable = false;
|
||||
if(b == 2) {
|
||||
menuCall("palette_window_sort_menu", bx + ui(32), by, [
|
||||
menuItem(__txtx("palette_editor_sort_brighter", "Brighter"), function() { sortPalette(__sortBright); }),
|
||||
menuItem(__txtx("palette_editor_sort_darker", "Darker"), function() { sortPalette(__sortDark); }),
|
||||
menuItemAction(__txtx("palette_editor_sort_brighter", "Brighter"), function() { sortPalette(__sortBright); }),
|
||||
menuItemAction(__txtx("palette_editor_sort_darker", "Darker"), function() { sortPalette(__sortDark); }),
|
||||
-1,
|
||||
menuItem(__txtx("palette_editor_sort_hue", "Hue"), function() { sortPalette(__sortHue); }),
|
||||
menuItem(__txtx("palette_editor_sort_sat", "Saturation"), function() { sortPalette(__sortSat); }),
|
||||
menuItem(__txtx("palette_editor_sort_val", "Value"), function() { sortPalette(__sortVal); }),
|
||||
menuItemAction(__txtx("palette_editor_sort_hue", "Hue"), function() { sortPalette(__sortHue); }),
|
||||
menuItemAction(__txtx("palette_editor_sort_sat", "Saturation"), function() { sortPalette(__sortSat); }),
|
||||
menuItemAction(__txtx("palette_editor_sort_val", "Value"), function() { sortPalette(__sortVal); }),
|
||||
],, palette);
|
||||
}
|
||||
bx -= ui(32);
|
||||
|
|
|
@ -100,7 +100,7 @@ if !ready exit;
|
|||
instance_destroy();
|
||||
} else if(mouse_press(mb_right)) {
|
||||
menuCall("panel_window_menu",,, [
|
||||
menuItem(__txt("Move"), function() {
|
||||
menuItemAction(__txt("Move"), function() {
|
||||
content.dragSurface = surface_clone(panel);
|
||||
o_main.panel_dragging = content;
|
||||
content.in_dialog = false;
|
||||
|
|
|
@ -635,11 +635,6 @@ event_inherited();
|
|||
})
|
||||
]);
|
||||
|
||||
vk_list = [
|
||||
vk_left, vk_right, vk_up, vk_down, vk_space, vk_backspace, vk_tab, vk_home, vk_end, vk_delete, vk_insert,
|
||||
vk_pageup, vk_pagedown, vk_pause, vk_printscreen,
|
||||
vk_f1, vk_f2, vk_f3, vk_f4, vk_f5, vk_f6, vk_f7, vk_f8, vk_f9, vk_f10, vk_f11, vk_f12,
|
||||
];
|
||||
hk_editing = noone;
|
||||
|
||||
sp_hotkey = new scrollPane(dialog_w - ui(padding + padding) - page_width, dialog_h - ui(title_height + padding), function(_y, _m) {
|
||||
|
@ -694,6 +689,8 @@ event_inherited();
|
|||
th = line_get_height(f_p1);
|
||||
ind = 0;
|
||||
|
||||
var _hov = sHOVER && sp_hotkey.hover;
|
||||
|
||||
for(var j = 0; j < ds_list_size(HOTKEY_CONTEXT); j++) {
|
||||
var ll = HOTKEYS[? HOTKEY_CONTEXT[| j]];
|
||||
|
||||
|
@ -729,39 +726,46 @@ event_inherited();
|
|||
}
|
||||
|
||||
var _yy = yy + hh;
|
||||
|
||||
if(ind++ % 2 == 0)
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, _yy - padd, sp_hotkey.surface_w, th + padd * 2, COLORS.dialog_preference_prop_bg, 1);
|
||||
|
||||
var _lb_y = _yy;
|
||||
|
||||
if(ind++ % 2 == 0) draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, _yy - padd, sp_hotkey.surface_w, th + padd * 2, COLORS.dialog_preference_prop_bg, 1);
|
||||
|
||||
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text_add(ui(24), _lb_y, name);
|
||||
|
||||
var dk = key_get_name(key.key, key.modi);
|
||||
var kw = string_width(dk);
|
||||
|
||||
var tx = key_x1 - ui(24);
|
||||
var bx = tx - kw - ui(8);
|
||||
var by = _yy - ui(4);
|
||||
var bw = kw + ui(16);
|
||||
var bh = th + ui(8);
|
||||
var cc = c_white;
|
||||
|
||||
if(hk_editing == key) {
|
||||
dk = key_get_name(key.key, key.modi);
|
||||
kw = string_width(dk);
|
||||
draw_sprite_stretched(THEME.button_hide, 2, key_x1 - ui(40) - kw, _yy, kw + ui(32), th);
|
||||
draw_sprite_stretched_ext(THEME.ui_panel, 1, bx, by, bw, bh, COLORS._main_accent);
|
||||
cc = COLORS._main_text_accent;
|
||||
|
||||
} else {
|
||||
var bx = key_x1 - ui(40) - kw;
|
||||
var by = _yy;
|
||||
var b = buttonInstant(THEME.button_hide, bx, by, kw + ui(32), th, _m, sFOCUS, sHOVER && sp_hotkey.hover)
|
||||
if(_hov && point_in_rectangle(_m[0], _m[1], bx, by, bx + bw, by + bh)) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel, 1, bx, by, bw, bh, CDEF.main_ltgrey);
|
||||
sp_hotkey.hover_content = true;
|
||||
cc = CDEF.main_ltgrey;
|
||||
|
||||
if(b) sp_hotkey.hover_content = true;
|
||||
if(b == 2) {
|
||||
if(mouse_press(mb_left, sFOCUS)) {
|
||||
hk_editing = key;
|
||||
keyboard_lastchar = pkey;
|
||||
}
|
||||
|
||||
} else {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel, 1, bx, by, bw, bh, CDEF.main_dkgrey, 1);
|
||||
cc = COLORS._main_text_sub;
|
||||
}
|
||||
}
|
||||
|
||||
var cc = (key.key == 0 && key.modi == MOD_KEY.none)? COLORS._main_text_sub : COLORS._main_text;
|
||||
if(hk_editing == key) cc = COLORS._main_text_accent;
|
||||
|
||||
draw_set_text(f_p1, fa_right, fa_top, cc);
|
||||
draw_text_add(key_x1 - ui(24), _lb_y, dk);
|
||||
draw_text_add(tx, _lb_y, dk);
|
||||
|
||||
if(key.key != dkey || key.modi != dmod) {
|
||||
modified = true;
|
||||
|
@ -782,7 +786,7 @@ event_inherited();
|
|||
}
|
||||
|
||||
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_sub);
|
||||
draw_text_add(ui(8), yy + hh, "Nodes (Single key only)");
|
||||
draw_text_add(ui(8), yy + hh, "Nodes");
|
||||
array_push(sect, [ "Nodes", sp_hotkey, hh + ui(12) ]);
|
||||
hh += string_height("l") + ui(16);
|
||||
|
||||
|
@ -862,65 +866,7 @@ event_inherited();
|
|||
}
|
||||
}
|
||||
|
||||
if(hk_editing != noone) {
|
||||
var _mod_prs = 0;
|
||||
|
||||
if(keyboard_check(vk_control)) _mod_prs |= MOD_KEY.ctrl;
|
||||
if(keyboard_check(vk_shift)) _mod_prs |= MOD_KEY.shift;
|
||||
if(keyboard_check(vk_alt)) _mod_prs |= MOD_KEY.alt;
|
||||
|
||||
if(keyboard_check_pressed(vk_escape)) {
|
||||
hk_editing.key = 0;
|
||||
hk_editing.modi = 0;
|
||||
|
||||
PREF_SAVE();
|
||||
} else if(keyboard_check_pressed(vk_anykey)) {
|
||||
hk_editing.modi = _mod_prs;
|
||||
hk_editing.key = 0;
|
||||
var press = false;
|
||||
|
||||
for(var a = 0; a < array_length(vk_list); a++) {
|
||||
if(!keyboard_check_pressed(vk_list[a])) continue;
|
||||
hk_editing.key = vk_list[a];
|
||||
press = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!press) {
|
||||
var k = ds_map_find_first(global.KEY_STRING_MAP);
|
||||
var amo = ds_map_size(global.KEY_STRING_MAP);
|
||||
repeat(amo) {
|
||||
if(!keyboard_check_pressed(k)) {
|
||||
k = ds_map_find_next(global.KEY_STRING_MAP, k);
|
||||
continue;
|
||||
}
|
||||
hk_editing.key = k;
|
||||
press = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PREF_SAVE();
|
||||
}
|
||||
}
|
||||
|
||||
//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_16) == 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();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
if(hk_editing != noone) hotkey_editing(hk_editing);
|
||||
sections[page_current] = sect;
|
||||
|
||||
return hh;
|
||||
|
|
|
@ -53,7 +53,7 @@ event_inherited();
|
|||
|
||||
if(mouse_click(mb_right, sFOCUS)) {
|
||||
var dia = menuCall("preset_window_menu",,, [
|
||||
menuItem(__txt("Delete"), function() {
|
||||
menuItemAction(__txt("Delete"), function() {
|
||||
file_delete(o_dialog_menubox.path);
|
||||
__initPresets();
|
||||
}),
|
||||
|
|
|
@ -60,29 +60,6 @@
|
|||
|
||||
panelInit();
|
||||
|
||||
addHotkey("", "New file", "N", MOD_KEY.ctrl, NEW);
|
||||
if(!DEMO) {
|
||||
addHotkey("", "Save", "S", MOD_KEY.ctrl, SAVE);
|
||||
addHotkey("", "Save as", "S", MOD_KEY.ctrl | MOD_KEY.shift, SAVE_AS);
|
||||
addHotkey("", "Save all", "S", MOD_KEY.ctrl | MOD_KEY.alt, SAVE_ALL);
|
||||
addHotkey("", "Open", "O", MOD_KEY.ctrl, LOAD);
|
||||
}
|
||||
|
||||
addHotkey("", "Undo", "Z", MOD_KEY.ctrl, UNDO);
|
||||
addHotkey("", "Redo", "Z", MOD_KEY.ctrl | MOD_KEY.shift, REDO);
|
||||
|
||||
addHotkey("", "Full panel", "`", MOD_KEY.none, set_focus_fullscreen);
|
||||
addHotkey("", "Reset layout", vk_f10, MOD_KEY.ctrl, resetPanel);
|
||||
|
||||
addHotkey("", "Open notification", vk_f12, MOD_KEY.none, function() { dialogPanelCall(new Panel_Notification()); });
|
||||
|
||||
addHotkey("", "Fullscreen", vk_f11, MOD_KEY.none, global_fullscreen);
|
||||
addHotkey("", "Render all", vk_f5, MOD_KEY.none, global_render_all);
|
||||
|
||||
addHotkey("", "Close file", "Q", MOD_KEY.ctrl, global_project_close);
|
||||
addHotkey("", "Close program", vk_f4, MOD_KEY.alt, window_close);
|
||||
addHotkey("", "Reload theme", vk_f10, MOD_KEY.ctrl | MOD_KEY.shift, global_theme_reload);
|
||||
|
||||
globalvar HOTKEY_MOD, HOTKEY_BLOCK;
|
||||
HOTKEY_MOD = 0;
|
||||
HOTKEY_BLOCK = false;
|
||||
|
|
|
@ -4,7 +4,7 @@ function __Node_3D_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
inputs[0] = nodeValue("Vertex data", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3vertex, [] )
|
||||
.setVisible(true, true);
|
||||
|
||||
inputs[1] = nodeValue_Text("Path", self, "", "Export location without '.obj' extension." )
|
||||
inputs[1] = nodeValue_Path("Path", self, "", "Export location without '.obj' extension." )
|
||||
.setDisplay(VALUE_DISPLAY.path_save, { filter: "3d object|*.obj" });
|
||||
|
||||
inputs[2] = nodeValue_Bool("Export texture", self, true );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
function __Node_3D_Obj(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "3D Object";
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_load, { filter: "3d object|*.obj" })
|
||||
.rejectArray();
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ function __NodeValue_Object(_name, _node, _type, _value, _tooltip = "") : NodeVa
|
|||
return val;
|
||||
}
|
||||
|
||||
static __getAnimValue = function(_time = CURRENT_FRAME) { return array_empty(animator.values)? 0 : animator.values[0].value; }
|
||||
static __getAnimValue = function(_time = CURRENT_FRAME) { return array_empty(animator.values)? noone : animator.values[0].value; }
|
||||
|
||||
static arrayLength = arrayLengthSimple;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ function addonContextItem(_addon, _name, _function) constructor {
|
|||
self._name = _name;
|
||||
self._function = _function;
|
||||
|
||||
menu_item = menuItem(_name, function(_data) {
|
||||
menu_item = menuItemAction(_name, function(_data) {
|
||||
lua_call(_addon.thread, self._function, lua_byref(_data.context, true));
|
||||
})//.setColor(COLORS._main_accent);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ function addonContextSubMenu(_name, _content) constructor {
|
|||
self.name = _name;
|
||||
self.content = _content;
|
||||
|
||||
menu_item = menuItem(name, function(_dat) {
|
||||
menu_item = menuItemAction(name, function(_dat) {
|
||||
return submenuCall(_dat, content);
|
||||
})//.setColor(COLORS._main_accent)
|
||||
.setIsShelf();
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#region context menu
|
||||
#region data
|
||||
globalvar CONTEXT_MENU_CALLBACK;
|
||||
CONTEXT_MENU_CALLBACK = ds_map_create();
|
||||
#endregion
|
||||
|
||||
function menuCall(menu_id = "", _x = mouse_mx + ui(4), _y = mouse_my + ui(4), menu = [], align = fa_left, context = noone) {
|
||||
function menuCall(menu_id = "", _x = mouse_mx + ui(4), _y = mouse_my + ui(4), menu = [], align = fa_left, context = noone) {
|
||||
var dia = dialogCall(o_dialog_menubox, _x, _y);
|
||||
if(menu_id != "" && ds_map_exists(CONTEXT_MENU_CALLBACK, menu_id)) {
|
||||
var callbacks = CONTEXT_MENU_CALLBACK[? menu_id];
|
||||
|
@ -15,9 +16,9 @@
|
|||
dia.context = context;
|
||||
dia.setMenu(menu, align);
|
||||
return dia;
|
||||
}
|
||||
}
|
||||
|
||||
function pieMenuCall(menu_id = "", _x = mouse_mx, _y = mouse_my, menu = [], context = noone) {
|
||||
function pieMenuCall(menu_id = "", _x = mouse_mx, _y = mouse_my, menu = [], context = noone) {
|
||||
var dia = instance_create(_x, _y, o_pie_menu);
|
||||
if(menu_id != "" && ds_map_exists(CONTEXT_MENU_CALLBACK, menu_id)) {
|
||||
var callbacks = CONTEXT_MENU_CALLBACK[? menu_id];
|
||||
|
@ -30,9 +31,9 @@
|
|||
dia.context = context;
|
||||
dia.setMenu(menu);
|
||||
return dia;
|
||||
}
|
||||
}
|
||||
|
||||
function submenuCall(_data, menu = []) {
|
||||
function submenuCall(_data, menu = []) {
|
||||
var dia = instance_create_depth(_data.x - ui(4), _data.y, _data.depth - 1, o_dialog_menubox);
|
||||
dia.context = _data.context;
|
||||
dia.setMenu(menu);
|
||||
|
@ -40,77 +41,50 @@
|
|||
if(_data.x - ui(4) + dia.dialog_w > WIN_W - ui(2))
|
||||
dia.dialog_x = _data._x - dia.dialog_w + ui(4);
|
||||
|
||||
return dia;
|
||||
}
|
||||
|
||||
function fileNameCall(path, onModify, _x = mouse_mx + 8, _y = mouse_my + 8) {
|
||||
return dia;
|
||||
}
|
||||
|
||||
function fileNameCall(path, onModify, _x = mouse_mx + 8, _y = mouse_my + 8) {
|
||||
var dia = dialogCall(o_dialog_file_name, _x, _y);
|
||||
dia.onModify = onModify;
|
||||
dia.path = string_trim_end(path, [ "\\", "/" ]) + "/";
|
||||
|
||||
return dia;
|
||||
}
|
||||
}
|
||||
|
||||
function menuItem(name, func, spr = noone, hotkey = noone, toggle = noone, params = {}) {
|
||||
INLINE
|
||||
return new MenuItem(name, func, spr, hotkey, toggle, params);
|
||||
}
|
||||
function menuItem(name, func, spr = noone, hotkey = noone, toggle = noone, params = {}) { return new MenuItem(name, func, spr, hotkey, toggle, params); }
|
||||
function menuItemAction(name, func, spr = noone, toggle = noone) { return new MenuItem(name, func, spr, struct_try_get(ACTION_MAP, func, noone), toggle); }
|
||||
|
||||
function MenuItem(name, func, spr = noone, hotkey = noone, toggle = noone, params = {}) constructor {
|
||||
function MenuItem(_name, _func, _spr = noone, _hotkey = noone, _toggle = noone, _params = {}) constructor {
|
||||
active = true;
|
||||
self.name = name;
|
||||
self.func = func;
|
||||
self.spr = spr;
|
||||
self.hotkey = hotkey;
|
||||
self.toggle = toggle;
|
||||
self.params = params;
|
||||
name = _name;
|
||||
func = _func;
|
||||
spr = _spr;
|
||||
hotkey = _hotkey;
|
||||
toggle = _toggle;
|
||||
params = _params;
|
||||
color = c_white;
|
||||
|
||||
isShelf = false;
|
||||
shelfObject = noone;
|
||||
|
||||
shiftMenu = noone;
|
||||
hoykeyObject = noone;
|
||||
|
||||
static setIsShelf = function() {
|
||||
INLINE
|
||||
isShelf = true;
|
||||
return self;
|
||||
}
|
||||
static deactivate = function() /*=>*/ { INLINE active = false; return self; }
|
||||
static setIsShelf = function() /*=>*/ { INLINE isShelf = true; return self; }
|
||||
static setActive = function(_active) /*=>*/ { INLINE active = _active; return self; }
|
||||
static setColor = function(_color) /*=>*/ { INLINE color = _color; return self; }
|
||||
static setShiftMenu = function(_shiftMenu) /*=>*/ { INLINE shiftMenu = _shiftMenu; return self; }
|
||||
}
|
||||
|
||||
static setActive = function(active) {
|
||||
INLINE
|
||||
self.active = active;
|
||||
return self;
|
||||
}
|
||||
function menuItemGroup(_name, _group) { return new MenuItemGroup(_name, _group); }
|
||||
|
||||
static setColor = function(color) {
|
||||
INLINE
|
||||
self.color = color;
|
||||
return self;
|
||||
}
|
||||
|
||||
static setShiftMenu = function(shiftMenu) {
|
||||
INLINE
|
||||
self.shiftMenu = shiftMenu;
|
||||
return self;
|
||||
}
|
||||
|
||||
static deactivate = function() {
|
||||
INLINE
|
||||
active = false;
|
||||
return self;
|
||||
}
|
||||
}
|
||||
|
||||
function menuItemGroup(name, group) {
|
||||
return new MenuItemGroup(name, group);
|
||||
}
|
||||
|
||||
function MenuItemGroup(name, group) constructor {
|
||||
function MenuItemGroup(_name, _group) constructor {
|
||||
active = true;
|
||||
self.name = name;
|
||||
self.group = group;
|
||||
name = _name;
|
||||
group = _group;
|
||||
hotkey = noone;
|
||||
|
||||
spacing = ui(36);
|
||||
}
|
||||
#endregion
|
||||
}
|
|
@ -482,12 +482,12 @@ function curveBox(_onModify) : widget() constructor {
|
|||
[ [THEME.curve_presets, 3], function() { onModify(CURVE_DEF_10); } ],
|
||||
]),
|
||||
-1,
|
||||
menuItem(__txt("Reset View"), function() {
|
||||
menuItemAction(__txt("Reset View"), function() {
|
||||
minx = 0; maxx = 1;
|
||||
miny = 0; maxy = 1;
|
||||
}),
|
||||
menuItem(grid_show? __txt("Hide grid") : __txt("Show grid"), function() { grid_show = !grid_show; }),
|
||||
menuItem(__txt("Snap to grid"), function() { grid_snap = !grid_snap; },,, function() { return grid_snap } ),
|
||||
menuItemAction(grid_show? __txt("Hide grid") : __txt("Show grid"), function() { grid_show = !grid_show; }),
|
||||
menuItemAction(__txt("Snap to grid"), function() { grid_snap = !grid_snap; },,, function() { return grid_snap } ),
|
||||
menuItemGroup(__txt("Grid size"), [
|
||||
[ "1%", function() { grid_step = 0.01; } ],
|
||||
[ "5%", function() { grid_step = 0.05; } ],
|
||||
|
|
|
@ -11,41 +11,38 @@
|
|||
}
|
||||
|
||||
function __fnInit() {
|
||||
globalvar CMD_FUNCTIONS;
|
||||
globalvar CMD_FUNCTIONS, ACTION_MAP;
|
||||
CMD_FUNCTIONS = {};
|
||||
|
||||
__registerFunction("new", NEW);
|
||||
__registerFunction("save", SAVE_AT, [ ARG("project", function() { return PROJECT; }, true), ARG("path", ""), ARG("log", "save at ") ]);
|
||||
__registerFunction("load", LOAD_AT, [ ARG("path", ""), ARG("readonly", false), ARG("override", false) ]);
|
||||
__registerFunction("close", closeProject, [ ARG("project", function() { return PROJECT; }, true) ]);
|
||||
__registerFunction("append", APPEND, [ ARG("path", ""), ARG("context", function() { return PANEL_GRAPH.getCurrentContext(); }, true) ]);
|
||||
|
||||
__registerFunction("undo", UNDO);
|
||||
__registerFunction("redo", REDO);
|
||||
__registerFunction("exit", window_close);
|
||||
ACTION_MAP = {};
|
||||
|
||||
__fnInit_Global();
|
||||
__fnInit_Preview();
|
||||
__fnInit_Inspector();
|
||||
__fnInit_Animation();
|
||||
__fnInit_Graph();
|
||||
__fnInit_Collection();
|
||||
}
|
||||
#endregion
|
||||
|
||||
function __registerFunction(name, fn, args = []) { #region
|
||||
INLINE
|
||||
CMD_FUNCTIONS[$ name] = { fn, args };
|
||||
} #endregion
|
||||
function registerFunction(_context, _name, _key, _mod, _action, _args = []) {
|
||||
addHotkey(_context, _name, _key, _mod, _action);
|
||||
|
||||
function callStatusFunction(name) { #region
|
||||
var _fnName = _context == ""? _name : $"{_context} {_name}";
|
||||
_fnName = string_to_var(_fnName);
|
||||
|
||||
CMD_FUNCTIONS[$ _fnName] = { _action, _args };
|
||||
ACTION_MAP[$ _action] = [ _context, _name ];
|
||||
}
|
||||
|
||||
function callStatusFunction(name) {
|
||||
INLINE
|
||||
var command = $"{name} {string_join_ext(",", _args)}";
|
||||
|
||||
array_push(CMD, cmdLine(command, COLORS._main_text_sub));
|
||||
array_push(CMDIN, command);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function callFunction(name, args) { #region
|
||||
function callFunction(name, args) {
|
||||
INLINE
|
||||
|
||||
var _f = CMD_FUNCTIONS[$ name];
|
||||
|
@ -71,5 +68,5 @@ function callFunction(name, args) { #region
|
|||
}
|
||||
|
||||
return true;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
LATEST_VERSION = 11700;
|
||||
VERSION = 11790;
|
||||
SAVE_VERSION = 11700;
|
||||
VERSION_STRING = "1.17.10.002";
|
||||
VERSION_STRING = "1.17.10.003";
|
||||
BUILD_NUMBER = 11790;
|
||||
|
||||
HOTKEYS = ds_map_create();
|
||||
|
@ -54,7 +54,7 @@
|
|||
#endregion
|
||||
|
||||
#region input
|
||||
globalvar FOCUS, FOCUS_STR, HOVER, HOVERING_ELEMENT, _HOVERING_ELEMENT;
|
||||
globalvar FOCUS, FOCUS_STR, FOCUS_CONTENT, HOVER, HOVERING_ELEMENT, _HOVERING_ELEMENT;
|
||||
globalvar DOUBLE_CLICK, DOUBLE_CLICK_POS;
|
||||
globalvar DIALOG_CLICK;
|
||||
|
||||
|
@ -62,6 +62,7 @@
|
|||
DOUBLE_CLICK = false;
|
||||
|
||||
FOCUS = noone;
|
||||
FOCUS_CONTENT = noone;
|
||||
FOCUS_STR = "";
|
||||
|
||||
HOVER = noone;
|
||||
|
@ -178,19 +179,59 @@
|
|||
#endregion
|
||||
|
||||
#region functions
|
||||
function __fnInit_Global() {
|
||||
__registerFunction("fullscreen", global_fullscreen);
|
||||
__registerFunction("render_all", global_render_all);
|
||||
__registerFunction("project_close", global_project_close);
|
||||
function global_fullscreen() { CALL("fullscreen"); winMan_setFullscreen(!window_is_fullscreen); }
|
||||
function global_project_close() { CALL("close_project"); PANEL_GRAPH.close(); }
|
||||
function global_project_close_all() { CALL("close_project_all"); for( var i = array_length(PROJECTS) - 1; i >= 0; i-- ) closeProject(PROJECTS[i]); }
|
||||
function global_theme_reload() { CALL("reload_theme"); loadGraphic(PREFERENCES.theme); resetPanel(); }
|
||||
|
||||
__registerFunction("theme_reload", global_theme_reload);
|
||||
function global_render_all() { CALL("render_all"); RENDER_ALL_REORDER }
|
||||
function global_export_all() {
|
||||
for (var i = 0, n = array_length(PROJECT.allNodes); i < n; i++) {
|
||||
var node = PROJECT.allNodes[i];
|
||||
|
||||
if(!node.active) continue;
|
||||
if(instanceof(node) != "Node_Export") continue;
|
||||
|
||||
node.doInspectorAction();
|
||||
}
|
||||
}
|
||||
|
||||
function global_fullscreen() { CALL("fullscreen"); winMan_setFullscreen(!window_is_fullscreen); }
|
||||
function global_render_all() { CALL("render_all"); RENDER_ALL_REORDER }
|
||||
function global_project_close() { CALL("project_close"); PANEL_GRAPH.close(); }
|
||||
function __fnInit_Global() {
|
||||
registerFunction("", "New file", "N", MOD_KEY.ctrl, NEW);
|
||||
|
||||
if(!DEMO) {
|
||||
registerFunction("", "Save", "S", MOD_KEY.ctrl, SAVE);
|
||||
registerFunction("", "Save as", "S", MOD_KEY.ctrl | MOD_KEY.shift, SAVE_AS);
|
||||
registerFunction("", "Save at", "", MOD_KEY.none, SAVE_AT, [ ARG("project", function() { return PROJECT; }, true), ARG("path", ""), ARG("log", "save at ") ]);
|
||||
registerFunction("", "Save all", "S", MOD_KEY.ctrl | MOD_KEY.alt, SAVE_ALL);
|
||||
registerFunction("", "Open", "O", MOD_KEY.ctrl, LOAD);
|
||||
registerFunction("", "Open Safe", "", MOD_KEY.none, LOAD_SAFE);
|
||||
registerFunction("", "Open at", "", MOD_KEY.none, LOAD_AT, [ ARG("path", ""), ARG("readonly", false), ARG("override", false) ]);
|
||||
registerFunction("", "Append", "", MOD_KEY.none, APPEND, [ ARG("path", ""), ARG("context", function() { return PANEL_GRAPH.getCurrentContext(); }, true) ]);
|
||||
|
||||
registerFunction("", "Import .zip", "", MOD_KEY.none, __IMPORT_ZIP);
|
||||
registerFunction("", "Export .zip", "", MOD_KEY.none, __EXPORT_ZIP);
|
||||
}
|
||||
|
||||
registerFunction("", "Undo", "Z", MOD_KEY.ctrl, UNDO);
|
||||
registerFunction("", "Redo", "Z", MOD_KEY.ctrl | MOD_KEY.shift, REDO);
|
||||
|
||||
registerFunction("", "Full panel", "`", MOD_KEY.none, set_focus_fullscreen);
|
||||
registerFunction("", "Reset layout", vk_f10, MOD_KEY.ctrl, resetPanel);
|
||||
|
||||
registerFunction("", "Open notification", vk_f12, MOD_KEY.none, function() /*=>*/ { dialogPanelCall(new Panel_Notification()); });
|
||||
|
||||
registerFunction("", "Fullscreen", vk_f11, MOD_KEY.none, global_fullscreen);
|
||||
registerFunction("", "Render all", vk_f5, MOD_KEY.none, global_render_all);
|
||||
registerFunction("", "Export all", "", MOD_KEY.none, global_export_all);
|
||||
|
||||
registerFunction("", "Close file", "Q", MOD_KEY.ctrl, global_project_close);
|
||||
registerFunction("", "Close all files", "", MOD_KEY.none, global_project_close_all);
|
||||
registerFunction("", "Close program", vk_f4, MOD_KEY.alt, window_close);
|
||||
registerFunction("", "Close project", "", MOD_KEY.none, closeProject, [ ARG("project", function() { return PROJECT; }, true) ]);
|
||||
registerFunction("", "Reload theme", vk_f10, MOD_KEY.ctrl | MOD_KEY.shift, global_theme_reload);
|
||||
}
|
||||
|
||||
function global_theme_reload() { CALL("theme_reload"); loadGraphic(PREFERENCES.theme); resetPanel(); }
|
||||
#endregion
|
||||
|
||||
#region debug
|
||||
|
|
|
@ -287,6 +287,8 @@ function gradientObject(color = c_black) constructor {
|
|||
var _time = s.keys[i].time;
|
||||
var _value = s.keys[i].value;
|
||||
|
||||
if(LOADING_VERSION < 11660) _value = cola(_value);
|
||||
|
||||
keys[i] = new gradientKey(_time, _value);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#region
|
||||
globalvar HOTKEYS_CUSTOM;
|
||||
globalvar HOTKEYS_CUSTOM;
|
||||
|
||||
function __initHotKey() {
|
||||
function __initHotKey() {
|
||||
HOTKEYS_CUSTOM = {
|
||||
"Node_Canvas": {
|
||||
"Selection": new hotkeySimple("S"),
|
||||
|
@ -75,9 +74,9 @@
|
|||
},
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function getToolHotkey(_group, _key) {
|
||||
function getToolHotkey(_group, _key) {
|
||||
INLINE
|
||||
|
||||
if(!struct_has(HOTKEYS_CUSTOM, _group)) return noone;
|
||||
|
@ -86,12 +85,9 @@
|
|||
if(!struct_has(_grp, _key)) return noone;
|
||||
|
||||
return _grp[$ _key];
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region hotkeys
|
||||
function hotkeySimple(_key, modi = MOD_KEY.none) constructor {
|
||||
function hotkeySimple(_key, modi = MOD_KEY.none) constructor {
|
||||
self.key = key_get_index(_key);
|
||||
self.modi = modi;
|
||||
|
||||
|
@ -107,9 +103,9 @@
|
|||
if(is_string(key)) key = key_get_index(key);
|
||||
return key_get_name(key, modi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hotkeyObject(_context, _name, _key, _mod = MOD_KEY.none, _action = noone) constructor {
|
||||
function hotkeyObject(_context, _name, _key, _mod = MOD_KEY.none, _action = noone) constructor {
|
||||
context = _context;
|
||||
name = _name;
|
||||
key = _key;
|
||||
|
@ -129,9 +125,9 @@
|
|||
var _loadKey = $"{context}_{name}";
|
||||
if(struct_has(HOTKEYS_DATA, _loadKey))
|
||||
deserialize(HOTKEYS_DATA[$ _loadKey]);
|
||||
}
|
||||
}
|
||||
|
||||
function addHotkey(_context, _name, _key, _mod, _action) {
|
||||
function addHotkey(_context, _name, _key, _mod, _action) {
|
||||
if(is_string(_key)) _key = key_get_index(_key);
|
||||
|
||||
var key = new hotkeyObject(_context, _name, _key, _mod, _action);
|
||||
|
@ -153,25 +149,94 @@
|
|||
|
||||
if(_context == "") ds_list_insert(HOTKEYS[? _context], 0, key);
|
||||
else ds_list_add(HOTKEYS[? _context], key);
|
||||
}
|
||||
}
|
||||
|
||||
function find_hotkey(_context, _name) { #region
|
||||
function find_hotkey(_context, _name) {
|
||||
if(!ds_map_exists(HOTKEYS, _context)) return noone;
|
||||
|
||||
for(var j = 0; j < ds_list_size(HOTKEYS[? _context]); j++) {
|
||||
if(HOTKEYS[? _context][| j].name == _name)
|
||||
return HOTKEYS[? _context][| j];
|
||||
}
|
||||
} #endregion
|
||||
#endregion
|
||||
}
|
||||
|
||||
function hotkey_draw(keyStr, _x, _y) {
|
||||
function hotkey_editing(hotkey) {
|
||||
static vk_list = [
|
||||
vk_left, vk_right, vk_up, vk_down, vk_space, vk_backspace, vk_tab, vk_home, vk_end, vk_delete, vk_insert,
|
||||
vk_pageup, vk_pagedown, vk_pause, vk_printscreen,
|
||||
vk_f1, vk_f2, vk_f3, vk_f4, vk_f5, vk_f6, vk_f7, vk_f8, vk_f9, vk_f10, vk_f11, vk_f12,
|
||||
];
|
||||
|
||||
var _mod_prs = 0;
|
||||
|
||||
if(keyboard_check(vk_control)) _mod_prs |= MOD_KEY.ctrl;
|
||||
if(keyboard_check(vk_shift)) _mod_prs |= MOD_KEY.shift;
|
||||
if(keyboard_check(vk_alt)) _mod_prs |= MOD_KEY.alt;
|
||||
|
||||
if(keyboard_check_pressed(vk_escape)) {
|
||||
hotkey.key = 0;
|
||||
hotkey.modi = 0;
|
||||
|
||||
PREF_SAVE();
|
||||
|
||||
} else if(keyboard_check_pressed(vk_anykey)) {
|
||||
hotkey.modi = _mod_prs;
|
||||
hotkey.key = 0;
|
||||
var press = false;
|
||||
|
||||
for(var a = 0; a < array_length(vk_list); a++) {
|
||||
if(!keyboard_check_pressed(vk_list[a])) continue;
|
||||
hotkey.key = vk_list[a];
|
||||
press = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!press) {
|
||||
var k = ds_map_find_first(global.KEY_STRING_MAP);
|
||||
var amo = ds_map_size(global.KEY_STRING_MAP);
|
||||
repeat(amo) {
|
||||
if(!keyboard_check_pressed(k)) {
|
||||
k = ds_map_find_next(global.KEY_STRING_MAP, k);
|
||||
continue;
|
||||
}
|
||||
hotkey.key = k;
|
||||
press = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PREF_SAVE();
|
||||
}
|
||||
}
|
||||
|
||||
function hotkey_draw(keyStr, _x, _y, _status = 0) {
|
||||
if(keyStr == "") return;
|
||||
|
||||
draw_set_text(f_p1, fa_right, fa_center, COLORS._main_text_sub);
|
||||
var bc = c_white;
|
||||
var tc = c_white;
|
||||
|
||||
switch(_status) {
|
||||
case 0 :
|
||||
bc = CDEF.main_dkgrey;
|
||||
tc = COLORS._main_text_sub;
|
||||
break;
|
||||
|
||||
case 1 :
|
||||
bc = CDEF.main_ltgrey;
|
||||
tc = CDEF.main_ltgrey;
|
||||
break;
|
||||
|
||||
case 2 :
|
||||
bc = COLORS._main_accent;
|
||||
tc = COLORS._main_text_accent;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
draw_set_text(f_p1, fa_right, fa_center, tc);
|
||||
var _tw = string_width( keyStr);
|
||||
var _th = string_height(keyStr);
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_panel, 1, _x - _tw - ui(4), _y - _th / 2 - ui(3), _tw + ui(8), _th + ui(3), COLORS._main_text_sub, 0.5);
|
||||
draw_sprite_stretched_ext(THEME.ui_panel, 1, _x - _tw - ui(4), _y - _th / 2 - ui(3), _tw + ui(8), _th + ui(3), bc);
|
||||
draw_text(_x, _y, keyStr);
|
||||
}
|
|
@ -5,6 +5,8 @@ function __loadParams(readonly = false, override = false, apply_layout = false)
|
|||
self.apply_layout = apply_layout;
|
||||
}
|
||||
|
||||
function LOAD_SAFE() { LOAD(true); }
|
||||
|
||||
function LOAD(safe = false) {
|
||||
if(DEMO) return false;
|
||||
|
||||
|
@ -271,7 +273,8 @@ function LOAD_AT(path, params = new __loadParams()) { #region
|
|||
return true;
|
||||
} #endregion
|
||||
|
||||
function __IMPORT_ZIP() { #region
|
||||
function __EXPORT_ZIP() { exportPortable(PROJECT); }
|
||||
function __IMPORT_ZIP() {
|
||||
var path = get_open_filename_pxc("Pixel Composer portable project (.zip)|*.zip", "");
|
||||
|
||||
var _fname = filename_name_only(path);
|
||||
|
@ -289,4 +292,4 @@ function __IMPORT_ZIP() { #region
|
|||
if(!file_exists_empty(_proj)) return false;
|
||||
|
||||
LOAD_PATH(_proj, true);
|
||||
} #endregion
|
||||
}
|
|
@ -4,7 +4,7 @@ function Node_3D_Mesh_Export(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
inputs[0] = nodeValue_D3Mesh("Mesh", self, noone)
|
||||
.setVisible(true, true);
|
||||
|
||||
inputs[1] = nodeValue_Text("Paths", self, "")
|
||||
inputs[1] = nodeValue_Path("Paths", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_save, { filter: "Obj (.obj)|*.obj" })
|
||||
.setVisible(true);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group)
|
|||
object = noone;
|
||||
object_class = __3dObject;
|
||||
|
||||
inputs[in_mesh + 0] = nodeValue_Text("File Path", self, "" )
|
||||
inputs[in_mesh + 0] = nodeValue_Path("File Path", self, "" )
|
||||
.setDisplay(VALUE_DISPLAY.path_load, { filter: "3d object|*.obj" })
|
||||
.rejectArray();
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
|
||||
w = 128;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_load, { filter: "Aseprite file|*.ase;*.aseprite" });
|
||||
|
||||
inputs[1] = nodeValue_Trigger("Generate layers", self, false )
|
||||
|
|
|
@ -4,7 +4,7 @@ function Node_Byte_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
|
||||
w = 128;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_load, { filter: "any file|*" })
|
||||
.rejectArray();
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ function Node_Byte_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con
|
|||
|
||||
w = 128;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_save, { filter: "any file|*" })
|
||||
.rejectArray();
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ function Node_CSV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
|
||||
w = 128;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_load, { filter: "CSV file|*.csv" })
|
||||
.rejectArray();
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ function Node_CSV_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
|
||||
w = 128;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_save, { filter: "csv file|*.csv" })
|
||||
.rejectArray();
|
||||
|
||||
|
|
|
@ -637,14 +637,11 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
NODE_SET_INPUT_SIZE
|
||||
|
||||
w = SHOW_PARAM? attributes.node_param_width : min_w;
|
||||
|
||||
if(!auto_height) return;
|
||||
|
||||
var _ss = getGraphPreviewSurface();
|
||||
var _ps = is_surface(_ss);
|
||||
var _ou = preview_channel >= 0 && preview_channel < output_list_size && outputs[preview_channel].type == VALUE_TYPE.surface;
|
||||
|
||||
// print($"{previewable} && {preview_draw} && ([{_ss}] {_ps} || {_ou})");
|
||||
var _prev_surf = previewable && preview_draw && (_ps || _ou);
|
||||
|
||||
junction_draw_hei_y = SHOW_PARAM? 32 : 24;
|
||||
|
@ -653,8 +650,13 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
var _hi, _ho;
|
||||
|
||||
if(previewable) {
|
||||
_hi = junction_draw_pad_y + SHOW_PARAM * 4;
|
||||
_ho = junction_draw_pad_y + SHOW_PARAM * 4;
|
||||
_hi = junction_draw_pad_y;
|
||||
_ho = junction_draw_pad_y;
|
||||
|
||||
if(SHOW_PARAM) {
|
||||
_hi = con_h;
|
||||
_ho = con_h;
|
||||
}
|
||||
|
||||
} else {
|
||||
junction_draw_hei_y = 16;
|
||||
|
@ -1184,13 +1186,23 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
out_cache_len = output_list_size;
|
||||
}
|
||||
|
||||
var _iny = yy + (junction_draw_pad_y + junction_draw_hei_y * 0.5 * SHOW_PARAM) * _s;
|
||||
var rx = x, ry = y + junction_draw_pad_y + junction_draw_hei_y * 0.5 * SHOW_PARAM;
|
||||
var _junRy = junction_draw_pad_y;
|
||||
var _junSy = yy + _junRy * _s;
|
||||
|
||||
if(SHOW_PARAM) {
|
||||
_junRy = con_h + junction_draw_hei_y / 2;
|
||||
_junSy = yy + _junRy * _s;
|
||||
}
|
||||
|
||||
var _ix = xx;
|
||||
var _iy = _junSy;
|
||||
var rx = x;
|
||||
var ry = y + _junRy;
|
||||
|
||||
for( var i = 0, n = input_list_size; i < n; i++ ) {
|
||||
jun = inputs[i];
|
||||
jun.x = xx;
|
||||
jun.y = _iny;
|
||||
jun.x = _ix;
|
||||
jun.y = _iy;
|
||||
|
||||
jun.rx = rx;
|
||||
jun.ry = ry;
|
||||
|
@ -1199,26 +1211,28 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
for(var i = 0; i < in_cache_len; i++) {
|
||||
jun = inputDisplayList[i];
|
||||
|
||||
jun.x = xx;
|
||||
jun.y = _iny;
|
||||
_iny += junction_draw_hei_y * _s;
|
||||
jun.x = _ix;
|
||||
jun.y = _iy;
|
||||
_iy += junction_draw_hei_y * _s;
|
||||
|
||||
jun.rx = rx;
|
||||
jun.ry = ry;
|
||||
ry += junction_draw_hei_y;
|
||||
}
|
||||
|
||||
xx = xx + w * _s;
|
||||
var _outy = yy + (junction_draw_pad_y + junction_draw_hei_y * 0.5 * SHOW_PARAM) * _s;
|
||||
var rx = x + w, ry = y + junction_draw_pad_y + junction_draw_hei_y * 0.5 * SHOW_PARAM;
|
||||
var _ox = xx + w * _s;
|
||||
var _oy = _junSy;
|
||||
var rx = x + w;
|
||||
var ry = y + _junRy;
|
||||
var idx;
|
||||
|
||||
for(var i = 0; i < outputs_amount; i++) {
|
||||
var idx = outputs_index[i];
|
||||
idx = outputs_index[i];
|
||||
jun = outputs[idx];
|
||||
|
||||
jun.x = xx;
|
||||
jun.y = _outy;
|
||||
_outy += junction_draw_hei_y * _s * jun.isVisible();
|
||||
jun.x = _ox;
|
||||
jun.y = _oy;
|
||||
_oy += junction_draw_hei_y * _s * jun.isVisible();
|
||||
|
||||
jun.rx = rx;
|
||||
jun.ry = ry;
|
||||
|
@ -1227,7 +1241,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
|
||||
if(SHOW_PARAM) h = h_param;
|
||||
|
||||
onPreDraw(_x, _y, _s, _iny, _outy);
|
||||
onPreDraw(_x, _y, _s, _iy, _oy);
|
||||
}
|
||||
|
||||
static onPreDraw = function(_x, _y, _s, _iny, _outy) {}
|
||||
|
@ -1365,6 +1379,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
}
|
||||
|
||||
if(jun.value_from || wd == noone) {
|
||||
extY += junction_draw_hei_y;
|
||||
jy += wh;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ function Node_Directory_Search(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
name = "Directory Search";
|
||||
color = COLORS.node_blend_input;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_load, { filter: "dir" });
|
||||
|
||||
inputs[1] = nodeValue_Text("Extensions", self, ".png");
|
||||
|
|
|
@ -26,7 +26,7 @@ function Node_Display_Image(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
name = "Display Image";
|
||||
auto_height = false;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setVisible(false)
|
||||
.setDisplay(VALUE_DISPLAY.path_load, { filter: "image|*.png;*.jpg" })
|
||||
.rejectArray();
|
||||
|
|
|
@ -48,7 +48,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
|
||||
inputs[0] = nodeValue_Surface("Surface", self);
|
||||
|
||||
inputs[1] = nodeValue_Text("Paths", self, "")
|
||||
inputs[1] = nodeValue_Path("Paths", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_save, _format_still)
|
||||
.setVisible(true);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
name = "Image";
|
||||
color = COLORS.node_blend_input;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_load, { filter: "image|*.png;*.jpg" });
|
||||
|
||||
inputs[1] = nodeValue_Padding("Padding", self, [0, 0, 0, 0]);
|
||||
|
|
|
@ -38,7 +38,7 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
|
||||
update_on_frame = true;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, [])
|
||||
inputs[0] = nodeValue_Path("Path", self, [])
|
||||
.setDisplay(VALUE_DISPLAY.path_array, { filter: ["image|*.png;*.jpg", ""] });
|
||||
|
||||
inputs[1] = nodeValue_Padding("Padding", self, [0, 0, 0, 0])
|
||||
|
|
|
@ -29,7 +29,7 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
update_on_frame = true;
|
||||
setAlwaysTimeline(new timelineItemNode_Image_gif(self));
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_load, { filter: "Animated gif|*.gif" });
|
||||
|
||||
inputs[1] = nodeValue_Trigger("Set animation length to gif", self, false )
|
||||
|
|
|
@ -39,7 +39,7 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
spr = [];
|
||||
color = COLORS.node_blend_input;
|
||||
|
||||
inputs[0] = nodeValue_Text("Paths", self, [])
|
||||
inputs[0] = nodeValue_Path("Paths", self, [])
|
||||
.setDisplay(VALUE_DISPLAY.path_array, { filter: ["image|*.png;*.jpg", ""] });
|
||||
|
||||
inputs[1] = nodeValue_Padding("Padding", self, [0, 0, 0, 0])
|
||||
|
|
|
@ -29,7 +29,7 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
|
||||
w = 128;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_load, { filter: "JSON file|*.json" })
|
||||
.rejectArray();
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con
|
|||
|
||||
w = 128;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_save, { filter: "json file|*.json" })
|
||||
.rejectArray();
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
var _wig = _data[4];
|
||||
var _sed = _data[5];
|
||||
var _ang = _data[6];
|
||||
var _pat = _data[7];
|
||||
var _pat = _data[7]; print(_pat);
|
||||
var _ratio = _data[8];
|
||||
var _shift = _data[9];
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ function Node_Path_Separate_Folder(_x, _y, _group = noone) : Node_Processor(_x,
|
|||
|
||||
setDimension(96, 48);
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setVisible(true, true);
|
||||
|
||||
inputs[1] = nodeValue_Bool("Keep extension", self, true);
|
||||
|
|
|
@ -151,8 +151,9 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
#endregion
|
||||
|
||||
for(var l = 0; l < process_amount; l++) {
|
||||
__l = l;
|
||||
_data[i] = array_map(inputs, function(_in, i) /*=>*/ {return all_inputs[i][__l]});
|
||||
|
||||
for(var i = input_list_size - 1; i >= 0; i--)
|
||||
_data[i] = all_inputs[i][l];
|
||||
|
||||
if(_output.type == VALUE_TYPE.surface) { #region // Output surface verification
|
||||
if(manage_atlas) {
|
||||
|
|
|
@ -2,7 +2,7 @@ function Node_Shell(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
name = "Execute Shell";
|
||||
setDimension(96, 32 + 24 * 1);
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "");
|
||||
inputs[0] = nodeValue_Path("Path", self, "");
|
||||
|
||||
inputs[1] = nodeValue_Text("Script", self, "");
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ function Node_SVG(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
name = "SVG";
|
||||
color = COLORS.node_blend_input;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_load, { filter: "Scalable Vector Graphics|*.svg" });
|
||||
|
||||
inputs[1] = nodeValue_Float("Scale", self, 1);
|
||||
|
|
|
@ -29,7 +29,7 @@ function Node_Text_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
|
||||
w = 128;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_load, { filter: "any file|*" })
|
||||
.rejectArray();
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ function Node_Text_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con
|
|||
|
||||
w = 128;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_save, { filter: "text file|*.txt" })
|
||||
.rejectArray();
|
||||
|
||||
|
|
|
@ -370,11 +370,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
mappedJunc = noone;
|
||||
mapped_vec4 = false;
|
||||
|
||||
static setMappable = function(index, vec4 = false) { #region
|
||||
static setMappable = function(index, vec4 = false) {
|
||||
attributes.mapped = false;
|
||||
attributes.map_index = index;
|
||||
mapped_vec4 = vec4;
|
||||
|
||||
if(arrayLength == arrayLengthSimple)
|
||||
arrayLength = __arrayLength;
|
||||
|
||||
mapButton = button(function() {
|
||||
attributes.mapped = !attributes.mapped;
|
||||
|
||||
|
@ -405,7 +408,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
editWidget.side_button = mapButton;
|
||||
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static setMapped = function(junc) { #region
|
||||
mappedJunc = junc;
|
||||
|
@ -1159,7 +1162,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
var val = __curr_get_val[0];
|
||||
var nod = __curr_get_val[1];
|
||||
|
||||
var typ = nod == undefined? VALUE_TYPE.any : nod.type;
|
||||
var typ = nod.type;
|
||||
var dis = nod.display_type;
|
||||
|
||||
if(connect_type == JUNCTION_CONNECT.output) return val;
|
||||
|
@ -1360,7 +1363,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
}
|
||||
|
||||
__is_array = false;
|
||||
static arrayLength = function(val = undefined) {
|
||||
__array_length = -1;
|
||||
|
||||
static __arrayLength = function(val = undefined) {
|
||||
val ??= getValue();
|
||||
|
||||
__is_array = false;
|
||||
|
@ -1386,6 +1391,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
return __is_array? array_length(val) : -1;
|
||||
}
|
||||
|
||||
arrayLength = __arrayLength;
|
||||
|
||||
/////============== SET =============
|
||||
|
||||
static onValidate = function() { #region
|
||||
|
|
|
@ -13,7 +13,7 @@ function NodeValue_D3Material(_name, _node, _value, _tooltip = "") : NodeValue(_
|
|||
var val = __curr_get_val[0];
|
||||
var nod = __curr_get_val[1];
|
||||
|
||||
var typ = nod == undefined? VALUE_TYPE.any : nod.type;
|
||||
var typ = nod.type;
|
||||
var dis = nod.display_type;
|
||||
|
||||
if(nod == self)
|
||||
|
|
|
@ -19,7 +19,7 @@ function NodeValue_Dimension(_node, value) : NodeValue("Dimension", _node, JUNCT
|
|||
var val = __curr_get_val[0];
|
||||
var nod = __curr_get_val[1];
|
||||
|
||||
var typ = nod == undefined? VALUE_TYPE.any : nod.type;
|
||||
var typ = nod.type;
|
||||
var dis = nod.display_type;
|
||||
|
||||
if(typ != VALUE_TYPE.surface) {
|
||||
|
|
|
@ -9,7 +9,7 @@ function NodeValue_Float(_name, _node, _value, _tooltip = "") : NodeValue(_name,
|
|||
var val = __curr_get_val[0];
|
||||
var nod = __curr_get_val[1];
|
||||
|
||||
var typ = nod == undefined? VALUE_TYPE.any : nod.type;
|
||||
var typ = nod.type;
|
||||
var dis = nod.display_type;
|
||||
|
||||
if(typ != VALUE_TYPE.surface) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
function nodeValue_Gradient(_name, _node, _value, _tooltip = "") { return new NodeValue_Gradient(_name, _node, _value, _tooltip); }
|
||||
|
||||
function NodeValue_Gradient(_name, _node, _value, _tooltip = "") : NodeValue(_name, _node, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, _value, _tooltip) constructor {
|
||||
setDisplay(VALUE_DISPLAY.palette);
|
||||
|
||||
/////============== GET =============
|
||||
|
||||
|
@ -11,7 +10,7 @@ function NodeValue_Gradient(_name, _node, _value, _tooltip = "") : NodeValue(_na
|
|||
var nod = __curr_get_val[1];
|
||||
|
||||
if(is_instanceof(val, gradientObject)) return val;
|
||||
if(typeFrom != VALUE_TYPE.color) return val;
|
||||
if(nod.type != VALUE_TYPE.color) return val;
|
||||
|
||||
if(is_array(val)) {
|
||||
var amo = array_length(val);
|
||||
|
|
|
@ -9,7 +9,7 @@ function NodeValue_Int(_name, _node, _value, _tooltip = "") : NodeValue(_name, _
|
|||
var val = __curr_get_val[0];
|
||||
var nod = __curr_get_val[1];
|
||||
|
||||
var typ = nod == undefined? VALUE_TYPE.any : nod.type;
|
||||
var typ = nod.type;
|
||||
var dis = nod.display_type;
|
||||
|
||||
if(typ != VALUE_TYPE.surface) {
|
||||
|
|
|
@ -4,7 +4,7 @@ function NodeValue_Output(_name, _node, _type, _value, _tooltip = "") : NodeValu
|
|||
|
||||
/////============== GET =============
|
||||
|
||||
output_value = 0;
|
||||
output_value = _value;
|
||||
|
||||
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value
|
||||
return output_value;
|
||||
|
|
19
scripts/node_value_path/node_value_path.gml
Normal file
19
scripts/node_value_path/node_value_path.gml
Normal file
|
@ -0,0 +1,19 @@
|
|||
function nodeValue_Path(_name, _node, _value, _tooltip = "") { return new NodeValue_Path(_name, _node, _value, _tooltip); }
|
||||
|
||||
function NodeValue_Path(_name, _node, _value, _tooltip = "") : NodeValue(_name, _node, JUNCTION_CONNECT.input, VALUE_TYPE.path, _value, _tooltip) constructor {
|
||||
|
||||
/////============== GET =============
|
||||
|
||||
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value
|
||||
getValueRecursive(self.__curr_get_val, _time);
|
||||
var val = __curr_get_val[0];
|
||||
return val;
|
||||
}
|
||||
|
||||
static __getAnimValue = function(_time = CURRENT_FRAME) {
|
||||
if(is_anim) return animator.getValue(_time);
|
||||
return array_empty(animator.values)? 0 : animator.values[0].value;
|
||||
}
|
||||
|
||||
static arrayLength = arrayLengthSimple;
|
||||
}
|
13
scripts/node_value_path/node_value_path.yy
Normal file
13
scripts/node_value_path/node_value_path.yy
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"$GMScript":"",
|
||||
"%Name":"node_value_path",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
"name":"node_value_path",
|
||||
"parent":{
|
||||
"name":"types",
|
||||
"path":"folders/nodes/values/types.yy",
|
||||
},
|
||||
"resourceType":"GMScript",
|
||||
"resourceVersion":"2.0",
|
||||
}
|
|
@ -10,7 +10,7 @@ function NodeValue_Quaternion(_name, _node, _value, _tooltip = "") : NodeValue_A
|
|||
var val = __curr_get_val[0];
|
||||
var nod = __curr_get_val[1];
|
||||
|
||||
var typ = nod == undefined? VALUE_TYPE.any : nod.type;
|
||||
var typ = nod.type;
|
||||
var dis = nod.display_type;
|
||||
|
||||
if(!is_array(val)) return [ val, val, val, val ];
|
||||
|
|
|
@ -9,7 +9,7 @@ function NodeValue_Rotation(_name, _node, _value, _tooltip = "") : NodeValue(_na
|
|||
getValueRecursive(self.__curr_get_val, _time);
|
||||
var val = __curr_get_val[0];
|
||||
var nod = __curr_get_val[1];
|
||||
var typ = nod == undefined? VALUE_TYPE.any : nod.type;
|
||||
var typ = nod.type;
|
||||
|
||||
if(typ == VALUE_TYPE.text) val = toNumber(val);
|
||||
return val;
|
||||
|
|
|
@ -19,14 +19,20 @@ function NodeValue_Vec2(_name, _node, _value, _data = {}) : NodeValue(_name, _no
|
|||
var val = __curr_get_val[0];
|
||||
var nod = __curr_get_val[1];
|
||||
|
||||
var typ = nod == undefined? VALUE_TYPE.any : nod.type;
|
||||
var typ = nod.type;
|
||||
var dis = nod.display_type;
|
||||
|
||||
if(typ != VALUE_TYPE.surface) {
|
||||
if(!is_array(val)) val = [ val, val ];
|
||||
if(array_length(val) != 2) val = [ array_safe_get_fast(val, 0), array_safe_get_fast(val, 1) ];
|
||||
if(!is_array(val)) return [ val, val ];
|
||||
|
||||
return valueProcess(val, nod, applyUnit, arrIndex);
|
||||
var _d = array_get_depth(val);
|
||||
if(_d == 1) return valueProcess(val, nod, applyUnit, arrIndex);
|
||||
if(_d == 2) {
|
||||
for (var i = 0, n = array_length(val); i < n; i++)
|
||||
val[i] = valueProcess(val[1], nod, applyUnit, arrIndex);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
// Dimension conversion
|
||||
|
@ -49,8 +55,10 @@ function NodeValue_Vec2(_name, _node, _value, _data = {}) : NodeValue(_name, _no
|
|||
|
||||
if(eqSize) return _osZ;
|
||||
return sArr;
|
||||
|
||||
} else if (is_surface(val))
|
||||
return [ surface_get_width_safe(val), surface_get_height_safe(val) ];
|
||||
|
||||
return [ 1, 1 ];
|
||||
}
|
||||
|
||||
|
|
|
@ -36,13 +36,13 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
wd_pan_my = 0;
|
||||
|
||||
coordinate_menu = [
|
||||
menuItem(__txt("Reset view"), function() {
|
||||
menuItemAction(__txt("Reset view"), function() {
|
||||
wd_minx = -1;
|
||||
wd_miny = -1;
|
||||
wd_maxx = 1;
|
||||
wd_maxy = 1;
|
||||
}),
|
||||
menuItem(__txt("Focus value"), function() {
|
||||
menuItemAction(__txt("Focus value"), function() {
|
||||
var _x = getInputData(0);
|
||||
var _y = getInputData(1);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
name = "WAV File In";
|
||||
color = COLORS.node_blend_input;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_load, { filter: "audio|*.wav" })
|
||||
.rejectArray();
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ function Node_WAV_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
color = COLORS.node_blend_input;
|
||||
setDimension(, 72);
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_save, { filter: "audio file|*.wav" })
|
||||
.rejectArray()
|
||||
.setVisible(true);
|
||||
|
|
|
@ -9,7 +9,7 @@ function Node_Websocket_Sender(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
|
||||
inputs[3] = nodeValue_Surface("Surface", self);
|
||||
|
||||
inputs[4] = nodeValue_Text("Path", self, "")
|
||||
inputs[4] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_load)
|
||||
.nonValidate();
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ function Node_XML_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
|
||||
w = 128;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_load, { filter: "XML file|*.xml" })
|
||||
.rejectArray();
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ function Node_XML_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
|
||||
w = 128;
|
||||
|
||||
inputs[0] = nodeValue_Text("Path", self, "")
|
||||
inputs[0] = nodeValue_Path("Path", self, "")
|
||||
.setDisplay(VALUE_DISPLAY.path_save, { filter: "xml file|*.xml" })
|
||||
.rejectArray();
|
||||
|
||||
|
|
|
@ -1,32 +1,77 @@
|
|||
#region funtion calls
|
||||
function __fnInit_Animation() {
|
||||
__registerFunction("animation_play_pause", panel_animation_play_pause);
|
||||
__registerFunction("animation_resume", panel_animation_resume);
|
||||
registerFunction("", "Play/Pause", vk_space, MOD_KEY.none, panel_animation_play_pause);
|
||||
registerFunction("", "Resume/Pause", vk_space, MOD_KEY.shift, panel_animation_resume);
|
||||
|
||||
__registerFunction("animation_first_frame", panel_animation_first_frame);
|
||||
__registerFunction("animation_last_frame", panel_animation_last_frame);
|
||||
__registerFunction("animation_next_frame", panel_animation_next_frame);
|
||||
__registerFunction("animation_prev_frame", panel_animation_prev_frame);
|
||||
registerFunction("", "First frame", vk_home, MOD_KEY.none, panel_animation_first_frame);
|
||||
registerFunction("", "Last frame", vk_end, MOD_KEY.none, panel_animation_last_frame);
|
||||
registerFunction("", "Next frame", vk_right, MOD_KEY.none, panel_animation_next_frame);
|
||||
registerFunction("", "Previous frame", vk_left, MOD_KEY.none, panel_animation_prev_frame);
|
||||
|
||||
__registerFunction("animation_delete_key", panel_animation_delete_key);
|
||||
__registerFunction("animation_duplicate", panel_animation_duplicate);
|
||||
__registerFunction("animation_copy", panel_animation_copy);
|
||||
__registerFunction("animation_paste", panel_animation_paste);
|
||||
registerFunction("Animation", "Delete keys", vk_delete, MOD_KEY.none, panel_animation_delete_key);
|
||||
registerFunction("Animation", "Duplicate", "D", MOD_KEY.ctrl, panel_animation_duplicate);
|
||||
registerFunction("Animation", "Copy", "C", MOD_KEY.ctrl, panel_animation_copy);
|
||||
registerFunction("Animation", "Paste", "V", MOD_KEY.ctrl, panel_animation_paste);
|
||||
registerFunction("Animation", "Collapse Toggle", "C", MOD_KEY.none, panel_animation_collapseToggle);
|
||||
registerFunction("Animation", "Toggle Nodes", "H", MOD_KEY.none, panel_animation_show_nodes);
|
||||
|
||||
registerFunction("Animation", "Settings", "S", MOD_KEY.ctrl | MOD_KEY.shift, panel_animation_settings);
|
||||
registerFunction("Animation", "Scaler", "", MOD_KEY.none, panel_animation_scale);
|
||||
|
||||
registerFunction("Animation", "Edit Keyframe Value","", MOD_KEY.none, panel_animation_edit_keyframe_value);
|
||||
registerFunction("Animation", "Lock Keyframe Y", "", MOD_KEY.none, panel_animation_edit_keyframe_lock_y);
|
||||
registerFunction("Animation", "Stagger", "", MOD_KEY.none, panel_animation_edit_keyframe_stagger);
|
||||
registerFunction("Animation", "Driver", "", MOD_KEY.none, panel_animation_keyframe_driver);
|
||||
|
||||
registerFunction("Animation", "New Folder", "", MOD_KEY.none, panel_animation_dopesheet_new_folder);
|
||||
registerFunction("Animation", "Dopesheet Expand", "", MOD_KEY.none, panel_animation_dopesheet_expand);
|
||||
registerFunction("Animation", "Dopesheet Collapse", "", MOD_KEY.none, panel_animation_dopesheet_collapse);
|
||||
|
||||
registerFunction("Animation", "Rename Group", "", MOD_KEY.none, panel_animation_group_rename);
|
||||
registerFunction("Animation", "Remove Group", "", MOD_KEY.none, panel_animation_group_remove);
|
||||
registerFunction("Animation", "Separate Axis", "", MOD_KEY.none, panel_animation_separate_axis);
|
||||
registerFunction("Animation", "Combine Axis", "", MOD_KEY.none, panel_animation_combine_axis);
|
||||
|
||||
registerFunction("Animation", "Set Range Start", "", MOD_KEY.none, panel_animation_range_set_start);
|
||||
registerFunction("Animation", "Set Range End", "", MOD_KEY.none, panel_animation_range_set_end);
|
||||
registerFunction("Animation", "Reset Range", "", MOD_KEY.none, panel_animation_range_reset);
|
||||
}
|
||||
|
||||
function panel_animation_play_pause() { CALL("animation_play_pause"); if(IS_RENDERING) return; if(IS_PLAYING) PROJECT.animator.pause() else PROJECT.animator.play(); }
|
||||
function panel_animation_resume() { CALL("animation_resume"); if(IS_RENDERING) return; if(PROJECT.animator.is_playing) PROJECT.animator.pause() else PROJECT.animator.resume(); }
|
||||
function panel_animation_settings() { var dia = dialogPanelCall(new Panel_Animation_Setting()); dia.anchor = ANCHOR.none; }
|
||||
function panel_animation_scale() { dialogPanelCall(new Panel_Animation_Scaler()); }
|
||||
|
||||
function panel_animation_first_frame() { CALL("animation_first_frame"); if(IS_RENDERING) return; PROJECT.animator.firstFrame(); }
|
||||
function panel_animation_last_frame() { CALL("animation_last_frame"); if(IS_RENDERING) return; PROJECT.animator.lastFrame(); }
|
||||
function panel_animation_next_frame() { CALL("animation_next_frame"); if(IS_RENDERING) return; PROJECT.animator.setFrame(min(PROJECT.animator.real_frame + 1, TOTAL_FRAMES - 1)); }
|
||||
function panel_animation_prev_frame() { CALL("animation_prev_frame"); if(IS_RENDERING) return; PROJECT.animator.setFrame(max(PROJECT.animator.real_frame - 1, 0)); }
|
||||
function panel_animation_play_pause() { CALL("play_pause"); if(IS_RENDERING) return; if(IS_PLAYING) PROJECT.animator.pause() else PROJECT.animator.play(); }
|
||||
function panel_animation_resume() { CALL("resume_pause"); if(IS_RENDERING) return; if(PROJECT.animator.is_playing) PROJECT.animator.pause() else PROJECT.animator.resume(); }
|
||||
|
||||
function panel_animation_first_frame() { CALL("first_frame"); if(IS_RENDERING) return; PROJECT.animator.firstFrame(); }
|
||||
function panel_animation_last_frame() { CALL("last_frame"); if(IS_RENDERING) return; PROJECT.animator.lastFrame(); }
|
||||
function panel_animation_next_frame() { CALL("next_frame"); if(IS_RENDERING) return; PROJECT.animator.setFrame(min(PROJECT.animator.real_frame + 1, TOTAL_FRAMES - 1)); }
|
||||
function panel_animation_prev_frame() { CALL("previous_frame"); if(IS_RENDERING) return; PROJECT.animator.setFrame(max(PROJECT.animator.real_frame - 1, 0)); }
|
||||
|
||||
function panel_animation_collapseToggle(){ CALL("animation_collapse_toggle"); PANEL_ANIMATION.collapseToggle(); }
|
||||
function panel_animation_delete_key() { CALL("animation_delete_key"); PANEL_ANIMATION.deleteKeys(); }
|
||||
function panel_animation_duplicate() { CALL("animation_duplicate"); PANEL_ANIMATION.doDuplicate(); }
|
||||
function panel_animation_copy() { CALL("animation_copy"); PANEL_ANIMATION.doCopy(); }
|
||||
function panel_animation_paste() { CALL("animation_paste"); PANEL_ANIMATION.doPaste(PANEL_ANIMATION.value_focusing); }
|
||||
function panel_animation_show_nodes() { CALL("animation_paste"); PANEL_ANIMATION.show_nodes = !PANEL_ANIMATION.show_nodes; }
|
||||
function panel_animation_show_nodes() { CALL("animation_toggle_nodes"); PANEL_ANIMATION.show_nodes = !PANEL_ANIMATION.show_nodes; }
|
||||
|
||||
function panel_animation_edit_keyframe_value() { CALL("animation_edit_keyframe_value"); PANEL_ANIMATION.edit_keyframe_value(); }
|
||||
function panel_animation_edit_keyframe_lock_y() { CALL("animation_edit_lock_keyframe_y"); PANEL_ANIMATION.edit_keyframe_lock_y(); }
|
||||
function panel_animation_edit_keyframe_stagger() { CALL("animation_stagger"); PANEL_ANIMATION.edit_keyframe_stagger(); }
|
||||
function panel_animation_keyframe_driver() { CALL("animation_driver"); PANEL_ANIMATION.edit_keyframe_driver(); }
|
||||
|
||||
function panel_animation_dopesheet_new_folder() { CALL("animation_new_folder"); PANEL_ANIMATION.dopesheet_new_folder(); }
|
||||
function panel_animation_dopesheet_expand() { CALL("animation_dopesheet_expand"); PANEL_ANIMATION.dopesheet_expand(); }
|
||||
function panel_animation_dopesheet_collapse() { CALL("animation_dopesheet_collapse"); PANEL_ANIMATION.dopesheet_collapse(); }
|
||||
|
||||
function panel_animation_group_rename() { CALL("animation_rename_group"); PANEL_ANIMATION.group_rename(); }
|
||||
function panel_animation_group_remove() { CALL("animation_remove_group"); PANEL_ANIMATION.group_remove(); }
|
||||
function panel_animation_separate_axis() { CALL("animation_separate_axis"); PANEL_ANIMATION.separate_axis(); }
|
||||
function panel_animation_combine_axis() { CALL("animation_combine_axis"); PANEL_ANIMATION.combine_axis(); }
|
||||
|
||||
function panel_animation_range_set_start() { CALL("animation_range_set_start"); PANEL_ANIMATION.range_set_start(); }
|
||||
function panel_animation_range_set_end() { CALL("animation_range_set_end"); PANEL_ANIMATION.range_set_end(); }
|
||||
function panel_animation_range_reset() { CALL("animation_range_reset"); PANEL_ANIMATION.range_reset(); }
|
||||
#endregion
|
||||
|
||||
enum KEYFRAME_DRAG_TYPE {
|
||||
|
@ -48,7 +93,7 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
tool_width = ui(224);
|
||||
#endregion
|
||||
|
||||
static initSize = function() { #region
|
||||
static initSize = function() {
|
||||
timeline_w = w - tool_width - ui(80);
|
||||
timeline_surface = surface_create_valid(timeline_w, timeline_h);
|
||||
timeline_mask = surface_create_valid(timeline_w, timeline_h);
|
||||
|
@ -60,7 +105,7 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
|
||||
dope_sheet_name_mask = surface_create_valid(tool_width, 1);
|
||||
dope_sheet_name_surface = surface_create_valid(tool_width, 1);
|
||||
} #endregion
|
||||
}
|
||||
initSize();
|
||||
|
||||
#region ---- position ----
|
||||
|
@ -178,47 +223,20 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
#endregion
|
||||
|
||||
on_end_dragging_anim = noone;
|
||||
|
||||
onion_dragging = noone;
|
||||
|
||||
prev_cache = array_create(TOTAL_FRAMES);
|
||||
|
||||
copy_clipboard = ds_list_create();
|
||||
|
||||
#region ++++ hotkeys ++++
|
||||
|
||||
__collapse = false;
|
||||
function collapseToggle() { #region
|
||||
function collapseToggle() {
|
||||
PANEL_ANIMATION.__collapse = !PANEL_ANIMATION.__collapse;
|
||||
|
||||
for( var i = 0, n = array_length(PANEL_ANIMATION.timeline_contents); i < n; i++ )
|
||||
PANEL_ANIMATION.timeline_contents[i].item.show = PANEL_ANIMATION.__collapse;
|
||||
} #endregion
|
||||
|
||||
addHotkey("", "Play/Pause", vk_space, MOD_KEY.none, panel_animation_play_pause);
|
||||
addHotkey("", "Resume/Pause", vk_space, MOD_KEY.shift, panel_animation_resume);
|
||||
|
||||
addHotkey("", "First frame", vk_home, MOD_KEY.none, panel_animation_first_frame);
|
||||
addHotkey("", "Last frame", vk_end, MOD_KEY.none, panel_animation_last_frame);
|
||||
addHotkey("", "Next frame", vk_right, MOD_KEY.none, panel_animation_next_frame);
|
||||
addHotkey("", "Previous frame", vk_left, MOD_KEY.none, panel_animation_prev_frame);
|
||||
|
||||
addHotkey("Animation", "Delete keys", vk_delete, MOD_KEY.none, panel_animation_delete_key);
|
||||
addHotkey("Animation", "Duplicate", "D", MOD_KEY.ctrl, panel_animation_duplicate);
|
||||
addHotkey("Animation", "Copy", "C", MOD_KEY.ctrl, panel_animation_copy);
|
||||
addHotkey("Animation", "Paste", "V", MOD_KEY.ctrl, panel_animation_paste);
|
||||
addHotkey("Animation", "Collapse Toggle", "C", MOD_KEY.none, collapseToggle);
|
||||
addHotkey("Animation", "Toggle nodes", "H", MOD_KEY.none, panel_animation_show_nodes);
|
||||
|
||||
addHotkey("Animation", "Settings", "S", MOD_KEY.ctrl | MOD_KEY.shift, function() {
|
||||
var dia = dialogPanelCall(new Panel_Animation_Setting());
|
||||
dia.anchor = ANCHOR.none;
|
||||
});
|
||||
|
||||
tooltip_toggle_nodes = new tooltipHotkey(__txtx("panel_animation_show_node", "Toggle node label"), "Animation", "Toggle nodes");
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region ++++ control_buttons ++++
|
||||
tooltip_toggle_nodes = new tooltipHotkey(__txtx("panel_animation_show_node", "Toggle node label"), "Animation", "Toggle nodes");
|
||||
tooltip_resume = new tooltipHotkey(__txt("Resume"), "", "Resume/Pause");
|
||||
tooltip_pause = new tooltipHotkey(__txt("Pause"), "", "Resume/Pause");
|
||||
tooltip_fr_first = new tooltipHotkey(__txtx("panel_animation_go_to_first_frame", "Go to first frame"), "", "First frame");
|
||||
|
@ -268,19 +286,38 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
|
||||
#region ++++ context menu ++++
|
||||
|
||||
keyframe_menu = [
|
||||
#region actions
|
||||
function edit_keyframe_value() { if(array_empty(keyframe_selecting)) return; editKeyFrame(keyframe_selecting[0]); }
|
||||
|
||||
menuItem(__txtx("panel_animation_keyframe_edit", "Edit Value..."), function() {
|
||||
if(array_empty(keyframe_selecting)) return;
|
||||
editKeyFrame(keyframe_selecting[0]);
|
||||
}),
|
||||
|
||||
menuItem(__txtx("panel_animation_lock_y", "Lock/Unlock Y easing"), function() {
|
||||
function edit_keyframe_lock_y() {
|
||||
for( var i = 0, n = array_length(keyframe_selecting); i < n; i++ ) {
|
||||
var k = keyframe_selecting[i];
|
||||
k.ease_y_lock = !k.ease_y_lock;
|
||||
}
|
||||
}),
|
||||
}
|
||||
|
||||
function edit_keyframe_stagger() { stagger_mode = 1; }
|
||||
function edit_keyframe_driver() { dialogPanelCall(new Panel_Keyframe_Driver(keyframe_selecting[0]), mouse_mx + ui(8), mouse_my + ui(8)); }
|
||||
|
||||
function dopesheet_new_folder() { var _dir = new timelineItemGroup(); PROJECT.timelines.addItem(_dir); }
|
||||
function dopesheet_expand() { for( var i = 0, n = array_length(timeline_contents); i < n; i++ ) timeline_contents[i].item.show = true; }
|
||||
function dopesheet_collapse() { for( var i = 0, n = array_length(timeline_contents); i < n; i++ ) timeline_contents[i].item.show = false; }
|
||||
|
||||
function group_rename() { context_selecting_item.item.rename(); }
|
||||
function group_remove() { context_selecting_item.item.destroy(); }
|
||||
|
||||
function separate_axis() { context_selecting_prop.sep_axis = true; }
|
||||
function combine_axis() { context_selecting_prop.sep_axis = false; }
|
||||
|
||||
function range_set_start() { if(FRAME_RANGE == noone) FRAME_RANGE = [ __selecting_frame, TOTAL_FRAMES ]; else FRAME_RANGE[0] = __selecting_frame; }
|
||||
function range_set_end() { if(FRAME_RANGE == noone) FRAME_RANGE = [ 0, __selecting_frame ]; else FRAME_RANGE[1] = __selecting_frame; }
|
||||
function range_reset() { FRAME_RANGE = noone; }
|
||||
#endregion
|
||||
|
||||
keyframe_menu = [
|
||||
|
||||
menuItemAction(__txtx("panel_animation_keyframe_edit", "Edit Value..."), panel_animation_edit_keyframe_value),
|
||||
menuItemAction(__txtx("panel_animation_lock_y", "Lock/Unlock Y easing"), panel_animation_edit_keyframe_lock_y),
|
||||
|
||||
menuItemGroup(__txtx("panel_animation_ease_in", "Ease in"), [
|
||||
[ [THEME.timeline_ease, 0], function() {
|
||||
|
@ -355,36 +392,27 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
[ [THEME.object_halign, 1], function() { alignKeys(fa_center); } ],
|
||||
[ [THEME.object_halign, 2], function() { alignKeys(fa_right); } ],
|
||||
]),
|
||||
menuItem(__txtx("panel_animation_stagger", "Stagger"), function() { stagger_mode = 1; }),
|
||||
menuItem(__txtx("panel_driver", "Driver..."), function() { dialogPanelCall(new Panel_Keyframe_Driver(keyframe_selecting[0]), mouse_mx + ui(8), mouse_my + ui(8)); }),
|
||||
menuItemAction(__txtx("panel_animation_stagger", "Stagger"), panel_animation_edit_keyframe_stagger),
|
||||
menuItemAction(__txtx("panel_driver", "Driver..."), panel_animation_keyframe_driver),
|
||||
-1,
|
||||
menuItem(__txt("Delete"), function() { deleteKeys(); }, noone, [ "Animation", "Delete keys" ]),
|
||||
menuItem(__txt("Duplicate"), function() { doDuplicate(); }, THEME.duplicate, [ "Animation", "Duplicate" ]),
|
||||
menuItem(__txt("Copy"), function() { doCopy(); }, THEME.copy, [ "Animation", "Copy" ]),
|
||||
menuItem(__txt("Paste"), function() { doPaste(value_focusing); }, THEME.paste, [ "Animation", "Paste" ]),
|
||||
menuItemAction(__txt("Delete"), panel_animation_delete_key),
|
||||
menuItemAction(__txt("Duplicate"), panel_animation_duplicate, THEME.duplicate),
|
||||
menuItemAction(__txt("Copy"), panel_animation_copy, THEME.copy),
|
||||
menuItemAction(__txt("Paste"), panel_animation_paste, THEME.paste),
|
||||
];
|
||||
|
||||
keyframe_menu_empty = [
|
||||
menuItem(__txt("Paste"), function() { doPaste(value_focusing); }, THEME.paste, [ "Animation", "Paste" ]),
|
||||
menuItemAction(__txt("Paste"), panel_animation_paste, THEME.paste),
|
||||
];
|
||||
|
||||
context_selecting_item = noone;
|
||||
context_selecting_prop = noone;
|
||||
|
||||
name_menu_empty = [
|
||||
menuItem(__txt("New folder"), function() {
|
||||
var _dir = new timelineItemGroup();
|
||||
PROJECT.timelines.addItem(_dir);
|
||||
}, THEME.folder_content),
|
||||
menuItemAction(__txt("New folder"), panel_animation_dopesheet_new_folder, THEME.folder_content),
|
||||
-1,
|
||||
menuItem(__txt("Expand all"), function() {
|
||||
for( var i = 0, n = array_length(timeline_contents); i < n; i++ )
|
||||
timeline_contents[i].item.show = true;
|
||||
}),
|
||||
menuItem(__txt("Collapse all"), function() {
|
||||
for( var i = 0, n = array_length(timeline_contents); i < n; i++ )
|
||||
timeline_contents[i].item.show = false;
|
||||
}),
|
||||
menuItemAction(__txt("Expand all"), panel_animation_dopesheet_expand),
|
||||
menuItemAction(__txt("Collapse all"), panel_animation_dopesheet_collapse),
|
||||
];
|
||||
|
||||
var _clrs = COLORS.labels;
|
||||
|
@ -417,21 +445,21 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
|
||||
name_menu_group = [
|
||||
clr,
|
||||
menuItem(__txt("Rename"), function() { context_selecting_item.item.rename(); }),
|
||||
menuItem(__txt("Delete"), function() { context_selecting_item.item.destroy(); }, THEME.cross),
|
||||
menuItemAction(__txt("Rename"), panel_animation_group_rename),
|
||||
menuItemAction(__txt("Delete"), panel_animation_group_remove, THEME.cross),
|
||||
-1,
|
||||
name_menu_empty[0]
|
||||
];
|
||||
|
||||
name_menu_prop_sep = [
|
||||
menuItem(__txtx("panel_inspector_axis_separate", "Separate axis"), function() { context_selecting_prop.sep_axis = true; }),
|
||||
menuItemAction(__txtx("panel_inspector_axis_separate", "Separate axis"), panel_animation_separate_axis),
|
||||
-1,
|
||||
name_menu_empty[2],
|
||||
name_menu_empty[3],
|
||||
];
|
||||
|
||||
name_menu_prop_join = [
|
||||
menuItem(__txtx("panel_inspector_axis_combine", "Combine axis"), function() { context_selecting_prop.sep_axis = false; }),
|
||||
menuItemAction(__txtx("panel_inspector_axis_combine", "Combine axis"), panel_animation_combine_axis),
|
||||
-1,
|
||||
name_menu_empty[2],
|
||||
name_menu_empty[3],
|
||||
|
@ -448,7 +476,7 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
keyframe_selecting = [];
|
||||
}
|
||||
|
||||
function alignKeys(halign = fa_left) { #region
|
||||
function alignKeys(halign = fa_left) {
|
||||
if(array_empty(keyframe_selecting)) return;
|
||||
|
||||
var tt = 0;
|
||||
|
@ -476,13 +504,13 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
var k = keyframe_selecting[i];
|
||||
k.anim.setKeyTime(k, tt,, true);
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function arrangeKeys() { #region
|
||||
function arrangeKeys() {
|
||||
//keyframe_selecting = l;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function staggerKeys(_index, _stag) { #region
|
||||
function staggerKeys(_index, _stag) {
|
||||
var modified = false;
|
||||
var t = keyframe_selecting[_index].time;
|
||||
|
||||
|
@ -494,11 +522,11 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
}
|
||||
|
||||
if(modified) UNDO_HOLDING = true;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function onFocusBegin() { PANEL_ANIMATION = self; }
|
||||
|
||||
function surfaceVerify() { #region
|
||||
function surfaceVerify() {
|
||||
if(w - tool_width > 1) {
|
||||
timeline_mask = surface_verify(timeline_mask, timeline_w, timeline_h);
|
||||
timeline_surface = surface_verify(timeline_surface, timeline_w, timeline_h);
|
||||
|
@ -513,16 +541,16 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
dope_sheet_name_mask = surface_verify(dope_sheet_name_mask, tool_width, dope_sheet_h);
|
||||
dope_sheet_name_surface = surface_verify(dope_sheet_name_surface, tool_width, dope_sheet_h);
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function onResize() { #region
|
||||
function onResize() {
|
||||
initSize();
|
||||
|
||||
surfaceVerify();
|
||||
resetTimelineMask();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function resetTimelineMask() { #region
|
||||
function resetTimelineMask() {
|
||||
timeline_mask = surface_verify(timeline_mask, timeline_w, timeline_h);
|
||||
|
||||
surface_set_target(timeline_mask);
|
||||
|
@ -547,7 +575,7 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
|
||||
gpu_set_blendmode(bm_normal);
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
resetTimelineMask();
|
||||
|
||||
function getTimelineContentFolder(folder, _context = [], _depth = 0, _show = true) { #region
|
||||
|
@ -802,9 +830,9 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
__selecting_frame = clamp(round((mx - bar_x - timeline_shift) / timeline_scale), 0, TOTAL_FRAMES - 1);
|
||||
|
||||
menuCall("animation_summary_menu",,, [
|
||||
menuItem(__txtx("panel_animation_range_start", "Set start"), function() { if(FRAME_RANGE == noone) FRAME_RANGE = [ __selecting_frame, TOTAL_FRAMES ]; else FRAME_RANGE[0] = __selecting_frame; }, [ THEME.frame_range, 0 ]),
|
||||
menuItem(__txtx("panel_animation_range_end", "Set end"), function() { if(FRAME_RANGE == noone) FRAME_RANGE = [ 0, __selecting_frame ]; else FRAME_RANGE[1] = __selecting_frame; }, [ THEME.frame_range, 1 ]),
|
||||
menuItem(__txtx("panel_animation_range_reset", "Reset range"), function() { FRAME_RANGE = noone; }),
|
||||
menuItemAction(__txtx("panel_animation_range_start", "Set start"), panel_animation_range_set_start, [ THEME.frame_range, 0 ]),
|
||||
menuItemAction(__txtx("panel_animation_range_end", "Set end"), panel_animation_range_set_end, [ THEME.frame_range, 1 ]),
|
||||
menuItemAction(__txtx("panel_animation_range_reset", "Reset range"), panel_animation_range_reset),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -1300,9 +1328,9 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
var key_hover = noone;
|
||||
var key_list = animator.values;
|
||||
|
||||
if((animator.prop.on_end == KEYFRAME_END.loop || animator.prop.on_end == KEYFRAME_END.ping) && ds_list_size(key_list) > 1) {
|
||||
var keyframe_s = animator.prop.loop_range == -1? key_list[| 0].time : key_list[| ds_list_size(key_list) - 1 - animator.prop.loop_range].time;
|
||||
var keyframe_e = key_list[| ds_list_size(key_list) - 1].time;
|
||||
if((animator.prop.on_end == KEYFRAME_END.loop || animator.prop.on_end == KEYFRAME_END.ping) && array_length(key_list) > 1) {
|
||||
var keyframe_s = animator.prop.loop_range == -1? key_list[0].time : key_list[array_length(key_list) - 1 - animator.prop.loop_range].time;
|
||||
var keyframe_e = key_list[array_length(key_list) - 1].time;
|
||||
|
||||
var ks_x = (keyframe_s + 1) * timeline_scale + timeline_shift;
|
||||
var ke_x = (keyframe_e + 1) * timeline_scale + timeline_shift;
|
||||
|
@ -1313,8 +1341,8 @@ function Panel_Animation() : PanelContent() constructor {
|
|||
draw_set_alpha(1);
|
||||
}
|
||||
|
||||
for( var k = 0; k < ds_list_size(key_list); k++ ) { //draw easing
|
||||
var key = key_list[| k];
|
||||
for( var k = 0, n = array_length(key_list); k < n; k++ ) { //draw easing
|
||||
var key = key_list[k];
|
||||
var t = key.dopesheet_x;
|
||||
|
||||
if(key.ease_in_type == CURVE_TYPE.bezier) {
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
#region funtion calls
|
||||
function __fnInit_Collection() {
|
||||
registerFunction("Collection", "Replace", "", MOD_KEY.none, panel_collection_replace);
|
||||
registerFunction("Collection", "Edit Meta", "", MOD_KEY.none, panel_collection_edit_meta);
|
||||
registerFunction("Collection", "Update Thumbnail", "", MOD_KEY.none, panel_collection_update_thumbnail);
|
||||
registerFunction("Collection", "Delete Collection", "", MOD_KEY.none, panel_collection_delete_collection);
|
||||
|
||||
registerFunction("Collection", "Upload To Steam", "", MOD_KEY.none, panel_collection_steam_file_upload);
|
||||
registerFunction("Collection", "Update Steam", "", MOD_KEY.none, panel_collection_steam_file_update);
|
||||
registerFunction("Collection", "Unsubscribe", "", MOD_KEY.none, panel_collection_steam_unsubscribe);
|
||||
}
|
||||
|
||||
function panel_collection_replace() { CALL("collection_replace"); PANEL_COLLECTION.replace(); }
|
||||
function panel_collection_edit_meta() { CALL("collection_edit_meta"); PANEL_COLLECTION.edit_meta(); }
|
||||
function panel_collection_update_thumbnail() { CALL("collection_update_thumbnail"); PANEL_COLLECTION.update_thumbnail(); }
|
||||
function panel_collection_delete_collection() { CALL("collection_delete_collection"); PANEL_COLLECTION.delete_collection(); }
|
||||
|
||||
function panel_collection_steam_file_upload() { CALL("collection_steam_file_upload"); PANEL_COLLECTION.steam_file_upload(); }
|
||||
function panel_collection_steam_file_update() { CALL("collection_steam_file_update"); PANEL_COLLECTION.steam_file_update(); }
|
||||
function panel_collection_steam_unsubscribe() { CALL("collection_steam_unsubscribe"); PANEL_COLLECTION.steam_unsubscribe(); }
|
||||
#endregion
|
||||
|
||||
function Panel_Collection() : PanelContent() constructor {
|
||||
title = __txt("Collections");
|
||||
expandable = false;
|
||||
|
@ -36,21 +58,19 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
|
||||
PANEL_COLLECTION = self;
|
||||
|
||||
static initMenu = function() {
|
||||
#region ++++++++++++ Actions ++++++++++++
|
||||
function replace() {
|
||||
if(_menu_node == noone) return;
|
||||
var meta = _menu_node.getMetadata();
|
||||
|
||||
contentMenu = [];
|
||||
|
||||
if(meta == noone || !meta.steam) {
|
||||
contentMenu = [
|
||||
menuItem(__txtx("panel_collection_replace", "Replace with selected"), function() {
|
||||
var _path = filename_dir(_menu_node.path);
|
||||
var _name = filename_name(_menu_node.path);
|
||||
|
||||
saveCollection(PANEL_INSPECTOR.getInspecting(), _path, _name, false, _menu_node.meta);
|
||||
}),
|
||||
menuItem(__txtx("panel_collection_edit_meta", "Edit metadata") + "...", function() {
|
||||
}
|
||||
|
||||
function edit_meta() {
|
||||
if(_menu_node == noone) return;
|
||||
|
||||
var dia = dialogCall(o_dialog_file_name_collection, mouse_mx + ui(8), mouse_my + ui(-320));
|
||||
var meta = _menu_node.getMetadata();
|
||||
if(meta != noone && meta != undefined)
|
||||
|
@ -60,8 +80,11 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
dia.data_path = data_path;
|
||||
dia.updating = _menu_node;
|
||||
dia.doExpand();
|
||||
}),
|
||||
menuItem(__txtx("panel_collection_update_thumbnail", "Update thumbnail"), function() {
|
||||
}
|
||||
|
||||
function update_thumbnail() {
|
||||
if(_menu_node == noone) return;
|
||||
|
||||
var _path = _menu_node.path;
|
||||
var preview_surface = PANEL_PREVIEW.getNodePreviewSurface();
|
||||
if(!is_surface(preview_surface)) {
|
||||
|
@ -73,21 +96,18 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
surface_save_safe(preview_surface, icon_path);
|
||||
|
||||
refreshContext();
|
||||
}),
|
||||
-1,
|
||||
menuItem(__txt("Delete"), function() {
|
||||
file_delete(_menu_node.path);
|
||||
refreshContext();
|
||||
})
|
||||
];
|
||||
|
||||
if(STEAM_ENABLED)
|
||||
array_push(contentMenu, -1);
|
||||
}
|
||||
|
||||
if(STEAM_ENABLED) {
|
||||
if(meta.steam == FILE_STEAM_TYPE.local) {
|
||||
array_push(contentMenu, menuItem(__txtx("panel_collection_workshop_upload", "Upload to Steam Workshop") + "...", function() {
|
||||
function delete_collection() {
|
||||
if(_menu_node == noone) return;
|
||||
|
||||
file_delete(_menu_node.path);
|
||||
refreshContext();
|
||||
}
|
||||
|
||||
function steam_file_upload() {
|
||||
if(_menu_node == noone) return;
|
||||
|
||||
var dia = dialogCall(o_dialog_file_name_collection, mouse_mx + ui(8), mouse_my + ui(-320));
|
||||
var meta = _menu_node.getMetadata();
|
||||
if(meta != noone && meta != undefined)
|
||||
|
@ -97,10 +117,11 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
dia.ugc = 1;
|
||||
dia.updating = _menu_node;
|
||||
dia.doExpand();
|
||||
}));
|
||||
} else {
|
||||
if(meta.author_steam_id == STEAM_USER_ID && meta.file_id != 0) {
|
||||
array_push(contentMenu, menuItem(__txtx("panel_collection_workshop_update", "Update Steam Workshop content") + "...", function() {
|
||||
}
|
||||
|
||||
function steam_file_update() {
|
||||
if(_menu_node == noone) return;
|
||||
|
||||
var _node = PANEL_INSPECTOR.getInspecting();
|
||||
if(_node == noone) {
|
||||
noti_warning("No node selected. Select a node in graph panel to update workshop content.");
|
||||
|
@ -116,10 +137,11 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
dia.ugc = 2;
|
||||
dia.updating = _menu_node;
|
||||
dia.doExpand();
|
||||
}));
|
||||
}
|
||||
|
||||
array_push(contentMenu, menuItem(__txt("Unsubscribe"), function() {
|
||||
function steam_unsubscribe() {
|
||||
if(_menu_node == noone) return;
|
||||
|
||||
var meta = _menu_node.getMetadata();
|
||||
var del_id = meta.file_id;
|
||||
|
||||
|
@ -130,7 +152,35 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
}
|
||||
}
|
||||
steam_ugc_unsubscribe_item(del_id);
|
||||
}));
|
||||
}
|
||||
#endregion
|
||||
|
||||
static initMenu = function() {
|
||||
if(_menu_node == noone) return;
|
||||
var meta = _menu_node.getMetadata();
|
||||
|
||||
contentMenu = [];
|
||||
|
||||
if(meta == noone || !meta.steam) {
|
||||
contentMenu = [
|
||||
menuItemAction(__txtx("panel_collection_replace", "Replace with selected"), panel_collection_replace),
|
||||
menuItemAction(__txtx("panel_collection_edit_meta", "Edit metadata") + "...", panel_collection_edit_meta),
|
||||
menuItemAction(__txtx("panel_collection_update_thumbnail", "Update thumbnail"), panel_collection_update_thumbnail),
|
||||
-1,
|
||||
menuItemAction(__txt("Delete"), panel_collection_delete_collection)
|
||||
];
|
||||
|
||||
if(STEAM_ENABLED)
|
||||
array_push(contentMenu, -1);
|
||||
}
|
||||
|
||||
if(STEAM_ENABLED) {
|
||||
if(meta.steam == FILE_STEAM_TYPE.local) {
|
||||
array_push(contentMenu, menuItemAction(__txtx("panel_collection_workshop_upload", "Upload to Steam Workshop") + "...", panel_collection_steam_file_upload));
|
||||
} else {
|
||||
if(meta.author_steam_id == STEAM_USER_ID && meta.file_id != 0)
|
||||
array_push(contentMenu, menuItemAction(__txtx("panel_collection_workshop_update", "Update Steam Workshop content") + "...", panel_collection_steam_file_update));
|
||||
array_push(contentMenu, menuItemAction(__txt("Unsubscribe"), panel_collection_steam_unsubscribe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,15 +327,15 @@ function Panel_Color() : PanelContent() constructor {
|
|||
|
||||
if(mouse_press(mb_right, pFOCUS)) {
|
||||
menuCall("color_window_menu",,, [
|
||||
menuItem(__txt("Hue"), function() { mode = 0; } ),
|
||||
menuItem(__txt("Value"), function() { mode = 1; } ),
|
||||
menuItem(__txt("Saturation"), function() { mode = 2; } ),
|
||||
menuItemAction(__txt("Hue"), function() { mode = 0; } ),
|
||||
menuItemAction(__txt("Value"), function() { mode = 1; } ),
|
||||
menuItemAction(__txt("Saturation"), function() { mode = 2; } ),
|
||||
-1,
|
||||
menuItem(__txt("Toggle Alpha"), function() { show_alpha = !show_alpha; }, noone, noone, function() /*=>*/ {return show_alpha} ),
|
||||
menuItem(__txt("Toggle Palette"), function() { show_palette = !show_palette; }, noone, noone, function() /*=>*/ {return show_palette} ),
|
||||
menuItem(__txt("Toggle Hex"), function() { show_hex = !show_hex; }, noone, noone, function() /*=>*/ {return show_hex} ),
|
||||
menuItemAction(__txt("Toggle Alpha"), function() { show_alpha = !show_alpha; }, noone, noone, function() /*=>*/ {return show_alpha} ),
|
||||
menuItemAction(__txt("Toggle Palette"), function() { show_palette = !show_palette; }, noone, noone, function() /*=>*/ {return show_palette} ),
|
||||
menuItemAction(__txt("Toggle Hex"), function() { show_hex = !show_hex; }, noone, noone, function() /*=>*/ {return show_hex} ),
|
||||
-1,
|
||||
menuItem(__txt("Discretize"), function() { discretize_pal = !discretize_pal; }, noone, noone, function() /*=>*/ {return discretize_pal} ),
|
||||
menuItemAction(__txt("Discretize"), function() { discretize_pal = !discretize_pal; }, noone, noone, function() /*=>*/ {return discretize_pal} ),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,18 +53,18 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
|
|||
|
||||
draw_droppable = false;
|
||||
|
||||
border_rb_close = menuItem(__txt("Close"), function() {
|
||||
border_rb_close = menuItemAction(__txt("Close"), function() {
|
||||
var con = getContent();
|
||||
if(con == noone) return;
|
||||
con.close();
|
||||
}, THEME.cross);
|
||||
|
||||
border_rb_menu = [
|
||||
menuItem(__txt("Move"), function() {
|
||||
menuItemAction(__txt("Move"), function() {
|
||||
extract();
|
||||
panel_mouse = 1;
|
||||
}),
|
||||
menuItem(__txtx("panel_pop_out", "Pop out"), function() { popWindow(); }, THEME.node_goto),
|
||||
menuItemAction(__txtx("panel_pop_out", "Pop out"), function() { popWindow(); }, THEME.node_goto),
|
||||
border_rb_close
|
||||
];
|
||||
|
||||
|
@ -954,8 +954,10 @@ function PanelContent() constructor {
|
|||
if(o_main.panel_dragging == noone) {
|
||||
pFOCUS = FOCUS == panel/* && panel.mouse_active*/;
|
||||
pHOVER = !CURSOR_IS_LOCK && HOVER == panel && panel.mouse_active;
|
||||
if(pFOCUS) FOCUS_CONTENT = self;
|
||||
}
|
||||
|
||||
|
||||
drawContent(panel);
|
||||
}
|
||||
|
||||
|
|
|
@ -207,29 +207,29 @@ function Panel_File_Explorer() : PanelContent() constructor {
|
|||
__menu_cnxt_selecting = noone;
|
||||
|
||||
menu_file_image = [
|
||||
menuItem("Add as node", function() {
|
||||
menuItemAction("Add as node", function() {
|
||||
var node = Node_create_Image_path(PANEL_GRAPH.graph_cx, PANEL_GRAPH.graph_cy, __menu_file_selecting.path);
|
||||
PANEL_PREVIEW.setNodePreview(node);
|
||||
PANEL_INSPECTOR.inspecting = node;
|
||||
}),
|
||||
|
||||
menuItem("Add as canvas", function() {
|
||||
menuItemAction("Add as canvas", function() {
|
||||
var node = nodeBuild("Node_Canvas", PANEL_GRAPH.graph_cx, PANEL_GRAPH.graph_cy).loadImagePath(__menu_file_selecting.path);
|
||||
PANEL_PREVIEW.setNodePreview(node);
|
||||
PANEL_INSPECTOR.inspecting = node;
|
||||
}),
|
||||
|
||||
menuItem("Copy path", function() { clipboard_set_text(__menu_file_selecting.path); }, THEME.copy),
|
||||
menuItemAction("Copy path", function() { clipboard_set_text(__menu_file_selecting.path); }, THEME.copy),
|
||||
];
|
||||
|
||||
menu_file_project = [
|
||||
menuItem("Open", function() { LOAD_AT(__menu_file_selecting.path); }),
|
||||
menuItemAction("Open", function() { LOAD_AT(__menu_file_selecting.path); }),
|
||||
|
||||
menuItem("Copy path", function() { clipboard_set_text(__menu_file_selecting.path); }, THEME.copy),
|
||||
menuItemAction("Copy path", function() { clipboard_set_text(__menu_file_selecting.path); }, THEME.copy),
|
||||
];
|
||||
|
||||
menu_general = [
|
||||
menuItem("New Canvas", function() {
|
||||
menuItemAction("New Canvas", function() {
|
||||
var dia = dialogCall(o_dialog_file_name, mouse_mx + 8, mouse_my + 8);
|
||||
dia.onModify = function (txt) {
|
||||
var _s = surface_create(DEF_SURF_W, DEF_SURF_H);
|
||||
|
@ -246,7 +246,7 @@ function Panel_File_Explorer() : PanelContent() constructor {
|
|||
dia.path = __menu_cnxt_selecting.path + "/";
|
||||
}, THEME.new_file),
|
||||
|
||||
menuItem("New Folder", function() {
|
||||
menuItemAction("New Folder", function() {
|
||||
var dia = dialogCall(o_dialog_file_name, mouse_mx + 8, mouse_my + 8);
|
||||
dia.name = "New Folder";
|
||||
dia.onModify = function (txt) {
|
||||
|
@ -257,7 +257,7 @@ function Panel_File_Explorer() : PanelContent() constructor {
|
|||
}, THEME.folder),
|
||||
|
||||
-1,
|
||||
menuItem("Refresh", function() { if(rootFile) rootFile.getContent() }),
|
||||
menuItemAction("Refresh", function() { if(rootFile) rootFile.getContent() }),
|
||||
];
|
||||
#endregion
|
||||
|
||||
|
@ -447,8 +447,6 @@ function Panel_File_Explorer() : PanelContent() constructor {
|
|||
_dir.open = !_dir.open;
|
||||
}
|
||||
|
||||
// if(mouse_press(mb_right)) menuCall("",,, [ menuItem("Delete", function() {}) ]);
|
||||
|
||||
}
|
||||
|
||||
draw_sprite_stretched(THEME.ui_panel_bg, _ind, _px, _py, _ppw, _ph);
|
||||
|
|
|
@ -445,36 +445,74 @@
|
|||
#endregion
|
||||
|
||||
#region hotkey
|
||||
function __initPanelHotkeys() {
|
||||
addHotkey("", "Preference", "", MOD_KEY.none, function() /*=>*/ {return dialogCall(o_dialog_preference)});
|
||||
addHotkey("", "Splash screen", "", MOD_KEY.none, function() /*=>*/ {return dialogCall(o_dialog_splash)});
|
||||
addHotkey("", "Release note", "", MOD_KEY.none, function() /*=>*/ {return dialogCall(o_dialog_release_note)});
|
||||
addHotkey("", "Autosave folder", "", MOD_KEY.none, function() /*=>*/ {return shellOpenExplorer(DIRECTORY + "autosave")});
|
||||
|
||||
addHotkey("", "Recent files", "R", MOD_KEY.ctrl | MOD_KEY.shift, function() /*=>*/ {
|
||||
function call_dialog_preference() { dialogCall(o_dialog_preference); }
|
||||
function call_dialog_splash() { dialogCall(o_dialog_splash); }
|
||||
function call_dialog_release_note() { dialogCall(o_dialog_release_note); }
|
||||
function open_autosave_folder() { shellOpenExplorer(DIRECTORY + "autosave"); }
|
||||
|
||||
function call_panel_addon() { dialogPanelCall(new Panel_Addon()); }
|
||||
function call_panel_history() { dialogPanelCall(new Panel_History()); }
|
||||
|
||||
function call_panel_Notification() { panelAdd("Panel_Notification", true); }
|
||||
function call_panel_Collection() { panelAdd("Panel_Collection", true); }
|
||||
function call_panel_Graph() { panelAdd("Panel_Graph", true); }
|
||||
|
||||
function call_panel_Preview() { panelAdd("Panel_Preview", true); }
|
||||
function call_panel_Preview_Histogram() { panelAdd("Panel_Preview_Histogram", true); }
|
||||
|
||||
function call_panel_Inspector() { panelAdd("Panel_Inspector", true); }
|
||||
function call_panel_Workspace() { panelAdd("Panel_Workspace", true); }
|
||||
function call_panel_Animation() { panelAdd("Panel_Animation", true); }
|
||||
function call_panel_Node_Align() { panelAdd("Panel_Node_Align", true); }
|
||||
function call_panel_Nodes() { panelAdd("Panel_Nodes", true); }
|
||||
function call_panel_Tunnels() { panelAdd("Panel_Tunnels", true); }
|
||||
|
||||
function call_panel_Color() { panelAdd("Panel_Color", true); }
|
||||
function call_panel_Palette() { panelAdd("Panel_Palette", true); }
|
||||
function call_panel_Palette_Mixer() { panelAdd("Panel_Palette_Mixer", true); }
|
||||
function call_panel_Gradient() { panelAdd("Panel_Gradient", true); }
|
||||
|
||||
function call_panel_Console() { panelAdd("Panel_Console", true); }
|
||||
function call_panel_Globalvar() { panelAdd("Panel_Globalvar", true); }
|
||||
function call_panel_File_Explorer() { panelAdd("Panel_File_Explorer", true); }
|
||||
|
||||
function __initPanelHotkeys() {
|
||||
registerFunction("", "Preference", "", MOD_KEY.none, call_dialog_preference);
|
||||
registerFunction("", "Splash screen", "", MOD_KEY.none, call_dialog_splash);
|
||||
registerFunction("", "Release note", "", MOD_KEY.none, call_dialog_release_note);
|
||||
registerFunction("", "Autosave folder", "", MOD_KEY.none, open_autosave_folder);
|
||||
|
||||
registerFunction("", "Recent files", "R", MOD_KEY.ctrl | MOD_KEY.shift, function() /*=>*/ {
|
||||
var arr = [];
|
||||
for(var i = 0; i < min(10, ds_list_size(RECENT_FILES)); i++)
|
||||
array_push(arr, menuItem(RECENT_FILES[| i], function(_dat) { LOAD_PATH(_dat.name); }));
|
||||
|
||||
array_push(arr, menuItemAction(RECENT_FILES[| i], function(_dat) { LOAD_PATH(_dat.name); }));
|
||||
return menuCall("Recent files",,, arr);
|
||||
});
|
||||
|
||||
addHotkey("", "Addons", "", MOD_KEY.none, function() /*=>*/ {return dialogPanelCall(new Panel_Addon())});
|
||||
addHotkey("", "History", "", MOD_KEY.none, function() /*=>*/ {return dialogPanelCall(new Panel_History())});
|
||||
registerFunction("", "Addons", "", MOD_KEY.none, call_panel_addon);
|
||||
registerFunction("", "History", "", MOD_KEY.none, call_panel_history);
|
||||
|
||||
addHotkey("", "Notification Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Notification", true)});
|
||||
addHotkey("", "Collections Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Collection", true)});
|
||||
addHotkey("", "Graph Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Graph", true)});
|
||||
addHotkey("", "Preview Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Preview", true)});
|
||||
addHotkey("", "Inspector Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Inspector", true)});
|
||||
addHotkey("", "Workspace Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Workspace", true)});
|
||||
addHotkey("", "Animation Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Animation", true)});
|
||||
addHotkey("", "Align Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Node_Align", true)});
|
||||
addHotkey("", "Nodes Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Nodes", true)});
|
||||
addHotkey("", "Tunnels Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Tunnels", true)});
|
||||
addHotkey("", "Color Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Color", true)});
|
||||
addHotkey("", "Palettes Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Palette", true)});
|
||||
addHotkey("", "Gradients Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Gradient", true)});
|
||||
addHotkey("", "Console Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Console", true)});
|
||||
registerFunction("", "Notification Panel", "", MOD_KEY.none, call_panel_Notification );
|
||||
registerFunction("", "Collections Panel", "", MOD_KEY.none, call_panel_Collection );
|
||||
registerFunction("", "Graph Panel", "", MOD_KEY.none, call_panel_Graph );
|
||||
registerFunction("", "Preview Panel", "", MOD_KEY.none, call_panel_Preview );
|
||||
registerFunction("", "Preview Histogram", "", MOD_KEY.none, call_panel_Preview_Histogram );
|
||||
registerFunction("", "Inspector Panel", "", MOD_KEY.none, call_panel_Inspector );
|
||||
registerFunction("", "Workspace Panel", "", MOD_KEY.none, call_panel_Workspace );
|
||||
registerFunction("", "Animation Panel", "", MOD_KEY.none, call_panel_Animation );
|
||||
|
||||
registerFunction("", "Align Panel", "", MOD_KEY.none, call_panel_Node_Align );
|
||||
registerFunction("", "Nodes Panel", "", MOD_KEY.none, call_panel_Nodes );
|
||||
registerFunction("", "Tunnels Panel", "", MOD_KEY.none, call_panel_Tunnels );
|
||||
|
||||
registerFunction("", "Color Panel", "", MOD_KEY.none, call_panel_Color );
|
||||
registerFunction("", "Palettes Panel", "", MOD_KEY.none, call_panel_Palette );
|
||||
registerFunction("", "Palettes Mixer Panel","", MOD_KEY.none, call_panel_Palette_Mixer );
|
||||
registerFunction("", "Gradients Panel", "", MOD_KEY.none, call_panel_Gradient );
|
||||
|
||||
registerFunction("", "Console Panel", "", MOD_KEY.none, call_panel_Console );
|
||||
registerFunction("", "Globalvar Panel", "", MOD_KEY.none, call_panel_Globalvar );
|
||||
registerFunction("", "File Explorer Panel", "", MOD_KEY.none, call_panel_File_Explorer );
|
||||
}
|
||||
#endregion
|
|
@ -1,50 +1,7 @@
|
|||
// function calls
|
||||
function __fnInit_Graph() {
|
||||
__registerFunction("graph_add_node", panel_graph_add_node);
|
||||
__registerFunction("graph_focus_content", panel_graph_focus_content);
|
||||
__registerFunction("graph_preview_focus", panel_graph_preview_focus);
|
||||
__registerFunction("graph_preview_window", panel_graph_preview_window);
|
||||
|
||||
__registerFunction("graph_import_image", panel_graph_import_image);
|
||||
__registerFunction("graph_import_image_array", panel_graph_import_image_array);
|
||||
__registerFunction("graph_add_number", panel_graph_add_number);
|
||||
__registerFunction("graph_add_vec2", panel_graph_add_vec2);
|
||||
__registerFunction("graph_add_vec3", panel_graph_add_vec3);
|
||||
__registerFunction("graph_add_vec4", panel_graph_add_vec4);
|
||||
__registerFunction("graph_add_display", panel_graph_add_display);
|
||||
__registerFunction("graph_add_transform", panel_graph_add_transform);
|
||||
|
||||
__registerFunction("graph_select_all", panel_graph_select_all);
|
||||
__registerFunction("graph_toggle_grid", panel_graph_toggle_grid);
|
||||
__registerFunction("graph_toggle_preview", panel_graph_toggle_preview);
|
||||
__registerFunction("graph_toggle_render", panel_graph_toggle_render);
|
||||
|
||||
__registerFunction("graph_export", panel_graph_export);
|
||||
|
||||
__registerFunction("graph_blend", panel_graph_blend);
|
||||
__registerFunction("graph_compose", panel_graph_compose);
|
||||
__registerFunction("graph_array", panel_graph_array);
|
||||
__registerFunction("graph_group", panel_graph_group);
|
||||
__registerFunction("graph_ungroup", panel_graph_ungroup);
|
||||
|
||||
__registerFunction("graph_canvas", panel_graph_canvas);
|
||||
__registerFunction("graph_canvas_blend", panel_graph_canvas_blend);
|
||||
|
||||
__registerFunction("graph_frame", panel_graph_frame);
|
||||
__registerFunction("graph_delete_break", panel_graph_delete_break);
|
||||
__registerFunction("graph_delete_merge", panel_graph_delete_merge);
|
||||
__registerFunction("graph_duplicate", panel_graph_duplicate);
|
||||
__registerFunction("graph_copy", panel_graph_copy);
|
||||
__registerFunction("graph_paste", panel_graph_paste);
|
||||
|
||||
__registerFunction("graph_pan", panel_graph_pan);
|
||||
__registerFunction("graph_zoom", panel_graph_zoom);
|
||||
}
|
||||
|
||||
#region // function calls
|
||||
function panel_graph_add_node() { CALL("graph_add_node"); PANEL_GRAPH.callAddDialog(); }
|
||||
function panel_graph_focus_content() { CALL("graph_focus_content"); PANEL_GRAPH.fullView(); }
|
||||
function panel_graph_preview_focus() { CALL("graph_preview_focus"); PANEL_GRAPH.setCurrentPreview(); }
|
||||
function panel_graph_preview_window() { CALL("graph_preview_window"); PANEL_GRAPH.create_preview_window(PANEL_GRAPH.getFocusingNode()); }
|
||||
|
||||
function panel_graph_import_image() { CALL("graph_import_image"); PANEL_GRAPH.createNodeHotkey("Node_Image"); }
|
||||
function panel_graph_import_image_array() { CALL("graph_import_image_array"); PANEL_GRAPH.createNodeHotkey("Node_Image_Sequence"); }
|
||||
|
@ -58,9 +15,6 @@
|
|||
|
||||
function panel_graph_select_all() { CALL("graph_select_all"); PANEL_GRAPH.nodes_selecting = PANEL_GRAPH.nodes_list; }
|
||||
function panel_graph_toggle_grid() { CALL("graph_toggle_grid"); PANEL_GRAPH.display_parameter.show_grid = !PANEL_GRAPH.display_parameter.show_grid; }
|
||||
function panel_graph_toggle_preview() { CALL("graph_toggle_preview"); PANEL_GRAPH.setTriggerPreview(); }
|
||||
function panel_graph_toggle_parameter() { CALL("graph_toggle_parameter"); PANEL_GRAPH.setTriggerParameter(); }
|
||||
function panel_graph_toggle_render() { CALL("graph_toggle_render"); PANEL_GRAPH.setTriggerRender(); }
|
||||
|
||||
function panel_graph_export() { CALL("graph_export"); PANEL_GRAPH.setCurrentExport(); }
|
||||
|
||||
|
@ -85,24 +39,90 @@
|
|||
function panel_graph_search() { CALL("graph_search"); PANEL_GRAPH.toggleSearch(); }
|
||||
function panel_graph_toggle_minimap() { CALL("graph_toggle_minimap"); PANEL_GRAPH.minimap_show = !PANEL_GRAPH.minimap_show; }
|
||||
|
||||
function panel_graph_pan() {
|
||||
CALL("graph_pan");
|
||||
if(PANEL_GRAPH.node_hovering) return;
|
||||
if(PANEL_GRAPH.value_focus) return;
|
||||
function panel_graph_pan() { CALL("graph_pan"); if(PANEL_GRAPH.node_hovering || PANEL_GRAPH.value_focus) return; PANEL_GRAPH.graph_dragging_key = true; }
|
||||
function panel_graph_zoom() { CALL("graph_zoom"); if(PANEL_GRAPH.node_hovering || PANEL_GRAPH.value_focus) return; PANEL_GRAPH.graph_zooming_key = true; }
|
||||
|
||||
PANEL_GRAPH.graph_dragging_key = true;
|
||||
function panel_graph_send_to_preview() { CALL("graph_send_to_preview"); PANEL_GRAPH.send_to_preview(); }
|
||||
function panel_graph_preview_window() { CALL("graph_preview_window"); create_preview_window(PANEL_GRAPH.getFocusingNode()); }
|
||||
function panel_graph_inspector_panel() { CALL("graph_inspector_panel"); PANEL_GRAPH.inspector_panel(); }
|
||||
function panel_graph_send_to_export() { CALL("graph_send_to_export"); PANEL_GRAPH.send_to_export(); }
|
||||
function panel_graph_toggle_preview() { CALL("graph_toggle_preview"); PANEL_GRAPH.setTriggerPreview(); }
|
||||
function panel_graph_toggle_render() { CALL("graph_toggle_render"); PANEL_GRAPH.setTriggerRender(); }
|
||||
function panel_graph_toggle_parameter() { CALL("graph_toggle_parameter"); PANEL_GRAPH.setTriggerParameter(); }
|
||||
function panel_graph_enter_group() { CALL("graph_enter_group"); PANEL_GRAPH.enter_group(); }
|
||||
function panel_graph_hide_disconnected() { CALL("graph_hide_disconnected"); PANEL_GRAPH.hide_disconnected(); }
|
||||
|
||||
function panel_graph_open_group_tab() { CALL("graph_open_group_tab"); PANEL_GRAPH.open_group_tab(); }
|
||||
function panel_graph_set_as_tool() { CALL("graph_open_set_as_tool"); PANEL_GRAPH.set_as_tool(); }
|
||||
|
||||
function panel_graph_doCopyProp() { CALL("graph_doCopyProp"); PANEL_GRAPH.doCopyProp(); }
|
||||
function panel_graph_doPasteProp() { CALL("graph_doPasteProp"); PANEL_GRAPH.doPasteProp(); }
|
||||
function panel_graph_createTunnel() { CALL("graph_createTunnel"); PANEL_GRAPH.createTunnel(); }
|
||||
|
||||
function __fnInit_Graph() {
|
||||
registerFunction("Graph", "Add Node", "A", MOD_KEY.none, panel_graph_add_node);
|
||||
registerFunction("Graph", "Focus Content", "F", MOD_KEY.none, panel_graph_focus_content);
|
||||
registerFunction("Graph", "Preview Focusing Node", "P", MOD_KEY.none, panel_graph_preview_focus);
|
||||
|
||||
registerFunction("Graph", "Import Image", "I", MOD_KEY.none, panel_graph_import_image);
|
||||
registerFunction("Graph", "Import Image Array", "I", MOD_KEY.shift, panel_graph_import_image_array);
|
||||
registerFunction("Graph", "Add Number", "1", MOD_KEY.none, panel_graph_add_number);
|
||||
registerFunction("Graph", "Add Vector2", "2", MOD_KEY.none, panel_graph_add_vec2);
|
||||
registerFunction("Graph", "Add Vector3", "3", MOD_KEY.none, panel_graph_add_vec3);
|
||||
registerFunction("Graph", "Add Vector4", "4", MOD_KEY.none, panel_graph_add_vec4);
|
||||
registerFunction("Graph", "Add Display", "D", MOD_KEY.none, panel_graph_add_display);
|
||||
registerFunction("Graph", "Transform Node", "T", MOD_KEY.ctrl, panel_graph_add_transform);
|
||||
|
||||
registerFunction("Graph", "Select All", "A", MOD_KEY.ctrl, panel_graph_select_all);
|
||||
registerFunction("Graph", "Toggle Grid", "G", MOD_KEY.none, panel_graph_toggle_grid);
|
||||
|
||||
if(!DEMO) registerFunction("Graph", "Export", "E", MOD_KEY.ctrl, panel_graph_export);
|
||||
|
||||
registerFunction("Graph", "Blend", "B", MOD_KEY.ctrl, panel_graph_blend);
|
||||
registerFunction("Graph", "Compose", "B", MOD_KEY.ctrl | MOD_KEY.shift, panel_graph_compose);
|
||||
registerFunction("Graph", "Array", "A", MOD_KEY.ctrl | MOD_KEY.shift, panel_graph_array);
|
||||
registerFunction("Graph", "Group", "G", MOD_KEY.ctrl, panel_graph_group);
|
||||
registerFunction("Graph", "Ungroup", "G", MOD_KEY.ctrl | MOD_KEY.shift, panel_graph_ungroup);
|
||||
registerFunction("Graph", "Frame", "F", MOD_KEY.shift, panel_graph_frame);
|
||||
|
||||
registerFunction("Graph", "Canvas", "C", MOD_KEY.ctrl | MOD_KEY.shift, panel_graph_canvas);
|
||||
registerFunction("Graph", "Canvas Blend", "C", MOD_KEY.ctrl | MOD_KEY.alt, panel_graph_canvas_blend);
|
||||
|
||||
|
||||
registerFunction("Graph", "Delete (break)", vk_delete, MOD_KEY.shift, panel_graph_delete_break);
|
||||
registerFunction("Graph", "Delete (merge)", vk_delete, MOD_KEY.none, panel_graph_delete_merge);
|
||||
|
||||
registerFunction("Graph", "Duplicate", "D", MOD_KEY.ctrl, panel_graph_duplicate);
|
||||
registerFunction("Graph", "Copy", "C", MOD_KEY.ctrl, panel_graph_copy);
|
||||
registerFunction("Graph", "Paste", "V", MOD_KEY.ctrl, panel_graph_paste);
|
||||
|
||||
registerFunction("Graph", "Pan", "", MOD_KEY.ctrl, panel_graph_pan);
|
||||
registerFunction("Graph", "Zoom", "", MOD_KEY.alt | MOD_KEY.ctrl, panel_graph_zoom);
|
||||
|
||||
registerFunction("Graph", "Auto Align", "L", MOD_KEY.none, panel_graph_auto_align);
|
||||
registerFunction("Graph", "Search", "F", MOD_KEY.ctrl, panel_graph_search);
|
||||
registerFunction("Graph", "Toggle Minimap", "M", MOD_KEY.ctrl, panel_graph_toggle_minimap);
|
||||
|
||||
registerFunction("Graph", "Preview Hovering Node", "", MOD_KEY.none, panel_graph_send_to_preview);
|
||||
registerFunction("Graph", "Preview Window", "P", MOD_KEY.ctrl, panel_graph_preview_window);
|
||||
registerFunction("Graph", "Inspect", "", MOD_KEY.none, panel_graph_inspector_panel);
|
||||
if(!DEMO) registerFunction("Graph", "Export", "", MOD_KEY.none, panel_graph_send_to_export);
|
||||
registerFunction("Graph", "Toggle Preview", "H", MOD_KEY.none, panel_graph_toggle_preview);
|
||||
registerFunction("Graph", "Toggle Render", "R", MOD_KEY.none, panel_graph_toggle_render);
|
||||
registerFunction("Graph", "Toggle Parameters", "M", MOD_KEY.none, panel_graph_toggle_parameter);
|
||||
registerFunction("Graph", "Enter Group", "", MOD_KEY.none, panel_graph_enter_group);
|
||||
registerFunction("Graph", "Hide Disconnected", "", MOD_KEY.none, panel_graph_hide_disconnected);
|
||||
|
||||
registerFunction("Graph", "Open In New Tab", "", MOD_KEY.none, panel_graph_open_group_tab);
|
||||
registerFunction("Graph", "Set As Tool", "", MOD_KEY.none, panel_graph_set_as_tool);
|
||||
|
||||
registerFunction("Graph", "Copy Value", "", MOD_KEY.none, panel_graph_doCopyProp);
|
||||
registerFunction("Graph", "Paste Value", "", MOD_KEY.none, panel_graph_doPasteProp);
|
||||
registerFunction("Graph", "Create Tunnel", "", MOD_KEY.none, panel_graph_createTunnel);
|
||||
}
|
||||
#endregion
|
||||
|
||||
function panel_graph_zoom() {
|
||||
CALL("graph_zoom");
|
||||
if(PANEL_GRAPH.node_hovering) return;
|
||||
if(PANEL_GRAPH.value_focus) return;
|
||||
|
||||
PANEL_GRAPH.graph_zooming_key = true;
|
||||
}
|
||||
|
||||
|
||||
function connectionParameter() constructor { //
|
||||
function connectionParameter() constructor {
|
||||
log = false;
|
||||
active = true;
|
||||
|
||||
|
@ -167,7 +187,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
resetContext();
|
||||
}
|
||||
|
||||
// ---- display ----
|
||||
#region // ---- display ----
|
||||
display_parameter = {
|
||||
show_grid : true,
|
||||
show_dimension : true,
|
||||
|
@ -186,9 +206,9 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
bg_color = c_black;
|
||||
|
||||
slider_width = 0;
|
||||
#endregion
|
||||
|
||||
|
||||
// ---- position ----
|
||||
#region // ---- position ----
|
||||
graph_x = 0;
|
||||
graph_y = 0;
|
||||
graph_cx = 0;
|
||||
|
@ -224,9 +244,9 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
drag_key = PREFERENCES.pan_mouse_key;
|
||||
drag_locking = false;
|
||||
#endregion
|
||||
|
||||
|
||||
// ---- mouse ----
|
||||
#region // ---- mouse ----
|
||||
mouse_graph_x = 0;
|
||||
mouse_graph_y = 0;
|
||||
mouse_grid_x = 0;
|
||||
|
@ -239,9 +259,9 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
mouse_on_graph = false;
|
||||
node_bg_hovering = false;
|
||||
#endregion
|
||||
|
||||
|
||||
// ---- nodes ----
|
||||
#region // ---- nodes ----
|
||||
node_context = [];
|
||||
nodes_list = [];
|
||||
|
||||
|
@ -291,9 +311,9 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
frame_hovering = noone;
|
||||
_frame_hovering = noone;
|
||||
#endregion
|
||||
|
||||
|
||||
// ---- minimap ----
|
||||
#region // ---- minimap ----
|
||||
minimap_show = false;
|
||||
minimap_w = ui(160);
|
||||
minimap_h = ui(160);
|
||||
|
@ -305,17 +325,17 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
minimap_drag_sy = 0;
|
||||
minimap_drag_mx = 0;
|
||||
minimap_drag_my = 0;
|
||||
#endregion
|
||||
|
||||
|
||||
// ---- context frame ----
|
||||
#region // ---- context frame ----
|
||||
context_framing = false;
|
||||
context_frame_progress = 0;
|
||||
context_frame_direct = 0;
|
||||
context_frame_sx = 0; context_frame_ex = 0;
|
||||
context_frame_sy = 0; context_frame_ey = 0;
|
||||
#endregion
|
||||
|
||||
|
||||
// ---- search ----
|
||||
#region // ---- search ----
|
||||
is_searching = false;
|
||||
search_string = "";
|
||||
search_index = 0;
|
||||
|
@ -324,7 +344,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
tb_search = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ { search_string = string(str); searchNodes(); });
|
||||
tb_search.align = fa_left;
|
||||
tb_search.auto_update = true;
|
||||
|
||||
#endregion
|
||||
|
||||
toolbar_height = ui(40);
|
||||
|
||||
|
@ -374,56 +394,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
function initSize() { toCenterNode(); }
|
||||
|
||||
// ++++ hotkeys ++++
|
||||
addHotkey("Graph", "Add node", "A", MOD_KEY.none, panel_graph_add_node);
|
||||
addHotkey("Graph", "Focus content", "F", MOD_KEY.none, panel_graph_focus_content);
|
||||
addHotkey("Graph", "Preview focusing node", "P", MOD_KEY.none, panel_graph_preview_focus);
|
||||
addHotkey("Graph", "Preview window", "P", MOD_KEY.ctrl, panel_graph_preview_window);
|
||||
|
||||
addHotkey("Graph", "Import image", "I", MOD_KEY.none, panel_graph_import_image);
|
||||
addHotkey("Graph", "Import image array", "I", MOD_KEY.shift, panel_graph_import_image_array);
|
||||
addHotkey("Graph", "Add Number", "1", MOD_KEY.none, panel_graph_add_number);
|
||||
addHotkey("Graph", "Add Vector2", "2", MOD_KEY.none, panel_graph_add_vec2);
|
||||
addHotkey("Graph", "Add Vector3", "3", MOD_KEY.none, panel_graph_add_vec3);
|
||||
addHotkey("Graph", "Add Vector4", "4", MOD_KEY.none, panel_graph_add_vec4);
|
||||
addHotkey("Graph", "Add Display", "D", MOD_KEY.none, panel_graph_add_display);
|
||||
addHotkey("Graph", "Transform node", "T", MOD_KEY.ctrl, panel_graph_add_transform);
|
||||
|
||||
addHotkey("Graph", "Select all", "A", MOD_KEY.ctrl, panel_graph_select_all);
|
||||
addHotkey("Graph", "Toggle grid", "G", MOD_KEY.none, panel_graph_toggle_grid);
|
||||
addHotkey("Graph", "Toggle preview", "H", MOD_KEY.none, panel_graph_toggle_preview);
|
||||
addHotkey("Graph", "Toggle render", "R", MOD_KEY.none, panel_graph_toggle_render);
|
||||
addHotkey("Graph", "Toggle parameters", "M", MOD_KEY.none, panel_graph_toggle_parameter);
|
||||
|
||||
if(!DEMO) addHotkey("Graph", "Export", "E", MOD_KEY.ctrl, panel_graph_export);
|
||||
|
||||
addHotkey("Graph", "Blend", "B", MOD_KEY.ctrl, panel_graph_blend);
|
||||
addHotkey("Graph", "Compose", "B", MOD_KEY.ctrl | MOD_KEY.shift, panel_graph_compose);
|
||||
addHotkey("Graph", "Array", "A", MOD_KEY.ctrl | MOD_KEY.shift, panel_graph_array);
|
||||
addHotkey("Graph", "Group", "G", MOD_KEY.ctrl, panel_graph_group);
|
||||
addHotkey("Graph", "Ungroup", "G", MOD_KEY.ctrl | MOD_KEY.shift, panel_graph_ungroup);
|
||||
|
||||
addHotkey("Graph", "Canvas", "C", MOD_KEY.ctrl | MOD_KEY.shift, panel_graph_canvas);
|
||||
addHotkey("Graph", "Canvas blend", "C", MOD_KEY.ctrl | MOD_KEY.alt, panel_graph_canvas_blend);
|
||||
|
||||
addHotkey("Graph", "Frame", "F", MOD_KEY.shift, panel_graph_frame);
|
||||
|
||||
addHotkey("Graph", "Delete (break)", vk_delete, MOD_KEY.shift, panel_graph_delete_break);
|
||||
addHotkey("Graph", "Delete (merge)", vk_delete, MOD_KEY.none, panel_graph_delete_merge);
|
||||
|
||||
addHotkey("Graph", "Duplicate", "D", MOD_KEY.ctrl, panel_graph_duplicate);
|
||||
addHotkey("Graph", "Copy", "C", MOD_KEY.ctrl, panel_graph_copy);
|
||||
addHotkey("Graph", "Paste", "V", MOD_KEY.ctrl, panel_graph_paste);
|
||||
|
||||
addHotkey("Graph", "Pan", "", MOD_KEY.ctrl, panel_graph_pan);
|
||||
addHotkey("Graph", "Zoom", "", MOD_KEY.alt | MOD_KEY.ctrl, panel_graph_zoom);
|
||||
|
||||
addHotkey("Graph", "Auto Align", "L", MOD_KEY.none, panel_graph_auto_align);
|
||||
addHotkey("Graph", "Search", "F", MOD_KEY.ctrl, panel_graph_search);
|
||||
addHotkey("Graph", "Toggle Minimap", "M", MOD_KEY.ctrl, panel_graph_toggle_minimap);
|
||||
|
||||
|
||||
// ++++ toolbars ++++
|
||||
#region // ++++ toolbars ++++
|
||||
tooltip_center = new tooltipHotkey(__txtx("panel_graph_center_to_nodes", "Center to nodes"), "Graph", "Focus content");
|
||||
tooltip_search = new tooltipHotkey(__txt("Search"), "Graph", "Search");
|
||||
tooltip_minimap = new tooltipHotkey(__txtx("panel_graph_toggle_minimap", "Toggle minimap"), "Graph", "Toggle Minimap");
|
||||
|
@ -491,7 +462,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
];
|
||||
|
||||
toolbars = [ toolbars_general ];
|
||||
|
||||
#endregion
|
||||
|
||||
//// =========== Get Set ===========
|
||||
|
||||
|
@ -612,23 +583,24 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
//// =========== Menus ===========
|
||||
|
||||
menu_sent_to_preview = menuItem(__txtx("panel_graph_send_to_preview", "Send to preview"), function() /*=>*/ { setCurrentPreview(node_hover); });
|
||||
menu_send_to_window = menuItem(__txtx("panel_graph_preview_window", "Send to preview window"), function() /*=>*/ { create_preview_window(node_hover); }, noone, ["Graph", "Preview window"]);
|
||||
menu_sent_to_inspector = menuItem(__txtx("panel_graph_inspector_panel", "Send to new inspector"), function() /*=>*/ {
|
||||
#region ++++++++++++ Actions ++++++++++++
|
||||
function send_to_preview() { setCurrentPreview(node_hover); }
|
||||
|
||||
function inspector_panel() {
|
||||
var pan = panelAdd("Panel_Inspector", true);
|
||||
pan.destroy_on_click_out = false;
|
||||
pan.content.setInspecting(node_hover);
|
||||
pan.content.locked = true;
|
||||
});
|
||||
menu_send_export = menuItem(__txtx("panel_graph_send_to_export", "Send to export"), function() /*=>*/ { setCurrentExport(node_hover); }, noone, ["Graph", "Export"]);
|
||||
menu_toggle_preview = menuItem(__txtx("panel_graph_toggle_preview", "Toggle node preview"), function() /*=>*/ { setTriggerPreview(); }, noone, ["Graph", "Toggle preview"]);
|
||||
menu_toggle_render = menuItem(__txtx("panel_graph_toggle_render", "Toggle node render"), function() /*=>*/ { setTriggerRender(); }, noone, ["Graph", "Toggle render"]);
|
||||
menu_toggle_param = menuItem(__txtx("panel_graph_toggle_parameter", "Toggle node parameters"), function() /*=>*/ { setTriggerParameter(); }, noone, ["Graph", "Toggle parameters"]);
|
||||
menu_open_group = menuItem(__txtx("panel_graph_enter_group", "Open group"), function() /*=>*/ { PANEL_GRAPH.addContext(node_hover); }, THEME.group);
|
||||
}
|
||||
|
||||
menu_hide_disconnect = menuItem(__txtx("panel_graph_hide_disconnected", "Hide stray junctions"), function() /*=>*/ { hideDisconnected(); });
|
||||
function send_to_export() { setCurrentExport(node_hover); }
|
||||
function enter_group() { PANEL_GRAPH.addContext(node_hover); }
|
||||
function hide_disconnected() { hideDisconnected(); }
|
||||
|
||||
|
||||
function open_group_tab(group = node_hover) {
|
||||
if(group == noone) return;
|
||||
|
||||
function openGroupTab(group) {
|
||||
var graph = new Panel_Graph(project);
|
||||
panel.setContent(graph, true);
|
||||
|
||||
|
@ -639,47 +611,63 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
setFocus(panel);
|
||||
}
|
||||
|
||||
menu_open_group_tab = menuItem(__txtx("panel_graph_enter_group_new_tab", "Open group in new tab"), function() /*=>*/ { openGroupTab(node_hover); }, THEME.group);
|
||||
menu_group_group = menuItem(__txt("Group"), function() /*=>*/ { doGroup(); }, THEME.group, ["Graph", "group"]);
|
||||
menu_group_ungroup = menuItem(__txt("Ungroup"), function() /*=>*/ { doUngroup(); }, THEME.group, ["Graph", "Ungroup"]);
|
||||
menu_group_tool = menuItem(__txt("Set as group tool"), function() /*=>*/ { node_hover.setTool(!node_hover.isTool); });
|
||||
function set_as_tool() {
|
||||
if(node_hover == noone) return;
|
||||
node_hover.setTool(!node_hover.isTool);
|
||||
}
|
||||
#endregion
|
||||
|
||||
menu_node_delete_merge = menuItem(__txtx("panel_graph_delete_and_merge_connection", "Delete and merge connection"), function() /*=>*/ { doDelete(true); }, THEME.cross, ["Graph", "Delete (merge)"]);
|
||||
menu_node_delete_cut = menuItem(__txtx("panel_graph_delete_and_cut_connection", "Delete and cut connection"), function() /*=>*/ { doDelete(false); }, THEME.cross, ["Graph", "Delete (break)"]);
|
||||
menu_node_duplicate = menuItem(__txt("Duplicate"), function() /*=>*/ { doDuplicate(); }, THEME.duplicate, ["Graph", "Duplicate"]);
|
||||
menu_node_copy = menuItem(__txt("Copy"), function() /*=>*/ { doCopy(); }, THEME.copy, ["Graph", "Copy"]);
|
||||
menu_sent_to_preview = menuItemAction(__txtx("panel_graph_send_to_preview", "Send to preview"), panel_graph_send_to_preview);
|
||||
menu_send_to_window = menuItemAction(__txtx("panel_graph_preview_window", "Send to preview window"), panel_graph_preview_window);
|
||||
menu_sent_to_inspector = menuItemAction(__txtx("panel_graph_inspector_panel", "Send to new inspector"), panel_graph_inspector_panel);
|
||||
menu_send_export = menuItemAction(__txtx("panel_graph_send_to_export", "Send to export"), panel_graph_send_to_export);
|
||||
menu_toggle_preview = menuItemAction(__txtx("panel_graph_toggle_preview", "Toggle node preview"), panel_graph_toggle_preview);
|
||||
menu_toggle_render = menuItemAction(__txtx("panel_graph_toggle_render", "Toggle node render"), panel_graph_toggle_render);
|
||||
menu_toggle_param = menuItemAction(__txtx("panel_graph_toggle_parameter", "Toggle node parameters"), panel_graph_toggle_parameter);
|
||||
menu_open_group = menuItemAction(__txtx("panel_graph_enter_group", "Open group"), panel_graph_enter_group, THEME.group);
|
||||
menu_hide_disconnect = menuItemAction(__txtx("panel_graph_hide_disconnected", "Hide stray junctions"), panel_graph_hide_disconnected);
|
||||
|
||||
menu_node_transform = menuItem(__txtx("panel_graph_add_transform", "Add transform"), function() /*=>*/ { doTransform(); }, noone, ["Graph", "Transform node"]);
|
||||
menu_node_canvas = menuItem(__txtx("panel_graph_canvas", "Canvas"),
|
||||
menu_open_group_tab = menuItemAction(__txtx("panel_graph_enter_group_new_tab", "Open group in new tab"), panel_graph_open_group_tab, THEME.group);
|
||||
menu_group_group = menuItemAction(__txt("Group"), panel_graph_group, THEME.group);
|
||||
menu_group_ungroup = menuItemAction(__txt("Ungroup"), panel_graph_ungroup, THEME.group);
|
||||
menu_group_tool = menuItemAction(__txt("Set as group tool"), panel_graph_set_as_tool);
|
||||
|
||||
menu_node_delete_cut = menuItemAction(__txtx("panel_graph_delete_and_cut_connection", "Delete and cut connection"), panel_graph_delete_break, THEME.cross);
|
||||
menu_node_delete_merge = menuItemAction(__txtx("panel_graph_delete_and_merge_connection", "Delete and merge connection"), panel_graph_delete_merge, THEME.cross);
|
||||
menu_node_duplicate = menuItemAction(__txt("Duplicate"), panel_graph_duplicate, THEME.duplicate);
|
||||
menu_node_copy = menuItemAction(__txt("Copy"), panel_graph_copy, THEME.copy);
|
||||
|
||||
menu_node_transform = menuItemAction(__txtx("panel_graph_add_transform", "Add transform"), panel_graph_add_transform);
|
||||
menu_node_canvas = menuItemAction(__txtx("panel_graph_canvas", "Canvas"),
|
||||
function(_dat) {
|
||||
return submenuCall(_dat, [
|
||||
menuItem(__txtx("panel_graph_copy_to_canvas", "Copy to canvas"), function() /*=>*/ { setCurrentCanvas(node_hover); }, noone, ["Graph", "Canvas"]),
|
||||
menuItem(__txtx("panel_graph_overlay_canvas", "Overlay canvas"), function() /*=>*/ { setCurrentCanvasBlend(node_hover); }, noone, ["Graph", "Canvas blend"])
|
||||
menuItemAction(__txtx("panel_graph_copy_to_canvas", "Copy to canvas"), panel_graph_canvas),
|
||||
menuItemAction(__txtx("panel_graph_overlay_canvas", "Overlay canvas"), panel_graph_canvas_blend)
|
||||
]);
|
||||
}).setIsShelf();
|
||||
|
||||
menu_nodes_align = menuItemGroup(__txtx("panel_graph_align_nodes", "Align"), [
|
||||
[ [THEME.inspector_surface_halign, 0], function() /*=>*/ { node_halign(nodes_selecting, fa_left); } ],
|
||||
[ [THEME.inspector_surface_halign, 1], function() /*=>*/ { node_halign(nodes_selecting, fa_center); } ],
|
||||
[ [THEME.inspector_surface_halign, 2], function() /*=>*/ { node_halign(nodes_selecting, fa_right); } ],
|
||||
[ [THEME.inspector_surface_halign, 0], function() { node_halign(nodes_selecting, fa_left); } ],
|
||||
[ [THEME.inspector_surface_halign, 1], function() { node_halign(nodes_selecting, fa_center); } ],
|
||||
[ [THEME.inspector_surface_halign, 2], function() { node_halign(nodes_selecting, fa_right); } ],
|
||||
|
||||
[ [THEME.inspector_surface_valign, 0], function() /*=>*/ { node_valign(nodes_selecting, fa_top); } ],
|
||||
[ [THEME.inspector_surface_valign, 1], function() /*=>*/ { node_valign(nodes_selecting, fa_middle); } ],
|
||||
[ [THEME.inspector_surface_valign, 2], function() /*=>*/ { node_valign(nodes_selecting, fa_bottom); } ],
|
||||
[ [THEME.inspector_surface_valign, 0], function() { node_valign(nodes_selecting, fa_top); } ],
|
||||
[ [THEME.inspector_surface_valign, 1], function() { node_valign(nodes_selecting, fa_middle); } ],
|
||||
[ [THEME.inspector_surface_valign, 2], function() { node_valign(nodes_selecting, fa_bottom); } ],
|
||||
|
||||
[ [THEME.obj_distribute_h, 0], function() /*=>*/ { node_hdistribute(nodes_selecting); } ],
|
||||
[ [THEME.obj_distribute_v, 0], function() /*=>*/ { node_vdistribute(nodes_selecting); } ],
|
||||
[ [THEME.obj_distribute_h, 0], function() { node_hdistribute(nodes_selecting); } ],
|
||||
[ [THEME.obj_distribute_v, 0], function() { node_vdistribute(nodes_selecting); } ],
|
||||
]);
|
||||
menu_nodes_blend = menuItem(__txtx("panel_graph_blend_nodes", "Blend nodes"), function() /*=>*/ { doBlend(); }, noone, ["Graph", "Blend"]);
|
||||
menu_nodes_compose = menuItem(__txtx("panel_graph_compose_nodes", "Compose nodes"), function() /*=>*/ { doCompose(); }, noone, ["Graph", "Compose"]);
|
||||
menu_nodes_array = menuItem(__txtx("panel_graph_array_from_nodes", "Array from nodes"), function() /*=>*/ { doArray(); }, noone, ["Graph", "Array"]);
|
||||
menu_nodes_group = menuItem(__txtx("panel_graph_group_nodes", "Group nodes"), function() /*=>*/ { doGroup(); }, THEME.group, ["Graph", "Group"]);
|
||||
menu_nodes_frame = menuItem(__txtx("panel_graph_frame_nodes", "Frame nodes"), function() /*=>*/ { doFrame(); }, noone, ["Graph", "Frame"]);
|
||||
menu_nodes_blend = menuItemAction(__txtx("panel_graph_blend_nodes", "Blend nodes"), panel_graph_blend);
|
||||
menu_nodes_compose = menuItemAction(__txtx("panel_graph_compose_nodes", "Compose nodes"), panel_graph_compose);
|
||||
menu_nodes_array = menuItemAction(__txtx("panel_graph_array_from_nodes", "Array from nodes"), panel_graph_array);
|
||||
menu_nodes_group = menuItemAction(__txtx("panel_graph_group_nodes", "Group nodes"), panel_graph_group);
|
||||
menu_nodes_frame = menuItemAction(__txtx("panel_graph_frame_nodes", "Frame nodes"), panel_graph_frame);
|
||||
|
||||
menu_node_copy_prop = menuItem(__txtx("panel_graph_copy_prop", "Copy all properties"), function() /*=>*/ { doCopyProp(); });
|
||||
menu_node_paste_prop = menuItem(__txtx("panel_graph_paste_prop", "Paste all properties"), function() /*=>*/ { doPasteProp(); });
|
||||
menu_node_copy_prop = menuItemAction(__txtx("panel_graph_copy_prop", "Copy all properties"), panel_graph_doCopyProp);
|
||||
menu_node_paste_prop = menuItemAction(__txtx("panel_graph_paste_prop", "Paste all properties"), panel_graph_doPasteProp);
|
||||
|
||||
menu_connection_tunnel = menuItem(__txtx("panel_graph_tunnel", "Create tunnels"), function() /*=>*/ { createTunnel(); });
|
||||
menu_connection_tunnel = menuItemAction(__txtx("panel_graph_tunnel", "Create tunnels"), panel_graph_createTunnel);
|
||||
|
||||
// node color
|
||||
function setSelectingNodeColor(color) {
|
||||
|
@ -1337,7 +1325,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
var _to = value_focus.value_to[i];
|
||||
var _lb = $"[{_to.node.display_name}] {_to.getName()}";
|
||||
array_push(menu, menuItem(_lb, function(data) /*=>*/ { data.params.juncTo.removeFrom(); }, THEME.cross, noone, noone, { juncTo: _to }));
|
||||
array_push(menu, menuItemAction(_lb, function(data) /*=>*/ { data.params.juncTo.removeFrom(); }, THEME.cross, noone, noone, { juncTo: _to }));
|
||||
}
|
||||
|
||||
for( var i = 0, n = array_length(value_focus.value_to_loop); i < n; i++ ) {
|
||||
|
@ -1345,7 +1333,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
var _to = value_focus.value_to_loop[i];
|
||||
var _lb = $"[{_to.junc_in.node.display_name}] {_to.junc_in.getName()}";
|
||||
array_push(menu, menuItem(_lb, function(data) /*=>*/ { data.params.juncTo.destroy(); }, _to.icon_24, noone, noone, { juncTo: _to }));
|
||||
array_push(menu, menuItemAction(_lb, function(data) /*=>*/ { data.params.juncTo.destroy(); }, _to.icon_24, noone, noone, { juncTo: _to }));
|
||||
}
|
||||
} else {
|
||||
var sep = false;
|
||||
|
@ -1355,7 +1343,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
var _jun = value_focus.value_from;
|
||||
var _lb = $"[{_jun.node.display_name}] {_jun.getName()}";
|
||||
array_push(menu, menuItem(_lb, function(data) /*=>*/ { __junction_hovering.removeFrom(); }, THEME.cross));
|
||||
array_push(menu, menuItemAction(_lb, function(data) /*=>*/ { __junction_hovering.removeFrom(); }, THEME.cross));
|
||||
}
|
||||
|
||||
if(value_focus.value_from_loop) {
|
||||
|
@ -1363,7 +1351,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
var _jun = value_focus.value_from_loop.junc_out;
|
||||
var _lb = $"[{_jun.node.display_name}] {_jun.getName()}";
|
||||
array_push(menu, menuItem(_lb, function(data) /*=>*/ { __junction_hovering.removeFromLoop(); }, value_focus.value_from_loop.icon_24));
|
||||
array_push(menu, menuItemAction(_lb, function(data) /*=>*/ { __junction_hovering.removeFromLoop(); }, value_focus.value_from_loop.icon_24));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1405,19 +1393,19 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
if(junction_hovering != noone)
|
||||
array_push(menu, menu_junc_color, menu_connection_tunnel, -1);
|
||||
|
||||
array_push(menu, menuItem(__txt("Copy"), function() { doCopy(); }, THEME.copy, ["Graph", "Copy"]).setActive(array_length(nodes_selecting)));
|
||||
array_push(menu, menuItem(__txt("Paste"), function() { doPaste(); }, THEME.paste, ["Graph", "Paste"]).setActive(clipboard_get_text() != ""));
|
||||
array_push(menu, menuItemAction(__txt("Copy"), panel_graph_copy, THEME.copy).setActive(array_length(nodes_selecting)));
|
||||
array_push(menu, menuItemAction(__txt("Paste"), panel_graph_paste, THEME.paste).setActive(clipboard_get_text() != ""));
|
||||
|
||||
if(junction_hovering != noone) {
|
||||
array_push(menu, -1);
|
||||
|
||||
if(is_instanceof(junction_hovering, Node_Feedback_Inline)) {
|
||||
var _jun = junction_hovering.junc_out;
|
||||
array_push(menu, menuItem($"[{_jun.node.display_name}] {_jun.getName()}", function(data) /*=>*/ { __junction_hovering.destroy(); }, THEME.feedback));
|
||||
array_push(menu, menuItemAction($"[{_jun.node.display_name}] {_jun.getName()}", function(data) /*=>*/ { __junction_hovering.destroy(); }, THEME.feedback));
|
||||
|
||||
} else {
|
||||
var _jun = junction_hovering.value_from;
|
||||
array_push(menu, menuItem($"[{_jun.node.display_name}] {_jun.getName()}", function(data) /*=>*/ { __junction_hovering.removeFrom(); }, THEME.cross));
|
||||
array_push(menu, menuItemAction($"[{_jun.node.display_name}] {_jun.getName()}", function(data) /*=>*/ { __junction_hovering.removeFrom(); }, THEME.cross));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1806,7 +1794,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
_connect[1].value_from_loop.destroy();
|
||||
|
||||
var menu = [
|
||||
menuItem("Feedback", function(data) {
|
||||
menuItemAction("Feedback", function(data) {
|
||||
var junc_in = data.params.junc_in;
|
||||
var junc_out = data.params.junc_out;
|
||||
|
||||
|
@ -1818,7 +1806,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
}, THEME.feedback_24,,, { junc_in : _connect[1], junc_out : _connect[2] }),
|
||||
|
||||
menuItem("Loop", function(data) {
|
||||
menuItemAction("Loop", function(data) {
|
||||
var junc_in = data.params.junc_in;
|
||||
var junc_out = data.params.junc_out;
|
||||
|
||||
|
|
|
@ -1,17 +1,42 @@
|
|||
#region funtion calls
|
||||
function __fnInit_Inspector() {
|
||||
__registerFunction("inspector_copy_prop", panel_inspector_copy_prop);
|
||||
__registerFunction("inspector_paste_prop", panel_inspector_paste_prop);
|
||||
__registerFunction("inspector_toggle_animation", panel_inspector_toggle_animation);
|
||||
registerFunction("Inspector", "Copy property", "C", MOD_KEY.ctrl, panel_inspector_copy_prop);
|
||||
registerFunction("Inspector", "Paste property", "V", MOD_KEY.ctrl, panel_inspector_paste_prop);
|
||||
registerFunction("Inspector", "Toggle animation", "I", MOD_KEY.none, panel_inspector_toggle_animation);
|
||||
|
||||
__registerFunction("inspector_color_pick", panel_inspector_color_pick);
|
||||
registerFunction("", "Color picker", "", MOD_KEY.alt, panel_inspector_color_pick);
|
||||
|
||||
registerFunction("Inspector", "Expand All Sections", "", MOD_KEY.none, panel_inspector_section_expand_all);
|
||||
registerFunction("Inspector", "Collapse All Sections", "", MOD_KEY.none, panel_inspector_section_collapse_all);
|
||||
|
||||
registerFunction("Inspector", "Reset", "", MOD_KEY.none, panel_inspector_reset);
|
||||
registerFunction("Inspector", "Add", "", MOD_KEY.none, panel_inspector_add);
|
||||
registerFunction("Inspector", "Remove", "", MOD_KEY.none, panel_inspector_remove);
|
||||
registerFunction("Inspector", "Combine Axis", "", MOD_KEY.none, panel_inspector_axis_combine);
|
||||
registerFunction("Inspector", "Separate Axis", "", MOD_KEY.none, panel_inspector_axis_separate);
|
||||
registerFunction("Inspector", "Use Expression", "", MOD_KEY.none, panel_inspector_use_expression);
|
||||
registerFunction("Inspector", "Disable Expression", "", MOD_KEY.none, panel_inspector_disable_expression);
|
||||
registerFunction("Inspector", "Extract Value", "", MOD_KEY.none, panel_inspector_extract_single);
|
||||
}
|
||||
|
||||
function panel_inspector_copy_prop() { CALL("inspector_copy_prop"); PANEL_INSPECTOR.propSelectCopy(); }
|
||||
function panel_inspector_paste_prop() { CALL("inspector_paste_prop"); PANEL_INSPECTOR.propSelectPaste(); }
|
||||
function panel_inspector_copy_prop() { CALL("inspector_copy_property"); PANEL_INSPECTOR.propSelectCopy(); }
|
||||
function panel_inspector_paste_prop() { CALL("inspector_paste_property"); PANEL_INSPECTOR.propSelectPaste(); }
|
||||
function panel_inspector_toggle_animation() { CALL("inspector_toggle_animation"); PANEL_INSPECTOR.anim_toggling = true; }
|
||||
|
||||
function panel_inspector_color_pick() { CALL("inspector_color_pick"); if(!PREFERENCES.alt_picker&& !MOUSE_BLOCK) return; PANEL_INSPECTOR.color_picking = true; }
|
||||
function panel_inspector_color_pick() { CALL("color_picker"); if(!PREFERENCES.alt_picker&& !MOUSE_BLOCK) return; PANEL_INSPECTOR.color_picking = true; }
|
||||
|
||||
function panel_inspector_section_expand_all() { CALL("inspector_section_expand_all"); PANEL_INSPECTOR.section_expand_all(); }
|
||||
function panel_inspector_section_collapse_all() { CALL("inspector_section_collapse_all"); PANEL_INSPECTOR.section_collapse_all(); }
|
||||
|
||||
function panel_inspector_reset() { CALL("inspector_reset"); PANEL_INSPECTOR.junction_reset(); }
|
||||
function panel_inspector_add() { CALL("inspector_add"); PANEL_INSPECTOR.junction_add(); }
|
||||
function panel_inspector_remove() { CALL("inspector_remove"); PANEL_INSPECTOR.junction_remove(); }
|
||||
function panel_inspector_axis_combine() { CALL("inspector_axis_combine"); PANEL_INSPECTOR.junction_axis_combine(); }
|
||||
function panel_inspector_axis_separate() { CALL("inspector_axis_separate"); PANEL_INSPECTOR.junction_axis_separate(); }
|
||||
function panel_inspector_use_expression() { CALL("inspector_use_expression"); PANEL_INSPECTOR.junction_use_expression(); }
|
||||
function panel_inspector_disable_expression() { CALL("inspector_disable_expression"); PANEL_INSPECTOR.junction_disable_expression(); }
|
||||
function panel_inspector_extract_single() { CALL("inspector_extract_single"); PANEL_INSPECTOR.junction_extract_single(); }
|
||||
|
||||
#endregion
|
||||
|
||||
function Inspector_Custom_Renderer(drawFn, registerFn = noone) : widget() constructor {
|
||||
|
@ -128,14 +153,6 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
workshop_uploading = false;
|
||||
#endregion
|
||||
|
||||
#region ++++ hotkeys ++++
|
||||
addHotkey("Inspector", "Copy property", "C", MOD_KEY.ctrl, panel_inspector_copy_prop);
|
||||
addHotkey("Inspector", "Paste property", "V", MOD_KEY.ctrl, panel_inspector_paste_prop);
|
||||
addHotkey("Inspector", "Toggle animation", "I", MOD_KEY.none, panel_inspector_toggle_animation);
|
||||
|
||||
addHotkey("", "Color picker", "", MOD_KEY.alt, panel_inspector_color_pick);
|
||||
#endregion
|
||||
|
||||
#region ++++ menus ++++
|
||||
static nodeExpandAll = function(node) {
|
||||
if(node.input_display_list == -1) return;
|
||||
|
@ -157,31 +174,44 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
}
|
||||
}
|
||||
|
||||
group_menu = [
|
||||
menuItem(__txt("Expand all"), function() {
|
||||
function section_expand_all() {
|
||||
if(inspecting != noone) nodeExpandAll(inspecting);
|
||||
for( var i = 0, n = array_length(inspectings); i < n; i++ )
|
||||
nodeExpandAll(inspectings[i]);
|
||||
}),
|
||||
menuItem(__txt("Collapse all"), function() {
|
||||
}
|
||||
|
||||
function section_collapse_all() {
|
||||
if(inspecting != noone) nodeCollapseAll(inspecting);
|
||||
for( var i = 0, n = array_length(inspectings); i < n; i++ )
|
||||
nodeCollapseAll(inspectings[i]);
|
||||
}),
|
||||
}
|
||||
|
||||
function junction_reset() { if(__dialog_junction == noone) return; __dialog_junction.resetValue(); }
|
||||
function junction_add() { if(__dialog_junction == noone) return; __dialog_junction.setAnim(true); }
|
||||
function junction_remove() { if(__dialog_junction == noone) return; __dialog_junction.setAnim(false); }
|
||||
function junction_axis_combine() { if(__dialog_junction == noone) return; __dialog_junction.sep_axis = false; }
|
||||
function junction_axis_separate() { if(__dialog_junction == noone) return; __dialog_junction.sep_axis = true; }
|
||||
function junction_use_expression() { if(__dialog_junction == noone) return; __dialog_junction.expUse = true; }
|
||||
function junction_disable_expression() { if(__dialog_junction == noone) return; __dialog_junction.expUse = false; }
|
||||
function junction_extract_single() { if(__dialog_junction == noone) return; __dialog_junction.extractNode(); }
|
||||
|
||||
group_menu = [
|
||||
menuItemAction(__txt("Expand all"), panel_inspector_section_expand_all),
|
||||
menuItemAction(__txt("Collapse all"), panel_inspector_section_collapse_all),
|
||||
]
|
||||
|
||||
__dialog_junction = noone;
|
||||
menu_junc_reset_value = menuItem(__txtx("panel_inspector_reset", "Reset value"), function() { __dialog_junction.resetValue(); });
|
||||
menu_junc_add_anim = menuItem(__txtx("panel_inspector_add", "Add animation"), function() { __dialog_junction.setAnim(true); });
|
||||
menu_junc_rem_anim = menuItem(__txtx("panel_inspector_remove", "Remove animation"), function() { __dialog_junction.setAnim(false); });
|
||||
menu_junc_combine_axis = menuItem(__txtx("panel_inspector_axis_combine", "Combine axis"), function() { __dialog_junction.sep_axis = false; });
|
||||
menu_junc_separate_axis = menuItem(__txtx("panel_inspector_axis_separate", "Separate axis"), function() { __dialog_junction.sep_axis = true; });
|
||||
menu_junc_expression_ena = menuItem(__txtx("panel_inspector_use_expression", "Use expression"), function() { __dialog_junction.expUse = true; });
|
||||
menu_junc_expression_dis = menuItem(__txtx("panel_inspector_disable_expression", "Disable expression"), function() { __dialog_junction.expUse = false; });
|
||||
menu_junc_extract = menuItem(__txtx("panel_inspector_extract_single", "Extract to node"), function() { __dialog_junction.extractNode(); });
|
||||
menu_junc_reset_value = menuItemAction(__txtx("panel_inspector_reset", "Reset value"), panel_inspector_reset);
|
||||
menu_junc_add_anim = menuItemAction(__txtx("panel_inspector_add", "Add animation"), panel_inspector_add);
|
||||
menu_junc_rem_anim = menuItemAction(__txtx("panel_inspector_remove", "Remove animation"), panel_inspector_remove);
|
||||
menu_junc_combine_axis = menuItemAction(__txtx("panel_inspector_axis_combine", "Combine axis"), panel_inspector_axis_combine);
|
||||
menu_junc_separate_axis = menuItemAction(__txtx("panel_inspector_axis_separate", "Separate axis"), panel_inspector_axis_separate);
|
||||
menu_junc_expression_ena = menuItemAction(__txtx("panel_inspector_use_expression", "Use expression"), panel_inspector_use_expression);
|
||||
menu_junc_expression_dis = menuItemAction(__txtx("panel_inspector_disable_expression", "Disable expression"), panel_inspector_disable_expression);
|
||||
menu_junc_extract = menuItemAction(__txtx("panel_inspector_extract_single", "Extract to node"), panel_inspector_extract_single);
|
||||
|
||||
menu_junc_copy = menuItem(__txt("Copy"), function() { clipboard_set_text(__dialog_junction.getString()); }, THEME.copy, ["Inspector", "Copy property"]);
|
||||
menu_junc_paste = menuItem(__txt("Paste"), function() { __dialog_junction.setString(clipboard_get_text()); }, THEME.paste, ["Inspector", "Paste property"]);
|
||||
menu_junc_copy = menuItemAction(__txt("Copy"), panel_inspector_copy_prop, THEME.copy);
|
||||
menu_junc_paste = menuItemAction(__txt("Paste"), panel_inspector_paste_prop, THEME.paste);
|
||||
|
||||
function setSelectingItemColor(color) {
|
||||
if(__dialog_junction == noone) return;
|
||||
|
@ -870,11 +900,11 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
|
||||
if(jun.connect_type == JUNCTION_CONNECT.input && jun.extract_node != "") {
|
||||
if(is_array(jun.extract_node)) {
|
||||
var ext = menuItem(__txtx("panel_inspector_extract_multiple", "Extract to..."), function(_dat) {
|
||||
var ext = menuItemAction(__txtx("panel_inspector_extract_multiple", "Extract to..."), function(_dat) {
|
||||
var arr = [];
|
||||
for(var i = 0; i < array_length(__dialog_junction.extract_node); i++) {
|
||||
var _rec = __dialog_junction.extract_node[i];
|
||||
array_push(arr, menuItem(_rec, function(_dat) { __dialog_junction.extractNode(_dat.name); }));
|
||||
array_push(arr, menuItemAction(_rec, function(_dat) { __dialog_junction.extractNode(_dat.name); }));
|
||||
}
|
||||
|
||||
return submenuCall(_dat, arr);
|
||||
|
|
|
@ -17,47 +17,43 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
|
||||
#region file
|
||||
menu_file_nondemo = [
|
||||
menuItem(__txt("New"), function() { NEW(); }, THEME.new_file, ["", "New file"]),
|
||||
menuItem(__txt("Open") + "...", function() { LOAD(); }, THEME.noti_icon_file_load, ["", "Open"])
|
||||
.setShiftMenu(menuItem(__txt("Open in safe mode") + "...", function() { LOAD(true); }, THEME.noti_icon_file_load)),
|
||||
menuItem(__txt("Save"), function() { SAVE(); }, THEME.save, ["", "Save"]),
|
||||
menuItem(__txt("Save as") + "...", function() { SAVE_AS(); }, THEME.save, ["", "Save as"]),
|
||||
menuItem(__txt("Save all"), function() { SAVE_ALL(); }, THEME.icon_save_all, ["", "Save all"]),
|
||||
menuItem(__txt("Recent files"), function(_dat) {
|
||||
menuItemAction(__txt("New"), NEW, THEME.new_file),
|
||||
menuItemAction(__txt("Open") + "...", LOAD, THEME.noti_icon_file_load)
|
||||
.setShiftMenu(menuItemAction(__txt("Open in safe mode") + "...", LOAD_SAFE, THEME.noti_icon_file_load)),
|
||||
|
||||
menuItemAction(__txt("Save"), SAVE, THEME.save),
|
||||
menuItemAction(__txt("Save as") + "...", SAVE_AS, THEME.save),
|
||||
menuItemAction(__txt("Save all"), SAVE_ALL, THEME.icon_save_all),
|
||||
menuItemAction(__txt("Recent files"), function(_dat) {
|
||||
var arr = [];
|
||||
for(var i = 0; i < min(10, ds_list_size(RECENT_FILES)); i++) {
|
||||
var _rec = RECENT_FILES[| i];
|
||||
array_push(arr, menuItem(_rec, function(_dat) { LOAD_PATH(_dat.name); }));
|
||||
array_push(arr, menuItemAction(_rec, function(_dat) { LOAD_PATH(_dat.name); }));
|
||||
}
|
||||
|
||||
return submenuCall(_dat, arr);
|
||||
}).setIsShelf(),
|
||||
menuItem(__txtx("panel_menu_auto_save_folder", "Open autosave folder"), function() { shellOpenExplorer(DIRECTORY + "autosave"); }, THEME.save_auto, ["", "Autosave folder"]),
|
||||
menuItem(__txt("Import"), function(_dat) {
|
||||
var arr = [
|
||||
menuItem(__txt("Portable project (.zip)") + "...", function() { __IMPORT_ZIP(); }),
|
||||
];
|
||||
|
||||
menuItemAction(__txtx("panel_menu_auto_save_folder", "Open autosave folder"), open_autosave_folder, THEME.save_auto),
|
||||
menuItemAction(__txt("Import"), function(_dat) {
|
||||
var arr = [ menuItemAction(__txt("Portable project (.zip)") + "...", __IMPORT_ZIP), ];
|
||||
return submenuCall(_dat, arr);
|
||||
}).setIsShelf(),
|
||||
menuItem(__txt("Export"), function(_dat) {
|
||||
var arr = [
|
||||
menuItem(__txt("Portable project (.zip)") + "...", function() { exportPortable(PROJECT); }),
|
||||
];
|
||||
|
||||
menuItemAction(__txt("Export"), function(_dat) {
|
||||
var arr = [ menuItemAction(__txt("Portable project (.zip)") + "...", __EXPORT_ZIP), ];
|
||||
return submenuCall(_dat, arr);
|
||||
}).setIsShelf(),
|
||||
-1,
|
||||
];
|
||||
|
||||
menu_file = [
|
||||
menuItem(__txt("Preferences") + "...", function() { dialogCall(o_dialog_preference); }, THEME.gear, ["", "Preference"]),
|
||||
menuItem(__txt("Splash screen"), function() { dialogCall(o_dialog_splash); }, noone, ["", "Splash Screen"]),
|
||||
menuItemAction(__txt("Preferences") + "...", call_dialog_preference, THEME.gear),
|
||||
menuItemAction(__txt("Splash screen"), call_dialog_splash),
|
||||
-1,
|
||||
menuItem(__txt("Addons"), function(_dat) {
|
||||
menuItemAction(__txt("Addons"), function(_dat) {
|
||||
var arr = [
|
||||
menuItem(__txt("Addons") + "...", function() { dialogPanelCall(new Panel_Addon()); }, noone, ["", "Addons"]),
|
||||
menuItem(__txtx("panel_menu_addons_key", "Key displayer"), function() {
|
||||
menuItemAction(__txt("Addons") + "...", call_panel_addon),
|
||||
menuItemAction(__txtx("panel_menu_addons_key", "Key displayer"), function() {
|
||||
if(instance_exists(addon_key_displayer)) {
|
||||
instance_destroy(addon_key_displayer);
|
||||
return;
|
||||
|
@ -70,16 +66,16 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
|
||||
for( var i = 0, n = array_length(ADDONS); i < n; i++ ) {
|
||||
var _dir = ADDONS[i].name;
|
||||
array_push(arr, menuItem(_dir, function(_dat) { addonTrigger(_dat.name); } ));
|
||||
array_push(arr, menuItemAction(_dir, function(_dat) { addonTrigger(_dat.name); } ));
|
||||
}
|
||||
|
||||
return submenuCall(_dat, arr);
|
||||
}, THEME.addon_icon ).setIsShelf(),
|
||||
-1,
|
||||
menuItem(__txt("Fullscreen"), function() { winMan_setFullscreen(!window_is_fullscreen); }, noone, ["", "Fullscreen"]),
|
||||
menuItem(__txt("Close current project"), function() { PANEL_GRAPH.close(); }, noone, [ "", "Close file" ]),
|
||||
menuItem(__txt("Close all projects"), function() { for( var i = array_length(PROJECTS) - 1; i >= 0; i-- ) closeProject(PROJECTS[i]); }, noone, [ "", "Close all" ]),
|
||||
menuItem(__txt("Close program"), function() { window_close(); }, noone, [ "", "Close program" ]),
|
||||
menuItemAction(__txt("Fullscreen"), global_fullscreen),
|
||||
menuItemAction(__txt("Close current project"), global_project_close),
|
||||
menuItemAction(__txt("Close all projects"), global_project_close_all),
|
||||
menuItemAction(__txt("Close program"), window_close),
|
||||
];
|
||||
|
||||
if(!DEMO) menu_file = array_append(menu_file_nondemo, menu_file);
|
||||
|
@ -87,33 +83,23 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
|
||||
#region help
|
||||
menu_help = [
|
||||
menuItem(__txtx("panel_menu_help_video", "Tutorial videos"), function() {
|
||||
url_open("https://www.youtube.com/@makhamdev");
|
||||
}, THEME.youtube),
|
||||
menuItem(__txtx("panel_menu_help_wiki", "Community Wiki"), function() {
|
||||
url_open("https://pixel-composer.fandom.com/wiki/Pixel_Composer_Wiki");
|
||||
}, THEME.wiki),
|
||||
menuItemAction(__txtx("panel_menu_help_video", "Tutorial videos"), function() { url_open("https://www.youtube.com/@makhamdev"); }, THEME.youtube),
|
||||
menuItemAction(__txtx("panel_menu_help_wiki", "Community Wiki"), function() { url_open("https://pixel-composer.fandom.com/wiki/Pixel_Composer_Wiki"); }, THEME.wiki),
|
||||
-1,
|
||||
menuItem(__txtx("panel_menu_local_directory", "Open local directory"), function() {
|
||||
shellOpenExplorer(DIRECTORY);
|
||||
}, THEME.folder),
|
||||
menuItem(__txtx("panel_menu_autosave_directory", "Open autosave directory"), function() {
|
||||
shellOpenExplorer(DIRECTORY + "autosave/");
|
||||
}, THEME.folder),
|
||||
menuItem(__txtx("panel_menu_reset_default", "Reset default collection, assets"), function() {
|
||||
menuItemAction(__txtx("panel_menu_local_directory", "Open local directory"), function() { shellOpenExplorer(DIRECTORY); }, THEME.folder),
|
||||
menuItemAction(__txtx("panel_menu_autosave_directory", "Open autosave directory"), function() { shellOpenExplorer(DIRECTORY + "autosave/"); }, THEME.folder),
|
||||
menuItemAction(__txtx("panel_menu_reset_default", "Reset default collection, assets"), function() {
|
||||
zip_unzip("data/Collections.zip", DIRECTORY + "Collections");
|
||||
zip_unzip("data/Assets.zip", DIRECTORY + "Assets");
|
||||
}),
|
||||
-1,
|
||||
menuItem(__txtx("panel_menu_connect_patreon", "Connect to Patreon"), function() {
|
||||
dialogPanelCall(new Panel_Patreon());
|
||||
}, THEME.patreon),
|
||||
menuItemAction(__txtx("panel_menu_connect_patreon", "Connect to Patreon"), function() { dialogPanelCall(new Panel_Patreon()); }, THEME.patreon),
|
||||
];
|
||||
#endregion
|
||||
|
||||
#region //////// MENU ////////
|
||||
menuItem_undo = menuItem(__txt("Undo"), function() { UNDO(); }, THEME.undo, ["", "Undo"]);
|
||||
menuItem_redo = menuItem(__txt("Redo"), function() { REDO(); }, THEME.redo, ["", "Redo"]);
|
||||
menuItem_undo = menuItemAction(__txt("Undo"), UNDO, THEME.undo);
|
||||
menuItem_redo = menuItemAction(__txt("Redo"), REDO, THEME.redo);
|
||||
|
||||
menus = [
|
||||
[ __txt("File"), menu_file ],
|
||||
|
@ -121,12 +107,12 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
[ __txt("Edit"), [
|
||||
menuItem_undo,
|
||||
menuItem_redo,
|
||||
menuItem(__txt("History"), function() { dialogPanelCall(new Panel_History()); }, noone, ["", "History"]),
|
||||
menuItemAction(__txt("History"), call_panel_history),
|
||||
]],
|
||||
|
||||
[ __txt("Preview"), [
|
||||
menuItem(__txtx("panel_menu_center_preview", "Center preview"), function() { PANEL_PREVIEW.do_fullView = true; }, THEME.icon_center_canvas, ["Preview", "Focus content"]),
|
||||
menuItem(__txtx("panel_menu_save_current_preview_as", "Save current preview as..."), function() { PANEL_PREVIEW.saveCurrentFrame(); }, noone, ["Preview", "Save current frame"]),
|
||||
menuItemAction(__txtx("panel_menu_center_preview", "Center preview"), panel_preview_focus_content, THEME.icon_center_canvas),
|
||||
menuItemAction(__txtx("panel_menu_save_current_preview_as", "Save current preview as..."), panel_preview_save_current_frame),
|
||||
menuItemGroup(__txtx("panel_menu_preview_background", "Preview background"), [
|
||||
[ s_preview_transparent, function() { PANEL_PREVIEW.canvas_bg = -1; } ],
|
||||
[ s_preview_white, function() { PANEL_PREVIEW.canvas_bg = c_white; } ],
|
||||
|
@ -135,38 +121,21 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
]],
|
||||
|
||||
[ __txt("Animation"), [
|
||||
menuItem(__txtx("panel_menu_animation_setting", "Animation Settings..."), function() {
|
||||
var dia = dialogPanelCall(new Panel_Animation_Setting());
|
||||
dia.anchor = ANCHOR.none;
|
||||
}, THEME.animation_setting, ["Animation", "Settings"]),
|
||||
menuItemAction(__txtx("panel_menu_animation_setting", "Animation Settings..."), panel_animation_settings, THEME.animation_setting),
|
||||
-1,
|
||||
menuItem(__txtx("panel_menu_animation_scaler", "Animation Scaler..."), function() {
|
||||
dialogPanelCall(new Panel_Animation_Scaler());
|
||||
}, THEME.animation_timing),
|
||||
menuItemAction(__txtx("panel_menu_animation_scaler", "Animation Scaler..."), panel_animation_scale, THEME.animation_timing),
|
||||
]],
|
||||
|
||||
[ __txt("Rendering"), [
|
||||
menuItem(__txtx("panel_menu_render_all_nodes", "Render all nodes"), function() {
|
||||
RENDER_ALL_REORDER
|
||||
}, [ THEME.sequence_control, 1 ], ["", "Render all"]),
|
||||
|
||||
menuItem(__txtx("panel_menu_execute_exports", "Execute all export nodes"), function() {
|
||||
for (var i = 0, n = array_length(PROJECT.allNodes); i < n; i++) {
|
||||
var node = PROJECT.allNodes[i];
|
||||
|
||||
if(!node.active) continue;
|
||||
if(instanceof(node) != "Node_Export") continue;
|
||||
|
||||
node.doInspectorAction();
|
||||
}
|
||||
}),
|
||||
menuItem(__txtx("panel_menu_export_render_all", "Render disabled node when export"),
|
||||
menuItemAction(__txtx("panel_menu_render_all_nodes", "Render all nodes"), global_render_all, [ THEME.sequence_control, 1 ]),
|
||||
menuItemAction(__txtx("panel_menu_execute_exports", "Execute all export nodes"), global_export_all),
|
||||
menuItemAction(__txtx("panel_menu_export_render_all", "Render disabled node when export"),
|
||||
function() { PREFERENCES.render_all_export = !PREFERENCES.render_all_export; },,,
|
||||
function() { return PREFERENCES.render_all_export; } ),
|
||||
function() { return PREFERENCES.render_all_export; }),
|
||||
]],
|
||||
|
||||
[ __txt("Panels"), [
|
||||
menuItem(__txt("Workspace"), function(_dat) {
|
||||
menuItemAction(__txt("Workspace"), function(_dat) {
|
||||
var arr = [], lays = [];
|
||||
var f = file_find_first(DIRECTORY + "layouts/*", 0);
|
||||
while(f != "") {
|
||||
|
@ -174,7 +143,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
f = file_find_next();
|
||||
}
|
||||
|
||||
array_push(arr, menuItem(__txtx("panel_menu_save_layout", "Save layout"), function() {
|
||||
array_push(arr, menuItemAction(__txtx("panel_menu_save_layout", "Save layout"), function() {
|
||||
var dia = dialogCall(o_dialog_file_name, mouse_mx + ui(8), mouse_my + ui(8));
|
||||
dia.name = PREFERENCES.panel_layout_file;
|
||||
dia.onModify = function(name) {
|
||||
|
@ -183,13 +152,11 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
};
|
||||
}));
|
||||
|
||||
array_push(arr, menuItem(__txtx("panel_menu_reset_layout", "Reset layout"), function() {
|
||||
resetPanel();
|
||||
},, [ "", "Reset layout" ]));
|
||||
array_push(arr, menuItemAction(__txtx("panel_menu_reset_layout", "Reset layout"), resetPanel));
|
||||
array_push(arr, -1);
|
||||
|
||||
for(var i = 0; i < array_length(lays); i++) {
|
||||
array_push(arr, menuItem(lays[i],
|
||||
array_push(arr, menuItemAction(lays[i],
|
||||
function(_dat) {
|
||||
PREFERENCES.panel_layout_file = _dat.name;
|
||||
PREF_SAVE();
|
||||
|
@ -200,81 +167,79 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
return submenuCall(_dat, arr);
|
||||
}).setIsShelf(),
|
||||
-1,
|
||||
menuItem(__txt("Collections"), function() { panelAdd("Panel_Collection", true) }, noone, ["", "Collections Panel"], function() { return findPanel("Panel_Collection") != noone; } ),
|
||||
menuItem(__txt("Graph"), function() { panelAdd("Panel_Graph", true) }, noone, ["", "Graph Panel"], function() { return findPanel("Panel_Graph") != noone; } ),
|
||||
menuItem(__txt("Preview"), function() { panelAdd("Panel_Preview", true) }, noone, ["", "Preview Panel"], function() { return findPanel("Panel_Preview") != noone; } ),
|
||||
menuItem(__txt("Inspector"), function() { panelAdd("Panel_Inspector", true) }, noone, ["", "Inspector Panel"], function() { return findPanel("Panel_Inspector") != noone; } ),
|
||||
menuItem(__txt("Workspace"), function() { panelAdd("Panel_Workspace", true) }, noone, ["", "Workspace Panel"], function() { return findPanel("Panel_Workspace") != noone; } ),
|
||||
menuItem(__txt("Animation"), function() { panelAdd("Panel_Animation", true) }, noone, ["", "Animation Panel"], function() { return findPanel("Panel_Animation") != noone; } ),
|
||||
menuItem(__txt("Notifications"), function() { panelAdd("Panel_Notification", true) }, noone, ["", "Notification Panel"], function() { return findPanel("Panel_Notification") != noone; } ),
|
||||
menuItem(__txt("Global Variables"), function() { panelAdd("Panel_Globalvar", true) }, noone, noone, function() { return findPanel("Panel_Globalvar") != noone; } ),
|
||||
menuItem(__txt("File Explorer"), function() { panelAdd("Panel_File_Explorer", true) },noone, noone, function() { return findPanel("Panel_File_Explorer") != noone; } ),
|
||||
menuItemAction(__txt("Collections"), call_panel_Collection, noone, function() /*=>*/ { return findPanel("Panel_Collection") != noone; } ),
|
||||
menuItemAction(__txt("Graph"), call_panel_Graph, noone, function() /*=>*/ { return findPanel("Panel_Graph") != noone; } ),
|
||||
menuItemAction(__txt("Preview"), call_panel_Preview, noone, function() /*=>*/ { return findPanel("Panel_Preview") != noone; } ),
|
||||
menuItemAction(__txt("Inspector"), call_panel_Inspector, noone, function() /*=>*/ { return findPanel("Panel_Inspector") != noone; } ),
|
||||
menuItemAction(__txt("Workspace"), call_panel_Workspace, noone, function() /*=>*/ { return findPanel("Panel_Workspace") != noone; } ),
|
||||
menuItemAction(__txt("Animation"), call_panel_Animation, noone, function() /*=>*/ { return findPanel("Panel_Animation") != noone; } ),
|
||||
menuItemAction(__txt("Notifications"), call_panel_Notification, noone, function() /*=>*/ { return findPanel("Panel_Notification") != noone; } ),
|
||||
menuItemAction(__txt("Global Variables"), call_panel_Globalvar, noone, function() /*=>*/ { return findPanel("Panel_Globalvar") != noone; } ),
|
||||
menuItemAction(__txt("File Explorer"), call_panel_File_Explorer, noone, function() /*=>*/ { return findPanel("Panel_File_Explorer") != noone; } ),
|
||||
|
||||
menuItem(__txt("Nodes"), function(_dat) {
|
||||
menuItemAction(__txt("Nodes"), function(_dat) {
|
||||
return submenuCall(_dat, [
|
||||
menuItem(__txt("Align"), function() { panelAdd("Panel_Node_Align", true) }, noone, ["", "Align Panel"], function() { return findPanel("Panel_Node_Align") != noone; } ),
|
||||
menuItem(__txt("Nodes"), function() { panelAdd("Panel_Nodes", true) }, noone, ["", "Nodes Panel"], function() { return findPanel("Panel_Nodes") != noone; } ),
|
||||
menuItem(__txt("Tunnels"), function() { panelAdd("Panel_Tunnels", true) }, noone, ["", "Tunnels Panel"], function() { return findPanel("Panel_Tunnels") != noone; } ),
|
||||
menuItemAction(__txt("Align"), call_panel_Node_Align, noone, function() /*=>*/ { return findPanel("Panel_Node_Align") != noone; } ),
|
||||
menuItemAction(__txt("Nodes"), call_panel_Nodes, noone, function() /*=>*/ { return findPanel("Panel_Nodes") != noone; } ),
|
||||
menuItemAction(__txt("Tunnels"), call_panel_Tunnels, noone, function() /*=>*/ { return findPanel("Panel_Tunnels") != noone; } ),
|
||||
]);
|
||||
} ).setIsShelf(),
|
||||
|
||||
menuItem(__txt("Color"), function(_dat) {
|
||||
menuItemAction(__txt("Color"), function(_dat) {
|
||||
return submenuCall(_dat, [
|
||||
menuItem(__txt("Color"), function() { panelAdd("Panel_Color", true) }, noone, ["", "Color Panel"], function() { return findPanel("Panel_Color") != noone; } ),
|
||||
menuItem(__txt("Palettes"), function() { panelAdd("Panel_Palette", true) }, noone, ["", "Palettes Panel"], function() { return findPanel("Panel_Palette") != noone; } ),
|
||||
menuItem(__txt("Gradients"), function() { panelAdd("Panel_Gradient", true) }, noone, ["", "Gradients Panel"], function() { return findPanel("Panel_Gradient") != noone; } ),
|
||||
menuItemAction(__txt("Color"), call_panel_Color, noone, function() /*=>*/ { return findPanel("Panel_Color") != noone; } ),
|
||||
menuItemAction(__txt("Palettes"), call_panel_Palette, noone, function() /*=>*/ { return findPanel("Panel_Palette") != noone; } ),
|
||||
menuItemAction(__txt("Gradients"), call_panel_Gradient, noone, function() /*=>*/ { return findPanel("Panel_Gradient") != noone; } ),
|
||||
-1,
|
||||
menuItem(__txt("Palette Mixer"), function() { panelAdd("Panel_Palette_Mixer", true) }, noone, ["", "Palette Mixer Panel"], function() { return findPanel("Panel_Palette_Mixer") != noone; } ),
|
||||
menuItemAction(__txt("Palette Mixer"), call_panel_Palette_Mixer, noone, function() /*=>*/ { return findPanel("Panel_Palette_Mixer") != noone; } ),
|
||||
]);
|
||||
} ).setIsShelf(),
|
||||
|
||||
menuItem(__txt("Histogram"), function() { panelAdd("Panel_Preview_Histogram", true) }, noone, noone, function() { return findPanel("Panel_Preview_Histogram") != noone; } ),
|
||||
menuItemAction(__txt("Histogram"), call_panel_Preview_Histogram, noone, function() /*=>*/ { return findPanel("Panel_Preview_Histogram") != noone; } ),
|
||||
]],
|
||||
|
||||
[ __txt("Help"), menu_help ],
|
||||
];
|
||||
#endregion
|
||||
|
||||
if(TESTING) { #region
|
||||
if(TESTING) {
|
||||
array_push(menus, [ __txt("Dev"), [
|
||||
menuItem(__txtx("panel_debug_console", "Console"), function() /*=>*/ { panelAdd("Panel_Console", true) }, noone, ["", "Console Panel"]),
|
||||
menuItem(__txtx("panel_debug_overlay", "Debug overlay"), function() /*=>*/ { show_debug_overlay(true); }),
|
||||
menuItem(__txtx("panel_menu_tester", "Tester"), function() /*=>*/ { var dia = dialogPanelCall(new Panel_Test()); dia.destroy_on_click_out = false; }),
|
||||
menuItemAction(__txtx("panel_debug_console", "Console"), call_panel_Console),
|
||||
menuItemAction(__txtx("panel_debug_overlay", "Debug overlay"), function() /*=>*/ { show_debug_overlay(true); }),
|
||||
menuItemAction(__txtx("panel_menu_tester", "Tester"), function() /*=>*/ { var dia = dialogPanelCall(new Panel_Test()); dia.destroy_on_click_out = false; }),
|
||||
-1,
|
||||
|
||||
menuItem(__txtx("panel_menu_test_load_all", "Load all current collections"), function() /*=>*/ { __test_load_current_collections(); }),
|
||||
menuItem(__txtx("panel_menu_test_update_all", "Update all current collections"), function() /*=>*/ { __test_update_current_collections(); }),
|
||||
menuItem(__txtx("panel_menu_test_add_meta", "Add metadata to current collections"), function() /*=>*/ { __test_metadata_current_collections(); }),
|
||||
menuItem(__txtx("panel_menu_test_update_sam", "Update sample projects"), function() /*=>*/ { __test_update_sample_projects(); }),
|
||||
menuItemAction(__txtx("panel_menu_test_load_all", "Load all current collections"), function() /*=>*/ { __test_load_current_collections(); }),
|
||||
menuItemAction(__txtx("panel_menu_test_update_all", "Update all current collections"), function() /*=>*/ { __test_update_current_collections(); }),
|
||||
menuItemAction(__txtx("panel_menu_test_add_meta", "Add metadata to current collections"), function() /*=>*/ { __test_metadata_current_collections(); }),
|
||||
menuItemAction(__txtx("panel_menu_test_update_sam", "Update sample projects"), function() /*=>*/ { __test_update_sample_projects(); }),
|
||||
-1,
|
||||
menuItem(__txtx("panel_menu_test_load_nodes", "Load all nodes"), function() /*=>*/ { __test_load_all_nodes(); }),
|
||||
menuItem(__txtx("panel_menu_test_gen_guide", "Generate node guide"), function() /*=>*/ { var dia = dialogPanelCall(new Panel_Node_Data_Gen()); dia.destroy_on_click_out = false; }),
|
||||
menuItem(__txtx("panel_menu_test_gen_theme", "Generate theme object"), function() /*=>*/ { __test_generate_theme(); }),
|
||||
menuItemAction(__txtx("panel_menu_test_load_nodes", "Load all nodes"), function() /*=>*/ { __test_load_all_nodes(); }),
|
||||
menuItemAction(__txtx("panel_menu_test_gen_guide", "Generate node guide"), function() /*=>*/ { var dia = dialogPanelCall(new Panel_Node_Data_Gen()); dia.destroy_on_click_out = false; }),
|
||||
menuItemAction(__txtx("panel_menu_test_gen_theme", "Generate theme object"), function() /*=>*/ { __test_generate_theme(); }),
|
||||
-1,
|
||||
menuItem(__txtx("panel_menu_test_warning", "Display Warning"), function() /*=>*/ { noti_warning("Error message") }),
|
||||
menuItem(__txtx("panel_menu_test_error", "Display Error"), function() /*=>*/ { noti_error("Error message") }),
|
||||
menuItem(__txtx("panel_menu_test_crash", "Force crash"), function() /*=>*/ { print(1 + "a"); }),
|
||||
menuItemAction(__txtx("panel_menu_test_warning", "Display Warning"), function() /*=>*/ { noti_warning("Error message") }),
|
||||
menuItemAction(__txtx("panel_menu_test_error", "Display Error"), function() /*=>*/ { noti_error("Error message") }),
|
||||
menuItemAction(__txtx("panel_menu_test_crash", "Force crash"), function() /*=>*/ { print(1 + "a"); }),
|
||||
-1,
|
||||
menuItem(__txt("Misc."), function(_dat) {
|
||||
return submenuCall(_dat, [
|
||||
menuItem(__txtx("panel_menu_node_credit", "Node credit dialog"), function() /*=>*/ { var dia = dialogPanelCall(new Panel_Node_Cost()); }),
|
||||
]);
|
||||
menuItemAction(__txt("Misc."), function(_dat) {
|
||||
return submenuCall(_dat, [ menuItemAction(__txtx("panel_menu_node_credit", "Node credit dialog"), function() /*=>*/ { var dia = dialogPanelCall(new Panel_Node_Cost()); }), ]);
|
||||
} ).setIsShelf(),
|
||||
]]);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
menu_help_steam = array_clone(menu_help);
|
||||
array_push(menu_help_steam, -1,
|
||||
menuItem(__txtx("panel_menu_steam_workshop", "Steam Workshop"), function() /*=>*/ { steam_activate_overlay_browser("https://steamcommunity.com/app/2299510/workshop/"); }, THEME.steam) );
|
||||
menuItemAction(__txtx("panel_menu_steam_workshop", "Steam Workshop"), function() /*=>*/ { steam_activate_overlay_browser("https://steamcommunity.com/app/2299510/workshop/"); }, THEME.steam) );
|
||||
|
||||
function onFocusBegin() { PANEL_MENU = self; }
|
||||
|
||||
function setNotiIcon(icon) { #region
|
||||
function setNotiIcon(icon) {
|
||||
noti_icon = icon;
|
||||
noti_icon_time = 90;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function undoUpdate() { #region
|
||||
function undoUpdate() {
|
||||
var txt;
|
||||
|
||||
if(ds_stack_empty(UNDO_STACK)) {
|
||||
|
@ -302,9 +267,9 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
|
||||
menuItem_redo.active = !ds_stack_empty(REDO_STACK);
|
||||
menuItem_redo.name = txt;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function drawContent(panel) { #region
|
||||
function drawContent(panel) {
|
||||
var _right = PREFERENCES.panel_menu_right_control;
|
||||
var _draggable = pFOCUS;
|
||||
|
||||
|
@ -707,7 +672,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
for(var i = 0; i < min(10, ds_list_size(RECENT_FILES)); i++) {
|
||||
var _rec = RECENT_FILES[| i];
|
||||
var _dat = RECENT_FILE_DATA[| i];
|
||||
array_push(arr, menuItem(_rec, function(_dat) { LOAD_PATH(_dat.name); }));
|
||||
array_push(arr, menuItemAction(_rec, function(_dat) { LOAD_PATH(_dat.name); }));
|
||||
array_push(tip, [ method(_dat, _dat.getThumbnail), VALUE_TYPE.surface ]);
|
||||
}
|
||||
|
||||
|
@ -755,5 +720,5 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
if(mouse_press(mb_left, _draggable))
|
||||
winMan_initDrag(0b10000);
|
||||
#endregion
|
||||
} #endregion
|
||||
}
|
||||
}
|
|
@ -11,24 +11,24 @@ function Panel_Notification() : PanelContent() constructor {
|
|||
showHeader = false;
|
||||
|
||||
rightClickMenu = [
|
||||
menuItem(__txtx("noti_clear_log", "Clear log messages"), function() {
|
||||
menuItemAction(__txtx("noti_clear_log", "Clear log messages"), function() {
|
||||
for( var i = ds_list_size(STATUSES) - 1; i >= 0; i-- ) {
|
||||
if(STATUSES[| i].type == NOTI_TYPE.log)
|
||||
ds_list_delete(STATUSES, i);
|
||||
}
|
||||
}),
|
||||
menuItem(__txtx("noti_clear_warn", "Clear warning messages"), function() {
|
||||
menuItemAction(__txtx("noti_clear_warn", "Clear warning messages"), function() {
|
||||
for( var i = ds_list_size(STATUSES) - 1; i >= 0; i-- ) {
|
||||
if(STATUSES[| i].type == NOTI_TYPE.warning)
|
||||
ds_list_delete(STATUSES, i);
|
||||
}
|
||||
}),
|
||||
-1,
|
||||
menuItem(__txtx("noti_clear_all", "Clear all notifications"), function() {
|
||||
menuItemAction(__txtx("noti_clear_all", "Clear all notifications"), function() {
|
||||
ds_list_clear(STATUSES);
|
||||
}),
|
||||
-1,
|
||||
menuItem(__txtx("noti_open_log", "Open log file"), function() {
|
||||
menuItemAction(__txtx("noti_open_log", "Open log file"), function() {
|
||||
shellOpenExplorer(DIRECTORY + "log/log.txt");
|
||||
}),
|
||||
];
|
||||
|
@ -77,10 +77,10 @@ function Panel_Notification() : PanelContent() constructor {
|
|||
|
||||
if(mouse_press(mb_right, pFOCUS)) {
|
||||
var dia = menuCall("notification_menu",,, [
|
||||
menuItem(__txtx("noti_copy_message", "Copy notification message"), function() {
|
||||
menuItemAction(__txtx("noti_copy_message", "Copy notification message"), function() {
|
||||
clipboard_set_text(o_dialog_menubox.noti.txt);
|
||||
}),
|
||||
menuItem(__txtx("noti_delete_message", "Delete notification"), function() {
|
||||
menuItemAction(__txtx("noti_delete_message", "Delete notification"), function() {
|
||||
ds_list_remove(STATUSES, o_dialog_menubox.noti);
|
||||
}),
|
||||
],, noti);
|
||||
|
|
|
@ -14,17 +14,17 @@ function Panel_Palette() : PanelContent() constructor {
|
|||
__save_palette_data = [];
|
||||
view_label = true;
|
||||
|
||||
menu_refresh = menuItem(__txt("Refresh"), function() { __initPalette(); });
|
||||
menu_add = menuItem(__txt("Add"), function(_dat) {
|
||||
menu_refresh = menuItemAction(__txt("Refresh"), function() { __initPalette(); });
|
||||
menu_add = menuItemAction(__txt("Add"), function(_dat) {
|
||||
return submenuCall(_dat, [
|
||||
menuItem(__txt("File..."), function() {
|
||||
menuItemAction(__txt("File..."), function() {
|
||||
var _p = get_open_filename("hex|*.hex|gpl|*.gpl|Image|.png", "palette");
|
||||
if(!file_exists_empty(_p)) return;
|
||||
|
||||
file_copy(_p, $"{DIRECTORY}Palettes/{filename_name(_p)}");
|
||||
__initPalette();
|
||||
}),
|
||||
menuItem(__txt("Lospec..."), function() {
|
||||
menuItemAction(__txt("Lospec..."), function() {
|
||||
fileNameCall("", function(txt) {
|
||||
if(txt == "") return;
|
||||
txt = string_lower(txt);
|
||||
|
@ -37,8 +37,8 @@ function Panel_Palette() : PanelContent() constructor {
|
|||
]);
|
||||
}).setIsShelf();
|
||||
|
||||
menu_stretch = menuItem(__txt("Stretch"), function() { PREFERENCES.palette_stretch = !PREFERENCES.palette_stretch; }, noone, noone, function() /*=>*/ {return PREFERENCES.palette_stretch});
|
||||
menu_mini = menuItem(__txt("Label"), function() { view_label = !view_label; }, noone, noone, function() /*=>*/ {return view_label});
|
||||
menu_stretch = menuItemAction(__txt("Stretch"), function() { PREFERENCES.palette_stretch = !PREFERENCES.palette_stretch; }, noone, noone, function() /*=>*/ {return PREFERENCES.palette_stretch});
|
||||
menu_mini = menuItemAction(__txt("Label"), function() { view_label = !view_label; }, noone, noone, function() /*=>*/ {return view_label});
|
||||
|
||||
function onResize() {
|
||||
sp_palettes.resize(w - ui(padding + padding), h - ui(padding + padding));
|
||||
|
@ -164,10 +164,10 @@ function Panel_Palette() : PanelContent() constructor {
|
|||
menu_add,
|
||||
menu_refresh,
|
||||
-1,
|
||||
menuItem(__txtx("palette_editor_set_default", "Set as default"), function() {
|
||||
menuItemAction(__txtx("palette_editor_set_default", "Set as default"), function() {
|
||||
PROJECT.setPalette(array_clone(hovering.palette));
|
||||
}),
|
||||
menuItem(__txtx("palette_editor_delete", "Delete palette"), function() {
|
||||
menuItemAction(__txtx("palette_editor_delete", "Delete palette"), function() {
|
||||
file_delete(hovering.path);
|
||||
__initPalette();
|
||||
}),
|
||||
|
|
|
@ -188,7 +188,7 @@ function Panel_Palette_Mixer() : PanelContent() constructor {
|
|||
var _b = buttonInstant(THEME.button_hide, _bx, _by, _bs, pal_h, [ mx, my ], pFOCUS, pHOVER, "", THEME.hamburger_s);
|
||||
if(_b == 2) {
|
||||
menuCall("",,, [
|
||||
menuItem("Save palette as...", function() {
|
||||
menuItemAction("Save palette as...", function() {
|
||||
var _path = get_save_filename_pxc("Hex paleete|*.hex", "Palette");
|
||||
if(_path != "") {
|
||||
var _str = palette_string_hex(palette, false);
|
||||
|
@ -392,7 +392,7 @@ function Panel_Palette_Mixer() : PanelContent() constructor {
|
|||
conn_menu_ctx = [ blnd_hovering ];
|
||||
|
||||
menuCall(,,, [
|
||||
menuItem("Delete Blend point", function() { array_delete(palette_data.blends, conn_menu_ctx[0], 1); } ),
|
||||
menuItemAction("Delete Blend point", function() { array_delete(palette_data.blends, conn_menu_ctx[0], 1); } ),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -443,7 +443,7 @@ function Panel_Palette_Mixer() : PanelContent() constructor {
|
|||
conn_menu_ctx = [ conn[0], conn[1], _con_rat ];
|
||||
|
||||
menuCall(,,, [
|
||||
menuItem("New Blend point", function() { array_push(palette_data.blends, { from : conn_menu_ctx[0], to : conn_menu_ctx[1], amount : conn_menu_ctx[2] }) } ),
|
||||
menuItemAction("New Blend point", function() { array_push(palette_data.blends, { from : conn_menu_ctx[0], to : conn_menu_ctx[1], amount : conn_menu_ctx[2] }) } ),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -467,18 +467,18 @@ function Panel_Palette_Mixer() : PanelContent() constructor {
|
|||
|
||||
if(mouse_press(mb_right)) {
|
||||
menuCall(,,, [
|
||||
menuItem("Center view", function() { centerView(); } ),
|
||||
menuItemAction("Center view", function() { centerView(); } ),
|
||||
-1,
|
||||
menuItem("Save mixed...", function() {
|
||||
menuItemAction("Save mixed...", function() {
|
||||
var _path = get_save_filename_pxc("JSON|*.json", "New mixed");
|
||||
if(_path != "") save_palette_mixer(palette_data, _path);
|
||||
}, THEME.save),
|
||||
menuItem("Load mixed...", function() {
|
||||
menuItemAction("Load mixed...", function() {
|
||||
var _path = get_open_filename_pxc("JSON|*.json", "");
|
||||
if(_path != "") palette_data = load_palette_mixer(_path);
|
||||
}, THEME.noti_icon_file_load),
|
||||
-1,
|
||||
menuItem("Clear palette", function() { palette_data = { nodes: [], connections: [], blends: [], } }, THEME.cross),
|
||||
menuItemAction("Clear palette", function() { palette_data = { nodes: [], connections: [], blends: [], } }, THEME.cross),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
#macro CHECK_PANEL_PRESETS if(!is_instanceof(FOCUS_CONTENT, Panel_Presets)) return;
|
||||
|
||||
function panel_preset_replace() { CHECK_PANEL_PRESETS CALL("panel_preset_replace"); FOCUS_CONTENT.replacePreset(FOCUS_CONTENT.selecting_preset.path); }
|
||||
function panel_preset_delete() { CHECK_PANEL_PRESETS CALL("panel_preset_delete"); file_delete(FOCUS_CONTENT.selecting_preset.path); FOCUS_CONTENT.__initPresets(); }
|
||||
function panel_preset_reset() { CHECK_PANEL_PRESETS CALL("panel_preset_reset"); FOCUS_CONTENT.newPresetFromNode("_default"); }
|
||||
|
||||
function Panel_Presets(_node) : PanelContent() constructor {
|
||||
title = __txt("Presets");
|
||||
padding = 8;
|
||||
|
@ -23,13 +29,17 @@ function Panel_Presets(_node) : PanelContent() constructor {
|
|||
directory_verify($"{DIRECTORY}Presets/{instanceof(node)}/");
|
||||
__initPresets();
|
||||
|
||||
registerFunction("Presets", "Replace", "", MOD_KEY.none, panel_preset_replace);
|
||||
registerFunction("Presets", "Delete", "", MOD_KEY.none, panel_preset_delete);
|
||||
registerFunction("Presets", "Reset To Default", "", MOD_KEY.none, panel_preset_reset);
|
||||
|
||||
context_menu = [
|
||||
menuItem(__txt("Replace preset"), function() { replacePreset(selecting_preset.path); }),
|
||||
menuItem(__txt("Delete"), function() { file_delete(selecting_preset.path); __initPresets(); }, THEME.cross),
|
||||
menuItemAction(__txt("Replace preset"), panel_preset_replace),
|
||||
menuItemAction(__txt("Delete"), panel_preset_delete, THEME.cross),
|
||||
];
|
||||
|
||||
context_def = [
|
||||
menuItem(__txt("Set to default"), function() { newPresetFromNode("_default"); }),
|
||||
menuItemAction(__txt("Set to default"), panel_preset_reset),
|
||||
];
|
||||
|
||||
thumbnail_mask = surface_create(1, 1);
|
||||
|
|
|
@ -1,19 +1,44 @@
|
|||
#region funtion calls
|
||||
function __fnInit_Preview() {
|
||||
__registerFunction("preview_focus_content", panel_preview_focus_content);
|
||||
__registerFunction("preview_save_current_frame", panel_preview_save_current_frame);
|
||||
__registerFunction("preview_saveCurrentFrameToFocus", panel_preview_saveCurrentFrameToFocus);
|
||||
__registerFunction("preview_save_all_current_frame", panel_preview_save_all_current_frame);
|
||||
__registerFunction("preview_preview_window", panel_preview_preview_window);
|
||||
__registerFunction("preview_toggle_grid", panel_preview_toggle_grid);
|
||||
registerFunction("Preview", "Focus content", "F", MOD_KEY.none, panel_preview_focus_content);
|
||||
registerFunction("Preview", "Save current frame", "S", MOD_KEY.shift, panel_preview_save_current_frame);
|
||||
registerFunction("Preview", "Save to focused file", "", MOD_KEY.none, panel_preview_saveCurrentFrameToFocus);
|
||||
registerFunction("Preview", "Save all current frame", "", MOD_KEY.none, panel_preview_save_all_current_frame);
|
||||
registerFunction("Preview", "Preview window", "P", MOD_KEY.ctrl, panel_preview_preview_window);
|
||||
registerFunction("Preview", "Toggle grid", "G", MOD_KEY.ctrl, panel_preview_toggle_grid);
|
||||
|
||||
__registerFunction("preview_pan", panel_preview_pan);
|
||||
__registerFunction("preview_zoom", panel_preview_zoom);
|
||||
registerFunction("Preview", "Pan", "", MOD_KEY.ctrl, panel_preview_pan);
|
||||
registerFunction("Preview", "Zoom", "", MOD_KEY.alt | MOD_KEY.ctrl, panel_preview_zoom);
|
||||
|
||||
registerFunction("Preview", "3D Front view", vk_numpad1, MOD_KEY.none, panel_preview_3d_view_front);
|
||||
registerFunction("Preview", "3D Back view", vk_numpad1, MOD_KEY.alt, panel_preview_3d_view_back);
|
||||
registerFunction("Preview", "3D Right view ", vk_numpad3, MOD_KEY.none, panel_preview_3d_view_right);
|
||||
registerFunction("Preview", "3D Left view ", vk_numpad3, MOD_KEY.alt, panel_preview_3d_view_left);
|
||||
registerFunction("Preview", "3D Top view", vk_numpad7, MOD_KEY.none, panel_preview_3d_view_top);
|
||||
registerFunction("Preview", "3D Bottom view", vk_numpad7, MOD_KEY.alt, panel_preview_3d_view_bottom);
|
||||
|
||||
registerFunction("Preview", "Scale x1", "1", MOD_KEY.none, function() /*=>*/ { panel_preview_set_zoom(1); });
|
||||
registerFunction("Preview", "Scale x2", "2", MOD_KEY.none, function() /*=>*/ { panel_preview_set_zoom(2); });
|
||||
registerFunction("Preview", "Scale x4", "3", MOD_KEY.none, function() /*=>*/ { panel_preview_set_zoom(4); });
|
||||
registerFunction("Preview", "Scale x8", "4", MOD_KEY.none, function() /*=>*/ { panel_preview_set_zoom(8); });
|
||||
|
||||
registerFunction("Preview", "Set Tile Off", "", MOD_KEY.none, panel_preview_set_tile_off);
|
||||
registerFunction("Preview", "Set Tile Horizontal", "", MOD_KEY.none, panel_preview_set_tile_horizontal);
|
||||
registerFunction("Preview", "Set Tile Vertical", "", MOD_KEY.none, panel_preview_set_tile_vertical);
|
||||
registerFunction("Preview", "Set Tile Both", "", MOD_KEY.none, panel_preview_set_tile_both);
|
||||
registerFunction("Preview", "Toggle Tile", "", MOD_KEY.none, panel_preview_set_tile_toggle);
|
||||
|
||||
registerFunction("Preview", "New Preview Window", "", MOD_KEY.none, panel_preview_new_preview_window);
|
||||
registerFunction("Preview", "Save Current Frame", "", MOD_KEY.none, panel_preview_saveCurrentFrame);
|
||||
registerFunction("Preview", "Save All Current Frames", "", MOD_KEY.none, panel_preview_saveAllCurrentFrames);
|
||||
registerFunction("Preview", "Copy Current Frame", "", MOD_KEY.none, panel_preview_copyCurrentFrame);
|
||||
registerFunction("Preview", "Copy Color", "", MOD_KEY.none, panel_preview_copy_color);
|
||||
registerFunction("Preview", "Copy Color Hex", "", MOD_KEY.none, panel_preview_copy_color_hex);
|
||||
}
|
||||
|
||||
function panel_preview_focus_content() { CALL("preview_focus_content"); PANEL_PREVIEW.fullView(); }
|
||||
function panel_preview_save_current_frame() { CALL("preview_save_current_frame"); PANEL_PREVIEW.saveCurrentFrame(); }
|
||||
function panel_preview_saveCurrentFrameToFocus() { CALL("preview_saveCurrentFrameToFocus"); PANEL_PREVIEW.saveCurrentFrameToFocus(); }
|
||||
function panel_preview_saveCurrentFrameToFocus() { CALL("preview_save_to_focused_file"); PANEL_PREVIEW.saveCurrentFrameToFocus(); }
|
||||
function panel_preview_save_all_current_frame() { CALL("preview_save_all_current_frame"); PANEL_PREVIEW.saveAllCurrentFrames(); }
|
||||
function panel_preview_preview_window() { CALL("preview_preview_window"); PANEL_PREVIEW.create_preview_window(PANEL_PREVIEW.getNodePreview()); }
|
||||
function panel_preview_toggle_grid() { CALL("preview_toggle_grid"); PROJECT.previewGrid.show = !PROJECT.previewGrid.show; }
|
||||
|
@ -21,14 +46,28 @@
|
|||
function panel_preview_pan() { CALL("preview_pan"); PANEL_PREVIEW.canvas_dragging_key = true; }
|
||||
function panel_preview_zoom() { CALL("preview_zoom"); PANEL_PREVIEW.canvas_zooming_key = true; }
|
||||
|
||||
function panel_preview_3d_view_front() { CALL("preview_3d_view_front"); PANEL_PREVIEW.d3_view_action_front(); }
|
||||
function panel_preview_3d_view_back() { CALL("preview_3d_view_back"); PANEL_PREVIEW.d3_view_action_back(); }
|
||||
function panel_preview_3d_view_right() { CALL("preview_3d_view_right"); PANEL_PREVIEW.d3_view_action_right(); }
|
||||
function panel_preview_3d_view_left() { CALL("preview_3d_view_left"); PANEL_PREVIEW.d3_view_action_left(); }
|
||||
function panel_preview_3d_view_top() { CALL("preview_3d_view_top"); PANEL_PREVIEW.d3_view_action_top(); }
|
||||
function panel_preview_3d_view_bottom() { CALL("preview_3d_view_bottom"); PANEL_PREVIEW.d3_view_action_bottom(); }
|
||||
function panel_preview_3d_view_front() { CALL("preview_3d_front_view"); PANEL_PREVIEW.d3_view_action_front(); }
|
||||
function panel_preview_3d_view_back() { CALL("preview_3d_back_view"); PANEL_PREVIEW.d3_view_action_back(); }
|
||||
function panel_preview_3d_view_right() { CALL("preview_3d_right_view"); PANEL_PREVIEW.d3_view_action_right(); }
|
||||
function panel_preview_3d_view_left() { CALL("preview_3d_left_view"); PANEL_PREVIEW.d3_view_action_left(); }
|
||||
function panel_preview_3d_view_top() { CALL("preview_3d_top_view"); PANEL_PREVIEW.d3_view_action_top(); }
|
||||
function panel_preview_3d_view_bottom() { CALL("preview_3d_bottom_view"); PANEL_PREVIEW.d3_view_action_bottom(); }
|
||||
|
||||
function panel_preview_set_zoom(zoom) { CALL("preview_preview_set_zoom"); PANEL_PREVIEW.fullView(zoom); }
|
||||
|
||||
function panel_preview_set_tile_off() { CALL("preview_set_tile_off"); PANEL_PREVIEW.set_tile_off(); }
|
||||
function panel_preview_set_tile_horizontal() { CALL("preview_set_tile_horizontal"); PANEL_PREVIEW.set_tile_horizontal(); }
|
||||
function panel_preview_set_tile_vertical() { CALL("preview_set_tile_vertical"); PANEL_PREVIEW.set_tile_vertical(); }
|
||||
function panel_preview_set_tile_both() { CALL("preview_set_tile_both"); PANEL_PREVIEW.set_tile_both(); }
|
||||
function panel_preview_set_tile_toggle() { CALL("preview_set_tile_toggle"); PANEL_PREVIEW.set_tile_toggle(); }
|
||||
|
||||
function panel_preview_new_preview_window() { CALL("preview_new_preview_window"); PANEL_PREVIEW.new_preview_window(); }
|
||||
function panel_preview_saveCurrentFrame() { CALL("preview_saveCurrentFrame"); PANEL_PREVIEW.saveCurrentFrame(); }
|
||||
function panel_preview_saveAllCurrentFrames() { CALL("preview_saveAllCurrentFrames"); PANEL_PREVIEW.saveAllCurrentFrames(); }
|
||||
function panel_preview_copyCurrentFrame() { CALL("preview_copyCurrentFrame"); PANEL_PREVIEW.copyCurrentFrame(); }
|
||||
function panel_preview_copy_color() { CALL("preview_copy_color"); PANEL_PREVIEW.copy_color(); }
|
||||
function panel_preview_copy_color_hex() { CALL("preview_copy_color_hex"); PANEL_PREVIEW.copy_color_hex(); }
|
||||
|
||||
#endregion
|
||||
|
||||
function Panel_Preview() : PanelContent() constructor {
|
||||
|
@ -221,31 +260,17 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
|
||||
tb_framerate = new textBox(TEXTBOX_INPUT.number, function(val) { preview_rate = real(val); });
|
||||
|
||||
#region ++++ hotkey ++++
|
||||
addHotkey("Preview", "Focus content", "F", MOD_KEY.none, panel_preview_focus_content);
|
||||
addHotkey("Preview", "Save current frame", "S", MOD_KEY.shift, panel_preview_save_current_frame);
|
||||
addHotkey("Preview", "Save to focused file", "", MOD_KEY.none, panel_preview_saveCurrentFrameToFocus);
|
||||
addHotkey("Preview", "Save all current frame", "", MOD_KEY.none, panel_preview_save_all_current_frame);
|
||||
addHotkey("Preview", "Preview window", "P", MOD_KEY.ctrl, panel_preview_preview_window);
|
||||
addHotkey("Preview", "Toggle grid", "G", MOD_KEY.ctrl, panel_preview_toggle_grid);
|
||||
|
||||
addHotkey("Preview", "Pan", "", MOD_KEY.ctrl, panel_preview_pan);
|
||||
addHotkey("Preview", "Zoom", "", MOD_KEY.alt | MOD_KEY.ctrl, panel_preview_zoom);
|
||||
|
||||
addHotkey("Preview", "3D Front view", vk_numpad1, MOD_KEY.none, panel_preview_3d_view_front);
|
||||
addHotkey("Preview", "3D Back view", vk_numpad1, MOD_KEY.alt, panel_preview_3d_view_back);
|
||||
addHotkey("Preview", "3D Right view ", vk_numpad3, MOD_KEY.none, panel_preview_3d_view_right);
|
||||
addHotkey("Preview", "3D Left view ", vk_numpad3, MOD_KEY.alt, panel_preview_3d_view_left);
|
||||
addHotkey("Preview", "3D Top view", vk_numpad7, MOD_KEY.none, panel_preview_3d_view_top);
|
||||
addHotkey("Preview", "3D Bottom view", vk_numpad7, MOD_KEY.alt, panel_preview_3d_view_bottom);
|
||||
|
||||
addHotkey("Preview", "Scale x1", "1", MOD_KEY.none, function() /*=>*/ { panel_preview_set_zoom(1); });
|
||||
addHotkey("Preview", "Scale x2", "2", MOD_KEY.none, function() /*=>*/ { panel_preview_set_zoom(2); });
|
||||
addHotkey("Preview", "Scale x4", "3", MOD_KEY.none, function() /*=>*/ { panel_preview_set_zoom(4); });
|
||||
addHotkey("Preview", "Scale x8", "4", MOD_KEY.none, function() /*=>*/ { panel_preview_set_zoom(8); });
|
||||
#endregion
|
||||
|
||||
#region ++++ toolbars & actions ++++
|
||||
function set_tile_off() { tileMode = 0; }
|
||||
function set_tile_horizontal() { tileMode = 1; }
|
||||
function set_tile_vertical() { tileMode = 2; }
|
||||
function set_tile_both() { tileMode = 3; }
|
||||
function set_tile_toggle() { tileMode = (tileMode + 1) % 4; }
|
||||
|
||||
function new_preview_window() { create_preview_window(getNodePreview()); }
|
||||
function copy_color() { clipboard_set_text(sample_color); }
|
||||
function copy_color_hex() { clipboard_set_text(color_get_hex(sample_color)); }
|
||||
|
||||
topbar_height = ui(32);
|
||||
toolbar_height = ui(40);
|
||||
toolbars = [
|
||||
|
@ -283,10 +308,10 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
},
|
||||
function(data) {
|
||||
menuCall("preview_tile_menu", data.x + ui(28), data.y + ui(28), [
|
||||
menuItem(__txtx("panel_preview_tile_off", "Tile off"), function() { tileMode = 0; }),
|
||||
menuItem(__txtx("panel_preview_tile_horizontal", "Tile horizontal"), function() { tileMode = 1; }),
|
||||
menuItem(__txtx("panel_preview_tile_vertical", "Tile vertical"), function() { tileMode = 2; }),
|
||||
menuItem(__txtx("panel_preview_tile_both", "Tile both"), function() { tileMode = 3; }),
|
||||
menuItemAction(__txtx("panel_preview_tile_off", "Tile off"), panel_preview_set_tile_off),
|
||||
menuItemAction(__txtx("panel_preview_tile_horizontal", "Tile horizontal"), panel_preview_set_tile_horizontal),
|
||||
menuItemAction(__txtx("panel_preview_tile_vertical", "Tile vertical"), panel_preview_set_tile_vertical),
|
||||
menuItemAction(__txtx("panel_preview_tile_both", "Tile both"), panel_preview_set_tile_both),
|
||||
]);
|
||||
}
|
||||
],
|
||||
|
@ -2099,14 +2124,14 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
|
||||
if(mouse_on_preview && mouse_press(mb_right, pFOCUS) && !key_mod_press(SHIFT)) {
|
||||
menuCall("preview_context_menu",,, [
|
||||
menuItem(__txtx("panel_graph_preview_window", "Send to preview window"), function() { create_preview_window(getNodePreview()); }, noone, ["Preview", "Preview window"]),
|
||||
menuItemAction(__txtx("panel_graph_preview_window", "Send to preview window"), panel_preview_new_preview_window),
|
||||
-1,
|
||||
menuItem(__txtx("panel_preview_save", "Save current preview as") + "...", function() { saveCurrentFrame(); }, noone, ["Preview", "Save current frame"]),
|
||||
menuItem(__txtx("panel_preview_save_all", "Save all current previews as") + "...", function() { saveAllCurrentFrames(); }, noone, ["Preview", "Save all current frame"]),
|
||||
menuItemAction(__txtx("panel_preview_save", "Save current preview as") + "...", panel_preview_saveCurrentFrame),
|
||||
menuItemAction(__txtx("panel_preview_save_all", "Save all current previews as") + "...", panel_preview_saveAllCurrentFrames),
|
||||
-1,
|
||||
menuItem($"{__txtx("panel_preview_copy_image", "Copy image")}", function() { copyCurrentFrame(); }, THEME.copy),
|
||||
menuItem($"{__txtx("panel_preview_copy_color", "Copy color")} [{sample_color}]", function() { clipboard_set_text(sample_color); }),
|
||||
menuItem($"{__txtx("panel_preview_copy_hex", "Copy hex")} [{color_get_hex(sample_color)}]", function() { clipboard_set_text(color_get_hex(sample_color)); }),
|
||||
menuItemAction($"{__txtx("panel_preview_copy_image", "Copy image")}", panel_preview_copyCurrentFrame, THEME.copy),
|
||||
menuItemAction($"{__txtx("panel_preview_copy_color", "Copy color")} [{sample_color}]", panel_preview_copy_color),
|
||||
menuItemAction($"{__txtx("panel_preview_copy_hex", "Copy hex")} [{color_get_hex(sample_color)}]", panel_preview_copy_color_hex),
|
||||
],, getNodePreview());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
#macro CHECK_PANEL_PREVIEW_WINDOW if(!is_instanceof(FOCUS_CONTENT, Panel_Preview_Window)) return;
|
||||
|
||||
function panel_preview_window_reset() { CHECK_PANEL_PREVIEW_WINDOW CALL("preview_window_reset"); FOCUS_CONTENT.reset(); }
|
||||
function panel_preview_window_inspect() { CHECK_PANEL_PREVIEW_WINDOW CALL("preview_window_inspect"); PANEL_GRAPH.nodes_selecting = [ FOCUS_CONTENT.node_target ]; }
|
||||
function panel_preview_window_preview() { CHECK_PANEL_PREVIEW_WINDOW CALL("preview_window_preview"); PANEL_PREVIEW.setNodePreview(FOCUS_CONTENT.node_target); }
|
||||
|
||||
function Panel_Preview_Window() : PanelContent() constructor {
|
||||
min_w = ui(64);
|
||||
min_h = ui(64);
|
||||
|
@ -48,11 +54,15 @@ function Panel_Preview_Window() : PanelContent() constructor {
|
|||
content_surface = noone;
|
||||
surfaceCheck();
|
||||
|
||||
registerFunction("Preview Window", "Reset view", "", MOD_KEY.none, panel_preview_window_reset);
|
||||
registerFunction("Preview Window", "Inspect", "", MOD_KEY.none, panel_preview_window_inspect);
|
||||
registerFunction("Preview Window", "Preview", "", MOD_KEY.none, panel_preview_window_preview);
|
||||
|
||||
menu = [
|
||||
menuItem(__txtx("reset_view", "Reset view"), function() { reset(); }),
|
||||
menuItemAction(__txtx("reset_view", "Reset view"), panel_preview_window_reset),
|
||||
-1,
|
||||
menuItem(__txt("Inspect"), function() { PANEL_GRAPH.nodes_selecting = [ node_target ]; }),
|
||||
menuItem(__txtx("panel_graph_send_to_preview", "Send to preview"), function() { PANEL_PREVIEW.setNodePreview(node_target); }),
|
||||
menuItemAction(__txt("Inspect"), panel_preview_window_inspect),
|
||||
menuItemAction(__txtx("panel_graph_send_to_preview", "Send to preview"), panel_preview_window_preview),
|
||||
-1,
|
||||
]
|
||||
|
||||
|
@ -151,7 +161,7 @@ function Panel_Preview_Window() : PanelContent() constructor {
|
|||
var o = node_target.outputs[i];
|
||||
if(o.type != VALUE_TYPE.surface) continue;
|
||||
|
||||
array_push(_menu, menuItem(o.name, function(_dat) { changeChannel(_dat.index); }));
|
||||
array_push(_menu, menuItemAction(o.name, function(_dat) { changeChannel(_dat.index); }));
|
||||
}
|
||||
menuCall("preview_window_menu",,, _menu,, node_target);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
#macro CHECK_PANEL_WORKSPACE if(!is_instanceof(FOCUS_CONTENT, Panel_Workspace)) return;
|
||||
|
||||
function panel_workspace_apply() { CHECK_PANEL_WORKSPACE CALL("panel_workspace_apply"); FOCUS_CONTENT.apply_space(); }
|
||||
function panel_workspace_replace() { CHECK_PANEL_WORKSPACE CALL("panel_workspace_replace"); FOCUS_CONTENT.replace_space(); }
|
||||
function panel_workspace_delete() { CHECK_PANEL_WORKSPACE CALL("panel_workspace_delete"); FOCUS_CONTENT.delete_space(); }
|
||||
|
||||
function Panel_Workspace() : PanelContent() constructor {
|
||||
title = "Workspace";
|
||||
workspaces = [];
|
||||
|
@ -11,6 +17,29 @@ function Panel_Workspace() : PanelContent() constructor {
|
|||
|
||||
layout_selecting = "";
|
||||
|
||||
registerFunction("Workspace", "Apply", "", MOD_KEY.none, panel_workspace_apply);
|
||||
registerFunction("Workspace", "Replace", "", MOD_KEY.none, panel_workspace_replace);
|
||||
registerFunction("Workspace", "Delete", "", MOD_KEY.none, panel_workspace_delete);
|
||||
|
||||
function apply_space() {
|
||||
if(layout_selecting == "") return;
|
||||
PREFERENCES.panel_layout_file = layout_selecting;
|
||||
PREF_SAVE();
|
||||
setPanel();
|
||||
}
|
||||
|
||||
function replace_space() {
|
||||
if(layout_selecting == "") return;
|
||||
var cont = panelSerialize();
|
||||
json_save_struct(DIRECTORY + "layouts/" + layout_selecting + ".json", cont);
|
||||
}
|
||||
|
||||
function delete_space() {
|
||||
if(layout_selecting == "") return;
|
||||
file_delete(DIRECTORY + "layouts/" + layout_selecting + ".json");
|
||||
refreshContent();
|
||||
}
|
||||
|
||||
function refreshContent() {
|
||||
workspaces = [];
|
||||
|
||||
|
@ -20,8 +49,8 @@ function Panel_Workspace() : PanelContent() constructor {
|
|||
array_push(workspaces, filename_name_only(f));
|
||||
f = file_find_next();
|
||||
}
|
||||
}
|
||||
refreshContent();
|
||||
|
||||
} refreshContent();
|
||||
|
||||
function onFocusBegin() { refreshContent(); }
|
||||
|
||||
|
@ -74,20 +103,9 @@ function Panel_Workspace() : PanelContent() constructor {
|
|||
if(mouse_press(mb_right, pFOCUS)) {
|
||||
layout_selecting = str;
|
||||
menuCall("workspace_menu",,, [
|
||||
menuItem(__txt("Select"), function() {
|
||||
PREFERENCES.panel_layout_file = layout_selecting;
|
||||
PREF_SAVE();
|
||||
setPanel();
|
||||
}),
|
||||
menuItem(__txtx("workspace_replace_current", "Replace with current"), function() {
|
||||
var cont = panelSerialize();
|
||||
json_save_struct(DIRECTORY + "layouts/" + layout_selecting + ".json", cont);
|
||||
|
||||
}),
|
||||
menuItem(__txt("Delete"), function() {
|
||||
file_delete(DIRECTORY + "layouts/" + layout_selecting + ".json");
|
||||
refreshContent();
|
||||
}, THEME.cross),
|
||||
menuItemAction(__txt("Select"), apply_space),
|
||||
menuItemAction(__txtx("workspace_replace_current", "Replace with current"), replace_space),
|
||||
menuItemAction(__txt("Delete"), delete_space, THEME.cross),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ function filename_name_only(name) {
|
|||
return string_replace(name, filename_ext(name), "")
|
||||
}
|
||||
|
||||
function string_to_var(str) { INLINE return string_replace_all(string_lower(str), " ", "_"); }
|
||||
function string_to_var(str) { INLINE return string_replace_all(string_replace_all(string_lower(str), " ", "_"), "/", "_"); }
|
||||
function string_quote(str) { INLINE return $"\"{str}\""; }
|
||||
|
||||
function array_to_string(arr) {
|
||||
|
|
Loading…
Reference in a new issue