command palette group

This commit is contained in:
Tanasart 2024-08-10 20:32:50 +07:00
parent f15b0d9e65
commit 4cc55b3dc3
13 changed files with 462 additions and 379 deletions

View file

@ -6,8 +6,11 @@ event_inherited();
draggable = false;
selecting = 0;
text_pad = ui(8);
item_pad = ui(6);
dialog_w = ui(480);
dialog_h = ui(400);
dialog_h = ui(32) + line_get_height(f_p2, item_pad);
setFocus(self.id);
@ -15,6 +18,27 @@ event_inherited();
keys = variable_struct_get_names(FUNCTIONS);
hk_editing = noone;
edit_block = 0;
search_string = "";
KEYBOARD_STRING = "";
tb_search = new textBox(TEXTBOX_INPUT.text, function(str) {
search_string = string(str);
searchMenu();
});
selecting_hotkey = noone;
tb_search.hide = 2;
tb_search.font = f_p2;
tb_search.align = fa_left;
tb_search.auto_update = true;
tb_search.activate("");
_prex = mouse_mx;
_prey = mouse_my;
keyboard_trigger = false;
function searchMenu() {
data = [];
@ -39,27 +63,14 @@ event_inherited();
array_push(data, ds_priority_delete_max(pr_list));
ds_priority_destroy(pr_list);
var hght = line_get_height(f_p2, item_pad);
var _hh = min(ui(32) + max(1, array_length(data)) * hght , ui(400))
dialog_h = _hh;
sc_content.resize(dialog_w - ui(4), dialog_h - ui(32));
}
search_string = "";
KEYBOARD_STRING = "";
tb_search = new textBox(TEXTBOX_INPUT.text, function(str) {
search_string = string(str);
searchMenu();
});
tb_search.hide = 2;
tb_search.font = f_p2;
tb_search.align = fa_left;
tb_search.auto_update = true;
text_pad = ui(8);
item_pad = ui(6);
_prex = mouse_mx;
_prey = mouse_my;
sc_content = new scrollPane(dialog_w - ui(4), dialog_h - ui(32), function(_y, _m) {
draw_clear_alpha(COLORS.panel_bg_clear, 1);
var hght = line_get_height(f_p2, item_pad);
@ -71,39 +82,44 @@ event_inherited();
draw_rectangle(0, 0, ui(32), dialog_h, false);
var mouse_move = _prex != mouse_mx || _prey != mouse_my;
if(mouse_move) keyboard_trigger = false;
for(var i = 0; i < array_length(data); i++) {
var _menu = data[i];
var _menuItem = _menu.menu;
var _key = _menu.hotkey;
var _mhover = mouse_move && point_in_rectangle(_m[0], _m[1], 0, _ly, _dw, _ly + hght - 1);
if(selecting == i) {
draw_sprite_stretched_ext(THEME.textbox, 3, 0, _ly, dialog_w, hght, COLORS.dialog_menubox_highlight, 1);
if(sc_content.active) {
if(mouse_press(mb_left) || keyboard_check_pressed(vk_enter)) {
if((!keyboard_trigger && mouse_press(mb_left)) || keyboard_check_pressed(vk_enter)) {
_menu.action();
instance_destroy();
}
if(mouse_press(mb_right)) {
selecting_menu = _menuItem;
selecting_hotkey = _key;
var _loadKey = string_to_var($"{_key.context}.{_key.name}");
var context_menu_settings = [
_loadKey,
menuItem("Edit hotkey", function() /*=>*/ {
hk_editing = _key;
keyboard_lastchar = _key.key;
hk_editing = selecting_hotkey;
keyboard_lastchar = selecting_hotkey.key;
tb_search.deactivate();
}),
];
item_selecting = menuCall("", context_menu_settings);
item_selecting = menuCall("command_palette_item", context_menu_settings);
}
}
}
if(sc_content.hover && mouse_move && point_in_rectangle(_m[0], _m[1], 0, _ly, _dw, _ly + hght - 1)) {
if(sc_content.hover && _mhover) {
sc_content.hover_content = true;
selecting = i;
}
@ -118,7 +134,7 @@ event_inherited();
draw_text_add(_tx, _ty, _cnxt);
_tx += string_width(_cnxt);
draw_sprite_ext(THEME.arrow, 0, _tx + ui(8), _ty, 1, 1, 0, COLORS._main_text_sub);
draw_sprite_ext(THEME.arrow, 0, _tx + ui(8), _ty, .75, .75, 0, COLORS._main_text_sub);
_tx += ui(16);
}
@ -162,8 +178,9 @@ event_inherited();
_h += hght;
}
if(sc_content.active) {
if(hk_editing != noone) {
edit_block = 2;
if(keyboard_check_pressed(vk_enter))
hk_editing = noone;
else
@ -172,23 +189,34 @@ event_inherited();
if(keyboard_check_pressed(vk_escape))
hk_editing = noone;
} else {
} else if(sc_content.active) {
if(keyboard_check_pressed(vk_up)) {
keyboard_trigger = true;
selecting--;
if(selecting < 0) selecting = array_length(data) - 1;
}
if(keyboard_check_pressed(vk_down))
if(keyboard_check_pressed(vk_down)) {
keyboard_trigger = true;
selecting = safe_mod(selecting + 1, array_length(data));
}
if(keyboard_check_pressed(vk_escape))
instance_destroy();
}
}
_prex = mouse_mx;
_prey = mouse_my;
return _h;
});
function resetPosition() {
if(!active) return;
dialog_x = xstart - dialog_w / 2;
dialog_y = ystart - ui(480) / 2;
}
#endregion

View file

@ -2,12 +2,12 @@
draw_sprite_stretched(THEME.textbox, 3, dialog_x, dialog_y, dialog_w, dialog_h);
if(hk_editing == noone)
WIDGET_CURRENT = tb_search;
tb_search.setFocusHover(true, true);
tb_search.draw(dialog_x, dialog_y, dialog_w, ui(32), search_string);
tb_search.setFocusHover(sHOVER, sFOCUS);
tb_search.draw(dialog_x + ui(32), dialog_y, dialog_w - ui(32), ui(32), search_string);
tb_search.sprite_index = 0;
draw_sprite_ext(THEME.search, 0, dialog_x + ui(20), dialog_y + ui(16), 1, 1, 0, COLORS._main_icon, 1);
sc_content.setFocusHover(sFOCUS, sHOVER);
sc_content.draw(dialog_x, dialog_y + ui(32));

View file

@ -5,6 +5,7 @@ event_inherited();
destroy_on_click_out = false;
draggable = false;
mouse_init_inside = false;
mouse_init_r_pressed = mouse_click(mb_right);
selecting = -1;
menu_id = "";

View file

@ -2,3 +2,6 @@ event_inherited();
for( var i = 0, n = array_length(children); i < n; i++ )
instance_destroy(children[i]);
if(instance_number(o_dialog_menubox) == 1)
FOCUS = FOCUS_BEFORE;

View file

@ -4,7 +4,7 @@ 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));
var _rclick = sFOCUS && !mouse_init_inside && !mouse_init_r_pressed && mouse_release(mb_right);
if(!mouse_init_inside && mouse_press(mb_right) && item_selecting) {
instance_destroy(item_selecting);
item_selecting = noone;
@ -54,8 +54,7 @@ if(!ready) exit;
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, _hc, _ha);
if(is_instanceof(_menuItem, MenuItem) && _hovering_ch) {
if(_hovering_ch && is_instanceof(_menuItem, MenuItem)) {
if(_menuItem.active && _lclick) {
var _dat = {
_x: dialog_x,
@ -73,7 +72,9 @@ if(!ready) exit;
else if(remove_parents) instance_destroy(o_dialog_menubox); // close all
else instance_destroy(); // close self
}
}
if(_hovering_ch && (is_instanceof(_menuItem, MenuItem) || is_instanceof(_menuItem, MenuItemGroup))) {
if(_key && _rclick) {
var _dat = {
_x: mouse_mx + ui(4),
@ -88,6 +89,7 @@ if(!ready) exit;
selecting_menu = _menuItem;
var _loadKey = string_to_var($"{_key.context}.{_key.name}");
var context_menu_settings = [
_loadKey,
menuItem("Edit hotkey", function() /*=>*/ {
@ -103,9 +105,13 @@ if(!ready) exit;
array_push(children, item_selecting.id);
}
}
} else if(cc != c_white)
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, cc, 0.5);
var _hx = dialog_x + dialog_w - ui(16);
var _hy = yy + hght / 2 + ui(2);
if(is_instanceof(_menuItem, MenuItemGroup)) {
var _submenus = _menuItem.group;
draw_set_text(font, fa_center, fa_center, COLORS._main_text_sub);
@ -185,13 +191,11 @@ if(!ready) exit;
draw_text(tx, yy + hght / 2, label);
draw_set_alpha(1);
var _hx = dialog_x + dialog_w - ui(16);
var _hy = yy + hght / 2 + ui(2);
if(_menuItem.isShelf) {
draw_sprite_ui_uniform(THEME.arrow, 0, dialog_x + dialog_w - ui(20), yy + hght / 2, 1, COLORS._main_icon);
_hx -= ui(24);
}
}
if(_key) {
draw_set_font(font);
@ -216,7 +220,6 @@ if(!ready) exit;
draw_text(_hx, _hy, _ktxt);
}
}
yy += _h;
}
@ -246,6 +249,7 @@ if(!ready) exit;
draw_sprite_stretched(THEME.s_box_r2_clr, 1, dialog_x, dialog_y, dialog_w, dialog_h);
if(mouse_init_inside && (mouse_release(mb_left) || mouse_release(mb_right))) mouse_init_inside = false;
if(mouse_release(mb_right)) mouse_init_r_pressed = false;
#endregion
#region debug

View file

@ -1,12 +1,16 @@
#region data
globalvar CONTEXT_MENU_CALLBACK;
globalvar CONTEXT_MENU_CALLBACK, FOCUS_BEFORE;
CONTEXT_MENU_CALLBACK = ds_map_create();
FOCUS_BEFORE = noone;
#endregion
function menuCall(menu_id = "", menu = [], _x = 0, _y = 0, align = fa_left, context = noone) {
_x = _x == 0? mouse_mx + ui(4) : _x;
_y = _y == 0? mouse_my + ui(4) : _y;
FOCUS_BEFORE = FOCUS;
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];
@ -82,13 +86,19 @@ function MenuItem(_name, _func, _spr = noone, _hotkey = noone, _toggle = noone,
static setShiftMenu = function(_shiftMenu) /*=>*/ { INLINE shiftMenu = _shiftMenu; return self; }
}
function menuItemGroup(_name, _group) { return new MenuItemGroup(_name, _group); }
function MenuItemGroup(_name, _group) constructor {
function menuItemGroup(_name, _group, _hotkey = noone) { return new MenuItemGroup(_name, _group, _hotkey); }
function MenuItemGroup(_name, _group, _hotkey = noone) constructor {
active = true;
name = _name;
group = _group;
hotkey = noone;
hotkey = _hotkey;
params = {};
hoykeyObject = noone;
spacing = ui(36);
static setSpacing = function(_spacing) {
spacing = _spacing;
return self;
}
}

View file

@ -39,7 +39,7 @@
LATEST_VERSION = 11700;
VERSION = 11790;
SAVE_VERSION = 11700;
VERSION_STRING = "1.17.10.003";
VERSION_STRING = "1.17.10.004";
BUILD_NUMBER = 11790;
HOTKEYS = ds_map_create();

View file

@ -163,6 +163,8 @@ function find_hotkey(_context, _name) {
}
function hotkey_editing(hotkey) {
HOTKEY_BLOCK = true;
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,

View file

@ -1,41 +1,4 @@
#region funtion calls
function __fnInit_Animation() {
registerFunction("", "Play/Pause", vk_space, MOD_KEY.none, panel_animation_play_pause ).setMenu("play_pause", )
registerFunction("", "Resume/Pause", vk_space, MOD_KEY.shift, panel_animation_resume ).setMenu("resume_pause", )
registerFunction("", "First frame", vk_home, MOD_KEY.none, panel_animation_first_frame ).setMenu("first_frame", )
registerFunction("", "Last frame", vk_end, MOD_KEY.none, panel_animation_last_frame ).setMenu("last_frame", )
registerFunction("", "Next frame", vk_right, MOD_KEY.none, panel_animation_next_frame ).setMenu("next_frame", )
registerFunction("", "Previous frame", vk_left, MOD_KEY.none, panel_animation_prev_frame ).setMenu("previous_frame", )
registerFunction("Animation", "Delete keys", vk_delete, MOD_KEY.none, panel_animation_delete_key ).setMenu("animation_delete_keys", )
registerFunction("Animation", "Duplicate", "D", MOD_KEY.ctrl, panel_animation_duplicate ).setMenu("animation_duplicate", THEME.duplicate)
registerFunction("Animation", "Copy", "C", MOD_KEY.ctrl, panel_animation_copy ).setMenu("animation_copy", THEME.copy)
registerFunction("Animation", "Paste", "V", MOD_KEY.ctrl, panel_animation_paste ).setMenu("animation_paste", THEME.paste)
registerFunction("Animation", "Collapse Toggle", "C", MOD_KEY.none, panel_animation_collapseToggle ).setMenu("animation_collapse_toggle", )
registerFunction("Animation", "Toggle Nodes", "H", MOD_KEY.none, panel_animation_show_nodes ).setMenu("animation_toggle_nodes", )
registerFunction("Animation", "Settings", "S", MOD_KEY.ctrl | MOD_KEY.shift, panel_animation_settings ).setMenu("animation_settings", THEME.animation_setting )
registerFunction("Animation", "Scaler", "", MOD_KEY.none, panel_animation_scale ).setMenu("animation_scaler", THEME.animation_timing )
registerFunction("Animation", "Edit Keyframe Value","", MOD_KEY.none, panel_animation_edit_keyframe_value ).setMenu("animation_edit_keyframe_value", )
registerFunction("Animation", "Lock Keyframe Y", "", MOD_KEY.none, panel_animation_edit_keyframe_lock_y ).setMenu("animation_lock_keyframe_y", )
registerFunction("Animation", "Stagger", "", MOD_KEY.none, panel_animation_edit_keyframe_stagger ).setMenu("animation_stagger", )
registerFunction("Animation", "Driver", "", MOD_KEY.none, panel_animation_keyframe_driver ).setMenu("animation_driver", )
registerFunction("Animation", "New Folder", "", MOD_KEY.none, panel_animation_dopesheet_new_folder ).setMenu("animation_new_folder", THEME.folder_content)
registerFunction("Animation", "Dopesheet Expand", "", MOD_KEY.none, panel_animation_dopesheet_expand ).setMenu("animation_dopesheet_expand", )
registerFunction("Animation", "Dopesheet Collapse", "", MOD_KEY.none, panel_animation_dopesheet_collapse ).setMenu("animation_dopesheet_collapse", )
registerFunction("Animation", "Rename Group", "", MOD_KEY.none, panel_animation_group_rename ).setMenu("animation_rename_group", THEME.cross)
registerFunction("Animation", "Remove Group", "", MOD_KEY.none, panel_animation_group_remove ).setMenu("animation_remove_group", )
registerFunction("Animation", "Separate Axis", "", MOD_KEY.none, panel_animation_separate_axis ).setMenu("animation_separate_axis", )
registerFunction("Animation", "Combine Axis", "", MOD_KEY.none, panel_animation_combine_axis ).setMenu("animation_combine_axis", )
registerFunction("Animation", "Set Range Start", "", MOD_KEY.none, panel_animation_range_set_start ).setMenu("animation_set_range_start", [ THEME.frame_range, 0 ])
registerFunction("Animation", "Set Range End", "", MOD_KEY.none, panel_animation_range_set_end ).setMenu("animation_set_range_end", [ THEME.frame_range, 1 ])
registerFunction("Animation", "Reset Range", "", MOD_KEY.none, panel_animation_range_reset ).setMenu("animation_reset_range", )
}
function panel_animation_settings() { var dia = dialogPanelCall(new Panel_Animation_Setting()); dia.anchor = ANCHOR.none; }
function panel_animation_scale() { dialogPanelCall(new Panel_Animation_Scaler()); }
@ -72,6 +35,145 @@
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(); }
function __fnInit_Animation() {
registerFunction("", "Play/Pause", vk_space, MOD_KEY.none, panel_animation_play_pause ).setMenu("play_pause", )
registerFunction("", "Resume/Pause", vk_space, MOD_KEY.shift, panel_animation_resume ).setMenu("resume_pause", )
registerFunction("", "First frame", vk_home, MOD_KEY.none, panel_animation_first_frame ).setMenu("first_frame", )
registerFunction("", "Last frame", vk_end, MOD_KEY.none, panel_animation_last_frame ).setMenu("last_frame", )
registerFunction("", "Next frame", vk_right, MOD_KEY.none, panel_animation_next_frame ).setMenu("next_frame", )
registerFunction("", "Previous frame", vk_left, MOD_KEY.none, panel_animation_prev_frame ).setMenu("previous_frame", )
registerFunction("Animation", "Delete keys", vk_delete, MOD_KEY.none, panel_animation_delete_key ).setMenu("animation_delete_keys", )
registerFunction("Animation", "Duplicate", "D", MOD_KEY.ctrl, panel_animation_duplicate ).setMenu("animation_duplicate", THEME.duplicate)
registerFunction("Animation", "Copy", "C", MOD_KEY.ctrl, panel_animation_copy ).setMenu("animation_copy", THEME.copy)
registerFunction("Animation", "Paste", "V", MOD_KEY.ctrl, panel_animation_paste ).setMenu("animation_paste", THEME.paste)
registerFunction("Animation", "Collapse Toggle", "C", MOD_KEY.none, panel_animation_collapseToggle ).setMenu("animation_collapse_toggle", )
registerFunction("Animation", "Toggle Nodes", "H", MOD_KEY.none, panel_animation_show_nodes ).setMenu("animation_toggle_nodes", )
registerFunction("Animation", "Settings", "S", MOD_KEY.ctrl | MOD_KEY.shift, panel_animation_settings ).setMenu("animation_settings", THEME.animation_setting )
registerFunction("Animation", "Scaler", "", MOD_KEY.none, panel_animation_scale ).setMenu("animation_scaler", THEME.animation_timing )
registerFunction("Animation", "Edit Keyframe Value","", MOD_KEY.none, panel_animation_edit_keyframe_value ).setMenu("animation_edit_keyframe_value", )
registerFunction("Animation", "Lock Keyframe Y", "", MOD_KEY.none, panel_animation_edit_keyframe_lock_y ).setMenu("animation_lock_keyframe_y", )
registerFunction("Animation", "Stagger", "", MOD_KEY.none, panel_animation_edit_keyframe_stagger ).setMenu("animation_stagger", )
registerFunction("Animation", "Driver", "", MOD_KEY.none, panel_animation_keyframe_driver ).setMenu("animation_driver", )
registerFunction("Animation", "New Folder", "", MOD_KEY.none, panel_animation_dopesheet_new_folder ).setMenu("animation_new_folder", THEME.folder_content)
registerFunction("Animation", "Dopesheet Expand", "", MOD_KEY.none, panel_animation_dopesheet_expand ).setMenu("animation_dopesheet_expand", )
registerFunction("Animation", "Dopesheet Collapse", "", MOD_KEY.none, panel_animation_dopesheet_collapse ).setMenu("animation_dopesheet_collapse", )
registerFunction("Animation", "Rename Group", "", MOD_KEY.none, panel_animation_group_rename ).setMenu("animation_rename_group", )
registerFunction("Animation", "Remove Group", "", MOD_KEY.none, panel_animation_group_remove ).setMenu("animation_remove_group", THEME.cross)
registerFunction("Animation", "Separate Axis", "", MOD_KEY.none, panel_animation_separate_axis ).setMenu("animation_separate_axis", )
registerFunction("Animation", "Combine Axis", "", MOD_KEY.none, panel_animation_combine_axis ).setMenu("animation_combine_axis", )
registerFunction("Animation", "Set Range Start", "", MOD_KEY.none, panel_animation_range_set_start ).setMenu("animation_set_range_start", [ THEME.frame_range, 0 ])
registerFunction("Animation", "Set Range End", "", MOD_KEY.none, panel_animation_range_set_end ).setMenu("animation_set_range_end", [ THEME.frame_range, 1 ])
registerFunction("Animation", "Reset Range", "", MOD_KEY.none, panel_animation_range_reset ).setMenu("animation_reset_range", )
__fnGroupInit_Animation();
}
function __fnGroupInit_Animation() {
MENU_ITEMS.animation_group_ease_in = menuItemGroup(__txtx("panel_animation_ease_in", "Ease in"), [
[ [THEME.timeline_ease, 0], function() /*=>*/ {
for( var i = 0, n = array_length(PANEL_ANIMATION.keyframe_selecting); i < n; i++ ) {
var k = PANEL_ANIMATION.keyframe_selecting[i];
k.ease_in_type = CURVE_TYPE.linear;
k.ease_in = [0, 1];
}
}, __txtx("panel_animation_ease_linear", "Linear") ],
[ [THEME.timeline_ease, 1], function() /*=>*/ {
for( var i = 0, n = array_length(PANEL_ANIMATION.keyframe_selecting); i < n; i++ ) {
var k = PANEL_ANIMATION.keyframe_selecting[i];
k.ease_in_type = CURVE_TYPE.bezier;
k.ease_in = [1, 1];
}
}, __txtx("panel_animation_ease_smooth", "Smooth") ],
[ [THEME.timeline_ease, 2], function() /*=>*/ {
for( var i = 0, n = array_length(PANEL_ANIMATION.keyframe_selecting); i < n; i++ ) {
var k = PANEL_ANIMATION.keyframe_selecting[i];
k.ease_in_type = CURVE_TYPE.bezier;
k.ease_in = [1, 2];
}
}, __txtx("panel_animation_ease_overshoot", "Overshoot") ],
[ [THEME.timeline_ease, 3], function() /*=>*/ {
for( var i = 0, n = array_length(PANEL_ANIMATION.keyframe_selecting); i < n; i++ ) {
var k = PANEL_ANIMATION.keyframe_selecting[i];
k.ease_in_type = CURVE_TYPE.bezier;
k.ease_in = [0, 0];
}
}, __txtx("panel_animation_ease_sharp", "Sharp") ],
[ [THEME.timeline_ease, 4], function() /*=>*/ {
for( var i = 0, n = array_length(PANEL_ANIMATION.keyframe_selecting); i < n; i++ ) {
var k = PANEL_ANIMATION.keyframe_selecting[i];
k.ease_in_type = CURVE_TYPE.cut;
k.ease_in = [0, 0];
}
}, __txtx("panel_animation_ease_hold", "Hold") ],
], [ "Animation", "Ease In" ]);
registerFunction("Animation", "Ease In", "", MOD_KEY.none, function() /*=>*/ { menuCall("", [ MENU_ITEMS.animation_group_ease_in ]); });
MENU_ITEMS.animation_group_ease_out = menuItemGroup(__txtx("panel_animation_ease_out", "Ease out"), [
[ [THEME.timeline_ease, 0], function() /*=>*/ {
for( var i = 0, n = array_length(PANEL_ANIMATION.keyframe_selecting); i < n; i++ ) {
var k = PANEL_ANIMATION.keyframe_selecting[i];
k.ease_out_type = CURVE_TYPE.linear;
k.ease_out = [0, 0];
}
}, __txtx("panel_animation_ease_linear", "Linear") ],
[ [THEME.timeline_ease, 1], function() /*=>*/ {
for( var i = 0, n = array_length(PANEL_ANIMATION.keyframe_selecting); i < n; i++ ) {
var k = PANEL_ANIMATION.keyframe_selecting[i];
k.ease_out_type = CURVE_TYPE.bezier;
k.ease_out = [1, 0];
}
}, __txtx("panel_animation_ease_smooth", "Smooth") ],
[ [THEME.timeline_ease, 2], function() /*=>*/ {
for( var i = 0, n = array_length(PANEL_ANIMATION.keyframe_selecting); i < n; i++ ) {
var k = PANEL_ANIMATION.keyframe_selecting[i];
k.ease_out_type = CURVE_TYPE.bezier;
k.ease_out = [1, -1];
}
}, __txtx("panel_animation_ease_overshoot", "Overshoot") ],
[ [THEME.timeline_ease, 3], function() /*=>*/ {
for( var i = 0, n = array_length(PANEL_ANIMATION.keyframe_selecting); i < n; i++ ) {
var k = PANEL_ANIMATION.keyframe_selecting[i];
k.ease_out_type = CURVE_TYPE.bezier;
k.ease_out = [0, 1];
}
}, __txtx("panel_animation_ease_sharp", "Sharp") ],
], [ "Animation", "Ease Outs" ]);
registerFunction("Animation", "Ease Out", "", MOD_KEY.none, function() /*=>*/ { menuCall("", [ MENU_ITEMS.animation_group_ease_out ]); });
MENU_ITEMS.animation_group_align = menuItemGroup(__txt("Align"), [
[ [THEME.object_halign, 0], function() /*=>*/ { PANEL_ANIMATION.alignKeys(fa_left); } ],
[ [THEME.object_halign, 1], function() /*=>*/ { PANEL_ANIMATION.alignKeys(fa_center); } ],
[ [THEME.object_halign, 2], function() /*=>*/ { PANEL_ANIMATION.alignKeys(fa_right); } ],
], [ "Animation", "Align" ]);
registerFunction("Animation", "Align", "", MOD_KEY.none, function() /*=>*/ { menuCall("", [ MENU_ITEMS.animation_group_align ]); });
var _clrs = COLORS.labels;
var _item = array_create(array_length(_clrs));
for( var i = 0, n = array_length(_clrs); i < n; i++ ) {
_item[i] = [
[ THEME.timeline_color, i > 0, _clrs[i] ],
function(_data) { PANEL_ANIMATION.setSelectingItemColor(_data.color); }, "", { color: i == 0? -1 : _clrs[i] }
];
}
array_push(_item, [
[ THEME.timeline_color, 2 ],
function(_data) /*=>*/ { colorSelectorCall(PANEL_ANIMATION.context_selecting_item? PANEL_ANIMATION.context_selecting_item.item.getColor() : c_white, PANEL_ANIMATION.setSelectingItemColor); }
]);
MENU_ITEMS.animation_group_label_color = menuItemGroup(__txt("Color"), _item, ["Animation", "Label Color"]).setSpacing(ui(24));
registerFunction("Animation", "Label Color", "", MOD_KEY.none, function() /*=>*/ { menuCall("", [ MENU_ITEMS.animation_group_label_color ]); });
}
#endregion
enum KEYFRAME_DRAG_TYPE {
@ -319,80 +421,11 @@ function Panel_Animation() : PanelContent() constructor {
MENU_ITEMS.animation_edit_keyframe_value,
MENU_ITEMS.animation_lock_keyframe_y,
menuItemGroup(__txtx("panel_animation_ease_in", "Ease in"), [
[ [THEME.timeline_ease, 0], function() {
for( var i = 0, n = array_length(keyframe_selecting); i < n; i++ ) {
var k = keyframe_selecting[i];
k.ease_in_type = CURVE_TYPE.linear;
k.ease_in = [0, 1];
}
}, __txtx("panel_animation_ease_linear", "Linear") ],
[ [THEME.timeline_ease, 1], function() {
for( var i = 0, n = array_length(keyframe_selecting); i < n; i++ ) {
var k = keyframe_selecting[i];
k.ease_in_type = CURVE_TYPE.bezier;
k.ease_in = [1, 1];
}
}, __txtx("panel_animation_ease_smooth", "Smooth") ],
[ [THEME.timeline_ease, 2], function() {
for( var i = 0, n = array_length(keyframe_selecting); i < n; i++ ) {
var k = keyframe_selecting[i];
k.ease_in_type = CURVE_TYPE.bezier;
k.ease_in = [1, 2];
}
}, __txtx("panel_animation_ease_overshoot", "Overshoot") ],
[ [THEME.timeline_ease, 3], function() {
for( var i = 0, n = array_length(keyframe_selecting); i < n; i++ ) {
var k = keyframe_selecting[i];
k.ease_in_type = CURVE_TYPE.bezier;
k.ease_in = [0, 0];
}
}, __txtx("panel_animation_ease_sharp", "Sharp") ],
[ [THEME.timeline_ease, 4], function() {
for( var i = 0, n = array_length(keyframe_selecting); i < n; i++ ) {
var k = keyframe_selecting[i];
k.ease_in_type = CURVE_TYPE.cut;
k.ease_in = [0, 0];
}
}, __txtx("panel_animation_ease_hold", "Hold") ],
]),
MENU_ITEMS.animation_group_ease_in,
MENU_ITEMS.animation_group_ease_out,
menuItemGroup(__txtx("panel_animation_ease_out", "Ease out"), [
[ [THEME.timeline_ease, 0], function() {
for( var i = 0, n = array_length(keyframe_selecting); i < n; i++ ) {
var k = keyframe_selecting[i];
k.ease_out_type = CURVE_TYPE.linear;
k.ease_out = [0, 0];
}
}, __txtx("panel_animation_ease_linear", "Linear") ],
[ [THEME.timeline_ease, 1], function() {
for( var i = 0, n = array_length(keyframe_selecting); i < n; i++ ) {
var k = keyframe_selecting[i];
k.ease_out_type = CURVE_TYPE.bezier;
k.ease_out = [1, 0];
}
}, __txtx("panel_animation_ease_smooth", "Smooth") ],
[ [THEME.timeline_ease, 2], function() {
for( var i = 0, n = array_length(keyframe_selecting); i < n; i++ ) {
var k = keyframe_selecting[i];
k.ease_out_type = CURVE_TYPE.bezier;
k.ease_out = [1, -1];
}
}, __txtx("panel_animation_ease_overshoot", "Overshoot") ],
[ [THEME.timeline_ease, 3], function() {
for( var i = 0, n = array_length(keyframe_selecting); i < n; i++ ) {
var k = keyframe_selecting[i];
k.ease_out_type = CURVE_TYPE.bezier;
k.ease_out = [0, 1];
}
}, __txtx("panel_animation_ease_sharp", "Sharp") ],
]),
-1,
menuItemGroup(__txt("Align"), [
[ [THEME.object_halign, 0], function() { alignKeys(fa_left); } ],
[ [THEME.object_halign, 1], function() { alignKeys(fa_center); } ],
[ [THEME.object_halign, 2], function() { alignKeys(fa_right); } ],
]),
MENU_ITEMS.animation_group_align,
MENU_ITEMS.animation_stagger,
MENU_ITEMS.animation_driver,
-1,
@ -416,25 +449,9 @@ function Panel_Animation() : PanelContent() constructor {
MENU_ITEMS.animation_dopesheet_collapse,
];
var _clrs = COLORS.labels;
var _item = array_create(array_length(_clrs));
function setSelectingItemColor(color) { if(context_selecting_item == noone) return; context_selecting_item.item.setColor(color); }
for( var i = 0, n = array_length(_clrs); i < n; i++ ) {
_item[i] = [
[ THEME.timeline_color, i > 0, _clrs[i] ],
function(_data) { setSelectingItemColor(_data.color); }, "", { color: i == 0? -1 : _clrs[i] }
];
}
array_push(_item, [
[ THEME.timeline_color, 2 ],
function(_data) /*=>*/ { colorSelectorCall(context_selecting_item? context_selecting_item.item.getColor() : c_white, setSelectingItemColor); }
]);
var clr = menuItemGroup(__txt("Color"), _item);
clr.spacing = ui(24);
var clr = MENU_ITEMS.animation_group_label_color;
name_menu_item = [
clr,

View file

@ -123,6 +123,60 @@
registerFunction("Graph", "Export Selected", "E", MOD_KEY.ctrl, panel_graph_export ).setMenu("graph_export_selected")
registerFunction("Graph", "Export Hover", "", MOD_KEY.none, panel_graph_send_to_export ).setMenu("graph_export_hover")
}
__fnGroupInit_Graph()
}
function __fnGroupInit_Graph() {
MENU_ITEMS.graph_group_align = menuItemGroup(__txtx("panel_graph_align_nodes", "Align"), [
[ [THEME.inspector_surface_halign, 0], function() { node_halign(PANEL_GRAPH.nodes_selecting, fa_left); } ],
[ [THEME.inspector_surface_halign, 1], function() { node_halign(PANEL_GRAPH.nodes_selecting, fa_center); } ],
[ [THEME.inspector_surface_halign, 2], function() { node_halign(PANEL_GRAPH.nodes_selecting, fa_right); } ],
[ [THEME.inspector_surface_valign, 0], function() { node_valign(PANEL_GRAPH.nodes_selecting, fa_top); } ],
[ [THEME.inspector_surface_valign, 1], function() { node_valign(PANEL_GRAPH.nodes_selecting, fa_middle); } ],
[ [THEME.inspector_surface_valign, 2], function() { node_valign(PANEL_GRAPH.nodes_selecting, fa_bottom); } ],
[ [THEME.obj_distribute_h, 0], function() { node_hdistribute(PANEL_GRAPH.nodes_selecting); } ],
[ [THEME.obj_distribute_v, 0], function() { node_vdistribute(PANEL_GRAPH.nodes_selecting); } ],
], ["Graph", "Align Nodes"]);
registerFunction("Graph", "Align Nodes", "", MOD_KEY.none, function() /*=>*/ { menuCall("", [ MENU_ITEMS.graph_group_align ]); });
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var _clrs = COLORS.labels;
var _item = array_create(array_length(_clrs));
for( var i = 0, n = array_length(_clrs); i < n; i++ ) {
_item[i] = [
[ THEME.timeline_color, i > 0, _clrs[i] ],
function(_data) { PANEL_GRAPH.setSelectingNodeColor(_data.color); }, "", { color: i == 0? -1 : _clrs[i] }
];
}
array_push(_item, [ [ THEME.timeline_color, 2 ], function() /*=>*/ { colorSelectorCall(PANEL_GRAPH.node_hover? PANEL_GRAPH.node_hover.attributes.color : c_white, PANEL_GRAPH.setSelectingNodeColor); } ]);
MENU_ITEMS.graph_group_node_color = menuItemGroup(__txt("Node Color"), _item, ["Graph", "Set Node Color"]).setSpacing(ui(24));
registerFunction("Graph", "Set Node Color", "", MOD_KEY.none, function() /*=>*/ { menuCall("", [ MENU_ITEMS.graph_group_node_color ]); });
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var _clrs = COLORS.labels;
var _item = array_create(array_length(_clrs));
for( var i = 0, n = array_length(_clrs); i < n; i++ ) {
_item[i] = [
[ THEME.timeline_color, i > 0, _clrs[i] ],
function(_data) { PANEL_GRAPH.setSelectingJuncColor(_data.color); }, "", { color: i == 0? -1 : _clrs[i] }
];
}
array_push(_item, [ [ THEME.timeline_color, 2 ], function() /*=>*/ { colorSelectorCall(PANEL_GRAPH.__junction_hovering? PANEL_GRAPH.__junction_hovering.color : c_white, PANEL_GRAPH.setSelectingJuncColor); } ]);
MENU_ITEMS.graph_group_junction_color = menuItemGroup(__txt("Connection Color"), _item, ["Graph", "Set Junction Color"]).setSpacing(ui(24));
registerFunction("Graph", "Set Junction Color", "", MOD_KEY.none, function() /*=>*/ { menuCall("", [ MENU_ITEMS.graph_group_junction_color ]); });
}
#endregion
@ -641,18 +695,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
menu_node_duplicate = MENU_ITEMS.graph_duplicate;
menu_node_copy = MENU_ITEMS.graph_copy;
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_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); } ],
]);
menu_nodes_align = MENU_ITEMS.graph_group_align;
menu_node_transform = MENU_ITEMS.graph_transform_node;
menu_nodes_blend = MENU_ITEMS.graph_blend;
@ -675,27 +718,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
array_foreach(nodes_selecting, function(node) { node.attributes.color = __temp_color; });
}
var _clrs = COLORS.labels;
var _item = array_create(array_length(_clrs));
for( var i = 0, n = array_length(_clrs); i < n; i++ ) {
_item[i] = [
[ THEME.timeline_color, i > 0, _clrs[i] ],
function(_data) {
setSelectingNodeColor(_data.color);
}, "", { color: i == 0? -1 : _clrs[i] }
];
}
array_push(_item, [
[ THEME.timeline_color, 2 ],
function(_data) {
colorSelectorCall(node_hover? node_hover.attributes.color : c_white, setSelectingNodeColor);
}
]);
menu_node_color = menuItemGroup(__txt("Node Color"), _item);
menu_node_color.spacing = ui(24);
menu_node_color = MENU_ITEMS.graph_group_node_color;
// junction color
@ -716,27 +739,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
}
}
var _clrs = COLORS.labels;
var _item = array_create(array_length(_clrs));
for( var i = 0, n = array_length(_clrs); i < n; i++ ) {
_item[i] = [
[ THEME.timeline_color, i > 0, _clrs[i] ],
function(_data) {
setSelectingJuncColor(_data.color);
}, "", { color: i == 0? -1 : _clrs[i] }
];
}
array_push(_item, [
[ THEME.timeline_color, 2 ],
function(_data) {
colorSelectorCall(__junction_hovering? __junction_hovering.color : c_white, setSelectingJuncColor);
}
]);
menu_junc_color = menuItemGroup(__txt("Connection Color"), _item);
menu_junc_color.spacing = ui(24);
menu_junc_color = MENU_ITEMS.graph_group_junction_color;
//// ============ Project ============

View file

@ -1,23 +1,4 @@
#region funtion calls
function __fnInit_Inspector() {
registerFunction("", "Color picker", "", MOD_KEY.alt, panel_inspector_color_pick ).setMenu("color_picker")
registerFunction("Inspector", "Copy property", "C", MOD_KEY.ctrl, panel_inspector_copy_prop ).setMenu("inspector_copy_property", THEME.copy)
registerFunction("Inspector", "Paste property", "V", MOD_KEY.ctrl, panel_inspector_paste_prop ).setMenu("inspector_paste_property", THEME.paste)
registerFunction("Inspector", "Toggle animation", "I", MOD_KEY.none, panel_inspector_toggle_animation ).setMenu("inspector_toggle_animation")
registerFunction("Inspector", "Expand All Sections", "", MOD_KEY.none, panel_inspector_section_expand_all ).setMenu("inspector_expand_all_sections")
registerFunction("Inspector", "Collapse All Sections", "", MOD_KEY.none, panel_inspector_section_collapse_all ).setMenu("inspector_collapse_all_sections")
registerFunction("Inspector", "Reset", "", MOD_KEY.none, panel_inspector_reset ).setMenu("inspector_reset")
registerFunction("Inspector", "Add", "", MOD_KEY.none, panel_inspector_add ).setMenu("inspector_add")
registerFunction("Inspector", "Remove", "", MOD_KEY.none, panel_inspector_remove ).setMenu("inspector_remove")
registerFunction("Inspector", "Combine Axis", "", MOD_KEY.none, panel_inspector_axis_combine ).setMenu("inspector_combine_axis")
registerFunction("Inspector", "Separate Axis", "", MOD_KEY.none, panel_inspector_axis_separate ).setMenu("inspector_separate_axis")
registerFunction("Inspector", "Use Expression", "", MOD_KEY.none, panel_inspector_use_expression ).setMenu("inspector_use_expression")
registerFunction("Inspector", "Disable Expression", "", MOD_KEY.none, panel_inspector_disable_expression ).setMenu("inspector_disable_expression")
registerFunction("Inspector", "Extract Value", "", MOD_KEY.none, panel_inspector_extract_single ).setMenu("inspector_extract_value")
}
function panel_inspector_copy_prop() { CALL("inspector_copy_property"); PANEL_INSPECTOR.propSelectCopy(); }
function panel_inspector_paste_prop() { CALL("inspector_paste_property"); PANEL_INSPECTOR.propSelectPaste(); }
@ -37,6 +18,50 @@
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(); }
function __fnInit_Inspector() {
registerFunction("", "Color picker", "", MOD_KEY.alt, panel_inspector_color_pick ).setMenu("color_picker")
registerFunction("Inspector", "Copy property", "C", MOD_KEY.ctrl, panel_inspector_copy_prop ).setMenu("inspector_copy_property", THEME.copy)
registerFunction("Inspector", "Paste property", "V", MOD_KEY.ctrl, panel_inspector_paste_prop ).setMenu("inspector_paste_property", THEME.paste)
registerFunction("Inspector", "Toggle animation", "I", MOD_KEY.none, panel_inspector_toggle_animation ).setMenu("inspector_toggle_animation")
registerFunction("Inspector", "Expand All Sections", "", MOD_KEY.none, panel_inspector_section_expand_all ).setMenu("inspector_expand_all_sections")
registerFunction("Inspector", "Collapse All Sections", "", MOD_KEY.none, panel_inspector_section_collapse_all ).setMenu("inspector_collapse_all_sections")
registerFunction("Inspector", "Reset", "", MOD_KEY.none, panel_inspector_reset ).setMenu("inspector_reset")
registerFunction("Inspector", "Add", "", MOD_KEY.none, panel_inspector_add ).setMenu("inspector_add")
registerFunction("Inspector", "Remove", "", MOD_KEY.none, panel_inspector_remove ).setMenu("inspector_remove")
registerFunction("Inspector", "Combine Axis", "", MOD_KEY.none, panel_inspector_axis_combine ).setMenu("inspector_combine_axis")
registerFunction("Inspector", "Separate Axis", "", MOD_KEY.none, panel_inspector_axis_separate ).setMenu("inspector_separate_axis")
registerFunction("Inspector", "Use Expression", "", MOD_KEY.none, panel_inspector_use_expression ).setMenu("inspector_use_expression")
registerFunction("Inspector", "Disable Expression", "", MOD_KEY.none, panel_inspector_disable_expression ).setMenu("inspector_disable_expression")
registerFunction("Inspector", "Extract Value", "", MOD_KEY.none, panel_inspector_extract_single ).setMenu("inspector_extract_value")
__fnGroupInit_Inspector();
}
function __fnGroupInit_Inspector() {
var _clrs = COLORS.labels;
var _item = array_create(array_length(_clrs));
for( var i = 0, n = array_length(_clrs); i < n; i++ ) {
_item[i] = [
[ THEME.timeline_color, i > 0, _clrs[i] ],
function(_data) { PANEL_INSPECTOR.setSelectingItemColor(_data.color); }, "", { color: i == 0? -1 : _clrs[i] }
];
}
array_push(_item, [
[ THEME.timeline_color, 2 ],
function(_data) { colorSelectorCall(PANEL_INSPECTOR.__dialog_junction? PANEL_INSPECTOR.__dialog_junction.color : c_white, PANEL_INSPECTOR.setSelectingItemColor); }
]);
MENU_ITEMS.inspector_group_set_color = menuItemGroup(__txt("Color"), _item, ["Inspector", "Set Color"]).setSpacing(ui(24));
registerFunction("Inspector", "Set Color", "", MOD_KEY.none, function() /*=>*/ { menuCall("", [ MENU_ITEMS.inspector_group_set_color ]); });
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
#endregion
function Inspector_Custom_Renderer(drawFn, registerFn = noone) : widget() constructor {
@ -100,7 +125,6 @@ function Panel_Inspector() : PanelContent() constructor {
prop_sel_drag_y = 0;
color_picking = false;
picker_index = 0;
picker_change = false;
@ -223,27 +247,7 @@ function Panel_Inspector() : PanelContent() constructor {
_val_to[i].setColor(color);
}
var _clrs = COLORS.labels;
var _item = array_create(array_length(_clrs));
for( var i = 0, n = array_length(_clrs); i < n; i++ ) {
_item[i] = [
[ THEME.timeline_color, i > 0, _clrs[i] ],
function(_data) {
setSelectingItemColor(_data.color);
}, "", { color: i == 0? -1 : _clrs[i] }
];
}
array_push(_item, [
[ THEME.timeline_color, 2 ],
function(_data) {
colorSelectorCall(__dialog_junction? __dialog_junction.color : c_white, setSelectingItemColor);
}
]);
menu_junc_color = menuItemGroup(__txt("Color"), _item);
menu_junc_color.spacing = ui(24);
menu_junc_color = MENU_ITEMS.inspector_group_set_color;
#endregion
function setInspecting(inspecting, _lock = false, _focus = true) {

View file

@ -67,6 +67,7 @@
registerFunction("", "Reload theme", vk_f10, MOD_KEY.ctrl | MOD_KEY.shift, global_theme_reload ).setMenu("reload_theme", )
}
#endregion
function Panel_Menu() : PanelContent() constructor {
@ -165,11 +166,7 @@ function Panel_Menu() : PanelContent() constructor {
[ __txt("Preview"), [
MENU_ITEMS.preview_focus_content,
MENU_ITEMS.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; } ],
[ s_preview_black, function() { PANEL_PREVIEW.canvas_bg = c_black; } ],
]),
MENU_ITEMS.preview_group_preview_bg,
]],
[ __txt("Animation"), [

View file

@ -1,4 +1,37 @@
#region funtion calls
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_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; }
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_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(); }
function __fnInit_Preview() {
registerFunction("Preview", "Focus content", "F", MOD_KEY.none, panel_preview_focus_content ).setMenu("preview_focus_content", THEME.icon_center_canvas)
registerFunction("Preview", "Save current frame", "S", MOD_KEY.shift, panel_preview_save_current_frame ).setMenu("preview_save_current_frame")
@ -34,40 +67,19 @@
registerFunction("Preview", "Copy Current Frame", "", MOD_KEY.none, panel_preview_copyCurrentFrame ).setMenu("preview_copy_current_frame", THEME.copy)
registerFunction("Preview", "Copy Color", "", MOD_KEY.none, panel_preview_copy_color ).setMenu("preview_copy_color")
registerFunction("Preview", "Copy Color Hex", "", MOD_KEY.none, panel_preview_copy_color_hex ).setMenu("preview_copy_color_hex")
__fnGroupInit_Preview();
}
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_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; }
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_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(); }
function __fnGroupInit_Preview() {
MENU_ITEMS.preview_group_preview_bg = 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; } ],
[ s_preview_black, function() { PANEL_PREVIEW.canvas_bg = c_black; } ],
], ["Preview", "Background"]);
registerFunction("Preview", "Background", "", MOD_KEY.none, function() /*=>*/ { menuCall("", [ MENU_ITEMS.menu_group_preview_bg ]); });
}
#endregion
function Panel_Preview() : PanelContent() constructor {
@ -2130,6 +2142,8 @@ function Panel_Preview() : PanelContent() constructor {
MENU_ITEMS.preview_copy_current_frame,
MENU_ITEMS.preview_copy_color,
MENU_ITEMS.preview_copy_color_hex,
-1,
MENU_ITEMS.preview_group_preview_bg,
], 0, 0, fa_left, getNodePreview());
}