Pixel-Composer/objects/o_main/Draw_75.gml

207 lines
5.5 KiB
Plaintext
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description tooltip filedrop
2023-12-18 04:40:21 +01:00
if(winMan_isMinimized()) exit;
2023-03-28 06:58:28 +02:00
2022-01-13 05:24:03 +01:00
#region tooltip
2024-09-12 12:42:35 +02:00
if(!_MOUSE_BLOCK) {
2024-09-12 05:27:42 +02:00
if(TOOLTIP_WINDOW != noone) {
winwin_draw_begin(TOOLTIP_WINDOW);
winwin_draw_clear(0, 0);
}
if(is_struct(TOOLTIP)) {
if(struct_has(TOOLTIP, "drawTooltip"))
TOOLTIP.drawTooltip();
} else if(is_array(TOOLTIP)) {
var content = TOOLTIP[0];
var type = TOOLTIP[1];
if(is_method(content)) content = content();
switch(type) {
2024-05-16 09:42:34 +02:00
case VALUE_TYPE.float :
case VALUE_TYPE.integer :
case VALUE_TYPE.text :
case VALUE_TYPE.struct :
case VALUE_TYPE.path :
2024-05-16 04:26:35 +02:00
draw_tooltip_text(content);
break;
case VALUE_TYPE.boolean :
draw_tooltip_text(printBool(content));
break;
case VALUE_TYPE.curve :
2024-06-19 11:32:41 +02:00
// draw_tooltip_text($"[{__txt("Curve Object")}]");
draw_tooltip_curve(content);
break;
case VALUE_TYPE.color :
draw_tooltip_color(content);
break;
case VALUE_TYPE.gradient :
draw_tooltip_gradient(content);
break;
case VALUE_TYPE.d3object :
2024-05-07 10:54:34 +02:00
draw_tooltip_text($"[{__txt("3D Object")}]");
break;
case VALUE_TYPE.object :
2024-05-07 10:54:34 +02:00
draw_tooltip_text($"[{__txt("Object")}]");
break;
case VALUE_TYPE.surface :
draw_tooltip_surface(content);
break;
case VALUE_TYPE.rigid :
2024-05-07 12:40:18 +02:00
draw_tooltip_text($"[{__txt("Rigidbody Object")} (id: {content.object})]");
break;
case VALUE_TYPE.particle :
2024-05-07 12:40:18 +02:00
draw_tooltip_text($"[{__txt("Particle Object")} (size: {array_length(content)}) ]");
break;
case VALUE_TYPE.pathnode :
2024-05-07 10:54:34 +02:00
draw_tooltip_text($"[{__txt("Path Object")}]");
break;
case VALUE_TYPE.sdomain :
2024-05-07 10:54:34 +02:00
draw_tooltip_text($"[{__txt("Domain")} (id: {content})]");
break;
case VALUE_TYPE.strands :
var txt = __txt("Strands Object");
if(is_struct(content))
2024-05-07 10:54:34 +02:00
txt += $" (strands: {array_length(content.hairs)})";
draw_tooltip_text($"[{txt}]");
break;
case VALUE_TYPE.mesh :
var txt = __txt("Mesh Object");
if(is_struct(content))
2024-05-07 10:54:34 +02:00
txt += $" (triangles: {array_length(content.triangles)})";
draw_tooltip_text($"[{txt}]");
break;
case VALUE_TYPE.d3vertex :
2024-05-07 10:54:34 +02:00
draw_tooltip_text($"[{__txt("3D Vertex")} (groups: {array_length(content)})]");
break;
case VALUE_TYPE.buffer :
draw_tooltip_buffer(content);
break;
case "sprite" :
draw_tooltip_sprite(content);
break;
default :
var tt = "";
if(is_struct(content)) tt = $"[{instanceof(content)}] {content}";
else tt = string(content);
draw_tooltip_text(tt);
}
} else if(TOOLTIP != "")
draw_tooltip_text(TOOLTIP);
2024-09-12 05:27:42 +02:00
if(TOOLTIP_WINDOW != noone) {
winwin_draw_end();
}
}
2022-01-13 05:24:03 +01:00
TOOLTIP = "";
2023-02-14 02:51:14 +01:00
#endregion
2023-03-25 12:27:04 +01:00
#region dragging
if(DRAGGING != noone) {
2024-05-27 07:12:24 +02:00
var mx = mouse_mx + ui(8);
var my = mouse_my + ui(8);
2023-03-25 12:27:04 +01:00
switch(DRAGGING.type) {
2023-03-26 07:13:36 +02:00
case "Color" :
draw_sprite_stretched_ext(THEME.s_box_r2, 0, mx, my, ui(32), ui(32), DRAGGING.data, 1);
draw_sprite_stretched_add(THEME.s_box_r2, 1, mx, my, ui(32), ui(32), c_white, 0.3);
2023-03-26 07:13:36 +02:00
break;
2024-04-08 07:13:46 +02:00
2023-03-25 12:27:04 +01:00
case "Palette" :
2024-05-27 07:12:24 +02:00
var _l = array_safe_length(DRAGGING.data);
var _w = max(ui(128), _l * ui(10));
drawPalette(DRAGGING.data, mx, my, _w, ui(24), 1);
draw_sprite_stretched_add(THEME.s_box_r2, 1, mx, my, _w, ui(24), c_white, 0.3);
2023-03-25 12:27:04 +01:00
break;
2024-04-08 07:13:46 +02:00
2023-03-26 07:13:36 +02:00
case "Gradient" :
2024-05-27 07:12:24 +02:00
DRAGGING.data.draw(mx, my, ui(128), ui(24), 1);
draw_sprite_stretched_add(THEME.s_box_r2, 1, mx, my, ui(128), ui(24), c_white, 0.3);
2023-03-25 12:27:04 +01:00
break;
2024-04-08 07:13:46 +02:00
2023-03-26 07:13:36 +02:00
case "Bool" :
draw_set_alpha(0.5);
draw_set_text(f_h3, fa_center, fa_center, COLORS._main_text);
2024-05-27 07:12:24 +02:00
draw_text_bbox({ xc: mx, yc: my, w: ui(128), h: ui(24) }, __txt(DRAGGING.data? "True" : "False"));
2023-03-26 07:13:36 +02:00
draw_set_alpha(1);
break;
2024-04-08 07:13:46 +02:00
case "Asset" :
case "Project" :
case "Collection" :
if(DRAGGING.data.spr) {
var ss = ui(48) / max(sprite_get_width(DRAGGING.data.spr), sprite_get_height(DRAGGING.data.spr))
2024-05-27 07:12:24 +02:00
draw_sprite_ext(DRAGGING.data.spr, 0, mx, my, ss, ss, 0, c_white, 1);
2024-04-08 07:13:46 +02:00
}
break;
2023-03-26 07:13:36 +02:00
default:
draw_set_alpha(0.5);
draw_set_text(f_h3, fa_center, fa_center, COLORS._main_text);
2024-05-27 07:12:24 +02:00
draw_text_bbox({ xc: mx, yc: my, w: ui(128), h: ui(24) }, DRAGGING.data);
2023-03-26 07:13:36 +02:00
draw_set_alpha(1);
2023-03-25 12:27:04 +01:00
}
if(mouse_release(mb_left))
DRAGGING = noone;
}
#endregion
2023-02-14 02:51:14 +01:00
#region safe mode
2023-11-01 08:10:25 +01:00
if(PROJECT.safeMode) {
draw_sprite_stretched_ext(THEME.ui_panel, 1, 0, 0, WIN_W, WIN_H, COLORS._main_value_negative, 1);
2023-02-14 02:51:14 +01:00
draw_set_text(f_h1, fa_right, fa_bottom, COLORS._main_value_negative);
2023-11-01 08:10:25 +01:00
draw_set_alpha(0.25);
2023-06-04 18:28:29 +02:00
draw_text(WIN_W - ui(16), WIN_H - ui(8), __txtx("safe_mode", "SAFE MODE"));
2023-02-14 02:51:14 +01:00
draw_set_alpha(1);
}
2023-02-23 07:02:19 +01:00
#endregion
2023-03-25 12:27:04 +01:00
#region draw gui top
PANEL_MAIN.drawGUI();
2023-06-17 14:30:49 +02:00
if(NODE_DROPPER_TARGET != noone) {
draw_sprite_ui(THEME.node_dropper, 0, mouse_x + ui(20), mouse_y + ui(20));
if(mouse_press(mb_left, NODE_DROPPER_TARGET_CAN))
NODE_DROPPER_TARGET = noone;
NODE_DROPPER_TARGET_CAN = true;
} else
NODE_DROPPER_TARGET_CAN = false;
2023-11-25 08:54:35 +01:00
panelDisplayDraw();
dialogGUIDraw();
2023-03-25 12:27:04 +01:00
#endregion
2023-05-08 19:14:30 +02:00
#region debug
2023-05-22 20:31:55 +02:00
if(global.FLAG[$ "hover_element"]) {
2023-05-08 19:14:30 +02:00
draw_set_text(f_p0, fa_right, fa_bottom, COLORS._main_text);
if(HOVERING_ELEMENT)
draw_text(WIN_W, WIN_H, $"[{instanceof(HOVERING_ELEMENT)}]");
}
#endregion
2023-02-23 07:02:19 +01:00
#region frame
2023-04-05 20:13:27 +02:00
draw_set_color(merge_color(COLORS._main_icon, COLORS._main_icon_dark, 0.95));
2023-02-23 07:02:19 +01:00
draw_rectangle(1, 1, WIN_W - 2, WIN_H - 2, true);
2022-01-13 05:24:03 +01:00
#endregion