diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index d103f3f46..7e191b2a2 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -546,6 +546,7 @@ {"name":"fd_rectangle_get_collision_mask_sprite_image","order":5,"path":"scripts/fd_rectangle_get_collision_mask_sprite_image/fd_rectangle_get_collision_mask_sprite_image.yy",}, {"name":"s_node_stripe","order":16,"path":"sprites/s_node_stripe/s_node_stripe.yy",}, {"name":"s_node_lua_global","order":19,"path":"sprites/s_node_lua_global/s_node_lua_global.yy",}, + {"name":"transformBox","order":29,"path":"scripts/transformBox/transformBox.yy",}, {"name":"sh_grey_alpha","order":14,"path":"shaders/sh_grey_alpha/sh_grey_alpha.yy",}, {"name":"sh_normal","order":1,"path":"shaders/sh_normal/sh_normal.yy",}, {"name":"s_node_time_map","order":39,"path":"sprites/s_node_time_map/s_node_time_map.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index bee78f00a..c5f73685b 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -244,6 +244,7 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_animation_timing.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_arrow_16_strip4.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_arrow_back_32.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_bone.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_button_path_icon.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_button_path_not_found_icon.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_cache.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",}, @@ -1056,6 +1057,7 @@ {"id":{"name":"fd_rectangle_get_collision_mask_sprite_image","path":"scripts/fd_rectangle_get_collision_mask_sprite_image/fd_rectangle_get_collision_mask_sprite_image.yy",},}, {"id":{"name":"s_node_stripe","path":"sprites/s_node_stripe/s_node_stripe.yy",},}, {"id":{"name":"s_node_lua_global","path":"sprites/s_node_lua_global/s_node_lua_global.yy",},}, + {"id":{"name":"transformBox","path":"scripts/transformBox/transformBox.yy",},}, {"id":{"name":"s_node_fluidSim_group","path":"sprites/s_node_fluidSim_group/s_node_fluidSim_group.yy",},}, {"id":{"name":"sh_grey_alpha","path":"shaders/sh_grey_alpha/sh_grey_alpha.yy",},}, {"id":{"name":"sh_normal","path":"shaders/sh_normal/sh_normal.yy",},}, diff --git a/datafiles/data/themes/default.zip b/datafiles/data/themes/default.zip index b006984c4..a54b52bca 100644 Binary files a/datafiles/data/themes/default.zip and b/datafiles/data/themes/default.zip differ diff --git a/objects/o_dialog_about/Draw_64.gml b/objects/o_dialog_about/Draw_64.gml index 63c20e406..a6c483dd0 100644 --- a/objects/o_dialog_about/Draw_64.gml +++ b/objects/o_dialog_about/Draw_64.gml @@ -21,6 +21,6 @@ if !ready exit; var thank_y = dialog_y + ui(188); draw_sprite_stretched(THEME.ui_panel_bg, 0, dialog_x + ui(24), thank_y - ui(8), dialog_w - ui(48), thank_h + ui(16)); - sc_thank.setActiveFocus(sFOCUS, sHOVER); + sc_thank.setFocusHover(sFOCUS, sHOVER); sc_thank.draw(dialog_x + ui(32), thank_y); #endregion \ No newline at end of file diff --git a/objects/o_dialog_add_multiple_images/Draw_64.gml b/objects/o_dialog_add_multiple_images/Draw_64.gml index aae41828f..d0b554188 100644 --- a/objects/o_dialog_add_multiple_images/Draw_64.gml +++ b/objects/o_dialog_add_multiple_images/Draw_64.gml @@ -61,14 +61,14 @@ if !ready exit; if(is_dir) { var dir_y = dialog_y + ui(172); - cb_recursive.setActiveFocus(sFOCUS, sHOVER); + cb_recursive.setFocusHover(sFOCUS, sHOVER); cb_recursive.draw(dialog_x + dialog_w - ui(48), dir_y, dir_recursive, mouse_ui); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(24), dir_y + ui(14), __txtx("add_images_recursive", "Recursive")); dir_y += ui(40); - tb_filter.setActiveFocus(sFOCUS, sHOVER); + tb_filter.setFocusHover(sFOCUS, sHOVER); tb_filter.draw(dialog_x + ui(100), dir_y, dialog_w - ui(120), ui(36), dir_filter, mouse_ui); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); diff --git a/objects/o_dialog_add_node/Draw_64.gml b/objects/o_dialog_add_node/Draw_64.gml index bf133932e..ff3b6680a 100644 --- a/objects/o_dialog_add_node/Draw_64.gml +++ b/objects/o_dialog_add_node/Draw_64.gml @@ -11,22 +11,22 @@ if !ready exit; WIDGET_CURRENT = tb_search; if(search_string == "") { - tb_search.setActiveFocus(false, false); + tb_search.setFocusHover(false, false); tb_search.sprite_index = 1; - catagory_pane.setActiveFocus(sFOCUS, sHOVER); + catagory_pane.setFocusHover(sFOCUS, sHOVER); catagory_pane.draw(dialog_x + ui(14), dialog_y + ui(52)); var _x = dialog_x + category_width - ui(12); draw_sprite_stretched(THEME.ui_panel_bg, 0, _x, dialog_y + ui(52), dialog_w - category_width - ui(2), dialog_h - ui(66)); - content_pane.setActiveFocus(sFOCUS, sHOVER); + content_pane.setFocusHover(sFOCUS, sHOVER); content_pane.draw(_x, dialog_y + ui(52)); node_selecting = 0; } else { - tb_search.setActiveFocus(true, true); + tb_search.setFocusHover(true, true); draw_sprite_stretched(THEME.ui_panel_bg, 0, dialog_x + ui(14), dialog_y + ui(52), dialog_w - ui(28), dialog_h - ui(66)); - search_pane.setActiveFocus(sFOCUS, sHOVER); + search_pane.setFocusHover(sFOCUS, sHOVER); search_pane.draw(dialog_x + ui(16), dialog_y + ui(52)); } diff --git a/objects/o_dialog_anim_time_scaler/Draw_64.gml b/objects/o_dialog_anim_time_scaler/Draw_64.gml index dbbdfb7f4..87ed42b8b 100644 --- a/objects/o_dialog_anim_time_scaler/Draw_64.gml +++ b/objects/o_dialog_anim_time_scaler/Draw_64.gml @@ -14,7 +14,7 @@ if !ready exit; var yy = dialog_y + ui(44); tb_scale_frame.register(); - tb_scale_frame.setActiveFocus(sFOCUS, sHOVER); + tb_scale_frame.setFocusHover(sFOCUS, sHOVER); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy + ui(17), __txtx("anim_scale_target_frame_length", "Target frame length")); var tb_x = dialog_x + ui(200); @@ -28,6 +28,6 @@ if !ready exit; var by = yy; b_apply.register(); - b_apply.setActiveFocus(sFOCUS, sHOVER); + b_apply.setFocusHover(sFOCUS, sHOVER); b_apply.draw(bx, by, ui(36), ui(36), mouse_ui, THEME.button_lime); #endregion \ No newline at end of file diff --git a/objects/o_dialog_animation/Draw_64.gml b/objects/o_dialog_animation/Draw_64.gml index 40dcf1e7f..b4f6d89c1 100644 --- a/objects/o_dialog_animation/Draw_64.gml +++ b/objects/o_dialog_animation/Draw_64.gml @@ -13,21 +13,21 @@ if !ready exit; #region draw var yy = dialog_y + ui(44); - tb_length.setActiveFocus(sFOCUS, sHOVER); + tb_length.setFocusHover(sFOCUS, sHOVER); tb_length.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy + ui(17), __txtx("anim_length", "Animation length")); tb_length.draw(dialog_x + dialog_w - ui(120), yy, ui(96), TEXTBOX_HEIGHT, ANIMATOR.frames_total, mouse_ui); yy += ui(44); - tb_framerate.setActiveFocus(sFOCUS, sHOVER); + tb_framerate.setFocusHover(sFOCUS, sHOVER); tb_framerate.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy + ui(17), __txtx("anim_frame_rate", "Preview frame rate")); tb_framerate.draw(dialog_x + dialog_w - ui(120), yy, ui(96), TEXTBOX_HEIGHT, ANIMATOR.framerate, mouse_ui); yy += ui(44); - eb_playback.setActiveFocus(sFOCUS, sHOVER); + eb_playback.setFocusHover(sFOCUS, sHOVER); eb_playback.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy + ui(17), __txtx("anim_on_end", "On end")); diff --git a/objects/o_dialog_arrayBox/Draw_64.gml b/objects/o_dialog_arrayBox/Draw_64.gml index 07ec0f262..c0980cd98 100644 --- a/objects/o_dialog_arrayBox/Draw_64.gml +++ b/objects/o_dialog_arrayBox/Draw_64.gml @@ -2,7 +2,7 @@ #region draw draw_sprite_stretched(THEME.textbox, 3, dialog_x, dialog_y, dialog_w, dialog_h); - sc_content.setActiveFocus(sHOVER, sFOCUS); + sc_content.setFocusHover(sFOCUS, sHOVER); sc_content.draw(dialog_x, dialog_y); draw_sprite_stretched(THEME.textbox, 1, dialog_x, dialog_y, dialog_w, dialog_h); diff --git a/objects/o_dialog_assetbox/Draw_64.gml b/objects/o_dialog_assetbox/Draw_64.gml index d305c1a47..7fadfcf91 100644 --- a/objects/o_dialog_assetbox/Draw_64.gml +++ b/objects/o_dialog_assetbox/Draw_64.gml @@ -37,9 +37,9 @@ } } - folderPane.setActiveFocus(sHOVER, sFOCUS); + folderPane.setFocusHover(sFOCUS, sHOVER); folderPane.draw(dialog_x + ui(16), dialog_y + ui(48)); - contentPane.setActiveFocus(sHOVER, sFOCUS); + contentPane.setFocusHover(sFOCUS, sHOVER); contentPane.draw(dialog_x + ui(20) + folderW, dialog_y + ui(16)); #endregion \ No newline at end of file diff --git a/objects/o_dialog_color_selector/Draw_64.gml b/objects/o_dialog_color_selector/Draw_64.gml index d1bd2186c..20a48ab6c 100644 --- a/objects/o_dialog_color_selector/Draw_64.gml +++ b/objects/o_dialog_color_selector/Draw_64.gml @@ -33,7 +33,7 @@ if !ready exit; #region palette draw_sprite_stretched(THEME.ui_panel_bg, 0, presets_x + ui(16), dialog_y + ui(44), ui(240 - 32), dialog_h - ui(60)); - sp_presets.setActiveFocus(sFOCUS, sHOVER); + sp_presets.setFocusHover(sFOCUS, sHOVER); sp_presets.draw(presets_x + ui(24), dialog_y + ui(44)); var bx = presets_x + presets_w - ui(44); @@ -63,11 +63,11 @@ if !ready exit; var by = dialog_y + dialog_h - ui(36); b_apply.register(); - b_apply.setActiveFocus(sFOCUS, sHOVER); + b_apply.setFocusHover(sFOCUS, sHOVER); b_apply.draw(bx - ui(18), by - ui(18), ui(36), ui(36), mouse_ui, THEME.button_lime); bx -= ui(48); b_cancel.register(); - b_cancel.setActiveFocus(sFOCUS, sHOVER); + b_cancel.setFocusHover(sFOCUS, sHOVER); b_cancel.draw(bx - ui(18), by - ui(18), ui(36), ui(36), mouse_ui, THEME.button_hide); #endregion \ No newline at end of file diff --git a/objects/o_dialog_drag_folder/Draw_64.gml b/objects/o_dialog_drag_folder/Draw_64.gml index dedee3daf..90db08b6a 100644 --- a/objects/o_dialog_drag_folder/Draw_64.gml +++ b/objects/o_dialog_drag_folder/Draw_64.gml @@ -13,14 +13,14 @@ if !ready exit; #region directory option var dir_y = dialog_y + ui(44); - cb_recursive.setActiveFocus(sFOCUS, sHOVER); + cb_recursive.setFocusHover(sFOCUS, sHOVER); cb_recursive.draw(dialog_x + dialog_w - ui(48), dir_y, dir_recursive, mouse_ui); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(20), dir_y + ui(14), __txt("Recursive")); dir_y += ui(40); - tb_filter.setActiveFocus(sFOCUS, sHOVER); + tb_filter.setFocusHover(sFOCUS, sHOVER); tb_filter.draw(dialog_x + ui(100), dir_y, dialog_w - ui(120), ui(36), dir_filter, mouse_ui); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); diff --git a/objects/o_dialog_file_name/Draw_64.gml b/objects/o_dialog_file_name/Draw_64.gml index f9b11fc13..b296d78a5 100644 --- a/objects/o_dialog_file_name/Draw_64.gml +++ b/objects/o_dialog_file_name/Draw_64.gml @@ -8,7 +8,7 @@ draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(8), dialog_y + dialog_h / 2, __txt("Name")); - tb_name.setActiveFocus(sFOCUS, sHOVER); + tb_name.setFocusHover(sFOCUS, sHOVER); tb_name.draw(dialog_x + ui(64), dialog_y + ui(8), dialog_w - ui(72), dialog_h - ui(16), name, mouse_ui); #endregion \ No newline at end of file diff --git a/objects/o_dialog_file_name_collection/Draw_64.gml b/objects/o_dialog_file_name_collection/Draw_64.gml index f1de11fd2..ad5eb924c 100644 --- a/objects/o_dialog_file_name_collection/Draw_64.gml +++ b/objects/o_dialog_file_name_collection/Draw_64.gml @@ -18,7 +18,7 @@ t_alias.interactable = !STEAM_UGC_ITEM_UPLOADING; tb_name.interactable = !STEAM_UGC_ITEM_UPLOADING; - tb_name.setActiveFocus(sFOCUS, sHOVER); + tb_name.setFocusHover(sFOCUS, sHOVER); tb_name.register(); tb_name.draw(dialog_x + ui(72), dialog_y + ui(16), dialog_w - ui(164), ui(32), meta.name, mouse_ui); @@ -102,7 +102,7 @@ yy += line_get_height() + ui(4); dialog_h += line_get_height() + ui(4); - t_desc.setActiveFocus(sFOCUS, sHOVER); + t_desc.setFocusHover(sFOCUS, sHOVER); t_desc.register(); t_desc.draw(dialog_x + ui(16), yy, dialog_w - ui(32), ui(200), meta.description, mouse_ui); yy += ui(200) + ui(8); @@ -113,7 +113,7 @@ yy += line_get_height() + ui(4); dialog_h += line_get_height() + ui(4); - t_auth.setActiveFocus(sFOCUS, sHOVER); + t_auth.setFocusHover(sFOCUS, sHOVER); t_auth.register(); t_auth.draw(dialog_x + ui(16), yy, dialog_w - ui(32), TEXTBOX_HEIGHT, meta.author, mouse_ui); yy += TEXTBOX_HEIGHT + ui(8); @@ -124,7 +124,7 @@ yy += line_get_height() + ui(4); dialog_h += line_get_height() + ui(4); - t_cont.setActiveFocus(sFOCUS, sHOVER); + t_cont.setFocusHover(sFOCUS, sHOVER); t_cont.register(); t_cont.draw(dialog_x + ui(16), yy, dialog_w - ui(32), TEXTBOX_HEIGHT, meta.contact, mouse_ui); yy += TEXTBOX_HEIGHT + ui(8); @@ -135,7 +135,7 @@ yy += line_get_height() + ui(4); dialog_h += line_get_height() + ui(4); - t_alias.setActiveFocus(sFOCUS, sHOVER); + t_alias.setFocusHover(sFOCUS, sHOVER); t_alias.register(); t_alias.draw(dialog_x + ui(16), yy, dialog_w - ui(32), TEXTBOX_HEIGHT, meta.alias, mouse_ui); yy += TEXTBOX_HEIGHT + ui(8); @@ -146,7 +146,7 @@ yy += line_get_height() + ui(4); dialog_h += line_get_height() + ui(4); - t_tags.setActiveFocus(sFOCUS, sHOVER); + t_tags.setFocusHover(sFOCUS, sHOVER); t_tags.register(); var hh = t_tags.draw(dialog_x + ui(16), yy, dialog_w - ui(32), TEXTBOX_HEIGHT, mouse_ui); yy += hh + ui(8); diff --git a/objects/o_dialog_fontscrollbox/Draw_64.gml b/objects/o_dialog_fontscrollbox/Draw_64.gml index 07ec0f262..c0980cd98 100644 --- a/objects/o_dialog_fontscrollbox/Draw_64.gml +++ b/objects/o_dialog_fontscrollbox/Draw_64.gml @@ -2,7 +2,7 @@ #region draw draw_sprite_stretched(THEME.textbox, 3, dialog_x, dialog_y, dialog_w, dialog_h); - sc_content.setActiveFocus(sHOVER, sFOCUS); + sc_content.setFocusHover(sFOCUS, sHOVER); sc_content.draw(dialog_x, dialog_y); draw_sprite_stretched(THEME.textbox, 1, dialog_x, dialog_y, dialog_w, dialog_h); diff --git a/objects/o_dialog_gradient/Draw_64.gml b/objects/o_dialog_gradient/Draw_64.gml index 6c60ba2cb..d93712d91 100644 --- a/objects/o_dialog_gradient/Draw_64.gml +++ b/objects/o_dialog_gradient/Draw_64.gml @@ -38,7 +38,7 @@ if !ready exit; #region presets draw_sprite_stretched(THEME.ui_panel_bg, 0, presets_x + ui(16), dialog_y + ui(44), ui(240 - 32), dialog_h - ui(60)); - sp_presets.setActiveFocus(sFOCUS, sHOVER); + sp_presets.setFocusHover(sFOCUS, sHOVER); sp_presets.draw(presets_x + ui(16 + 8), dialog_y + ui(44)); var bx = presets_x + presets_w - ui(44); @@ -82,7 +82,7 @@ if !ready exit; #region palette draw_sprite_stretched(THEME.ui_panel_bg, 0, palette_x + ui(16), dialog_y + ui(44), ui(240 - 32), dialog_h - ui(60)); - sp_palettes.setActiveFocus(sFOCUS, sHOVER); + sp_palettes.setFocusHover(sFOCUS, sHOVER); sp_palettes.draw(palette_x + ui(16 + 8), dialog_y + ui(44)); #endregion @@ -188,7 +188,7 @@ if !ready exit; draw_text(op_x, op_y + TEXTBOX_HEIGHT / 2, __txt("Position")) var txt = key_selecting? key_selecting.time * 100 : 0; - sl_position.setActiveFocus(sFOCUS, sHOVER); + sl_position.setFocusHover(sFOCUS, sHOVER); sl_position.register(); sl_position.draw(op_x + ui(100), op_y, ui(content_w - 140), TEXTBOX_HEIGHT, txt, mouse_ui); #endregion @@ -205,11 +205,11 @@ if !ready exit; var by = dialog_y + dialog_h - ui(36); b_apply.register(); - b_apply.setActiveFocus(sFOCUS, sHOVER); + b_apply.setFocusHover(sFOCUS, sHOVER); b_apply.draw(bx - ui(18), by - ui(18), ui(36), ui(36), mouse_ui, THEME.button_lime); bx -= ui(48); b_cancel.register(); - b_cancel.setActiveFocus(sFOCUS, sHOVER); + b_cancel.setFocusHover(sFOCUS, sHOVER); b_cancel.draw(bx - ui(18), by - ui(18), ui(36), ui(36), mouse_ui, THEME.button_hide); #endregion \ No newline at end of file diff --git a/objects/o_dialog_graph_connection/Draw_64.gml b/objects/o_dialog_graph_connection/Draw_64.gml index 0d73c3996..8d3cf4ed8 100644 --- a/objects/o_dialog_graph_connection/Draw_64.gml +++ b/objects/o_dialog_graph_connection/Draw_64.gml @@ -14,21 +14,21 @@ if !ready exit; var yy = dialog_y + ui(64); var ww = ui(128); - bs_type.setActiveFocus(sFOCUS, sHOVER); + bs_type.setFocusHover(sFOCUS, sHOVER); bs_type.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txt("Type")); bs_type.draw(dialog_x + dialog_w - ui(24) - ww, yy - TEXTBOX_HEIGHT / 2, ww, TEXTBOX_HEIGHT, PREF_MAP[? "curve_connection_line"], mouse_ui); yy += ui(40); - tb_width.setActiveFocus(sFOCUS, sHOVER); + tb_width.setFocusHover(sFOCUS, sHOVER); tb_width.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txtx("dialog_connection_thickness", "Line thickness")); tb_width.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PREF_MAP[? "connection_line_width"], mouse_ui,, fa_right, fa_center); yy += ui(40); - tb_corner.setActiveFocus(sFOCUS, sHOVER); + tb_corner.setFocusHover(sFOCUS, sHOVER); tb_corner.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txtx("dialog_connection_radius", "Corner radius")); diff --git a/objects/o_dialog_graph_grid/Draw_64.gml b/objects/o_dialog_graph_grid/Draw_64.gml index 313fd2d7a..2bc95c21f 100644 --- a/objects/o_dialog_graph_grid/Draw_64.gml +++ b/objects/o_dialog_graph_grid/Draw_64.gml @@ -14,28 +14,28 @@ if !ready exit; var yy = dialog_y + ui(64); var ww = ui(128); - cb_enable.setActiveFocus(sFOCUS, sHOVER); + cb_enable.setFocusHover(sFOCUS, sHOVER); cb_enable.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txtx("grid_snap", "Snap to grid")); cb_enable.draw(dialog_x + dialog_w - ui(24) - ww / 2, yy, PANEL_GRAPH.node_drag_snap, mouse_ui,, fa_center, fa_center); yy += ui(40); - tb_size.setActiveFocus(sFOCUS, sHOVER); + tb_size.setFocusHover(sFOCUS, sHOVER); tb_size.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txtx("grid_size", "Grid size")); tb_size.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PANEL_GRAPH.graph_line_s, mouse_ui,, fa_right, fa_center); yy += ui(40); - sl_opacity.setActiveFocus(sFOCUS, sHOVER); + sl_opacity.setFocusHover(sFOCUS, sHOVER); sl_opacity.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txtx("grid_opacity", "Grid opacity")); sl_opacity.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PANEL_GRAPH.grid_opacity, mouse_ui, ui(52), fa_right, fa_center); yy += ui(40); - cl_color.setActiveFocus(sFOCUS, sHOVER); + cl_color.setFocusHover(sFOCUS, sHOVER); cl_color.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txtx("grid_color", "Grid color")); diff --git a/objects/o_dialog_graph_view/Draw_64.gml b/objects/o_dialog_graph_view/Draw_64.gml index d6f9d1943..1050f4875 100644 --- a/objects/o_dialog_graph_view/Draw_64.gml +++ b/objects/o_dialog_graph_view/Draw_64.gml @@ -13,21 +13,21 @@ if !ready exit; #region draw var yy = dialog_y + ui(64); - cb_grid.setActiveFocus(sFOCUS, sHOVER); + cb_grid.setFocusHover(sFOCUS, sHOVER); cb_grid.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txt("Grid")); cb_grid.draw(dialog_x + dialog_w - ui(48), yy, PANEL_GRAPH.show_grid, mouse_ui,, fa_center, fa_center); yy += ui(40); - cb_dim.setActiveFocus(sFOCUS, sHOVER); + cb_dim.setFocusHover(sFOCUS, sHOVER); cb_dim.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txtx("graph_visibility_dim", "Dimension")); cb_dim.draw(dialog_x + dialog_w - ui(48), yy, PANEL_GRAPH.show_dimension, mouse_ui,, fa_center, fa_center); yy += ui(40); - cb_com.setActiveFocus(sFOCUS, sHOVER); + cb_com.setFocusHover(sFOCUS, sHOVER); cb_com.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txtx("graph_visibility_compute", "Compute time")); diff --git a/objects/o_dialog_group_input_order/Create_0.gml b/objects/o_dialog_group_input_order/Create_0.gml index f20f42d92..d8b96c167 100644 --- a/objects/o_dialog_group_input_order/Create_0.gml +++ b/objects/o_dialog_group_input_order/Create_0.gml @@ -62,7 +62,7 @@ event_inherited(); var sep = node.attributes.separator; WIDGET_CURRENT = tb_edit; - tb_edit.setActiveFocus(sFOCUS, sHOVER); + tb_edit.setFocusHover(sFOCUS, sHOVER); tb_edit.draw(ed_x + ui(4), _y + ui(4), con_w - (ed_x + ui(8)), hg - ui(8), sep[sep_editing][1], mouse_ui); if(keyboard_check_pressed(vk_enter)) diff --git a/objects/o_dialog_group_input_order/Draw_64.gml b/objects/o_dialog_group_input_order/Draw_64.gml index ba026cb9f..96a141773 100644 --- a/objects/o_dialog_group_input_order/Draw_64.gml +++ b/objects/o_dialog_group_input_order/Draw_64.gml @@ -17,7 +17,7 @@ if !ready exit; var ph = dialog_h - ui(title_height + padding) draw_sprite_stretched(THEME.ui_panel_bg, 0, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); - sc_group.setActiveFocus(sFOCUS, sHOVER); + sc_group.setFocusHover(sFOCUS, sHOVER); sc_group.draw(px, py); var bx = dialog_x + dialog_w - ui(32 + 16); diff --git a/objects/o_dialog_history/Draw_64.gml b/objects/o_dialog_history/Draw_64.gml index 3cea68fbb..6a508fcc3 100644 --- a/objects/o_dialog_history/Draw_64.gml +++ b/objects/o_dialog_history/Draw_64.gml @@ -23,6 +23,6 @@ if !ready exit; var ph = dialog_h - ui(title_height + padding); draw_sprite_stretched(THEME.ui_panel_bg, 0, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); - sc_history.setActiveFocus(sFOCUS, sHOVER); + sc_history.setFocusHover(sFOCUS, sHOVER); sc_history.draw(px, py); #endregion \ No newline at end of file diff --git a/objects/o_dialog_image_array_edit/Draw_64.gml b/objects/o_dialog_image_array_edit/Draw_64.gml index ea90142e6..38b76d3a4 100644 --- a/objects/o_dialog_image_array_edit/Draw_64.gml +++ b/objects/o_dialog_image_array_edit/Draw_64.gml @@ -18,7 +18,7 @@ if !target exit; var ph = dialog_h - ui(title_height + padding); draw_sprite_stretched(THEME.ui_panel_bg, 0, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); - sp_content.setActiveFocus(sFOCUS, sHOVER); + sp_content.setFocusHover(sFOCUS, sHOVER); sp_content.draw(px, py); #endregion diff --git a/objects/o_dialog_keyframe_curve/Draw_64.gml b/objects/o_dialog_keyframe_curve/Draw_64.gml index ec2bf5f3f..086f766f3 100644 --- a/objects/o_dialog_keyframe_curve/Draw_64.gml +++ b/objects/o_dialog_keyframe_curve/Draw_64.gml @@ -12,7 +12,7 @@ if !ready exit; #region draw if(value_target != noone) { - editWidget.setActiveFocus(sFOCUS, sHOVER); + editWidget.setFocusHover(sFOCUS, sHOVER); editWidget.draw(dialog_x + ui(16), dialog_y + ui(48), dialog_w - ui(32), dialog_h - ui(64), value_target.inter_curve, mouse_ui); } diff --git a/objects/o_dialog_l_system/Draw_64.gml b/objects/o_dialog_l_system/Draw_64.gml index 4b20997c8..737bcd918 100644 --- a/objects/o_dialog_l_system/Draw_64.gml +++ b/objects/o_dialog_l_system/Draw_64.gml @@ -17,6 +17,6 @@ if !ready exit; var ph = dialog_h - ui(title_height + padding); draw_sprite_stretched(THEME.ui_panel_bg, 0, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); - sp_note.setActiveFocus(sFOCUS, sHOVER); + sp_note.setFocusHover(sFOCUS, sHOVER); sp_note.draw(px, py); #endregion \ No newline at end of file diff --git a/objects/o_dialog_lua_reference/Draw_64.gml b/objects/o_dialog_lua_reference/Draw_64.gml index b7c51ff49..7d04258a9 100644 --- a/objects/o_dialog_lua_reference/Draw_64.gml +++ b/objects/o_dialog_lua_reference/Draw_64.gml @@ -17,6 +17,6 @@ if !ready exit; var ph = dialog_h - ui(title_height + padding); draw_sprite_stretched(THEME.ui_panel_bg, 0, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); - sp_note.setActiveFocus(sFOCUS, sHOVER); + sp_note.setFocusHover(sFOCUS, sHOVER); sp_note.draw(px, py); #endregion \ No newline at end of file diff --git a/objects/o_dialog_notifications/Draw_64.gml b/objects/o_dialog_notifications/Draw_64.gml index e94547bc0..c36cf9867 100644 --- a/objects/o_dialog_notifications/Draw_64.gml +++ b/objects/o_dialog_notifications/Draw_64.gml @@ -48,6 +48,6 @@ if !ready exit; var ph = dialog_h - ui(title_height + padding); draw_sprite_stretched(THEME.ui_panel_bg, 0, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); - sp_noti.setActiveFocus(sFOCUS, sHOVER); + sp_noti.setFocusHover(sFOCUS, sHOVER); sp_noti.draw(px, py); #endregion \ No newline at end of file diff --git a/objects/o_dialog_output_visibility/Draw_64.gml b/objects/o_dialog_output_visibility/Draw_64.gml index 26bcc7316..25afceb8d 100644 --- a/objects/o_dialog_output_visibility/Draw_64.gml +++ b/objects/o_dialog_output_visibility/Draw_64.gml @@ -17,6 +17,6 @@ if !ready exit; var ph = dialog_h - ui(title_height + padding) draw_sprite_stretched(THEME.ui_panel_bg, 0, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); - sc_outputs.setActiveFocus(sFOCUS, sHOVER); + sc_outputs.setFocusHover(sFOCUS, sHOVER); sc_outputs.draw(px, py); #endregion \ No newline at end of file diff --git a/objects/o_dialog_palette/Draw_64.gml b/objects/o_dialog_palette/Draw_64.gml index 776121d5d..c9c2cea2f 100644 --- a/objects/o_dialog_palette/Draw_64.gml +++ b/objects/o_dialog_palette/Draw_64.gml @@ -33,7 +33,7 @@ if palette == 0 exit; #region presets draw_sprite_stretched(THEME.ui_panel_bg, 0, presets_x + ui(16), dialog_y + ui(44), ui(240 - 32), dialog_h - ui(60)); - sp_presets.setActiveFocus(sFOCUS, sHOVER); + sp_presets.setFocusHover(sFOCUS, sHOVER); sp_presets.draw(presets_x + ui(24), dialog_y + ui(44)); var bx = presets_x + presets_w - ui(44); @@ -204,11 +204,11 @@ if palette == 0 exit; var by = dialog_y + dialog_h - ui(36); b_apply.register(); - b_apply.setActiveFocus(sFOCUS, sHOVER); + b_apply.setFocusHover(sFOCUS, sHOVER); b_apply.draw(bx - ui(18), by - ui(18), ui(36), ui(36), mouse_ui, THEME.button_lime); bx -= ui(48); b_cancel.register(); - b_cancel.setActiveFocus(sFOCUS, sHOVER); + b_cancel.setFocusHover(sFOCUS, sHOVER); b_cancel.draw(bx - ui(18), by - ui(18), ui(36), ui(36), mouse_ui, THEME.button_hide); #endregion \ No newline at end of file diff --git a/objects/o_dialog_preference/Create_0.gml b/objects/o_dialog_preference/Create_0.gml index 76c1a38d1..5f851a18f 100644 --- a/objects/o_dialog_preference/Create_0.gml +++ b/objects/o_dialog_preference/Create_0.gml @@ -443,7 +443,7 @@ event_inherited(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(ui(8), yy + th / 2, _pref[0]); - _pref[2].setActiveFocus(sFOCUS, sHOVER && sp_pref.hover); + _pref[2].setFocusHover(sFOCUS, sHOVER && sp_pref.hover); switch(instanceof(_pref[2])) { case "textBox" : diff --git a/objects/o_dialog_preference/Draw_64.gml b/objects/o_dialog_preference/Draw_64.gml index 33018560f..049aad415 100644 --- a/objects/o_dialog_preference/Draw_64.gml +++ b/objects/o_dialog_preference/Draw_64.gml @@ -54,11 +54,11 @@ if !ready exit; if(page_current == 0) { current_list = pref_global; - sp_pref.setActiveFocus(sHOVER, sFOCUS); + sp_pref.setFocusHover(sFOCUS, sHOVER); sp_pref.draw(px, py); } else if(page_current == 1) { current_list = pref_appr; - sp_pref.setActiveFocus(sHOVER, sFOCUS); + sp_pref.setFocusHover(sFOCUS, sHOVER); sp_pref.draw(px, py); } else if(page_current == 2) { var _w = ui(200); @@ -79,16 +79,16 @@ if !ready exit; draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(x1 + ui(8), yy + _h / 2, __txt("Theme")); - sb_theme.setActiveFocus(sFOCUS, sHOVER); + sb_theme.setFocusHover(sFOCUS, sHOVER); sb_theme.draw(x2 - ui(24) - _w, yy, _w, _h, PREF_MAP[? "theme"]); - sp_colors.setActiveFocus(sHOVER, sFOCUS); + sp_colors.setFocusHover(sFOCUS, sHOVER); sp_colors.draw(px, py + ui(40)); } else if(page_current == 3) { if(mouse_press(mb_left, sFOCUS)) hk_editing = noone; - sp_hotkey.setActiveFocus(sHOVER, sFOCUS); + sp_hotkey.setFocusHover(sFOCUS, sHOVER); sp_hotkey.draw(px, py); } #endregion \ No newline at end of file diff --git a/objects/o_dialog_preset/Draw_64.gml b/objects/o_dialog_preset/Draw_64.gml index 13407b21f..c92c1ba5a 100644 --- a/objects/o_dialog_preset/Draw_64.gml +++ b/objects/o_dialog_preset/Draw_64.gml @@ -17,7 +17,7 @@ if !ready exit; var ph = dialog_h - ui(title_height + padding) draw_sprite_stretched(THEME.ui_panel_bg, 0, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); - sc_presets.setActiveFocus(sFOCUS, sHOVER); + sc_presets.setFocusHover(sFOCUS, sHOVER); sc_presets.draw(px, py); var bx = dialog_x + dialog_w - ui(32 + 16); diff --git a/objects/o_dialog_preview_grid/Draw_64.gml b/objects/o_dialog_preview_grid/Draw_64.gml index 509547f6d..42cf5010a 100644 --- a/objects/o_dialog_preview_grid/Draw_64.gml +++ b/objects/o_dialog_preview_grid/Draw_64.gml @@ -14,42 +14,42 @@ if !ready exit; var yy = dialog_y + ui(64); var ww = ui(128); - cb_enable.setActiveFocus(sFOCUS, sHOVER); + cb_enable.setFocusHover(sFOCUS, sHOVER); cb_enable.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txt("Enabled")); cb_enable.draw(dialog_x + dialog_w - ui(24) - ww / 2, yy, PANEL_PREVIEW.grid_show, mouse_ui,, fa_center, fa_center); yy += ui(40); - cb_snap.setActiveFocus(sFOCUS, sHOVER); + cb_snap.setFocusHover(sFOCUS, sHOVER); cb_snap.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txtx("grid_snap", "Snap to grid")); cb_snap.draw(dialog_x + dialog_w - ui(24) - ww / 2, yy, PANEL_PREVIEW.grid_snap, mouse_ui,, fa_center, fa_center); yy += ui(40); - tb_width.setActiveFocus(sFOCUS, sHOVER); + tb_width.setFocusHover(sFOCUS, sHOVER); tb_width.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txt("Grid width")); tb_width.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PANEL_PREVIEW.grid_width, mouse_ui,, fa_right, fa_center); yy += ui(40); - tb_height.setActiveFocus(sFOCUS, sHOVER); + tb_height.setFocusHover(sFOCUS, sHOVER); tb_height.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txt("Grid height")); tb_height.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PANEL_PREVIEW.grid_height, mouse_ui,, fa_right, fa_center); yy += ui(40); - sl_opacity.setActiveFocus(sFOCUS, sHOVER); + sl_opacity.setFocusHover(sFOCUS, sHOVER); sl_opacity.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txt("Grid opacity")); sl_opacity.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PANEL_PREVIEW.grid_opacity, mouse_ui, ui(52), fa_right, fa_center); yy += ui(40); - cl_color.setActiveFocus(sFOCUS, sHOVER); + cl_color.setFocusHover(sFOCUS, sHOVER); cl_color.register(); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text(dialog_x + ui(32), yy, __txt("Grid Color")); diff --git a/objects/o_dialog_release_note/Draw_64.gml b/objects/o_dialog_release_note/Draw_64.gml index 72c174091..91d9f474f 100644 --- a/objects/o_dialog_release_note/Draw_64.gml +++ b/objects/o_dialog_release_note/Draw_64.gml @@ -13,6 +13,6 @@ if !ready exit; draw_sprite_stretched(THEME.ui_panel_bg, 0, dialog_x + ui(24), dialog_y + ui(48), dialog_w - ui(48), dialog_h - ui(72)); - sp_note.setActiveFocus(sHOVER, sFOCUS); + sp_note.setFocusHover(sFOCUS, sHOVER); sp_note.draw(dialog_x + ui(40), dialog_y + ui(56)); #endregion \ No newline at end of file diff --git a/objects/o_dialog_scrollbox/Draw_64.gml b/objects/o_dialog_scrollbox/Draw_64.gml index e122d16ea..b1c73ab6b 100644 --- a/objects/o_dialog_scrollbox/Draw_64.gml +++ b/objects/o_dialog_scrollbox/Draw_64.gml @@ -3,11 +3,11 @@ draw_sprite_stretched(THEME.textbox, 3, dialog_x, dialog_y, dialog_w, dialog_h); WIDGET_CURRENT = tb_search; - tb_search.setActiveFocus(true, true); + tb_search.setFocusHover(true, true); tb_search.draw(dialog_x + ui(8), dialog_y + ui(8), dialog_w - ui(16), ui(24), search_string); tb_search.sprite_index = 0; - sc_content.setActiveFocus(sHOVER, sFOCUS); + sc_content.setFocusHover(sFOCUS, sHOVER); sc_content.draw(dialog_x, dialog_y + ui(16 + 24)); draw_sprite_stretched(THEME.textbox, 1, dialog_x, dialog_y, dialog_w, dialog_h); diff --git a/objects/o_dialog_splash/Draw_64.gml b/objects/o_dialog_splash/Draw_64.gml index 4f06ed6a8..a358f74a9 100644 --- a/objects/o_dialog_splash/Draw_64.gml +++ b/objects/o_dialog_splash/Draw_64.gml @@ -43,7 +43,7 @@ if !ready exit; draw_set_text(f_p0, fa_left, fa_bottom, COLORS._main_text_sub); draw_text(x0, y0 - ui(4), __txt("Recent files")); draw_sprite_stretched(THEME.ui_panel_bg, 0, x0, y0, x1 - x0, y1 - y0); - sp_recent.setActiveFocus(sFOCUS, sHOVER); + sp_recent.setFocusHover(sFOCUS, sHOVER); sp_recent.draw(x0 + ui(6), y0); draw_sprite_stretched(THEME.ui_panel_fg, 0, x0, y0, x1 - x0, y1 - y0); @@ -153,7 +153,7 @@ if !ready exit; switch(pages[project_page]) { case "Sample projects" : - sp_sample.setActiveFocus(sFOCUS, sHOVER); + sp_sample.setFocusHover(sFOCUS, sHOVER); sp_sample.draw(x0 + ui(6), y0); if(!expand) { @@ -163,7 +163,7 @@ if !ready exit; } break; case "Workshop" : - sp_sample.setActiveFocus(sFOCUS, sHOVER); + sp_sample.setFocusHover(sFOCUS, sHOVER); sp_sample.draw(x0 + ui(6), y0); var bx = x1 - ui(32); @@ -177,7 +177,7 @@ if !ready exit; steamUCGload(); break; case "Contests" : - sp_contest.setActiveFocus(sFOCUS, sHOVER); + sp_contest.setFocusHover(sFOCUS, sHOVER); sp_contest.draw(x0 + ui(6), y0); break; } diff --git a/objects/o_dialog_tunnels/Draw_64.gml b/objects/o_dialog_tunnels/Draw_64.gml index ba05d716f..d798e1669 100644 --- a/objects/o_dialog_tunnels/Draw_64.gml +++ b/objects/o_dialog_tunnels/Draw_64.gml @@ -22,7 +22,7 @@ if !ready exit; if(search_string == "") tb_search.sprite_index = 1; - sc_tunnel.setActiveFocus(sFOCUS, sHOVER); + sc_tunnel.setFocusHover(sFOCUS, sHOVER); sc_tunnel.draw(px, py + ui(40)); var bx = dialog_x + dialog_w - ui(32 + 16); diff --git a/scripts/__bone/__bone.gml b/scripts/__bone/__bone.gml index 3f00f06f0..2b96043f3 100644 --- a/scripts/__bone/__bone.gml +++ b/scripts/__bone/__bone.gml @@ -1,4 +1,5 @@ -function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length = 0) constructor { +function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length = 0, attributes = {}) constructor { + id = UUID_generate(); self.name = "New bone"; self.distance = distance; self.direction = direction; @@ -9,6 +10,13 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length = self.parent_anchor = true; self.childs = []; + tb_name = new textBox(TEXTBOX_INPUT.text, function(_name) { name = _name; }); + tb_name.font = f_p2; + tb_name.hide = true; + + self.attributes = attributes; + updated = false; + self.parent = parent; if(parent != noone) { distance = parent.length; @@ -21,6 +29,13 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length = return self; } + static childCount = function() { + var amo = array_length(childs); + for( var i = 0; i < array_length(childs); i++ ) + amo += childs[i].childCount(); + return amo; + } + static getPoint = function(distance, direction) { if(parent == noone) return new Point(lengthdir_x(self.distance, self.direction), lengthdir_y(self.distance, self.direction)) @@ -60,18 +75,23 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length = draw_line_width2(p0.x, p0.y, p1.x, p1.y, 6, 2); draw_set_alpha(1.00); - if(edit && distance_to_line(_mx, _my, p0.x, p0.y, p1.x, p1.y) <= 6) //drag bone + if(attributes.display_name) { + draw_set_text(f_p2, fa_left, fa_center, COLORS._main_accent); + draw_text((p0.x + p1.x) / 2 + 4, (p0.y + p1.y) / 2, name); + } + + if(edit && distance_to_line(_mx, _my, p0.x, p0.y, p1.x, p1.y) <= 12) //drag bone hover = [ self, 2 ]; if(!parent_anchor) { - if(edit && point_in_circle(_mx, _my, p0.x, p0.y, ui(12))) { //drag head + if(edit && point_in_circle(_mx, _my, p0.x, p0.y, ui(20))) { //drag head draw_sprite_colored(THEME.anchor_selector, 0, p0.x, p0.y); hover = [ self, 0 ]; } else draw_sprite_colored(THEME.anchor_selector, 2, p0.x, p0.y); } - if(edit && point_in_circle(_mx, _my, p1.x, p1.y, ui(12))) { //drag tail + if(edit && point_in_circle(_mx, _my, p1.x, p1.y, ui(20))) { //drag tail draw_sprite_colored(THEME.anchor_selector, 0, p1.x, p1.y); hover = [ self, 1 ]; } else @@ -80,7 +100,7 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length = if(child) for( var i = 0; i < array_length(childs); i++ ) { - var h = childs[i].draw(edit, _x, _y, _s, _mx, _my, true, hovering) + var h = childs[i].draw(edit, _x, _y, _s, _mx, _my, true, hovering); if(hover == noone && h != noone) hover = h; } @@ -88,9 +108,30 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length = return hover; } + static drawInspector = function(_x, _y, _w, _m, _hover, _focus) { + var _h = ui(28); + + //draw_sprite_stretched(THEME.node_bg, 0, _x, _y, _w, _h); + draw_sprite_ui(THEME.bone, 0, _x + 12, _y + 12,,,, COLORS._main_icon); + tb_name.setFocusHover(_focus, _hover); + tb_name.draw(_x + 24, _y + 2, _w - 24 - 8, _h - 4, name, _m); + + _y += _h; + + draw_set_color(COLORS.node_composite_separator); + draw_line(_x + 16, _y, _x + _w - 16, _y); + + for( var i = 0; i < array_length(childs); i++ ) { + _y = childs[i].drawInspector(_x + ui(16), _y, _w - ui(16), _m, _hover, _focus); + } + + return _y; + } + static serialize = function() { var bone = {}; + bone.id = id; bone.name = name; bone.distance = distance; bone.direction = direction; @@ -107,7 +148,8 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length = return bone; } - static deserialize = function(bone) { + static deserialize = function(bone, attributes) { + id = bone.id; name = bone.name; distance = bone.distance; direction = bone.direction; @@ -117,12 +159,25 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length = is_main = bone.is_main; parent_anchor = bone.parent_anchor; + self.attributes = attributes; + childs = []; for( var i = 0; i < array_length(bone.childs); i++ ) { - var _b = new __Bone().deserialize(bone.childs[i]); + var _b = new __Bone().deserialize(bone.childs[i], attributes); addChild(_b); } return self; } + + static clone = function(attributes) { + var _b = new __Bone(parent, distance, direction, angle, length, attributes); + _b.is_main = is_main; + _b.parent_anchor = parent_anchor; + + for( var i = 0; i < array_length(childs); i++ ) + _b.addChild(childs[i].clone(attributes)); + + return _b; + } } \ No newline at end of file diff --git a/scripts/addon_lua/addon_lua.gml b/scripts/addon_lua/addon_lua.gml index ee42e44aa..e88321389 100644 --- a/scripts/addon_lua/addon_lua.gml +++ b/scripts/addon_lua/addon_lua.gml @@ -887,7 +887,7 @@ [ "__widget_wake", function(wd, hover, focus) { if(!ds_map_exists(global.ADDON_WIDGET, wd)) return; - global.ADDON_WIDGET[? wd].setActiveFocus(focus, hover); + global.ADDON_WIDGET[? wd].setFocusHover(focus, hover); } ], [ "__textBox", function(ID, type, onModify) { diff --git a/scripts/areaBox/areaBox.gml b/scripts/areaBox/areaBox.gml index 640d00c0e..341be1ce0 100644 --- a/scripts/areaBox/areaBox.gml +++ b/scripts/areaBox/areaBox.gml @@ -224,7 +224,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { } for(var i = 0; i < 4; i++) { - tb[i].setActiveFocus(hover, active); + tb[i].setFocusHover(active, hover); tb[i].align = fa_center; } @@ -289,7 +289,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { } if(unit != noone && unit.reference != noone) { - unit.triggerButton.setActiveFocus(hover, active); + unit.triggerButton.setFocusHover(active, hover); unit.draw(_x + ui(56 + 48 + 8), _y - ui(28), ui(32), ui(32), _m); } diff --git a/scripts/buttonColor/buttonColor.gml b/scripts/buttonColor/buttonColor.gml index 0399f8c51..f6e6adcfa 100644 --- a/scripts/buttonColor/buttonColor.gml +++ b/scripts/buttonColor/buttonColor.gml @@ -53,7 +53,7 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor { current_color = toNumber(_color); if(interactable) { - b_picker.setActiveFocus(hover, active); + b_picker.setFocusHover(active, hover); b_picker.draw(_x + _w - ui(32), _y + _h / 2 - ui(16), ui(32), ui(32), _m, THEME.button_hide); b_picker.icon_blend = c_white; b_picker.icon_index = 0; diff --git a/scripts/buttonGroup/buttonGroup.gml b/scripts/buttonGroup/buttonGroup.gml index 87bcae0bf..bebb7ac5d 100644 --- a/scripts/buttonGroup/buttonGroup.gml +++ b/scripts/buttonGroup/buttonGroup.gml @@ -60,7 +60,7 @@ function buttonGroupClass(_data, _onClick) : widget() constructor { if(display_button) { for(var i = 0; i < amo; i++) { - buttons[i].setActiveFocus(hover, active); + buttons[i].setFocusHover(active, hover); var bx = _x + ww * i; var spr = i == 0 ? buttonSpr[0] : (i == amo - 1? buttonSpr[2] : buttonSpr[1]); @@ -89,7 +89,7 @@ function buttonGroupClass(_data, _onClick) : widget() constructor { } } } else { - sb_small.setActiveFocus(hover, active); + sb_small.setFocusHover(active, hover); sb_small.draw(_x, _y, _w, _h, data[_selecting], _m, _rx, _ry); } diff --git a/scripts/color_selector/color_selector.gml b/scripts/color_selector/color_selector.gml index d0fbbf070..79cb6c974 100644 --- a/scripts/color_selector/color_selector.gml +++ b/scripts/color_selector/color_selector.gml @@ -220,7 +220,7 @@ function colorSelector(onApply = noone) constructor { var tx = hue_x + ui(36); var ty = _y + ui(4); - scr_disp.setActiveFocus(hover, focus); + scr_disp.setFocusHover(focus, hover); scr_disp.draw(tx, ty, ui(190), ui(32), disp_mode, mouse_ui); #endregion @@ -247,9 +247,9 @@ function colorSelector(onApply = noone) constructor { draw_text(data_x, data_y + ui(36 * 1 + 15), "S") draw_text(data_x, data_y + ui(36 * 2 + 15), "V"); - tb_hue.setActiveFocus(hover, focus); - tb_sat.setActiveFocus(hover, focus); - tb_val.setActiveFocus(hover, focus); + tb_hue.setFocusHover(focus, hover); + tb_sat.setFocusHover(focus, hover); + tb_val.setFocusHover(focus, hover); tb_hue.draw(data_x + ui(28), data_y + ui(36 * 0), ui(160), ui(30), round(color_get_hue(current_color)), mouse_ui); tb_sat.draw(data_x + ui(28), data_y + ui(36 * 1), ui(160), ui(30), round(color_get_saturation(current_color)), mouse_ui); @@ -262,9 +262,9 @@ function colorSelector(onApply = noone) constructor { draw_text(data_x, data_y + ui(36 * 1 + 15), "G"); draw_text(data_x, data_y + ui(36 * 2 + 15), "B"); - tb_red.setActiveFocus(hover, focus); - tb_green.setActiveFocus(hover, focus); - tb_blue.setActiveFocus(hover, focus); + tb_red.setFocusHover(focus, hover); + tb_green.setFocusHover(focus, hover); + tb_blue.setFocusHover(focus, hover); tb_red.draw (data_x + ui(28), data_y + ui(36 * 0), ui(160), ui(30), color_get_red(current_color), mouse_ui); tb_green.draw(data_x + ui(28), data_y + ui(36 * 1), ui(160), ui(30), color_get_green(current_color), mouse_ui); diff --git a/scripts/controlPointBox/controlPointBox.gml b/scripts/controlPointBox/controlPointBox.gml index a24291303..9578f093d 100644 --- a/scripts/controlPointBox/controlPointBox.gml +++ b/scripts/controlPointBox/controlPointBox.gml @@ -56,7 +56,7 @@ function controlPointBox(_onModify) : widget() constructor { y = _y; for( var i = 0; i < array_length(widgets); i++ ) - widgets[i].setActiveFocus(hover, active); + widgets[i].setFocusHover(active, hover); var yy = _y; diff --git a/scripts/fontScrollBox/fontScrollBox.gml b/scripts/fontScrollBox/fontScrollBox.gml index 68996efc7..068626fb2 100644 --- a/scripts/fontScrollBox/fontScrollBox.gml +++ b/scripts/fontScrollBox/fontScrollBox.gml @@ -33,7 +33,7 @@ function fontScrollBox(_onModify) : widget() constructor { w = _w; if(extra_button != noone) { - extra_button.setActiveFocus(hover, active); + extra_button.setFocusHover(active, hover); extra_button.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); w -= ui(40); } diff --git a/scripts/globalvar_drawer/globalvar_drawer.gml b/scripts/globalvar_drawer/globalvar_drawer.gml index 4beaf52ad..8a95bb9bf 100644 --- a/scripts/globalvar_drawer/globalvar_drawer.gml +++ b/scripts/globalvar_drawer/globalvar_drawer.gml @@ -30,9 +30,9 @@ function globalvar_viewer_draw(xx, yy, ww, _m, focus, hover, _scrollPane, rx, ry hh += ui(10); } - _edit.tb_name.setActiveFocus(focus, hover); - _edit.sc_type.setActiveFocus(focus, hover); - _edit.sc_disp.setActiveFocus(focus, hover); + _edit.tb_name.setFocusHover(focus, hover); + _edit.sc_type.setFocusHover(focus, hover); + _edit.sc_disp.setFocusHover(focus, hover); _edit.tb_name.draw(wd_x, yy, wd_w - wd_h - ui(4), wd_h, _inpu.name, _m, TEXTBOX_INPUT.text); if(buttonInstant(THEME.button_hide, wd_x + wd_w - wd_h, yy + ui(2), wd_h, wd_h, _m, focus, hover,, THEME.icon_delete,, COLORS._main_value_negative) == 2) diff --git a/scripts/luaRenderer/luaRenderer.gml b/scripts/luaRenderer/luaRenderer.gml index 50b644291..844d72fad 100644 --- a/scripts/luaRenderer/luaRenderer.gml +++ b/scripts/luaRenderer/luaRenderer.gml @@ -14,11 +14,11 @@ function luaArgumentRenderer() { var _typ = _jType.getValue(); var _h = 0; - _jType.editWidget.setActiveFocus(_focus, _hover); + _jType.editWidget.setFocusHover(_focus, _hover); _jType.editWidget.draw(tx, ty, ui(128), _th, _jType.display_data[_jType.showValue()], _m, argument_renderer.rx, argument_renderer.ry); var _jName = inputs[| i + 0]; - _jName.editWidget.setActiveFocus(_focus, _hover); + _jName.editWidget.setFocusHover(_focus, _hover); _jName.editWidget.draw(tx + ui(128 + 8), ty, _w - ui(128 + 8), _th, _jName.showValue(), _m, _jName.display_type); _h += _th + ui(6); @@ -28,7 +28,7 @@ function luaArgumentRenderer() { var _jValue = inputs[| i + 2]; if(_jValue.editWidget != noone) { - _jValue.editWidget.setActiveFocus(_focus, _hover); + _jValue.editWidget.setFocusHover(_focus, _hover); if(_typ == 2) { _jValue.editWidget.draw(tx + ui(64), ty + _th + ui(6), _w - ui(64), ui(96), _jValue.showValue(), _m, argument_renderer.rx, argument_renderer.ry); _h += ui(96 + 8); diff --git a/scripts/matrixGrid/matrixGrid.gml b/scripts/matrixGrid/matrixGrid.gml index 7026b3852..82e5d135e 100644 --- a/scripts/matrixGrid/matrixGrid.gml +++ b/scripts/matrixGrid/matrixGrid.gml @@ -74,7 +74,7 @@ function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor { h = _h; if(extras && instanceof(extras) == "buttonClass") { - extras.setActiveFocus(hover, active); + extras.setFocusHover(active, hover); extras.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); _w -= ui(40); } @@ -82,12 +82,12 @@ function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor { if(unit != noone && unit.reference != noone) { _w += ui(4); - unit.triggerButton.setActiveFocus(ihover, iactive); + unit.triggerButton.setFocusHover(iactive, ihover); unit.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m); _w -= ui(40); } - b_link.setActiveFocus(hover, active); + b_link.setFocusHover(active, hover); b_link.icon_index = linked; b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon; b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values"); @@ -107,7 +107,7 @@ function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor { for(var i = 0; i < 3; i++) for(var j = 0; j < 3; j++) { var ind = i * 3 + j; - tb[ind].setActiveFocus(hover, active); + tb[ind].setFocusHover(active, hover); var bx = _x + ww * j; var by = _y + hh * i; diff --git a/scripts/nodeValue_drawer/nodeValue_drawer.gml b/scripts/nodeValue_drawer/nodeValue_drawer.gml index 4497c918b..f7fdd65fc 100644 --- a/scripts/nodeValue_drawer/nodeValue_drawer.gml +++ b/scripts/nodeValue_drawer/nodeValue_drawer.gml @@ -194,13 +194,13 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc var expValid = jun.expTree != noone && jun.expTree.validate(); jun.express_edit.boxColor = expValid? COLORS._main_value_positive : COLORS._main_value_negative; - jun.express_edit.setActiveFocus(_focus, _hover); + jun.express_edit.setFocusHover(_focus, _hover); if(_focus) jun.express_edit.register(_scrollPane); var wd_h = jun.express_edit.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.expression, _m); widH = lineBreak? wd_h : 0; } else if(jun.editWidget) { - jun.editWidget.setActiveFocus(_focus, _hover); + jun.editWidget.setFocusHover(_focus, _hover); if(jun.connect_type == JUNCTION_CONNECT.input) { jun.editWidget.setInteract(jun.value_from == noone); @@ -209,6 +209,18 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc jun.editWidget.setInteract(false); } + var param = { + x: editBoxX, + y: editBoxY, + real_x: rx, + real_y: ry, + w: editBoxW, + h: editBoxH, + + data: jun.showValue(), + mouse: _m, + } + switch(jun.display_type) { case VALUE_DISPLAY.button : jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, _m); @@ -257,6 +269,9 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc var ebH = jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m); widH = lineBreak? ebH : ebH - lb_h; break; + case VALUE_DISPLAY.transform : + widH = jun.editWidget.drawParam(param); + break; } break; case VALUE_TYPE.boolean : diff --git a/scripts/node_armature/node_armature.gml b/scripts/node_armature/node_armature.gml index 8d7c3ed79..e9d651449 100644 --- a/scripts/node_armature/node_armature.gml +++ b/scripts/node_armature/node_armature.gml @@ -3,11 +3,38 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo //inputs[| 0] = nodeValue("Axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); + bone_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { + var _b = attributes.bones; + var amo = _b.childCount(); + var _h = ui(32 + 16) + amo * ui(28); + + draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); + draw_text_add(_x + ui(16), _y + ui(4), "Bones"); + + _y += ui(32); + + draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, _h, COLORS.node_composite_bg_blend, 1); + draw_set_color(COLORS.node_composite_separator); + draw_line(_x + 16, _y + ui(8), _x + _w - 16, _y + ui(8)); + + _y += ui(8); + + for( var i = 0; i < array_length(_b.childs); i++ ) { + _y = _b.childs[i].drawInspector(_x + ui(8), _y, _w - ui(16), _m, _hover, _focus); + } + + return _h; + }) + + input_display_list = [ + bone_renderer, + ]; + input_fix_len = ds_list_size(inputs); data_length = 1; static createBone = function(parent, distance, direction) { - var bone = new __Bone(parent, distance, direction); + var bone = new __Bone(parent, distance, direction,,, attributes); parent.addChild(bone); if(parent == attributes.bones) @@ -17,8 +44,16 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo outputs[| 0] = nodeValue("Armature", self, JUNCTION_CONNECT.output, VALUE_TYPE.armature, noone); - attributes.bones = new __Bone(); + attributes.bones = new __Bone(,,,,, attributes); + attributes.bones.name = "Main"; attributes.bones.is_main = true; + bone_update = false; + + attributes.display_name = true; + array_push(attributeEditors, ["Display name", "display_name", + new checkBox(function() { + attributes.display_name = !attributes.display_name; + })]); tools = [ new NodeTool( "Add bones", THEME.path_tools_transform ), @@ -95,8 +130,10 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo } } - if(mouse_release(mb_left)) + if(mouse_release(mb_left)) { builder_bone = noone; + UNDO_HOLDING = false; + } } if(isUsingTool(0)) { // builder @@ -106,14 +143,16 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo builder_type = 1; builder_sx = mx; builder_sy = my; + UNDO_HOLDING = true; } else if(anchor_selecting[1] == 1) { builder_bone = createBone(anchor_selecting[0], 0, 0); builder_type = 1; builder_sx = mx; builder_sy = my; + UNDO_HOLDING = true; } else if(anchor_selecting[1] == 2) { var _pr = anchor_selecting[0]; - var _md = new __Bone(noone, 0, 0, _pr.angle, _pr.length / 2); + var _md = new __Bone(noone, 0, 0, _pr.angle, _pr.length / 2, attributes); _pr.length = _md.length; for( var i = 0; i < array_length(_pr.childs); i++ ) @@ -121,6 +160,9 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo _pr.childs = []; _pr.addChild(_md); + + bone_update = true; + UNDO_HOLDING = true; } } } else if(isUsingTool(1)) { //remover @@ -135,6 +177,8 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo var _ch = _bone.childs[i]; _par.addChild(_ch); } + + bone_update = true; } } } else if(isUsingTool(2)) { //detach @@ -151,6 +195,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo builder_sy = lengthdir_y(par.length, par.angle); builder_mx = mx; builder_my = my; + UNDO_HOLDING = true; } } else { //mover if(anchor_selecting != noone && mouse_press(mb_left, active)) { @@ -176,10 +221,21 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo builder_my = my; } } + + UNDO_HOLDING = true; } } } + static step = function() { + if(bone_update) { + attributes.bone.updated = true; + bone_update = false; + } else { + attributes.bone.updated = false; + } + } + static update = function(frame = ANIMATOR.current_frame) { outputs[| 0].setValue(attributes.bones); } @@ -190,7 +246,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo static postDeserialize = function() { if(!struct_has(load_map, "bone")) return; - attributes.bones.deserialize(load_map.bone); + attributes.bones.deserialize(load_map.bone, attributes); } } diff --git a/scripts/node_armature_pose/node_armature_pose.gml b/scripts/node_armature_pose/node_armature_pose.gml index 6f8568f2b..cf85e4cb0 100644 --- a/scripts/node_armature_pose/node_armature_pose.gml +++ b/scripts/node_armature_pose/node_armature_pose.gml @@ -3,28 +3,254 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const inputs[| 0] = nodeValue("Armature", self, JUNCTION_CONNECT.input, VALUE_TYPE.armature, noone); + input_display_list = [ 0, + ["Bones", false] + ] + input_fix_len = ds_list_size(inputs); data_length = 1; outputs[| 0] = nodeValue("Armature", self, JUNCTION_CONNECT.output, VALUE_TYPE.armature, noone); + boneMap = ds_map_create(); + + attributes.display_name = true; + array_push(attributeEditors, ["Display name", "display_name", + new checkBox(function() { + attributes.display_name = !attributes.display_name; + })]); + + function createNewControl(bone = noone) { + var index = ds_list_size(inputs); + + inputs[| index] = nodeValue(bone != noone? bone.name : "bone", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 1 ] ) + .setDisplay(VALUE_DISPLAY.transform); + inputs[| index].extra_data[0] = bone != noone? bone.id : noone; + + if(bone != noone) + boneMap[? bone.id] = inputs[| index]; + + array_push(input_display_list, index); + } + + function setBone() { + var _b = inputs[| 0].getValue(); + if(_b == noone) return; + + var _bones = []; + var _bst = ds_stack_create(); + ds_stack_push(_bst, _b); + + while(!ds_stack_empty(_bst)) { + var __b = ds_stack_pop(_bst); + + for( var i = 0; i < array_length(__b.childs); i++ ) { + array_push(_bones, __b.childs[i]); + ds_stack_push(_bst, __b.childs[i]); + } + } + + ds_stack_destroy(_bst); + + var _inputs = ds_list_create(); + _inputs[| 0] = inputs[| 0]; + + var _input_display_list = [ + input_display_list[0], + input_display_list[1] + ]; + + for( var i = 0; i < array_length(_bones); i++ ) { + var bone = _bones[i]; + if(ds_map_exists(boneMap, bone.id)) { + var _inp = boneMap[? bone.id]; + var _idx = ds_list_size(_inputs); + + _inp.index = _idx; + array_append(_input_display_list, _idx); + ds_list_add(_inputs, _inp); + } else + createNewControl(bone); + } + + ds_list_destroy(inputs); + inputs = _inputs; + input_display_list = _input_display_list; + } + tools = [ ]; + anchor_selecting = noone; + posing_bone = noone; + posing_input = 0; + posing_type = 0; + posing_sx = 0; + posing_sy = 0; + posing_mx = 0; + posing_my = 0; + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { + var _b = outputs[| 0].getValue(); + if(_b == noone) return; + anchor_selecting = _b.draw(active, _x, _y, _s, _mx, _my, true, anchor_selecting); + + var mx = (_mx - _x) / _s; + var my = (_my - _y) / _s; + + if(posing_bone) { + if(posing_bone == 0) { //move + var bx = posing_sx + (mx - posing_mx); + var by = posing_sy + (my - posing_my); + + var val = posing_input.getValue(); + val[TRANSFORM.pos_x] = bx; + val[TRANSFORM.pos_y] = by; + if(posing_input.setValue(val)) + UNDO_HOLDING = true; + + } else if(posing_bone == 1) { //scale + var ss = point_distance(posing_mx, posing_my, mx, my) / posing_sx; + + var val = posing_input.getValue(); + val[TRANSFORM.sca_x] = ss; + if(posing_input.setValue(val)) + UNDO_HOLDING = true; + + } else if(posing_bone == 2) { //rotate + var ori = posing_bone.getPoint(0, 0); + var rot = angle_difference(point_direction(ori.x, ori.y, mx, my), posing_bone.angle); + + var val = posing_input.getValue(); + val[TRANSFORM.rot] = rot; + if(posing_input.setValue(val)) + UNDO_HOLDING = true; + + } + + if(mouse_release(mb_left)) { + posing_bone = noone; + UNDO_HOLDING = false; + } + } + + if(anchor_selecting != noone && mouse_click(mb_left, active)) { + if(anchor_selecting[1] == 0) { // move + posing_bone = anchor_selecting[0]; + if(!ds_map_exists(boneMap, posing_bone.id)) + setBone(); + posing_input = boneMap[? posing_bone.id]; + posing_type = 0; + + var val = posing_input.getValue(); + posing_sx = val[TRANSFORM.pos_x]; + posing_sy = val[TRANSFORM.pos_y]; + + posing_mx = mx; + posing_my = my; + + } else if(anchor_selecting[1] == 1) { // scale + posing_bone = anchor_selecting[0]; + if(!ds_map_exists(boneMap, posing_bone.id)) + setBone(); + posing_input = boneMap[? posing_bone.id]; + posing_type = 1; + + var val = posing_input.getValue(); + posing_sx = val[TRANSFORM.sca_x]; + + posing_mx = mx; + posing_my = my; + + } else if(anchor_selecting[1] == 2) { // rotate + posing_bone = anchor_selecting[0]; + if(!ds_map_exists(boneMap, posing_bone.id)) + setBone(); + posing_input = boneMap[? posing_bone.id]; + posing_type = 2; + + var val = posing_input.getValue(); + posing_sx = posing_bone.angle; + + posing_mx = mx; + posing_my = my; + + } + } + } + + static step = function() { + var _b = inputs[| 0].getValue(); + if(_b == noone) return; + + var _boneCount = ds_list_size(inputs) - input_fix_len; + if(_boneCount != _b.childCount()) setBone(); } static update = function(frame = ANIMATOR.current_frame) { + var _b = inputs[| 0].getValue(); + if(_b == noone) return; + var _bone_pose = _b.clone(); + + var _bst = ds_stack_create(); + ds_stack_push(_bst, _bone_pose); + + while(!ds_stack_empty(_bst)) { + var bone = ds_stack_pop(_bst); + var _id = bone.id; + + if(ds_map_exists(boneMap, _id)) { + var _inp = boneMap[? _id]; + _inp.name = bone.name; + _inp.updateName(); + + var _trn = _inp.getValue(); + + var px = _trn[0]; + var py = _trn[1]; + var rot = _trn[2]; + var sca = _trn[3]; + + var _x = lengthdir_x(bone.distance, bone.direction); + var _y = lengthdir_y(bone.distance, bone.direction); + + _x += px; + _y += py; + + bone.distance = point_distance(0, 0, _x, _y); + bone.direction = point_direction(0, 0, _x, _y); + + bone.angle += rot; + bone.length *= sca; + } + + for( var i = 0; i < array_length(bone.childs); i++ ) { + ds_stack_push(_bst, bone.childs[i]); + } + } + + ds_stack_destroy(_bst); + + outputs[| 0].setValue(_bone_pose); } static postDeserialize = function() { var _inputs = load_map.inputs; - for(var i = input_fix_len; i < array_length(_inputs); i += data_length) - createBone(); + for( var i = input_fix_len; i < array_length(_inputs); i += data_length ) + createNewControl(); + } + + static doApplyDeserialize = function() { + for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) { + var inp = inputs[| i]; + var idx = array_safe_get(inp.extra_data, 0); + + boneMap[? idx] = inp; + } } } diff --git a/scripts/node_boolean/node_boolean.gml b/scripts/node_boolean/node_boolean.gml index 6d4800a8e..f7990db9e 100644 --- a/scripts/node_boolean/node_boolean.gml +++ b/scripts/node_boolean/node_boolean.gml @@ -82,7 +82,7 @@ function Node_Boolean(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c var val = inputs[| 0].getValue(); var bbox = drawGetBbox(xx, yy, _s); - wd_checkBox.setActiveFocus(_focus, _hover); + wd_checkBox.setFocusHover(_focus, _hover); wd_checkBox.draw(bbox.xc, bbox.yc, val, [ _mx, _my ], bbox.h - 8 * _s, fa_center, fa_center); } } diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 6f5abece0..c853cb08d 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -4,7 +4,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x active = true; renderActive = true; - node_id = generateUUID(); + node_id = UUID_generate(); group = _group; destroy_when_upgroup = false; ds_list_add(PANEL_GRAPH.getNodeList(_group), self); diff --git a/scripts/node_equation/node_equation.gml b/scripts/node_equation/node_equation.gml index 7ff38cf90..c7b2d04c9 100644 --- a/scripts/node_equation/node_equation.gml +++ b/scripts/node_equation/node_equation.gml @@ -62,14 +62,14 @@ function Node_Equation(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var _h = 0; var _jName = inputs[| i + 0]; - _jName.editWidget.setActiveFocus(_focus, _hover); + _jName.editWidget.setFocusHover(_focus, _hover); _jName.editWidget.draw(tx, ty, ui(128), _th, _jName.showValue(), _m, _jName.display_type); draw_set_text(f_p1, fa_center, fa_top, COLORS._main_text_sub); draw_text_add(tx + ui(128 + 12), ty + ui(6), "="); var _jValue = inputs[| i + 1]; - _jValue.editWidget.setActiveFocus(_focus, _hover); + _jValue.editWidget.setFocusHover(_focus, _hover); _jValue.editWidget.draw(tx + ui(128 + 24), ty, _w - ui(128 + 24 + 16), _th, _jValue.showValue(), _m); _h += _th + ui(6); diff --git a/scripts/node_global/node_global.gml b/scripts/node_global/node_global.gml index 0c7e8d06c..601821a51 100644 --- a/scripts/node_global/node_global.gml +++ b/scripts/node_global/node_global.gml @@ -153,8 +153,8 @@ function variable_editor(nodeVal) constructor { var wd_h = ui(32); var lb_w = ui(72); - vb_range.setActiveFocus(_focus, _hover); - tb_step.setActiveFocus(_focus, _hover); + vb_range.setFocusHover(_focus, _hover); + tb_step.setFocusHover(_focus, _hover); draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_sub); draw_text(_x + ui(8), _y + wd_h / 2, "Range"); diff --git a/scripts/node_number/node_number.gml b/scripts/node_number/node_number.gml index 3fb1902d0..d2da2cc94 100644 --- a/scripts/node_number/node_number.gml +++ b/scripts/node_number/node_number.gml @@ -111,14 +111,14 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co wd_slider.handle_w = 24 * _s; if(sl_h > 8) { - wd_slider.setActiveFocus(_focus, _hover); + wd_slider.setFocusHover(_focus, _hover); wd_slider.draw(sl_x, sl_y, sl_w, sl_h, val, [_mx, _my], 0); draggable = !wd_slider.dragging; } break; case 2 : wd_rotator.scale = _s; - wd_rotator.setActiveFocus(_focus, _hover); + wd_rotator.setFocusHover(_focus, _hover); wd_rotator.draw(bbox.xc, bbox.yc - 48 * _s, val, [_mx, _my], false); draggable = !wd_rotator.dragging; diff --git a/scripts/node_path_l_system/node_path_l_system.gml b/scripts/node_path_l_system/node_path_l_system.gml index b2660d16f..1f3115ae8 100644 --- a/scripts/node_path_l_system/node_path_l_system.gml +++ b/scripts/node_path_l_system/node_path_l_system.gml @@ -63,12 +63,12 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text_sub); draw_text_add(_x + ui(8), ty + ui(8), string((i - input_fix_len) / data_length)); - _name.editWidget.setActiveFocus(_focus, _hover); + _name.editWidget.setFocusHover(_focus, _hover); _name.editWidget.draw(tx, ty, _tw, _th, _name.showValue(), _m, _name.display_type); draw_sprite_ui(THEME.arrow, 0, tx + _tw + ui(16), ty + _th / 2,,,, COLORS._main_icon); - _rule.editWidget.setActiveFocus(_focus, _hover); + _rule.editWidget.setFocusHover(_focus, _hover); _rule.editWidget.draw(tx + _tw + ui(32), ty, _w - (_tw + ui(8 + 24 + 32)), _th, _rule.showValue(), _m, _rule.display_type); ty += _th + ui(6); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index a3b3763e7..78b08b3dd 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -57,6 +57,7 @@ enum VALUE_DISPLAY { vector_range, area, kernel, + transform, //Curve curve, @@ -358,7 +359,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru _initName = _name; name = __txt_junction_name(instanceof(node), type, index, _name); name = _name; - internalName = string_lower(string_replace_all(_name, " ", "_")); + + static updateName = function() { + internalName = string_lower(string_replace_all(name, " ", "_")); + } updateName(); if(struct_has(node, "inputMap")) { if(_connect == JUNCTION_CONNECT.input) node.inputMap[? internalName] = self; @@ -728,6 +732,15 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru for( var i = 0; i < array_length(animators); i++ ) animators[i].suffix = " " + string(i); + extract_node = ""; + break; + case VALUE_DISPLAY.transform : + editWidget = new transformBox(function(index, _val) { + var _val = animator.getValue(); + _val[index] = val; + return setValueDirect(_val); + }); + extract_node = ""; break; } diff --git a/scripts/paddingBox/paddingBox.gml b/scripts/paddingBox/paddingBox.gml index 14f3151dd..f1ff11742 100644 --- a/scripts/paddingBox/paddingBox.gml +++ b/scripts/paddingBox/paddingBox.gml @@ -68,7 +68,7 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor { draw_sprite_ui_uniform(THEME.inspector_padding, 0, _x, _y + ui(64)); for(var i = 0; i < 4; i++) { - tb[i].setActiveFocus(hover, active); + tb[i].setFocusHover(active, hover); tb[i].align = fa_center; } @@ -77,7 +77,7 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor { tb[2].draw(_x - ui(64) - ui(64), _y + ui(64 - 17), ui(64), TEXTBOX_HEIGHT, _data[2], _m); tb[3].draw(_x - ui(32), _y + ui(64 + 48 + 8), ui(64), TEXTBOX_HEIGHT, _data[3], _m); - b_link.setActiveFocus(hover, active); + b_link.setFocusHover(active, hover); b_link.icon_index = linked; b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon; b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values"); @@ -87,7 +87,7 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor { b_link.draw(bx + ui(4), by + ui(4), ui(24), ui(24), _m, THEME.button_hide); if(unit != noone && unit.reference != noone) { - unit.triggerButton.setActiveFocus(ihover, iactive); + unit.triggerButton.setFocusHover(iactive, ihover); unit.draw(_x + ui(48), _y - ui(25), ui(32), ui(32), _m); } diff --git a/scripts/panel_addon/panel_addon.gml b/scripts/panel_addon/panel_addon.gml index 791cf852f..f6c52f3a2 100644 --- a/scripts/panel_addon/panel_addon.gml +++ b/scripts/panel_addon/panel_addon.gml @@ -174,7 +174,7 @@ function Panel_Addon() : PanelContent() constructor { tb_search.draw(px, py, pw, ui(32), search_string, [mx, my]); if(search_string == "") tb_search.sprite_index = 1; - sc_addon.setActiveFocus(pFOCUS, pHOVER); + sc_addon.setFocusHover(pFOCUS, pHOVER); sc_addon.draw(px, py + ui(40), mx - px, my - (py + ui(40))); } } \ No newline at end of file diff --git a/scripts/panel_collection/panel_collection.gml b/scripts/panel_collection/panel_collection.gml index 4094490ff..42b2ab449 100644 --- a/scripts/panel_collection/panel_collection.gml +++ b/scripts/panel_collection/panel_collection.gml @@ -341,10 +341,10 @@ function Panel_Collection() : PanelContent() constructor { var content_y = ui(48); draw_sprite_stretched(THEME.ui_panel_bg, 1, group_w, content_y, content_w, content_h); - contentPane.setActiveFocus(pFOCUS, pHOVER); + contentPane.setFocusHover(pFOCUS, pHOVER); contentPane.draw(group_w, content_y, mx - group_w, my - content_y); - folderPane.setActiveFocus(pFOCUS, pHOVER); + folderPane.setFocusHover(pFOCUS, pHOVER); folderPane.draw(0, content_y, mx, my - content_y); #region resize width diff --git a/scripts/panel_globalvar/panel_globalvar.gml b/scripts/panel_globalvar/panel_globalvar.gml index 0b53b5377..8026ceca9 100644 --- a/scripts/panel_globalvar/panel_globalvar.gml +++ b/scripts/panel_globalvar/panel_globalvar.gml @@ -45,7 +45,7 @@ function Panel_Globalvar() : PanelContent() constructor { draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); - contentPane.setActiveFocus(pFOCUS, pHOVER); + contentPane.setFocusHover(pFOCUS, pHOVER); contentPane.draw(px, py, mx - px, my - py); var bx = w - ui(32 + 16); diff --git a/scripts/panel_gradient/panel_gradient.gml b/scripts/panel_gradient/panel_gradient.gml index 4daaf5439..013bdd960 100644 --- a/scripts/panel_gradient/panel_gradient.gml +++ b/scripts/panel_gradient/panel_gradient.gml @@ -90,7 +90,7 @@ function Panel_Gradient() : PanelContent() constructor { draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); - sp_gradient.setActiveFocus(pFOCUS, pHOVER); + sp_gradient.setFocusHover(pFOCUS, pHOVER); sp_gradient.draw(px, py, mx - px, my - py); var bx = w - ui(32 + 16); diff --git a/scripts/panel_graph_export_image_dialog/panel_graph_export_image_dialog.gml b/scripts/panel_graph_export_image_dialog/panel_graph_export_image_dialog.gml index c555c5213..91411e118 100644 --- a/scripts/panel_graph_export_image_dialog/panel_graph_export_image_dialog.gml +++ b/scripts/panel_graph_export_image_dialog/panel_graph_export_image_dialog.gml @@ -77,7 +77,7 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor { var _wid = widgets[i][1]; var _dat = widgets[i][2](); - _wid.setActiveFocus(pFOCUS, pHOVER); + _wid.setFocusHover(pFOCUS, pHOVER); switch(instanceof(widgets[i][1])) { case "textBox" : _wid.draw(_tx - _ww, ty + wh * i - _hh / 2, _ww, _hh, _dat, _m); break; @@ -136,7 +136,7 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor { var sx = tx; var sy = ty + sh + ui(16); - sc_settings.setActiveFocus(pFOCUS, pHOVER); + sc_settings.setFocusHover(pFOCUS, pHOVER); sc_settings.draw(sx, sy, mx - sx, my - sy); if(is_surface(surface)) { @@ -147,7 +147,7 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor { bx = w - padding - _bw; by = h - padding - _bh; - b_export.setActiveFocus(pFOCUS, pHOVER); + b_export.setFocusHover(pFOCUS, pHOVER); b_export.draw(bx, by, _bw, _bh, _m); draw_text(bx + ui(16), by + ui(6), txt); } diff --git a/scripts/panel_history/panel_history.gml b/scripts/panel_history/panel_history.gml index 1b3ab0deb..a0df32dac 100644 --- a/scripts/panel_history/panel_history.gml +++ b/scripts/panel_history/panel_history.gml @@ -167,7 +167,7 @@ function Panel_History() : PanelContent() constructor { var ph = h - ui(title_height + padding); draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); - sc_history.setActiveFocus(pFOCUS, pHOVER); + sc_history.setFocusHover(pFOCUS, pHOVER); sc_history.draw(px, py, mx - px, my - py); } } \ No newline at end of file diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index 376ea35ad..1d9498e7b 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -148,7 +148,7 @@ function Panel_Inspector() : PanelContent() constructor { draw_sprite_stretched_ext(THEME.group_label, 0, 0, yy, con_w, ui(32), COLORS.panel_inspector_group_bg, 1); if(_b != noone) { - _b.setActiveFocus(pFOCUS, _hover); + _b.setFocusHover(pFOCUS, _hover); _b.draw(_x1, yy + ui(2), ui(28), ui(28), _m, THEME.button_hide_fill); } @@ -175,7 +175,7 @@ function Panel_Inspector() : PanelContent() constructor { yy += line_get_height() + ui(6); hh += line_get_height() + ui(6); - meta_tb[j].setActiveFocus(pFOCUS, _hover); + meta_tb[j].setFocusHover(pFOCUS, _hover); if(pFOCUS) meta_tb[j].register(contentPane); var wh = 0; @@ -291,11 +291,11 @@ function Panel_Inspector() : PanelContent() constructor { var hh = ui(40); //tb_prop_filter.register(contentPane); - //tb_prop_filter.setActiveFocus(pHOVER, pFOCUS); + //tb_prop_filter.setFocusHover(pHOVER, pFOCUS); //tb_prop_filter.draw(ui(32), _y + ui(4), con_w - ui(64), ui(28), filter_text, _m); //draw_sprite_ui(THEME.search, 0, ui(32 + 16), _y + ui(4 + 14), 1, 1, 0, COLORS._main_icon, 1); - prop_page_button.setActiveFocus(pFOCUS, pHOVER); + prop_page_button.setFocusHover(pFOCUS, pHOVER); prop_page_button.draw(ui(32), _y + ui(4), contentPane.w - ui(76), ui(28), prop_page, _m); var xc = con_w / 2; @@ -329,7 +329,7 @@ function Panel_Inspector() : PanelContent() constructor { } var val = inspecting.attributes[$ edt[1]]; - edt[2].setActiveFocus(pFOCUS, pHOVER); + edt[2].setFocusHover(pFOCUS, pHOVER); if(instanceof(edt[2]) == "buttonClass") { edt[2].text = edt[0]; @@ -588,7 +588,7 @@ function Panel_Inspector() : PanelContent() constructor { function drawInspectingNode() { tb_node_name.font = f_h5; tb_node_name.hide = true; - tb_node_name.setActiveFocus(pFOCUS, pHOVER); + tb_node_name.setFocusHover(pFOCUS, pHOVER); tb_node_name.align = fa_center; var txt = inspecting.display_name == ""? inspecting.name : inspecting.display_name; tb_node_name.draw(ui(64), ui(14), w - ui(128), ui(32), txt, [mx, my], VALUE_DISPLAY.node_title); @@ -700,7 +700,7 @@ function Panel_Inspector() : PanelContent() constructor { } } - contentPane.setActiveFocus(pFOCUS, pHOVER); + contentPane.setFocusHover(pFOCUS, pHOVER); contentPane.draw(ui(16), top_bar_h, mx - ui(16), my - top_bar_h); if(!locked && PANEL_GRAPH.node_focus && inspecting != PANEL_GRAPH.node_focus) diff --git a/scripts/panel_nodes/panel_nodes.gml b/scripts/panel_nodes/panel_nodes.gml index 8751f6853..73b4b2229 100644 --- a/scripts/panel_nodes/panel_nodes.gml +++ b/scripts/panel_nodes/panel_nodes.gml @@ -110,10 +110,10 @@ function Panel_Nodes() : PanelContent() constructor { var ph = h - ui(title_height + padding); draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); - tb_search.setActiveFocus(pFOCUS, pHOVER); + tb_search.setFocusHover(pFOCUS, pHOVER); tb_search.draw(px, py, pw, ui(32), search_string, [mx, my]); - sc_nodes.setActiveFocus(pFOCUS, pHOVER); + sc_nodes.setFocusHover(pFOCUS, pHOVER); sc_nodes.draw(px, py + ui(40), mx - px, my - (py + ui(40))); } } \ No newline at end of file diff --git a/scripts/panel_notification/panel_notification.gml b/scripts/panel_notification/panel_notification.gml index bb492ec38..eff5f0b6a 100644 --- a/scripts/panel_notification/panel_notification.gml +++ b/scripts/panel_notification/panel_notification.gml @@ -175,7 +175,7 @@ function Panel_Notification() : PanelContent() constructor { var ph = h - ui(title_height + padding); draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); - sp_noti.setActiveFocus(pHOVER, pHOVER); + sp_noti.setFocusHover(pHOVER, pHOVER); sp_noti.draw(px, py, mx - px, my - py); } } \ No newline at end of file diff --git a/scripts/panel_palette/panel_palette.gml b/scripts/panel_palette/panel_palette.gml index d69786866..31fb66988 100644 --- a/scripts/panel_palette/panel_palette.gml +++ b/scripts/panel_palette/panel_palette.gml @@ -106,7 +106,7 @@ function Panel_Palette() : PanelContent() constructor { draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); - sp_palettes.setActiveFocus(pFOCUS, pHOVER); + sp_palettes.setFocusHover(pFOCUS, pHOVER); sp_palettes.draw(px, py, mx - px, my - py); var bx = w - ui(32 + 16); diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index 4218126a1..a25ea6915 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -312,7 +312,7 @@ function Panel_Preview() : PanelContent() constructor { ww = max(ww, string_width(_node.outputs[| i].name) + ui(40)); } sbChannel.data_list = chName; - sbChannel.setActiveFocus(pFOCUS, pHOVER); + sbChannel.setFocusHover(pFOCUS, pHOVER); sbChannel.draw(_x - ww, _y - hh / 2, ww, hh, currName, [mx, my], x, y); right_menu_y += ui(40); @@ -692,7 +692,7 @@ function Panel_Preview() : PanelContent() constructor { tolx += string_width(nme) + ui(8); tol_max_w += string_width(nme) + ui(8); - wdg.setActiveFocus(pFOCUS, pHOVER); + wdg.setFocusHover(pFOCUS, pHOVER); switch(instanceof(wdg)) { case "textBox" : wdg.draw(tolx, toly, tolw, tolh, atr[$ key], [ mx, my ]); diff --git a/scripts/panel_test/panel_test.gml b/scripts/panel_test/panel_test.gml index dd2b2a8a2..f4e79ece5 100644 --- a/scripts/panel_test/panel_test.gml +++ b/scripts/panel_test/panel_test.gml @@ -63,7 +63,7 @@ function Panel_Test() : PanelContent() constructor { draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text); draw_text(8, yy + hh / 2, "Directory"); - tb_test_dir.setActiveFocus(pFOCUS, pHOVER); + tb_test_dir.setFocusHover(pFOCUS, pHOVER); tb_test_dir.draw(128, yy, w - 8 - 128, hh, test_dir, [ mx, my ]); yy += hh + 8; diff --git a/scripts/panel_tunnels/panel_tunnels.gml b/scripts/panel_tunnels/panel_tunnels.gml index 02f1ff2b8..359868f9c 100644 --- a/scripts/panel_tunnels/panel_tunnels.gml +++ b/scripts/panel_tunnels/panel_tunnels.gml @@ -166,7 +166,7 @@ function Panel_Tunnels() : PanelContent() constructor { if(search_string == "") tb_search.sprite_index = 1; - sc_tunnel.setActiveFocus(pFOCUS, pHOVER); + sc_tunnel.setFocusHover(pFOCUS, pHOVER); sc_tunnel.draw(px, py + ui(40), mx - px, my - (py + ui(40))); var bx = w - ui(32 + 16); diff --git a/scripts/pathArrayBox/pathArrayBox.gml b/scripts/pathArrayBox/pathArrayBox.gml index 742c6643b..0dc8f8305 100644 --- a/scripts/pathArrayBox/pathArrayBox.gml +++ b/scripts/pathArrayBox/pathArrayBox.gml @@ -23,7 +23,7 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor { w = _w; h = _h; - openPath.setActiveFocus(hover, active); + openPath.setFocusHover(active, hover); openPath.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); _w -= ui(40); diff --git a/scripts/random_function/random_function.gml b/scripts/random_function/random_function.gml index b428122a9..632f62025 100644 --- a/scripts/random_function/random_function.gml +++ b/scripts/random_function/random_function.gml @@ -76,18 +76,10 @@ function getWiggle(_min, _max, _freq, _time, seed_shift = 0, startTime = noone, return lerp(_min, _max, _lrp); } -function generateUUID() { - randomize(); - var uuid; - do { - uuid = irandom(1000000000); - } until(!ds_map_exists(NODE_MAP, uuid)) - return uuid; -} - -function UUID_generate() { +function UUID_generate(length = 16) { + static str = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + var _id = ""; - repeat(16) - _id += chr(choose(irandom_range(48, 57), irandom_range(65, 90), irandom_range(97, 122))); + repeat(length) _id += string_char_at(str, irandom_range(1, string_length(str))); return _id; } \ No newline at end of file diff --git a/scripts/rangeBox/rangeBox.gml b/scripts/rangeBox/rangeBox.gml index 3be22eb17..64574d671 100644 --- a/scripts/rangeBox/rangeBox.gml +++ b/scripts/rangeBox/rangeBox.gml @@ -54,7 +54,7 @@ function rangeBox(_type, _onModify) : widget() constructor { w = _w; h = _h; - b_link.setActiveFocus(hover, active); + b_link.setFocusHover(active, hover); b_link.icon_index = linked; b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon; b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values"); @@ -67,7 +67,7 @@ function rangeBox(_type, _onModify) : widget() constructor { _w -= ui(28); if(extras != -1 && is_struct(extras) && instanceof(extras) == "buttonClass") { - extras.setActiveFocus(hover, active); + extras.setFocusHover(active, hover); extras.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); _w -= ui(40); } @@ -75,7 +75,7 @@ function rangeBox(_type, _onModify) : widget() constructor { if(is_array(_data) && array_length(_data) >= 2) { var ww = _w / 2; for(var i = 0; i < 2; i++) { - tb[i].setActiveFocus(hover, active); + tb[i].setFocusHover(active, hover); var bx = _x + ww * i; tb[i].draw(bx + ui(44), _y, ww - ui(44), _h, _data[i], _m); diff --git a/scripts/rotator/rotator.gml b/scripts/rotator/rotator.gml index 4e8b73af1..67c3f3918 100644 --- a/scripts/rotator/rotator.gml +++ b/scripts/rotator/rotator.gml @@ -34,7 +34,7 @@ function rotator(_onModify, _step = -1) : widget() constructor { var knob_y = _y + ui(48) * scale; if(draw_tb) { - tb_value.setActiveFocus(hover, active); + tb_value.setFocusHover(active, hover); tb_value.draw(_x + ui(64), knob_y - ui(17), ui(64), TEXTBOX_HEIGHT, _data, _m); } diff --git a/scripts/rotatorRange/rotatorRange.gml b/scripts/rotatorRange/rotatorRange.gml index 8edb5c555..5b482a723 100644 --- a/scripts/rotatorRange/rotatorRange.gml +++ b/scripts/rotatorRange/rotatorRange.gml @@ -35,8 +35,8 @@ function rotatorRange(_onModify) : widget() constructor { if(!is_real(_data[1])) return; var knob_y = _y + ui(48); - tb_min.setActiveFocus(hover, active); - tb_max.setActiveFocus(hover, active); + tb_min.setFocusHover(active, hover); + tb_max.setFocusHover(active, hover); tb_min.draw(_x - ui(40 + 16 + 80), knob_y - TEXTBOX_HEIGHT / 2, ui(80), TEXTBOX_HEIGHT, array_safe_get(_data, 0), _m); tb_max.draw(_x + ui(40 + 16), knob_y - TEXTBOX_HEIGHT / 2, ui(80), TEXTBOX_HEIGHT, array_safe_get(_data, 1), _m); diff --git a/scripts/scrollBox/scrollBox.gml b/scripts/scrollBox/scrollBox.gml index 8e4c89b60..7ef82f7b0 100644 --- a/scripts/scrollBox/scrollBox.gml +++ b/scripts/scrollBox/scrollBox.gml @@ -38,7 +38,7 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor w = _w; if(extra_button != noone) { - extra_button.setActiveFocus(hover, active); + extra_button.setFocusHover(active, hover); extra_button.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); w -= ui(40); } diff --git a/scripts/slider/slider.gml b/scripts/slider/slider.gml index 525ac2cc1..41ee22237 100644 --- a/scripts/slider/slider.gml +++ b/scripts/slider/slider.gml @@ -64,7 +64,7 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg if(tb_w > 0) { sw = _w - (tb_w + ui(16)); - tb_value.setActiveFocus(hover, active); + tb_value.setFocusHover(active, hover); tb_value.draw(_x + sw + ui(16), _y, tb_w, _h, _data, _m); } diff --git a/scripts/sliderRange/sliderRange.gml b/scripts/sliderRange/sliderRange.gml index 6c00dfd9c..83ac06fa0 100644 --- a/scripts/sliderRange/sliderRange.gml +++ b/scripts/sliderRange/sliderRange.gml @@ -43,10 +43,10 @@ function sliderRange(_min, _max, _step, _onModify) : widget() constructor { var tb_w = ui(64); var sw = _w - (tb_w + ui(16)) * 2; - tb_value_min.setActiveFocus(hover, active); + tb_value_min.setFocusHover(active, hover); tb_value_min.draw(_x, _y, tb_w, TEXTBOX_HEIGHT, _data[0], _m); - tb_value_max.setActiveFocus(hover, active); + tb_value_max.setFocusHover(active, hover); tb_value_max.draw(_x + _w - tb_w, _y, tb_w, TEXTBOX_HEIGHT, _data[1], _m); var _x0 = _x + tb_w + ui(16); diff --git a/scripts/textArea/textArea.gml b/scripts/textArea/textArea.gml index c7d7cfcd7..880478ef0 100644 --- a/scripts/textArea/textArea.gml +++ b/scripts/textArea/textArea.gml @@ -474,7 +474,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod //} if(extras && instanceof(extras) == "buttonClass") { - extras.setActiveFocus(hover, active); + extras.setFocusHover(active, hover); extras.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); _w -= ui(40); } diff --git a/scripts/textBox/textBox.gml b/scripts/textBox/textBox.gml index 8fff0dc93..801f7037b 100644 --- a/scripts/textBox/textBox.gml +++ b/scripts/textBox/textBox.gml @@ -333,7 +333,7 @@ function textBox(_input, _onModify, _extras = noone) : textInput(_input, _onModi } if(extras && instanceof(extras) == "buttonClass") { - extras.setActiveFocus(hover, active); + extras.setFocusHover(active, hover); extras.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); _w -= ui(40); } diff --git a/scripts/transformBox/transformBox.gml b/scripts/transformBox/transformBox.gml new file mode 100644 index 000000000..40d8ed3a3 --- /dev/null +++ b/scripts/transformBox/transformBox.gml @@ -0,0 +1,72 @@ +enum TRANSFORM { + pos_x, + pos_y, + rot, + sca_x, + sca_y +} + +function transformBox(_onModify) : widget() constructor { + onModify = _onModify; + + onModifySingle[TRANSFORM.pos_x] = function(val) { onModify(TRANSFORM.pos_x, val); } + onModifySingle[TRANSFORM.pos_y] = function(val) { onModify(TRANSFORM.pos_y, val); } + onModifySingle[TRANSFORM.rot ] = function(val) { onModify(TRANSFORM.rot , val); } + onModifySingle[TRANSFORM.sca_x] = function(val) { onModify(TRANSFORM.sca_x, val); } + onModifySingle[TRANSFORM.sca_y] = function(val) { onModify(TRANSFORM.sca_y, val); } + + for(var i = 0; i < 5; i++) { + tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]); + tb[i].slidable = true; + } + + static setInteract = function(interactable = noone) { + self.interactable = interactable; + + for( var i = 0; i < array_length(tb); i++ ) + tb[i].interactable = interactable; + } + + static register = function(parent = noone) { + for( var i = 0; i < array_length(tb); i++ ) + tb[i].register(parent); + } + + static drawParam = function(param) { + return draw(param.x, param.y, param.w, param.data, param.mouse); + } + + static draw = function(_x, _y, _w, _data, _m) { + x = _x; + y = _y; + w = _w; + h = ui(192); + + for(var i = 0; i < array_length(_data); i++) + tb[i].setFocusHover(active, hover); + + var tbh = TEXTBOX_HEIGHT; + + draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_inner); + draw_text(_x + ui(8), _y + tbh / 2, "Position"); + + var tbw = (_w - ui(64)) / 2 - ui(4); + tb[TRANSFORM.pos_x].draw(_x + ui(64), _y, tbw, tbh, _data[TRANSFORM.pos_x], _m); + tb[TRANSFORM.pos_y].draw(_x + ui(64 + 8) + tbw, _y, tbw, tbh, _data[TRANSFORM.pos_y], _m); + + _y += ui(80); + + draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_inner); + draw_text(_x + ui(8), _y + tbh / 2, "Scale"); + + var tbw = array_length(_data) > 4? (_w - ui(64)) / 2 - ui(4) : _w - ui(64); + + tb[TRANSFORM.sca_x].draw(_x + ui(64), _y, tbw, tbh, _data[TRANSFORM.sca_x], _m); + if(array_length(_data) > 4) + tb[TRANSFORM.sca_y].draw(_x + ui(64 + 8) + tbw, _y, tbw, tbh, _data[TRANSFORM.sca_y], _m); + + resetFocus(); + + return h; + } +} \ No newline at end of file diff --git a/scripts/transformBox/transformBox.yy b/scripts/transformBox/transformBox.yy new file mode 100644 index 000000000..e4baef90e --- /dev/null +++ b/scripts/transformBox/transformBox.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "transformBox", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "widgets", + "path": "folders/widgets.yy", + }, +} \ No newline at end of file diff --git a/scripts/vectorBox/vectorBox.gml b/scripts/vectorBox/vectorBox.gml index 92baabfb3..48aa534e2 100644 --- a/scripts/vectorBox/vectorBox.gml +++ b/scripts/vectorBox/vectorBox.gml @@ -84,7 +84,7 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { current_value = _data; if(extras && instanceof(extras) == "buttonClass") { - extras.setActiveFocus(hover, active); + extras.setFocusHover(active, hover); extras.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); _w -= ui(40); } @@ -92,12 +92,12 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { if(unit != noone && unit.reference != noone) { _w += ui(4); - unit.triggerButton.setActiveFocus(ihover, iactive); + unit.triggerButton.setFocusHover(iactive, ihover); unit.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m); _w -= ui(40); } - b_link.setActiveFocus(hover, active); + b_link.setFocusHover(active, hover); b_link.icon_index = linked; b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon; b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values"); @@ -112,7 +112,7 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { var sz = min(size, array_length(_data)); var ww = _w / sz; for(var i = 0; i < sz; i++) { - tb[i].setActiveFocus(hover, active); + tb[i].setFocusHover(active, hover); var bx = _x + ww * i; tb[i].draw(bx + ui(24), _y, ww - ui(24), _h, _data[i], _m); diff --git a/scripts/vectorRangeBox/vectorRangeBox.gml b/scripts/vectorRangeBox/vectorRangeBox.gml index 2f87f43bd..2f6173753 100644 --- a/scripts/vectorRangeBox/vectorRangeBox.gml +++ b/scripts/vectorRangeBox/vectorRangeBox.gml @@ -63,7 +63,7 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const w = _w; h = _h * 2 + ui(4); - b_link.setActiveFocus(hover, active); + b_link.setFocusHover(active, hover); b_link.icon_index = linked; b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon; b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values"); @@ -76,14 +76,14 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const _w -= ui(28); if(extras && instanceof(extras) == "buttonClass") { - extras.setActiveFocus(hover, active); + extras.setFocusHover(active, hover); extras.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); _w -= ui(40); } var ww = _w / size * 2; for(var i = 0; i < size; i++) { - tb[i].setActiveFocus(hover, active); + tb[i].setFocusHover(active, hover); var bx = _x + ww * floor(i / 2); var by = _y + i % 2 * (_h + ui(4)); diff --git a/scripts/widget/widget.gml b/scripts/widget/widget.gml index 63106e3e2..b34ae1293 100644 --- a/scripts/widget/widget.gml +++ b/scripts/widget/widget.gml @@ -56,7 +56,7 @@ function widget() constructor { WIDGET_CURRENT_SCROLL = noone; } - static setActiveFocus = function(active = false, hover = false) { + static setFocusHover = function(active = false, hover = false) { self.active = interactable && active; self.hover = interactable && hover; self.iactive = active; @@ -67,4 +67,7 @@ function widget() constructor { active = false; hover = false; } + + static draw_param = function(param) {} + static draw = function() {} } \ No newline at end of file