Pixel-Composer/objects/o_dialog_add_multiple_images/Draw_64.gml

85 lines
2.9 KiB
Text
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description init
if !ready exit;
#region base UI
2023-11-13 15:42:14 +01:00
DIALOG_DRAW_BG
2022-11-03 11:44:49 +01:00
if(sFOCUS)
2023-11-13 15:42:14 +01:00
DIALOG_DRAW_FOCUS
2022-01-13 05:24:03 +01:00
2023-06-10 13:59:45 +02:00
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
draw_text(dialog_x + ui(24), dialog_y + ui(16), __txtx("add_images_title_images", "Import multiple images as"));
2022-01-13 05:24:03 +01:00
#endregion
#region nodes
draw_sprite_stretched(THEME.ui_panel_bg, 1, dialog_x + ui(12), dialog_y + ui(44), dialog_w - ui(24), ui(120));
2022-11-03 11:44:49 +01:00
var grid_size = ui(64);
var grid_space = ui(16);
var grid_width = grid_size + grid_space;
2022-01-13 05:24:03 +01:00
for(var i = 0; i < array_length(nodes); i++) {
var _node = nodes[i];
2022-11-03 11:44:49 +01:00
var xx = dialog_x + ui(32) + i * grid_width;
var yy = dialog_y + ui(60);
2022-01-13 05:24:03 +01:00
PANEL_GRAPH.stepBegin();
2024-05-16 15:28:45 +02:00
2024-05-19 15:11:45 +02:00
var nx = PANEL_GRAPH.graph_cx;
var ny = PANEL_GRAPH.graph_cy;
2022-01-13 05:24:03 +01:00
2022-11-18 03:20:31 +01:00
draw_sprite_stretched(THEME.node_bg, 0, xx, yy, grid_size, grid_size);
2022-12-10 05:06:01 +01:00
if(sHOVER && point_in_rectangle(mouse_mx, mouse_my, xx, yy, xx + grid_width, yy + grid_size)) {
draw_sprite_stretched_ext(THEME.node_bg, 1, xx, yy, grid_size, grid_size, COLORS._main_accent, 1);
2022-12-10 05:06:01 +01:00
if(mouse_press(mb_left, sFOCUS)) {
2024-05-16 09:42:34 +02:00
var path_arr = paths_to_array_ext(paths, dir_filter);
switch(_node.node) {
case "Node_Image" :
2023-07-25 20:12:40 +02:00
for( var i = 0, n = array_length(path_arr); i < n; i++ ) {
2022-01-13 05:24:03 +01:00
var path = path_arr[i];
Node_create_Image_path(nx, ny, path).skipDefault();
2023-01-25 06:49:00 +01:00
ny += 160;
2022-01-13 05:24:03 +01:00
}
break;
2024-05-16 09:42:34 +02:00
2024-05-16 15:28:45 +02:00
case "Node_Canvas" :
for( var i = 0, n = array_length(path_arr); i < n; i++ ) {
var path = path_arr[i];
var _canvas = nodeBuild("Node_Canvas", nx, ny).skipDefault();
2024-05-16 15:28:45 +02:00
_canvas.loadImagePath(path);
ny += 160;
}
break;
case "Node_Image_Sequence" : Node_create_Image_Sequence_path(nx, ny, path_arr).skipDefault(); break;
case "Node_Image_Animated" : Node_create_Image_Animated_path(nx, ny, path_arr).skipDefault(); break;
case "Node_Directory_Search" : Node_create_Directory_path(nx, ny, paths[0]).skipDefault(); break;
2022-01-13 05:24:03 +01:00
}
instance_destroy();
}
}
2023-07-05 15:09:52 +02:00
draw_sprite_ui_uniform(_node.spr, 0, xx + grid_size / 2, yy + grid_size / 2, 0.5);
2022-01-13 05:24:03 +01:00
2024-05-16 09:42:34 +02:00
draw_set_text(f_p3, fa_center, fa_top, COLORS._main_text);
draw_text_ext(xx + grid_size / 2, yy + grid_size + 4, _node.name, -1, grid_size + grid_space / 2);
2022-01-13 05:24:03 +01:00
}
#endregion
#region directory option
if(is_dir) {
2024-05-16 09:42:34 +02:00
var dir_y = dialog_y + ui(180);
2022-01-13 05:24:03 +01:00
2023-06-21 20:36:53 +02:00
cb_recursive.setFocusHover(sFOCUS, sHOVER);
2022-11-03 11:44:49 +01:00
cb_recursive.draw(dialog_x + dialog_w - ui(48), dir_y, dir_recursive, mouse_ui);
2022-01-13 05:24:03 +01:00
2022-11-18 03:20:31 +01:00
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
2023-06-05 18:27:53 +02:00
draw_text(dialog_x + ui(24), dir_y + ui(14), __txtx("add_images_recursive", "Recursive"));
2022-01-13 05:24:03 +01:00
2022-11-03 11:44:49 +01:00
dir_y += ui(40);
2023-06-21 20:36:53 +02:00
tb_filter.setFocusHover(sFOCUS, sHOVER);
2022-11-03 11:44:49 +01:00
tb_filter.draw(dialog_x + ui(100), dir_y, dialog_w - ui(120), ui(36), dir_filter, mouse_ui);
2022-01-13 05:24:03 +01:00
2022-11-18 03:20:31 +01:00
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
2023-06-05 18:27:53 +02:00
draw_text(dialog_x + ui(24), dir_y + ui(18), __txtx("add_images_filter", "Filter"));
2022-01-13 05:24:03 +01:00
}
#endregion