diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index d47deb387..7a64d4a84 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -63,6 +63,7 @@ {"name":"variables","order":37,"path":"folders/functions/variables.yy",}, {"name":"vector","order":38,"path":"folders/functions/vector.yy",}, {"name":"window","order":39,"path":"folders/functions/window.yy",}, + {"name":"game engines","order":335,"path":"folders/game engines.yy",}, {"name":"main","order":328,"path":"folders/main.yy",}, {"name":"components","order":3,"path":"folders/main/components.yy",}, {"name":"misc","order":338,"path":"folders/misc.yy",}, @@ -92,7 +93,6 @@ {"name":"effects","order":4,"path":"folders/nodes/data/filter/effects.yy",}, {"name":"fixes","order":5,"path":"folders/nodes/data/filter/fixes.yy",}, {"name":"warps","order":6,"path":"folders/nodes/data/filter/warps.yy",}, - {"name":"game engines","order":335,"path":"folders/game engines.yy",}, {"name":"generator","order":5,"path":"folders/nodes/data/generator.yy",}, {"name":"noise","order":1,"path":"folders/nodes/data/generator/noise.yy",}, {"name":"pattern","order":2,"path":"folders/nodes/data/generator/pattern.yy",}, @@ -483,7 +483,8 @@ {"name":"BBMOD_Vec3","order":5,"path":"scripts/BBMOD_Vec3/BBMOD_Vec3.yy",}, {"name":"BBMOD_Vec4","order":6,"path":"scripts/BBMOD_Vec4/BBMOD_Vec4.yy",}, {"name":"bin_function","order":11,"path":"scripts/bin_function/bin_function.yy",}, - {"name":"binder_gamemaker_room","order":4,"path":"scripts/binder_gamemaker_room/binder_gamemaker_room.yy",}, + {"name":"binder_gamemaker_room","order":5,"path":"scripts/binder_gamemaker_room/binder_gamemaker_room.yy",}, + {"name":"binder_gamemaker_tile","order":4,"path":"scripts/binder_gamemaker_tile/binder_gamemaker_tile.yy",}, {"name":"binder_gamemaker","order":3,"path":"scripts/binder_gamemaker/binder_gamemaker.yy",}, {"name":"biterator","order":1,"path":"scripts/biterator/biterator.yy",}, {"name":"buffer_object","order":1,"path":"scripts/buffer_object/buffer_object.yy",}, @@ -634,7 +635,7 @@ {"name":"function_register","order":2,"path":"scripts/function_register/function_register.yy",}, {"name":"fx_controller","order":1,"path":"scripts/fx_controller/fx_controller.yy",}, {"name":"gameframe","order":3,"path":"scripts/gameframe/gameframe.yy",}, - {"name":"gamemakerPathBox","order":5,"path":"scripts/gamemakerPathBox/gamemakerPathBox.yy",}, + {"name":"gamemakerPathBox","order":6,"path":"scripts/gamemakerPathBox/gamemakerPathBox.yy",}, {"name":"getGradientData","order":1,"path":"scripts/getGradientData/getGradientData.yy",}, {"name":"gif_reader","order":4,"path":"scripts/gif_reader/gif_reader.yy",}, {"name":"globals","order":2,"path":"scripts/globals/globals.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 05da81670..865bd3b8f 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -101,6 +101,8 @@ {"$GMFolder":"","%Name":"variables","folderPath":"folders/functions/variables.yy","name":"variables","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"vector","folderPath":"folders/functions/vector.yy","name":"vector","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"window","folderPath":"folders/functions/window.yy","name":"window","resourceType":"GMFolder","resourceVersion":"2.0",}, + {"$GMFolder":"","%Name":"game engines","folderPath":"folders/game engines.yy","name":"game engines","resourceType":"GMFolder","resourceVersion":"2.0",}, + {"$GMFolder":"","%Name":"gamemaker","folderPath":"folders/game engines/gamemaker.yy","name":"gamemaker","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"main","folderPath":"folders/main.yy","name":"main","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"components","folderPath":"folders/main/components.yy","name":"components","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"misc","folderPath":"folders/misc.yy","name":"misc","resourceType":"GMFolder","resourceVersion":"2.0",}, @@ -140,8 +142,6 @@ {"$GMFolder":"","%Name":"effects","folderPath":"folders/nodes/data/filter/effects.yy","name":"effects","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"fixes","folderPath":"folders/nodes/data/filter/fixes.yy","name":"fixes","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"warps","folderPath":"folders/nodes/data/filter/warps.yy","name":"warps","resourceType":"GMFolder","resourceVersion":"2.0",}, - {"$GMFolder":"","%Name":"game engines","folderPath":"folders/game engines.yy","name":"game engines","resourceType":"GMFolder","resourceVersion":"2.0",}, - {"$GMFolder":"","%Name":"gamemaker","folderPath":"folders/game engines/gamemaker.yy","name":"gamemaker","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"generator","folderPath":"folders/nodes/data/generator.yy","name":"generator","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"drawer","folderPath":"folders/nodes/data/generator/drawer.yy","name":"drawer","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"noise","folderPath":"folders/nodes/data/generator/noise.yy","name":"noise","resourceType":"GMFolder","resourceVersion":"2.0",}, @@ -944,6 +944,7 @@ {"id":{"name":"BBMOD_Vec4","path":"scripts/BBMOD_Vec4/BBMOD_Vec4.yy",},}, {"id":{"name":"bin_function","path":"scripts/bin_function/bin_function.yy",},}, {"id":{"name":"binder_gamemaker_room","path":"scripts/binder_gamemaker_room/binder_gamemaker_room.yy",},}, + {"id":{"name":"binder_gamemaker_tile","path":"scripts/binder_gamemaker_tile/binder_gamemaker_tile.yy",},}, {"id":{"name":"binder_gamemaker","path":"scripts/binder_gamemaker/binder_gamemaker.yy",},}, {"id":{"name":"biterator","path":"scripts/biterator/biterator.yy",},}, {"id":{"name":"blurSurface","path":"scripts/blurSurface/blurSurface.yy",},}, diff --git a/objects/o_dialog_add_node/Draw_64.gml b/objects/o_dialog_add_node/Draw_64.gml index 5188ffe1f..6635d4466 100644 --- a/objects/o_dialog_add_node/Draw_64.gml +++ b/objects/o_dialog_add_node/Draw_64.gml @@ -39,14 +39,14 @@ if !ready exit; var bx = dialog_x + dialog_w - ui(44); var by = dialog_y + ui(16); - var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, + var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, PREFERENCES.dialog_add_node_view? __txtx("view_list", "List view") : __txtx("view_grid", "Grid view"), THEME.view_mode, PREFERENCES.dialog_add_node_view, COLORS._main_icon); if(b == 2) PREFERENCES.dialog_add_node_view = !PREFERENCES.dialog_add_node_view; bx -= ui(32); - var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, + var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, PREFERENCES.dialog_add_node_grouping? __txtx("add_node_group_enabled", "Group enabled") : __txtx("add_node_group_disabled", "Group disabled"), THEME.view_group, PREFERENCES.dialog_add_node_grouping, COLORS._main_icon); if(b == 2) @@ -56,14 +56,14 @@ if !ready exit; var txt = node_show_connectable? __txtx("add_node_show_connect", "Showing connectable") : __txtx("add_node_show_all", "Showing all"); var cc = node_show_connectable? COLORS._main_accent : COLORS._main_icon; bx -= ui(32); - if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, txt, THEME.filter_type, node_show_connectable, cc) == 2) + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, txt, THEME.filter_type, node_show_connectable, cc) == 2) node_show_connectable = !node_show_connectable; } if(search_string != "") { var txt = __txtx("add_node_highlight", "Hightlight Query"); bx -= ui(32); - if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, txt, THEME.add_node_search_high, PREFERENCES.dialog_add_node_search_high, COLORS._main_icon) == 2) + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, txt, THEME.add_node_search_high, PREFERENCES.dialog_add_node_search_high, COLORS._main_icon) == 2) PREFERENCES.dialog_add_node_search_high = !PREFERENCES.dialog_add_node_search_high; } #endregion diff --git a/objects/o_dialog_color_selector/Draw_64.gml b/objects/o_dialog_color_selector/Draw_64.gml index a24885dc5..6a2df538b 100644 --- a/objects/o_dialog_color_selector/Draw_64.gml +++ b/objects/o_dialog_color_selector/Draw_64.gml @@ -44,16 +44,16 @@ if !ready exit; var by = dialog_y + ui(12); var bs = ui(28); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sFOCUS, sHOVER, __txt("Refresh"), THEME.refresh_20) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sHOVER, sFOCUS, __txt("Refresh"), THEME.refresh_20) == 2) __initPalette(); bx -= ui(32); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sFOCUS, sHOVER, __txtx("color_selector_open_palette", "Open palette folder"), THEME.path_open_20) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sHOVER, sFOCUS, __txtx("color_selector_open_palette", "Open palette folder"), THEME.path_open_20) == 2) shellOpenExplorer($"{DIRECTORY}Palettes"); draw_sprite_ui_uniform(THEME.path_open_20, 1, bx + bs / 2, by + bs / 2, 1, c_white); bx -= ui(32); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sFOCUS, sHOVER, __txt("Show on Selector"), THEME.display_palette, NODE_COLOR_SHOW_PALETTE, c_white) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sHOVER, sFOCUS, __txt("Show on Selector"), THEME.display_palette, NODE_COLOR_SHOW_PALETTE, c_white) == 2) NODE_COLOR_SHOW_PALETTE = !NODE_COLOR_SHOW_PALETTE; bx -= ui(32); #endregion diff --git a/objects/o_dialog_crashed/Draw_64.gml b/objects/o_dialog_crashed/Draw_64.gml index 47c584f91..832e434e1 100644 --- a/objects/o_dialog_crashed/Draw_64.gml +++ b/objects/o_dialog_crashed/Draw_64.gml @@ -27,13 +27,13 @@ draw_set_alpha(1); var by0 = by1 - bh; draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); - var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sHOVER, sFOCUS); draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Ignore")); if(b == 2) instance_destroy(); bx0 -= bw + ui(12); - var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sHOVER, sFOCUS); draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Restore")); if(b == 2) { var path = string(DIRECTORY) + "prev_crash.pxc"; @@ -42,7 +42,7 @@ draw_set_alpha(1); } bx0 = dialog_x + ui(16); - var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sHOVER, sFOCUS); draw_text(bx0 + bw / 2, by0 + bh / 2, __txtx("crashed_log", "Log file") + "..."); if(b == 2) { var path = string(DIRECTORY) + "crash_log.txt"; diff --git a/objects/o_dialog_crashed/o_dialog_crashed.yy b/objects/o_dialog_crashed/o_dialog_crashed.yy index 339888dbd..d398247c6 100644 --- a/objects/o_dialog_crashed/o_dialog_crashed.yy +++ b/objects/o_dialog_crashed/o_dialog_crashed.yy @@ -2,8 +2,8 @@ "$GMObject":"", "%Name":"o_dialog_crashed", "eventList":[ - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"o_dialog_crashed", diff --git a/objects/o_dialog_drag_folder/Draw_64.gml b/objects/o_dialog_drag_folder/Draw_64.gml index 7443588af..d9bd73363 100644 --- a/objects/o_dialog_drag_folder/Draw_64.gml +++ b/objects/o_dialog_drag_folder/Draw_64.gml @@ -29,7 +29,7 @@ if !ready exit; var bx = dialog_x + dialog_w - ui(120); dir_y += ui(48); - if(buttonInstant(THEME.button_def, bx, dir_y, ui(100), ui(40), mouse_ui, sFOCUS, sHOVER) == 2) { + if(buttonInstant(THEME.button_def, bx, dir_y, ui(100), ui(40), mouse_ui, sHOVER, sFOCUS) == 2) { if(target) { var paths = paths_to_array_ext(dir_paths, dir_filter); target.updatePaths(paths); diff --git a/objects/o_dialog_exit/Draw_64.gml b/objects/o_dialog_exit/Draw_64.gml index 244301dd2..4f9b9bb95 100644 --- a/objects/o_dialog_exit/Draw_64.gml +++ b/objects/o_dialog_exit/Draw_64.gml @@ -42,13 +42,13 @@ if(sFOCUS) DIALOG_DRAW_FOCUS var by0 = by1 - bh; draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); - var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sHOVER, sFOCUS); draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Cancel")); if(b == 2) _des = true; bx0 -= bw + ui(12); - var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sHOVER, sFOCUS); draw_text(bx0 + bw / 2, by0 + bh / 2, __txtx("dont_save", "Don't save")); if(b == 2) { if(instance_number(o_dialog_exit) == 1) @@ -57,7 +57,7 @@ if(sFOCUS) DIALOG_DRAW_FOCUS } bx0 -= bw + ui(12); - var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sHOVER, sFOCUS); draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Save")); if(b == 2 && SAVE(project)) { if(instance_number(o_dialog_exit) == 1) diff --git a/objects/o_dialog_exit/o_dialog_exit.yy b/objects/o_dialog_exit/o_dialog_exit.yy index 8914aa4db..f6382b022 100644 --- a/objects/o_dialog_exit/o_dialog_exit.yy +++ b/objects/o_dialog_exit/o_dialog_exit.yy @@ -2,9 +2,9 @@ "$GMObject":"", "%Name":"o_dialog_exit", "eventList":[ - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"o_dialog_exit", diff --git a/objects/o_dialog_file_name_action/Draw_64.gml b/objects/o_dialog_file_name_action/Draw_64.gml index cc91329d8..3b0401140 100644 --- a/objects/o_dialog_file_name_action/Draw_64.gml +++ b/objects/o_dialog_file_name_action/Draw_64.gml @@ -47,7 +47,7 @@ var icon = THEME.accept; var clr = COLORS._main_value_positive; - if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, txt, icon, 0, clr) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sHOVER, sFOCUS, txt, icon, 0, clr) == 2) { } @@ -57,7 +57,7 @@ var icon = THEME.cross; var clr = COLORS._main_value_negative; - if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, txt, icon, 0, clr) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sHOVER, sFOCUS, txt, icon, 0, clr) == 2) { instance_destroy(); } diff --git a/objects/o_dialog_file_name_action/o_dialog_file_name_action.yy b/objects/o_dialog_file_name_action/o_dialog_file_name_action.yy index 7d5836c8e..59c8324cf 100644 --- a/objects/o_dialog_file_name_action/o_dialog_file_name_action.yy +++ b/objects/o_dialog_file_name_action/o_dialog_file_name_action.yy @@ -2,8 +2,8 @@ "$GMObject":"", "%Name":"o_dialog_file_name_action", "eventList":[ - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"o_dialog_file_name_action", diff --git a/objects/o_dialog_file_name_collection/Draw_64.gml b/objects/o_dialog_file_name_collection/Draw_64.gml index 865fba253..119980d12 100644 --- a/objects/o_dialog_file_name_collection/Draw_64.gml +++ b/objects/o_dialog_file_name_collection/Draw_64.gml @@ -29,7 +29,7 @@ var bx = dialog_x + dialog_w - ui(8) - bw; var by = dialog_y + ui(24) - bh / 2; - if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, __txt("Close"), THEME.cross_16, 0, COLORS._main_value_negative) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sHOVER, sFOCUS, __txt("Close"), THEME.cross_16, 0, COLORS._main_value_negative) == 2) instance_destroy(); bx -= bw + ui(4); @@ -59,7 +59,7 @@ instance_destroy(); } else { - if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, txt, icon, 0, clr) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sHOVER, sFOCUS, txt, icon, 0, clr) == 2) { if(meta.author_steam_id == 0) meta.author_steam_id = STEAM_USER_ID; @@ -107,7 +107,7 @@ bx -= bw + ui(4); var txt = __txtx("new_collection_meta_edit", "Edit metadata"); - if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, txt, THEME.arrow, meta_expand? 3 : 0) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sHOVER, sFOCUS, txt, THEME.arrow, meta_expand? 3 : 0) == 2) doExpand(); #endregion diff --git a/objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy b/objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy index 31c520f09..de1cf5152 100644 --- a/objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy +++ b/objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy @@ -2,8 +2,8 @@ "$GMObject":"", "%Name":"o_dialog_file_name_collection", "eventList":[ - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"o_dialog_file_name_collection", diff --git a/objects/o_dialog_gradient/Draw_64.gml b/objects/o_dialog_gradient/Draw_64.gml index ef8b8b04a..2954eb7ce 100644 --- a/objects/o_dialog_gradient/Draw_64.gml +++ b/objects/o_dialog_gradient/Draw_64.gml @@ -49,7 +49,7 @@ if !ready exit; var by = dialog_y + ui(12); var bs = ui(28); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sFOCUS, sHOVER, __txtx("add_preset", "Add to preset"), THEME.add_20) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sHOVER, sFOCUS, __txtx("add_preset", "Add to preset"), THEME.add_20) == 2) { var dia = dialogCall(o_dialog_file_name, mouse_mx + ui(8), mouse_my + ui(8)); dia.onModify = function (txt) { var gradStr = ""; @@ -66,11 +66,11 @@ if !ready exit; } bx -= ui(32); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sFOCUS, sHOVER, __txt("Refresh"), THEME.refresh_20) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sHOVER, sFOCUS, __txt("Refresh"), THEME.refresh_20) == 2) __initGradient(); bx -= ui(32); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sFOCUS, sHOVER, __txtx("graident_editor_open_folder", "Open gradient folder"), THEME.path_open_20) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sHOVER, sFOCUS, __txtx("graident_editor_open_folder", "Open gradient folder"), THEME.path_open_20) == 2) { var _realpath = DIRECTORY + "Gradients"; shellOpenExplorer(_realpath) } @@ -87,7 +87,7 @@ if !ready exit; var bx = palette_x + palette_w - ui(44); var by = dialog_y + ui(12); - if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, __txt("Show on Selector"), THEME.display_palette, NODE_COLOR_SHOW_PALETTE, c_white) == 2) + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, __txt("Show on Selector"), THEME.display_palette, NODE_COLOR_SHOW_PALETTE, c_white) == 2) NODE_COLOR_SHOW_PALETTE = !NODE_COLOR_SHOW_PALETTE; bx -= ui(32); #endregion @@ -98,7 +98,7 @@ if !ready exit; var bx = content_x + content_w - ui(50); var by = dialog_y + ui(16); - if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, __txtx("gradient_editor_key_blend", "Key blending"), THEME.grad_blend) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, interactable && sFOCUS, __txtx("gradient_editor_key_blend", "Key blending"), THEME.grad_blend) == 2) { menuCall("gradient_window_blend_menu", [ menuItem(__txtx("gradient_editor_blend_hard", "Solid"), function() { gradient.type = 1; onApply(gradient); }), menuItem(__txtx("gradient_editor_blend_RGB", "RGB"), function() { gradient.type = 0; onApply(gradient); }), @@ -108,7 +108,7 @@ if !ready exit; } bx -= ui(32); - if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, __txtx("gradient_editor_reverse", "Reverse"), THEME.reverse) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, interactable && sFOCUS, __txtx("gradient_editor_reverse", "Reverse"), THEME.reverse) == 2) { for( var i = 0, n = array_length(gradient.keys); i < n; i++ ) gradient.keys[i].time = 1 - gradient.keys[i].time; gradient.keys = array_reverse(gradient.keys); diff --git a/objects/o_dialog_group_input_order/Draw_64.gml b/objects/o_dialog_group_input_order/Draw_64.gml index 980978f4d..da091102f 100644 --- a/objects/o_dialog_group_input_order/Draw_64.gml +++ b/objects/o_dialog_group_input_order/Draw_64.gml @@ -25,7 +25,7 @@ if !ready exit; if(type == CONNECT_TYPE.input) { var _txt = __txtx("dialog_group_order_add", "Add separator"); - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, _txt, THEME.add_16, 1, COLORS._main_value_positive) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), mouse_ui, sHOVER, sFOCUS, _txt, THEME.add_16, 1, COLORS._main_value_positive) == 2) { array_push(node.attributes.input_display_list, [ "Separator", false ]); node.sortIO(); } diff --git a/objects/o_dialog_image_array_edit/Draw_64.gml b/objects/o_dialog_image_array_edit/Draw_64.gml index 4602fff66..cfb90f41b 100644 --- a/objects/o_dialog_image_array_edit/Draw_64.gml +++ b/objects/o_dialog_image_array_edit/Draw_64.gml @@ -28,7 +28,7 @@ if !target exit; var bx = dialog_x + dialog_w - ui(padding - 8) - bw; var by = dialog_y + ui(18); - if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, __txt("Add") + "...", THEME.add,, COLORS._main_value_positive) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sHOVER, sFOCUS, __txt("Add") + "...", THEME.add,, COLORS._main_value_positive) == 2) { var path = get_open_filenames_compat("image|*.png;*.jpg", ""); key_release(); @@ -45,6 +45,6 @@ if !target exit; bx -= ui(36); - if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, __txtx("array_edit_sort_name", "Sort by name"), THEME.text) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sHOVER, sFOCUS, __txtx("array_edit_sort_name", "Sort by name"), THEME.text) == 2) sortByName(); #endregion \ No newline at end of file diff --git a/objects/o_dialog_migration/Draw_64.gml b/objects/o_dialog_migration/Draw_64.gml index 02b83be3a..2711fb635 100644 --- a/objects/o_dialog_migration/Draw_64.gml +++ b/objects/o_dialog_migration/Draw_64.gml @@ -28,13 +28,13 @@ draw_set_alpha(1); var by0 = by1 - bh; draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); - var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sHOVER, sFOCUS); draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Ignore")); if(b == 2) instance_destroy(); bx0 -= bw + ui(12); - var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sHOVER, sFOCUS); draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Migrate files")); if(b == 2) { var oldDir = env_user(); @@ -53,7 +53,7 @@ draw_set_alpha(1); bx0 = dialog_x + ui(16); bw = ui(160); - var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sHOVER, sFOCUS); draw_text(bx0 + bw / 2, by0 + bh / 2, __txtx("migrate_open_directory", "Open directory") + "..."); if(b == 2) { if(directory_exists(DIRECTORY)) diff --git a/objects/o_dialog_migration/o_dialog_migration.yy b/objects/o_dialog_migration/o_dialog_migration.yy index 619a92cc6..1ae36e70d 100644 --- a/objects/o_dialog_migration/o_dialog_migration.yy +++ b/objects/o_dialog_migration/o_dialog_migration.yy @@ -2,8 +2,8 @@ "$GMObject":"", "%Name":"o_dialog_migration", "eventList":[ - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"o_dialog_migration", diff --git a/objects/o_dialog_palette/Draw_64.gml b/objects/o_dialog_palette/Draw_64.gml index a13c6d020..75e228ff4 100644 --- a/objects/o_dialog_palette/Draw_64.gml +++ b/objects/o_dialog_palette/Draw_64.gml @@ -43,7 +43,7 @@ if palette == 0 exit; var by = dialog_y + ui(12); var bs = ui(28); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sFOCUS, sHOVER, __txtx("add_preset", "Add to preset"), THEME.add_20) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sHOVER, sFOCUS, __txtx("add_preset", "Add to preset"), THEME.add_20) == 2) { var dia = dialogCall(o_dialog_file_name, mouse_mx + ui(8), mouse_my + ui(8)); dia.onModify = function (txt) { var file = file_text_open_write(txt + ".hex"); @@ -63,11 +63,11 @@ if palette == 0 exit; } bx -= ui(32); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sFOCUS, sHOVER, __txt("Refresh"), THEME.refresh_20) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sHOVER, sFOCUS, __txt("Refresh"), THEME.refresh_20) == 2) __initPalette(); bx -= ui(32); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sFOCUS, sHOVER, __txtx("color_selector_open_palette", "Open palette folder"), THEME.path_open_20) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, mouse_ui, sHOVER, sFOCUS, __txtx("color_selector_open_palette", "Open palette folder"), THEME.path_open_20) == 2) { var _realpath = DIRECTORY + "Palettes"; shellOpenExplorer(_realpath) } @@ -83,7 +83,7 @@ if palette == 0 exit; var bc = index_selecting[1] < 2? COLORS._main_icon : merge_color(COLORS._main_icon, COLORS._main_accent, 0.5); var _txt = index_selecting[1] < 2? __txtx("palette_editor_sort", "Sort palette") : __txtx("palette_editor_sort_selected", "Sort selected"); - var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, _txt, THEME.sort, 0, bc); + var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, interactable && sFOCUS, _txt, THEME.sort, 0, bc); if(b) mouse_draggable = false; if(b == 2) { menuCall("palette_window_sort_menu", [ @@ -98,7 +98,7 @@ if palette == 0 exit; bx -= ui(32); var _txt = index_selecting[1] < 2? __txtx("palette_editor_reverse", "Reverse palette") : __txtx("palette_editor_reverse_selected", "Reverse selected"); - var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, _txt, THEME.reverse, 0, bc); + var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, interactable && sFOCUS, _txt, THEME.reverse, 0, bc); if(b) mouse_draggable = false; if(b == 2) { @@ -358,7 +358,7 @@ if palette == 0 exit; var by = pl_y - ui(2); if(array_length(palette) > 1) { - if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, "", THEME.minus) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, interactable && sFOCUS, "", THEME.minus) == 2) { array_delete(palette, index_selecting[0], index_selecting[1]); if(array_empty(palette)) palette = [ c_black ]; @@ -371,7 +371,7 @@ if palette == 0 exit; } bx -= ui(32); - if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, "", THEME.add) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, interactable && sFOCUS, "", THEME.add) == 2) { palette[array_length(palette)] = c_black; index_selecting = [ array_length(palette), 1 ]; @@ -379,7 +379,7 @@ if palette == 0 exit; } bx = content_x + ui(18); - if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, __txtx("palette_editor_load", "Load palette file") + " (.hex)", THEME.file) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, interactable && sFOCUS, __txtx("palette_editor_load", "Load palette file") + " (.hex)", THEME.file) == 2) { var path = get_open_filename_pxc("HEX palette|*.hex", ""); key_release(); diff --git a/objects/o_dialog_panel/Draw_64.gml b/objects/o_dialog_panel/Draw_64.gml index 9d6bb93f0..3d6fae18a 100644 --- a/objects/o_dialog_panel/Draw_64.gml +++ b/objects/o_dialog_panel/Draw_64.gml @@ -59,7 +59,7 @@ if(content.showHeader) { var _bs = ui(20); if(instanceof(content) != "Panel_Menu") - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mouse_mx, mouse_my ], sFOCUS, sHOVER, "", THEME.window_exit) == 2) { + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mouse_mx, mouse_my ], sHOVER, sFOCUS, "", THEME.window_exit) == 2) { DIALOG_POSTDRAW onDestroy(); instance_destroy(); @@ -88,7 +88,7 @@ var ss = content.showHeader? ui(20) : ui(28); var sc = content.showHeader? 0.75 : 1; if(window == noone && instanceof(content) != "Panel_Menu") { - var b = buttonInstant(THEME.button_hide, bx, by, ss, ss, [ mouse_mx, mouse_my ], sFOCUS, sHOVER, txt, THEME.pin, ind, cc, 1, sc); + var b = buttonInstant(THEME.button_hide, bx, by, ss, ss, [ mouse_mx, mouse_my ], sHOVER, sFOCUS, txt, THEME.pin, ind, cc, 1, sc); if(b == 2) destroy_on_click_out = !destroy_on_click_out; } diff --git a/objects/o_dialog_patreon/Draw_64.gml b/objects/o_dialog_patreon/Draw_64.gml index fa4fb451b..44d28b528 100644 --- a/objects/o_dialog_patreon/Draw_64.gml +++ b/objects/o_dialog_patreon/Draw_64.gml @@ -12,7 +12,7 @@ if !ready exit; var _by = dialog_y + ui(8); var _bs = ui(20); - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mouse_mx, mouse_my ], sFOCUS, sHOVER, "", THEME.window_exit) == 2) { + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mouse_mx, mouse_my ], sHOVER, sFOCUS, "", THEME.window_exit) == 2) { DIALOG_POSTDRAW onDestroy(); instance_destroy(); @@ -38,7 +38,7 @@ if !ready exit; draw_set_text(f_p1, fa_center, fa_center, COLORS._main_value_positive); draw_text(cx, _ty, txt); - if(buttonInstant(THEME.button_def, _bx, _by, _bw, _bh, mouse_ui, sFOCUS, sHOVER) == 2) { + if(buttonInstant(THEME.button_def, _bx, _by, _bw, _bh, mouse_ui, sHOVER, sFOCUS) == 2) { var _path = DIRECTORY + "patreon"; file_delete(_path); IS_PATREON = false; diff --git a/objects/o_dialog_preference/Create_0.gml b/objects/o_dialog_preference/Create_0.gml index 9d679a0d6..8c1a59f15 100644 --- a/objects/o_dialog_preference/Create_0.gml +++ b/objects/o_dialog_preference/Create_0.gml @@ -659,7 +659,7 @@ event_inherited(); draw_set_text(font, fa_left, fa_center, COLORS._main_text); draw_text_add(ui(24), yy + th / 2, keyStr); - var b = buttonInstant(THEME.button_def, cx, yy + cp, cw, ch, _m, sFOCUS, sHOVER && sp_colors.hover); + var b = buttonInstant(THEME.button_def, cx, yy + cp, cw, ch, _m, sHOVER, sFOCUS && sp_colors.hover); draw_sprite_stretched_ext(THEME.palette_mask, 1, cx + ui(2), yy + ui(2), cw - ui(4), ch - ui(4), val, 1); if(b) sp_colors.hover_content = true; @@ -838,7 +838,7 @@ event_inherited(); modified = true; var bx = _ww - ui(32); var by = _yy + th / 2 - ui(12); - var b = buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, sFOCUS, _hov, __txt("Reset"), THEME.refresh_16); + var b = buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, _hov, sFOCUS, __txt("Reset"), THEME.refresh_16); if(b) sp_hotkey.hover_content = true; if(b == 2) { @@ -968,7 +968,7 @@ event_inherited(); if(isEqual(data, _defVal)) draw_sprite_ext(THEME.refresh_16, 0, _bx + _bs / 2, _by + _bs / 2, 1, 1, 0, COLORS._main_icon_dark); else { - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, sFOCUS, sHOVER && sp_pref.hover, __txt("Reset"), THEME.refresh_16) == 2) + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, sHOVER, sFOCUS && sp_pref.hover, __txt("Reset"), THEME.refresh_16) == 2) _pref.onEdit(_defVal); } } diff --git a/objects/o_dialog_preference/Draw_64.gml b/objects/o_dialog_preference/Draw_64.gml index d3af8fba7..4a0367362 100644 --- a/objects/o_dialog_preference/Draw_64.gml +++ b/objects/o_dialog_preference/Draw_64.gml @@ -11,7 +11,7 @@ if !ready exit; var bx = dialog_x + ui(24); var by = dialog_y + ui(18); - if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, destroy_on_click_out? __txt("Pin") : __txt("Unpin"), + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, destroy_on_click_out? __txt("Pin") : __txt("Unpin"), THEME.pin, !destroy_on_click_out, destroy_on_click_out? COLORS._main_icon : COLORS._main_icon_light) == 2) destroy_on_click_out = !destroy_on_click_out; @@ -74,7 +74,7 @@ if !ready exit; var _x = dialog_x + dialog_w - ui(8); var bx = _x - ui(48); var _txt = __txtx("pref_reset_color", "Reset colors"); - var b = buttonInstant(THEME.button_hide, bx, py, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, _txt, THEME.refresh_icon); + var b = buttonInstant(THEME.button_hide, bx, py, ui(32), ui(32), mouse_ui, sHOVER, sFOCUS, _txt, THEME.refresh_icon); if(b == 2) { var path = $"{DIRECTORY}Themes/{PREFERENCES.theme}/override.json"; if(file_exists_empty(path)) file_delete(path); diff --git a/objects/o_dialog_preset/Draw_64.gml b/objects/o_dialog_preset/Draw_64.gml index 963b42c70..52c95b6eb 100644 --- a/objects/o_dialog_preset/Draw_64.gml +++ b/objects/o_dialog_preset/Draw_64.gml @@ -23,7 +23,7 @@ if !ready exit; var bx = dialog_x + dialog_w - ui(32 + 16); var by = dialog_y + ui(16); - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, __txtx("preset_new", "New preset"), THEME.add, 1) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), mouse_ui, sHOVER, sFOCUS, __txtx("preset_new", "New preset"), THEME.add, 1) == 2) { adding = !adding; if(adding) tb_add.activate(); } diff --git a/objects/o_dialog_release_note/Draw_64.gml b/objects/o_dialog_release_note/Draw_64.gml index 87e0c6cbd..7a179c2ec 100644 --- a/objects/o_dialog_release_note/Draw_64.gml +++ b/objects/o_dialog_release_note/Draw_64.gml @@ -22,7 +22,7 @@ if !ready exit; var r = __txt(pages[i]); var rw = string_width(r); - if(buttonInstant(THEME.button_hide_fill, _x - ui(8), _y - ui(4), rw + ui(16), bh, [ mouse_mx, mouse_my ], sFOCUS, sHOVER) == 2) + if(buttonInstant(THEME.button_hide_fill, _x - ui(8), _y - ui(4), rw + ui(16), bh, [ mouse_mx, mouse_my ], sHOVER, sFOCUS) == 2) page = i; draw_set_color(i == page? COLORS._main_text : COLORS._main_text_sub); diff --git a/objects/o_dialog_run_shell/Draw_64.gml b/objects/o_dialog_run_shell/Draw_64.gml index 870a8b6a0..abf80db5d 100644 --- a/objects/o_dialog_run_shell/Draw_64.gml +++ b/objects/o_dialog_run_shell/Draw_64.gml @@ -44,13 +44,13 @@ if !ready exit; var by0 = by1 - bh; draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); - var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sHOVER, sFOCUS); draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Cancel")); if(b == 2) instance_destroy(); bx0 -= bw + ui(12); - var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sHOVER, sFOCUS); draw_text(bx0 + bw / 2, by0 + bh / 2, __txtx("run", "Run")); if(b == 2) { shell_execute_async(prog, cmd); diff --git a/objects/o_dialog_run_shell/o_dialog_run_shell.yy b/objects/o_dialog_run_shell/o_dialog_run_shell.yy index b14086767..1cbb8b60e 100644 --- a/objects/o_dialog_run_shell/o_dialog_run_shell.yy +++ b/objects/o_dialog_run_shell/o_dialog_run_shell.yy @@ -2,8 +2,8 @@ "$GMObject":"", "%Name":"o_dialog_run_shell", "eventList":[ - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"o_dialog_run_shell", diff --git a/objects/o_dialog_save/Draw_64.gml b/objects/o_dialog_save/Draw_64.gml index f761e6fd5..61bb57db6 100644 --- a/objects/o_dialog_save/Draw_64.gml +++ b/objects/o_dialog_save/Draw_64.gml @@ -28,13 +28,13 @@ draw_set_alpha(1); var by0 = by1 - bh; draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text); - var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sHOVER, sFOCUS); draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Cancel")); if(b == 2) instance_destroy(); bx0 -= bw + ui(12); - var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sHOVER, sFOCUS); draw_text(bx0 + bw / 2, by0 + bh / 2, __txtx("dont_save", "Don't save")); if(b == 2) { closeProject(project); @@ -42,7 +42,7 @@ draw_set_alpha(1); } bx0 -= bw + ui(12); - var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); + var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sHOVER, sFOCUS); draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Save")); if(b == 2) { SAVE(project); diff --git a/objects/o_dialog_save/o_dialog_save.yy b/objects/o_dialog_save/o_dialog_save.yy index 325500ebb..b69759b04 100644 --- a/objects/o_dialog_save/o_dialog_save.yy +++ b/objects/o_dialog_save/o_dialog_save.yy @@ -2,8 +2,8 @@ "$GMObject":"", "%Name":"o_dialog_save", "eventList":[ - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"o_dialog_save", diff --git a/objects/o_dialog_scrollbox_horizontal/Draw_64.gml b/objects/o_dialog_scrollbox_horizontal/Draw_64.gml index 2f85691d4..3b2cee114 100644 --- a/objects/o_dialog_scrollbox_horizontal/Draw_64.gml +++ b/objects/o_dialog_scrollbox_horizontal/Draw_64.gml @@ -14,7 +14,7 @@ draw_sprite_stretched(THEME.textbox, 1, dialog_x, dialog_y, dialog_w, dialog_h); - if(buttonInstant(THEME.button_hide, dialog_x + dialog_w - ui(8) - ui(24), dialog_y + ui(8), ui(24), ui(24), mouse_ui, sFOCUS, sHOVER, "", THEME.scrollbox_direction, horizon) == 2) { + if(buttonInstant(THEME.button_hide, dialog_x + dialog_w - ui(8) - ui(24), dialog_y + ui(8), ui(24), ui(24), mouse_ui, sHOVER, sFOCUS, "", THEME.scrollbox_direction, horizon) == 2) { horizon = !horizon; setSize(); } diff --git a/objects/o_dialog_scrollbox_horizontal/o_dialog_scrollbox_horizontal.yy b/objects/o_dialog_scrollbox_horizontal/o_dialog_scrollbox_horizontal.yy index 650cfb231..fbaccbb3c 100644 --- a/objects/o_dialog_scrollbox_horizontal/o_dialog_scrollbox_horizontal.yy +++ b/objects/o_dialog_scrollbox_horizontal/o_dialog_scrollbox_horizontal.yy @@ -3,8 +3,8 @@ "%Name":"o_dialog_scrollbox_horizontal", "eventList":[ {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"o_dialog_scrollbox_horizontal", diff --git a/objects/o_dialog_splash/Draw_64.gml b/objects/o_dialog_splash/Draw_64.gml index 7fab5d735..aaffb5435 100644 --- a/objects/o_dialog_splash/Draw_64.gml +++ b/objects/o_dialog_splash/Draw_64.gml @@ -17,7 +17,7 @@ if !ready exit; var txt = VERSION_STRING; var ww = string_width(txt) + ui(8); var hh = line_get_height(, 4); - if(buttonInstant(THEME.button_hide_fill, bx - ui(4), by - ui(2), ww, hh, mouse_ui, sFOCUS, sHOVER) == 2) + if(buttonInstant(THEME.button_hide_fill, bx - ui(4), by - ui(2), ww, hh, mouse_ui, sHOVER, sFOCUS) == 2) dialogCall(o_dialog_release_note, WIN_W / 2, WIN_H / 2); draw_text(bx, by, txt); @@ -25,12 +25,12 @@ if !ready exit; var bs = ui(32); var bx = dialog_x + dialog_w - ui(16) - bs; var by = dialog_y + ui(16); - if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, mouse_ui, sFOCUS, sHOVER, __txt("Preferences"), THEME.gear) == 2) { + if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, mouse_ui, sHOVER, sFOCUS, __txt("Preferences"), THEME.gear) == 2) { dialogCall(o_dialog_preference, WIN_W / 2, WIN_H / 2); } bx -= bs + ui(4); - if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, mouse_ui, sFOCUS, sHOVER, __txt("Show on startup"), THEME.icon_splash_show_on_start, PREFERENCES.show_splash) == 2) { + if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, mouse_ui, sHOVER, sFOCUS, __txt("Show on startup"), THEME.icon_splash_show_on_start, PREFERENCES.show_splash) == 2) { PREFERENCES.show_splash = !PREFERENCES.show_splash; PREF_SAVE(); } @@ -52,20 +52,20 @@ if !ready exit; var bx = x1 - ui(28); var by = y0 - ui(28 + 4); var txt = __txtx("splash_clear_recent", "Clear recent files"); - if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, txt, THEME.icon_delete,, COLORS._main_value_negative) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, txt, THEME.icon_delete,, COLORS._main_value_negative) == 2) { ds_list_clear(RECENT_FILES); RECENT_SAVE(); } // bx -= ui(28 + 4); // txt = recent_thumbnail? __txtx("splash_hide_thumbnail", "Hide thumbnail") : __txtx("splash_show_thumbnail", "Show thumbnail"); - // if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, txt, THEME.splash_thumbnail, recent_thumbnail) == 2) { + // if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, txt, THEME.splash_thumbnail, recent_thumbnail) == 2) { // recent_thumbnail = !recent_thumbnail; // } bx -= ui(28 + 4); txt = __txtx("splash_open_autosave", "Open autosave folder"); - if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, txt, THEME.save_auto, 0) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, txt, THEME.save_auto, 0) == 2) { shellOpenExplorer(DIRECTORY + "autosave"); } @@ -75,7 +75,7 @@ if !ready exit; switch(pages[project_page]) { case "Welcome Files" : case "Workshop" : - if(buttonInstant(THEME.button_hide_fill, x1, (y0 + y1) / 2 - ui(32), ui(16), ui(32), mouse_ui, sFOCUS, sHOVER,, THEME.arrow, expand? 2 : 0) == 2) { + if(buttonInstant(THEME.button_hide_fill, x1, (y0 + y1) / 2 - ui(32), ui(16), ui(32), mouse_ui, sHOVER, sFOCUS,, THEME.arrow, expand? 2 : 0) == 2) { PREFERENCES.splash_expand_recent = !PREFERENCES.splash_expand_recent; expandAction = true; } @@ -193,11 +193,11 @@ if !ready exit; var bx = x1 - ui(32); var by = y0 - ui(36); - if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, mouse_ui, sFOCUS, sHOVER, __txtx("workshop_open", "Open Steam Workshop"), THEME.steam) == 2) + if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, mouse_ui, sHOVER, sFOCUS, __txtx("workshop_open", "Open Steam Workshop"), THEME.steam) == 2) steam_activate_overlay_browser("https://steamcommunity.com/app/2299510/workshop/"); bx -= bs + ui(4); - if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, mouse_ui, sFOCUS, sHOVER, __txt("Refresh"), THEME.refresh_icon) == 2) + if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, mouse_ui, sHOVER, sFOCUS, __txt("Refresh"), THEME.refresh_icon) == 2) steamUCGload(); break; diff --git a/objects/o_dialog_splash/o_dialog_splash.yy b/objects/o_dialog_splash/o_dialog_splash.yy index a36a02fae..048a8aca5 100644 --- a/objects/o_dialog_splash/o_dialog_splash.yy +++ b/objects/o_dialog_splash/o_dialog_splash.yy @@ -3,9 +3,9 @@ "%Name":"o_dialog_splash", "eventList":[ {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":62,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, - {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"o_dialog_splash", diff --git a/scripts/__panel_linear_setting/__panel_linear_setting.gml b/scripts/__panel_linear_setting/__panel_linear_setting.gml index 7f16c282e..8fdefc8a1 100644 --- a/scripts/__panel_linear_setting/__panel_linear_setting.gml +++ b/scripts/__panel_linear_setting/__panel_linear_setting.gml @@ -158,7 +158,7 @@ function Panel_Linear_Setting() : PanelContent() constructor { if(isEqual(_data, _defVal)) draw_sprite_ext(THEME.refresh_16, 0, _bx + _bs / 2, _by + _bs / 2, 1, 1, 0, COLORS._main_icon_dark); else { - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pFOCUS, pHOVER, __txt("Reset"), THEME.refresh_16) == 2) + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pHOVER, pFOCUS, __txt("Reset"), THEME.refresh_16) == 2) _prop.onEdit(_defVal); } } diff --git a/scripts/__tiler_rule/__tiler_rule.gml b/scripts/__tiler_rule/__tiler_rule.gml index 6e376a57f..c0869c8bf 100644 --- a/scripts/__tiler_rule/__tiler_rule.gml +++ b/scripts/__tiler_rule/__tiler_rule.gml @@ -167,7 +167,7 @@ function Tileset_Rule(_tileset) : Inspector_Custom_Renderer(noone, noone) constr var by = _yy; var bs = ui(24); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "New rule", THEME.add_16, 0, COLORS._main_value_positive) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "New rule", THEME.add_16, 0, COLORS._main_value_positive) == 2) { var _new_rl = new tiler_rule(); _new_rl.name = $"rule {array_length(ruleTiles)}" _new_rl.open = true; @@ -224,7 +224,7 @@ function Tileset_Rule(_tileset) : Inspector_Custom_Renderer(noone, noone) constr var bs = ui(24); var bx = _w - bs - ui(4); var by = _yy + _hg / 2 - bs / 2; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.minus_16, 0, _hov? COLORS._main_value_negative : COLORS._main_icon) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "", THEME.minus_16, 0, _hov? COLORS._main_value_negative : COLORS._main_icon) == 2) del = i; } diff --git a/scripts/areaBox/areaBox.gml b/scripts/areaBox/areaBox.gml index bd459bf3d..a40c4c638 100644 --- a/scripts/areaBox/areaBox.gml +++ b/scripts/areaBox/areaBox.gml @@ -145,7 +145,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { var _bx = _x + _w - _bs; var _by = _y + _h / 2 - _bs / 2; - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, active, hover, tooltip, THEME.inspector_area_type, mode) == 2) { + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, hover, active, tooltip, THEME.inspector_area_type, mode) == 2) { switch(mode) { case AREA_MODE.area : //area to padding var cx = array_safe_get_fast(_data, 0); @@ -193,7 +193,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { var _by = _y + _h + ui(4) + _h / 2 - _bs / 2; var _btxt = __txtx("widget_area_fill_surface", "Fill surface"); - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, active, hover, _btxt, THEME.fill, 0) == 2) { + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, hover, active, _btxt, THEME.fill, 0) == 2) { var cnvt = unit != noone && unit.mode == VALUE_UNIT.reference; switch(mode) { @@ -228,7 +228,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { var _bx = _x; var _by = _y + _h / 2 - _bs / 2; - if(useShape && !is_array(_bind) && buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, _bact, _bhov,, THEME.inspector_area, _bind) == 2) { + if(useShape && !is_array(_bind) && buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, _bhov, _bact,, THEME.inspector_area, _bind) == 2) { var val = (array_safe_get_fast(_data, 4) + 1) % 2; onModify(val, 4); } @@ -238,7 +238,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor { var _btxt = __txt("Link values"); var _bby = useShape? _by + _h + ui(4) : _y + h / 2 - _bs / 2; - if(buttonInstant(THEME.button_hide, _bx, _bby, _bs, _bs, _m, active, hover, _btxt, THEME.value_link, link_value, cc) == 2) + if(buttonInstant(THEME.button_hide, _bx, _bby, _bs, _bs, _m, hover, active, _btxt, THEME.value_link, link_value, cc) == 2) link_value = !link_value; } diff --git a/scripts/binder_gamemaker/binder_gamemaker.gml b/scripts/binder_gamemaker/binder_gamemaker.gml index 8e8fcde09..81cc84f8b 100644 --- a/scripts/binder_gamemaker/binder_gamemaker.gml +++ b/scripts/binder_gamemaker/binder_gamemaker.gml @@ -12,7 +12,7 @@ function Binder_Gamemaker(path) { return new __Binder_Gamemaker(path); } -function GMObject(_gm, _rpth, _rawData) constructor { +function GMAsset(_gm, _rpth, _rawData) constructor { static serialize_bool_keys = {}; gmBinder = _gm; @@ -31,42 +31,69 @@ function GMObject(_gm, _rpth, _rawData) constructor { return string(val); } - static simple_serialize = function(s, _pad, _depth = 0, _nline = false) { - if(is_array(s)) { - if(array_empty(s)) return "[]"; - var _d1 = _depth <= 1; - var _str = _d1? "[\n" : "["; - var _nl = _d1? ",\n" : ","; - var _padd = _d1? _pad + " " : ""; + static simple_serialize = function(_k, _v, _depth = 1) { + + var _newLine = false; + + if(is_array(_v)) { + if(array_empty(_v)) return "[]"; - for( var i = 0, n = array_length(s); i < n; i++ ) - _str += $"{_padd}{simple_serialize(s[i], _pad, _depth + 1)}{_nl}"; + switch(_k) { + case "assets" : + case "instances" : + case "instanceCreationOrder" : + case "layers" : + case "parent" : + case "physicsSettings" : + case "properties" : + case "roomSettings" : + case "viewSettings" : + case "views" : + _newLine = true; + break; + } + + var _str = _newLine? "[\n" : "["; + var _nl = _newLine? ",\n" : ","; + var _padd = _newLine? string_multiply(" ", _depth + 1) : ""; - _str += _d1? _pad + "]" : "]"; + for( var i = 0, n = array_length(_v); i < n; i++ ) + _str += $"{_padd}{simple_serialize(_k, _v[i], _depth + 1)}{_nl}"; + + _str += _newLine? string_multiply(" ", _depth) + "]" : "]"; return _str; - } else if(is_struct(s)) { - var _keys = struct_get_names(s); + } + + if(is_struct(_v)) { + switch(_k) { + case "parent" : + case "physicsSettings" : + case "roomSettings" : + case "viewSettings" : + _newLine = true; + break; + } + + var _keys = struct_get_names(_v); array_sort(_keys, function(a, b) /*=>*/ {return string_compare(a, b)}); - var _str = _nline? "{\n" : "{"; - var _nl = _nline? ",\n" : ","; - var _padd = _nline? _pad + " " : ""; + var _str = _newLine? "{\n" : "{"; + var _nl = _newLine? "\n" : ""; + var _padd = _newLine? string_multiply(" ", _depth + 1) : ""; for( var i = 0, n = array_length(_keys); i < n; i++ ) { - var _k = _keys[i]; - var _v = s[$ _k]; + var __k = _keys[i]; + var __v = _v[$ __k]; - _str += _padd; - _str += $"\"{_k}\":{is_array(_v) || is_struct(_v)? simple_serialize(_v, _padd, _depth + 1) : formatPrimitive(_k, _v)}"; - _str += _nl; + _str += $"{_padd}\"{__k}\":{simple_serialize(__k, __v, _depth + 1)},{_nl}"; } - _str += _pad + "}" + _str += _newLine? string_multiply(" ", _depth) + "}" : "}"; return _str; } - return formatPrimitive("", s); + return formatPrimitive(_k, _v); } static sync = function() { file_text_write_all(path, json_stringify(raw)); } @@ -74,7 +101,7 @@ function GMObject(_gm, _rpth, _rawData) constructor { static link = function() {} } -function GMSprite(_gm, _rpth, _rawData) : GMObject(_gm, _rpth, _rawData) constructor { +function GMSprite(_gm, _rpth, _rawData) : GMAsset(_gm, _rpth, _rawData) constructor { var _dirr = filename_dir(path); var _frame = raw.frames; var _layers = raw.layers; @@ -87,14 +114,24 @@ function GMSprite(_gm, _rpth, _rawData) : GMObject(_gm, _rpth, _rawData) constru thumbnail = sprite_add(thumbnailPath, 0, 0, 0, 0, 0); } -function GMTileset(_gm, _rpth, _rawData) : GMObject(_gm, _rpth, _rawData) constructor { - sprite = raw.spriteId.path; +function GMTileset(_gm, _rpth, _rawData) : GMAsset(_gm, _rpth, _rawData) constructor { + sprite = struct_try_get(raw.spriteId, "path", ""); + spriteObject = noone; static link = function() { spriteObject = gmBinder.getResourceFromPath(sprite); } } +function GMObject(_gm, _rpth, _rawData) : GMAsset(_gm, _rpth, _rawData) constructor { + sprite = struct_try_get(raw.spriteId, "path", ""); + spriteObject = noone; + + static link = function() { + spriteObject = gmBinder.getResourceFromPath(sprite); + } +} + function __Binder_Gamemaker(path) constructor { self.path = path; name = filename_name_only(path); @@ -104,6 +141,7 @@ function __Binder_Gamemaker(path) constructor { resourcesRaw = []; resourcesMap = {}; resourceList = []; + resources = [ { name: "sprites", data : [], closed : false, }, { name: "tileset", data : [], closed : false, }, @@ -137,11 +175,15 @@ function __Binder_Gamemaker(path) constructor { projectName = _resMap.name; resourcesRaw = _resMap.resources; - resourcesMap = {}; + + var resMap = {}; + resourceList = []; var sprites = []; + var objects = []; var tileset = []; var rooms = []; + var _asst; for( var i = 0, n = array_length(resourcesRaw); i < n; i++ ) { var _res = resourcesRaw[i].id; @@ -151,21 +193,28 @@ function __Binder_Gamemaker(path) constructor { var _rawData = readYY($"{dir}/{_rpth}"); if(_rawData == noone) continue; - var _asset = noone; - switch(_rawData.resourceType) { - case "GMSprite": _asset = new GMSprite( self, _rpth, _rawData); array_push(sprites, _asset); break; - case "GMTileSet": _asset = new GMTileset(self, _rpth, _rawData); array_push(tileset, _asset); break; - case "GMRoom": _asset = new GMRoom( self, _rpth, _rawData); array_push(rooms, _asset); break; + case "GMSprite": _asst = new GMSprite( self, _rpth, _rawData); array_push(sprites, _asst); break; + case "GMObject": _asst = new GMObject( self, _rpth, _rawData); array_push(objects, _asst); break; + case "GMTileSet": _asst = new GMTileset(self, _rpth, _rawData); array_push(tileset, _asst); break; + case "GMRoom": _asst = new GMRoom( self, _rpth, _rawData); array_push(rooms, _asst); break; + default : _asst = noone; } - resourcesMap[$ _rpth] = _asset; - array_push(resourceList, _asset); + if(_asst == noone) continue; + + if(struct_has(resourcesMap, _rpth)) { + struct_override(resourcesMap, _asst); + _asst = resourcesMap; + } + + resMap[$ _rpth] = _asst; + array_push(resourceList, _asst); } - for( var i = 0, n = array_length(resourceList); i < n; i++ ) { + resourcesMap = resMap; + for( var i = 0, n = array_length(resourceList); i < n; i++ ) resourceList[i].link(); - } resources[0].data = sprites; resources[1].data = tileset; diff --git a/scripts/binder_gamemaker_room/binder_gamemaker_room.gml b/scripts/binder_gamemaker_room/binder_gamemaker_room.gml index 843a5ca31..24024cdbf 100644 --- a/scripts/binder_gamemaker_room/binder_gamemaker_room.gml +++ b/scripts/binder_gamemaker_room/binder_gamemaker_room.gml @@ -1,32 +1,37 @@ -function GMRoom(_gm, _rpth, _rawData) : GMObject(_gm, _rpth, _rawData) constructor { +function GMRoom(_gm, _rpth, _rawData) : GMAsset(_gm, _rpth, _rawData) constructor { static serialize_bool_keys = { - clearDisplayBuffer: 1, - clearViewBackground: 1, - effectEnabled: 1, - enableViews: 1, - hierarchyFrozen: 1, - htiled: 1, - inherit: 1, - inheritCode: 1, - inheritCreationOrder: 1, - inheritLayerDepth: 1, - inheritLayers: 1, - inheritLayerSettings: 1, - inheritPhysicsSettings: 1, - inheritRoomSettings: 1, - inheritSubLayers: 1, - inheritViewSettings: 1, - inheritVisibility: 1, - isDnd: 1, - persistent: 1, - PhysicsWorld: 1, - stretch: 1, - userdefinedAnimFPS: 1, - userdefinedDepth: 1, - visible: 1, - vtiled: 1, + clearDisplayBuffer: 1, + clearViewBackground: 1, + effectEnabled: 1, + enableViews: 1, + frozen: 1, + hasCreationCode: 1, + hierarchyFrozen: 1, + htiled: 1, + ignore: 1, + inherit: 1, + inheritCode: 1, + inheritCreationOrder: 1, + inheritItemSettings: 1, + inheritLayerDepth: 1, + inheritLayers: 1, + inheritLayerSettings: 1, + inheritPhysicsSettings: 1, + inheritRoomSettings: 1, + inheritSubLayers: 1, + inheritViewSettings: 1, + inheritVisibility: 1, + isDnd: 1, + persistent: 1, + PhysicsWorld: 1, + stretch: 1, + userdefinedAnimFPS: 1, + userdefinedDepth: 1, + visible: 1, + vtiled: 1, }; + roomSettings = raw.roomSettings; layers = GMRoom_create_layers(self, gmBinder, raw.layers); static link = function() { array_foreach(layers, function(l) /*=>*/ {return l.link()}); } @@ -45,26 +50,12 @@ function GMRoom(_gm, _rpth, _rawData) : GMObject(_gm, _rpth, _rawData) construct var _str = "{\n"; var _nl = ",\n"; - var _padd = " "; for( var i = 0, n = array_length(_keys); i < n; i++ ) { var _k = _keys[i]; var _v = raw[$ _k]; - var _snl = false; - switch(_k) { - case "parent" : - case "physicsSettings" : - case "roomSettings" : - case "viewSettings" : - _snl = true; - break; - } - - _str += _padd; - if(is_array(_v) || is_struct(_v)) _str += $"\"{_k}\":{simple_serialize(_v, _padd, 0, _snl)}"; - else _str += $"\"{_k}\":{formatPrimitive(_k, _v)}"; - _str += _nl; + _str += $" \"{_k}\":{simple_serialize(_k, _v)}{_nl}"; } _str += "}" @@ -102,8 +93,9 @@ function GMRoom_Layer(_room, _gm, _raw) constructor { visible = _raw.visible; depth = _raw.depth; - layers = GMRoom_create_layers(roomObject, _gm, _raw.layers); - index = 6; + layers = GMRoom_create_layers(roomObject, _gm, _raw.layers); + index = 6; + preview = noone; static link = function() { array_foreach(layers, function(l) /*=>*/ {return l.link()}); } @@ -115,28 +107,145 @@ function GMRoom_Layer(_room, _gm, _raw) constructor { } return noone; } + + static refreshPreview = function() { + preview = surface_verify(preview, roomObject.roomSettings.Width, roomObject.roomSettings.Height); + surface_set_target(preview); + DRAW_CLEAR + doRefreshPreview(); + surface_reset_target(); + } + + static doRefreshPreview = function() {} } function GMRoom_Background(_room, _gm, _raw) : GMRoom_Layer(_room, _gm, _raw) constructor { index = 0; - - colour = raw.colour; -} - -function GMRoom_Tile(_room, _gm, _raw) : GMRoom_Layer(_room, _gm, _raw) constructor { - index = 1; - - tiles = raw.tiles; - tilesetId = raw.tilesetId; - tileset = noone; + spr = noone; static link = function() { - tileset = gmBinder.getResourceFromPath(struct_try_get(tilesetId, "path", "")); - array_foreach(layers, function(l) /*=>*/ {return l.link()}); + spr = gmBinder.getResourceFromPath(struct_try_get(raw.spriteId, "path")); + } + + static doRefreshPreview = function() { + if(spr != noone && spr.thumbnail != noone) { + if(raw.htiled || raw.vtiled) + draw_sprite_tiled(spr.thumbnail, 0, 0, 0); + else + draw_sprite(spr.thumbnail, 0, 0, 0); + } + } +} + +function GMRoom_Instance(_room, _gm, _raw) : GMRoom_Layer(_room, _gm, _raw) constructor { + index = 2; + instances = []; + + static link = function() { + instances = []; + + for( var i = 0, n = array_length(raw.instances); i < n; i++ ) { + var _ins = raw.instances[i]; + var _obj = _ins.objectId; + var _o = gmBinder.getResourceFromPath(struct_try_get(_obj, "path")); + + instances[i] = { + object: _o, + data: _ins, + }; + } + } + + static doRefreshPreview = function() { + for( var i = 0, n = array_length(instances); i < n; i++ ) { + var _ins = instances[i]; + var _obj = _ins.object; + var _dat = _ins.data; + if(_obj == noone) continue; + + var _spr = _obj.spriteObject; + if(_spr == noone) continue; + + var _thm = _spr.thumbnail; + var _thm_w = _spr.raw.width; + var _thm_h = _spr.raw.height; + var _thm_ox = _spr.raw.sequence.xorigin; + var _thm_oy = _spr.raw.sequence.yorigin; + + var _pos_x = _dat.x; + var _pos_y = _dat.y; + var _sca_x = _dat.scaleX; + var _sca_y = _dat.scaleY; + var _rot = _dat.rotation; + var _col = _dat.colour; + + var _rx = _pos_x - _thm_ox * _sca_x; + var _ry = _pos_y - _thm_oy * _sca_y; + + draw_sprite_ext(_thm, 0, _rx, _ry, _sca_x, _sca_y, _rot, _col); + } + } +} + +function GMRoom_Path(_room, _gm, _raw) : GMRoom_Layer(_room, _gm, _raw) constructor { + index = 3; + + static doRefreshPreview = function() { + + } +} + +function GMRoom_Asset(_room, _gm, _raw) : GMRoom_Layer(_room, _gm, _raw) constructor { + index = 4; + assets = []; + + static link = function() { + assets = []; + + for( var i = 0, n = array_length(raw.assets); i < n; i++ ) { + var _ass = raw.assets[i]; + var _spr = _ass.spriteId; + var _o = gmBinder.getResourceFromPath(struct_try_get(_spr, "path")); + + assets[i] = { + object: _o, + data: _ass, + }; + } + } + + static doRefreshPreview = function() { + for( var i = 0, n = array_length(assets); i < n; i++ ) { + var _ass = assets[i]; + var _spr = _ass.object; + var _dat = _ass.data; + + var _thm = _spr.thumbnail; + var _thm_w = _spr.raw.width; + var _thm_h = _spr.raw.height; + var _thm_ox = _spr.raw.sequence.xorigin; + var _thm_oy = _spr.raw.sequence.yorigin; + + var _pos_x = _dat.x; + var _pos_y = _dat.y; + var _sca_x = _dat.scaleX; + var _sca_y = _dat.scaleY; + var _rot = _dat.rotation; + var _col = _dat.colour; + + var _rx = _pos_x - _thm_ox * _sca_x; + var _ry = _pos_y - _thm_oy * _sca_y; + + draw_sprite_ext(_thm, 0, _rx, _ry, _sca_x, _sca_y, _rot, _col); + } + } +} + +function GMRoom_Effect(_room, _gm, _raw) : GMRoom_Layer(_room, _gm, _raw) constructor { + index = 5; + + static doRefreshPreview = function() { + } } -function GMRoom_Instance(_room, _gm, _raw) : GMRoom_Layer(_room, _gm, _raw) constructor { index = 2; } -function GMRoom_Path(_room, _gm, _raw) : GMRoom_Layer(_room, _gm, _raw) constructor { index = 3; } -function GMRoom_Asset(_room, _gm, _raw) : GMRoom_Layer(_room, _gm, _raw) constructor { index = 4; } -function GMRoom_Effect(_room, _gm, _raw) : GMRoom_Layer(_room, _gm, _raw) constructor { index = 5; } diff --git a/scripts/binder_gamemaker_tile/binder_gamemaker_tile.gml b/scripts/binder_gamemaker_tile/binder_gamemaker_tile.gml new file mode 100644 index 000000000..8d4b818d0 --- /dev/null +++ b/scripts/binder_gamemaker_tile/binder_gamemaker_tile.gml @@ -0,0 +1,99 @@ +function GMRoom_Tile(_room, _gm, _raw) : GMRoom_Layer(_room, _gm, _raw) constructor { + index = 1; + + tiles = raw.tiles; + tilesetId = raw.tilesetId; + tileset = noone; + + static link = function() { + tileset = gmBinder.getResourceFromPath(struct_try_get(tilesetId, "path", "")); + array_foreach(layers, function(l) /*=>*/ {return l.link()}); + } + + static doRefreshPreview = function() { + + } + + static setArray = function(arr) { + var _ww = tiles.SerialiseWidth; + var _hh = tiles.SerialiseHeight; + arr = array_verify(arr, _ww * _hh); + + var _ctil = []; + var _type = arr[0]; + var _runn = 1; + + for( var j = 1, m = array_length(arr); j < m; j++ ) { + if(arr[j] == _type) _runn++ + else { + array_push(_ctil, -_runn, _type); + _type = arr[j]; + _runn = 1; + } + } + + array_push(_ctil, -_runn, _type); + + if(array_length(_ctil) < array_length(arr)) { + tiles.TileCompressedData = _ctil; + tiles.TileDataFormat = 1; + + } else { + tiles.TileSerialiseData = arr; + struct_remove(tiles, "TileDataFormat"); + } + } + + static resizeBBOX = function(bbox) { + var _form = struct_try_get(tiles, "TileDataFormat", 0); + + var _ow = tiles.SerialiseWidth; + var _oh = tiles.SerialiseHeight; + + var _nw = bbox[2] - bbox[0]; + var _nh = bbox[3] - bbox[1]; + var _dx = -bbox[0]; + var _dy = -bbox[1]; + + var _grdo = ds_grid_create(_ow, _oh); + var _grdn = ds_grid_create(_nw, _nh); + var _data; + + if(_form == 0) { + _data = tiles.TileSerialiseData; + + } else if(_form == 1) { + var _d = tiles.TileCompressedData; + var _amo, _til, _i = 0; + + for( var i = 0, n = array_length(_d); i < n; i += 2 ) { + _amo = -_d[i + 0]; + _til = _d[i + 1]; + _til = max(0, _til + bool(_til)); + + repeat(_amo) _data[_i++] = _til; + } + } + + var _i = 0; + for( var i = 0; i < _oh; i++ ) + for( var j = 0; j < _ow; j++ ) + ds_grid_set(_grdo, j, i, _data[_i++]); + + ds_grid_set_grid_region(_grdn, _grdo, max(-_dx, 0), max(-_dy, 0), _ow - 1, _oh - 1, max(_dx, 0), max(_dy, 0)); + + var _dn = array_create(_nw * _nh); + var _i = 0; + + for( var i = 0; i < _oh; i++ ) + for( var j = 0; j < _ow; j++ ) + _dn[i++] = ds_grid_get(_grdn, j, i); + + ds_grid_destroy(_grdo); + ds_grid_destroy(_grdn); + + tiles.SerialiseWidth = _nw; + tiles.SerialiseHeight = _nh; + setArray(_dn); + } +} diff --git a/scripts/binder_gamemaker_tile/binder_gamemaker_tile.yy b/scripts/binder_gamemaker_tile/binder_gamemaker_tile.yy new file mode 100644 index 000000000..50a329948 --- /dev/null +++ b/scripts/binder_gamemaker_tile/binder_gamemaker_tile.yy @@ -0,0 +1,14 @@ +{ + "$GMScript":"v1", + "%Name":"binder_gamemaker_tile", + "isCompatibility":false, + "isDnD":false, + "name":"binder_gamemaker_tile", + "parent":{ + "name":"gamemaker", + "path":"folders/game engines/gamemaker.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", + "tags":[], +} \ No newline at end of file diff --git a/scripts/button/button.gml b/scripts/button/button.gml index 1dd68b596..b14b5eaa2 100644 --- a/scripts/button/button.gml +++ b/scripts/button/button.gml @@ -144,7 +144,7 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor { } } -function buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = noone, _icon_index = 0, _icon_blend = COLORS._main_icon, _icon_alpha = 1, _icon_scale = 1, +function buttonInstant(spr, _x, _y, _w, _h, _m, _hvr, _act, _tip = "", _icon = noone, _icon_index = 0, _icon_blend = COLORS._main_icon, _icon_alpha = 1, _icon_scale = 1, _button_blend = c_white) { var res = 0; @@ -179,7 +179,7 @@ function buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = n function buttonTextIconInstant(active, spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = noone, _icon_label = "", _icon_blend = COLORS._main_icon_light, _icon_alpha = 1) { var _b = 0; - if(active) _b = buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip); + if(active) _b = buttonInstant(spr, _x, _y, _w, _h, _m, _hvr, _act, _tip); draw_set_text(f_p1, fa_left, fa_center, active? COLORS._main_icon_light : COLORS._main_icon); var bxc = _x + _w / 2 - (string_width(_icon_label) + ui(64)) / 2; diff --git a/scripts/gamemakerPathBox/gamemakerPathBox.gml b/scripts/gamemakerPathBox/gamemakerPathBox.gml index 9d9001791..c3d42d70e 100644 --- a/scripts/gamemakerPathBox/gamemakerPathBox.gml +++ b/scripts/gamemakerPathBox/gamemakerPathBox.gml @@ -15,7 +15,7 @@ function gamemakerPathBox(project) : widget() constructor { h = _h; if(project.bind_gamemaker == noone) { - if(buttonInstant(THEME.button_def, _x, _y, _w, _h, _m, active, hover) == 2) { + if(buttonInstant(THEME.button_def, _x, _y, _w, _h, _m, hover, active) == 2) { var path = get_open_filename("GameMaker project|*.yyp", ""); key_release(); if(path == "") return noone; @@ -33,13 +33,13 @@ function gamemakerPathBox(project) : widget() constructor { draw_sprite_stretched(THEME.textbox, 3, _x, _y, _w, _h); - if(buttonInstant(THEME.button_def, _x, _y, ui(32), _h, _m, active, hover, "Explore project", s_gamemaker, 0, COLORS._main_icon) == 2) - dialogPanelCall(new Panel_GM_Explore(_gm)); + if(buttonInstant(THEME.button_def, _x, _y, ui(32), _h, _m, hover, active, "Refresh project", THEME.refresh_20, 0, COLORS._main_icon) == 2) + _gm.refreshResources(); draw_set_text(f_p2, fa_center, fa_center, COLORS._main_text); draw_text_add(_x + _w / 2, _y + _h / 2, _gm.projectName); - if(buttonInstant(THEME.button_def, _x + _w - ui(32), _y, ui(32), _h, _m, active, hover, "Disconnect", THEME.cross_12, 0, [ COLORS._main_icon, COLORS._main_value_negative ]) == 2) { + if(buttonInstant(THEME.button_def, _x + _w - ui(32), _y, ui(32), _h, _m, hover, active, "Disconnect", THEME.cross_12, 0, [ COLORS._main_icon, COLORS._main_value_negative ]) == 2) { project.attributes.bind_gamemaker_path = ""; project.bind_gamemaker = noone; } diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 1cb24b13e..b0386ed2a 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -44,7 +44,7 @@ LATEST_VERSION = 1_18_00_0; VERSION = 1_18_05_1; SAVE_VERSION = 1_18_05_0; - VERSION_STRING = MAC? "1.18.003m" : "1.18.6.003"; + VERSION_STRING = MAC? "1.18.003m" : "1.18.6.004"; BUILD_NUMBER = 1_18_05_1; var _vsp = string_split(VERSION_STRING, "."); diff --git a/scripts/globalvar_drawer/globalvar_drawer.gml b/scripts/globalvar_drawer/globalvar_drawer.gml index 9630d22b4..2424f2c40 100644 --- a/scripts/globalvar_drawer/globalvar_drawer.gml +++ b/scripts/globalvar_drawer/globalvar_drawer.gml @@ -84,7 +84,7 @@ function globalvar_viewer_draw(xx, yy, ww, _m, focus, hover, _scrollPane, rx, ry var _wd_ww = wd_w - _wd_h - ui(32 + 4); _edit.tb_name.draw(_wd_xx, yy, _wd_ww, _wd_h, _inpu.name, _m, TEXTBOX_INPUT.text); - if(buttonInstant(THEME.button_hide, _wd_x + wd_w - _wd_h, yy, _wd_h, _wd_h, _m, _foc, _hov,, THEME.icon_delete,, COLORS._main_value_negative) == 2) + if(buttonInstant(THEME.button_hide, _wd_x + wd_w - _wd_h, yy, _wd_h, _wd_h, _m, _hov, _foc,, THEME.icon_delete,, COLORS._main_value_negative) == 2) del = j; yy += _wd_h + _pd_h * 2; hh += _wd_h + _pd_h * 2; diff --git a/scripts/nodeValue_drawer/nodeValue_drawer.gml b/scripts/nodeValue_drawer/nodeValue_drawer.gml index 3f70764ed..94cac6e9a 100644 --- a/scripts/nodeValue_drawer/nodeValue_drawer.gml +++ b/scripts/nodeValue_drawer/nodeValue_drawer.gml @@ -15,134 +15,138 @@ function drawWidgetInit() { } function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _focus = false, _scrollPane = noone, rx = 0, ry = 0) { - var con_w = ww - ui(4); - var xc = xx + ww / 2; - var _font = viewMode == INSP_VIEW_MODE.spacious? f_p1 : f_p2; - var breakLine = viewMode == INSP_VIEW_MODE.spacious || jun.expUse; - var lb_h = line_get_height(_font, 6); - var lb_y = yy + lb_h / 2; - - var _name = jun.getName(); - var wid = jun.editWidget; - var cHov = false; - - switch(instanceof(wid)) { - case "textArea" : - case "controlPointBox" : - case "transformBox" : - breakLine = true; - break; - - case "matrixGrid" : - breakLine |= wid.size > 5; - break; - } - - var butx = xx; - if(jun.connect_type == CONNECT_TYPE.input && jun.isAnimable() && !jun.expUse) { // animation - var index = jun.hasJunctionFrom()? 2 : jun.is_anim; + #region data + var con_w = ww - ui(4); + var xc = xx + ww / 2; + var _font = viewMode == INSP_VIEW_MODE.spacious? f_p1 : f_p2; + var breakLine = viewMode == INSP_VIEW_MODE.spacious || jun.expUse; + var lb_h = line_get_height(_font, 6); + var lb_y = yy + lb_h / 2; - var cc = c_white; - if(jun.is_anim) cc = COLORS._main_value_positive; - if(index == 2) cc = COLORS._main_accent; + var _name = jun.getName(); + var wid = jun.editWidget; + var cHov = false; - draw_sprite_ui_uniform(THEME.animate_clock, index, butx, lb_y, 1, cc, 0.8); - if(_hover && point_in_circle(_m[0], _m[1], butx, lb_y, ui(10))) { - cHov = true; - - if(anim_hold != noone) - jun.setAnim(anim_hold, true); + switch(instanceof(wid)) { + case "textArea" : + case "controlPointBox" : + case "transformBox" : + breakLine = true; + break; - draw_sprite_ui_uniform(THEME.animate_clock, index, butx, lb_y, 1, index == 2? COLORS._main_accent : c_white, 1); - TOOLTIP = jun.hasJunctionFrom()? __txtx("panel_inspector_remove_link", "Remove link") : __txtx("panel_inspector_toggle_anim", "Toggle animation"); + case "matrixGrid" : + breakLine |= wid.size > 5; + break; + } + #endregion + + #region left buttons + var butx = xx; + if(jun.connect_type == CONNECT_TYPE.input && jun.isAnimable() && !jun.expUse) { // Animation + var index = jun.hasJunctionFrom()? 2 : jun.is_anim; + + var cc = c_white; + if(jun.is_anim) cc = COLORS._main_value_positive; + if(index == 2) cc = COLORS._main_accent; + + draw_sprite_ui_uniform(THEME.animate_clock, index, butx, lb_y, 1, cc, 0.8); + if(_hover && point_in_circle(_m[0], _m[1], butx, lb_y, ui(10))) { + cHov = true; + + if(anim_hold != noone) + jun.setAnim(anim_hold, true); - if(mouse_press(mb_left, _focus)) { - if(jun.value_from != noone) - jun.removeFrom(); - else { - jun.setAnim(!jun.is_anim, true); - anim_hold = jun.is_anim; + draw_sprite_ui_uniform(THEME.animate_clock, index, butx, lb_y, 1, index == 2? COLORS._main_accent : c_white, 1); + TOOLTIP = jun.hasJunctionFrom()? __txtx("panel_inspector_remove_link", "Remove link") : __txtx("panel_inspector_toggle_anim", "Toggle animation"); + + if(mouse_press(mb_left, _focus)) { + if(jun.value_from != noone) + jun.removeFrom(); + else { + jun.setAnim(!jun.is_anim, true); + anim_hold = jun.is_anim; + } } } } - } - - if(anim_hold != noone && mouse_release(mb_left)) anim_hold = noone; - - butx += ui(20); - if(!global_var) { // visibility - var _visi = jun.isVisible(); - - draw_sprite_ui_uniform(THEME.junc_visible, _visi, butx, lb_y, 1,, 0.8); - if(_hover && point_in_circle(_m[0], _m[1], butx, lb_y, ui(10))) { - cHov = true; - if(visi_hold != noone && jun.visible_manual != visi_hold) { - jun.setVisibleManual(visi_hold); - jun.node.refreshNodeDisplay(); - } + if(anim_hold != noone && mouse_release(mb_left)) anim_hold = noone; - draw_sprite_ui_uniform(THEME.junc_visible, _visi, butx, lb_y, 1,, 1); - TOOLTIP = __txt("Visibility"); - - if(mouse_press(mb_left, _focus)) { - jun.setVisibleManual(_visi? -1 : 1); - visi_hold = jun.visible_manual; - } - } - - } else - draw_sprite_ui_uniform(THEME.node_use_expression, 0, butx, lb_y, 1,, 0.8); - - if(visi_hold != noone && mouse_release(mb_left)) visi_hold = noone; - - var cc = COLORS._main_text; - if(jun.expUse) { - var expValid = jun.expTree != noone && jun.expTree.validate(); - cc = expValid? COLORS._main_value_positive : COLORS._main_value_negative; - } - - if(global_var) { - if(string_pos(" ", _name)) cc = COLORS._main_value_negative; - } else { - if(jun.is_anim) cc = COLORS._main_value_positive; - if(jun.hasJunctionFrom()) cc = COLORS._main_accent; - } - - draw_set_text(_font, fa_left, fa_center, cc); - var lb_w = ui(40 + 16) + string_width(_name); - var lb_x = ui(40) + xx; - - if(jun.color != -1) { - draw_sprite_ext(THEME.timeline_color, 1, lb_x + ui(8), lb_y, 1, 1, 0, jun.color, 1); - lb_x += ui(24); - lb_w += ui(24); - } - - if(!jun.active) { - draw_set_text(_font, fa_left, fa_center, COLORS._main_text_sub_inner); - draw_text_add(lb_x, lb_y - ui(2), _name); - - if(jun.active_tooltip != "") { - var tx = xx + ui(40) + string_width(_name) + ui(16); - var ty = lb_y - ui(1); + butx += ui(20); + if(!global_var) { // Visibility + var _visi = jun.isVisible(); - if(point_in_circle(_m[0], _m[1], tx, ty, ui(10))) { + draw_sprite_ui_uniform(THEME.junc_visible, _visi, butx, lb_y, 1,, 0.8); + if(_hover && point_in_circle(_m[0], _m[1], butx, lb_y, ui(10))) { cHov = true; - TOOLTIP = jun.active_tooltip; - draw_sprite_ui(THEME.info, 0, tx, ty,,,, COLORS._main_icon_light, 1); - } else - draw_sprite_ui(THEME.info, 0, tx, ty,,,, COLORS._main_icon_light, 0.75); + if(visi_hold != noone && jun.visible_manual != visi_hold) { + jun.setVisibleManual(visi_hold); + jun.node.refreshNodeDisplay(); + } + + draw_sprite_ui_uniform(THEME.junc_visible, _visi, butx, lb_y, 1,, 1); + TOOLTIP = __txt("Visibility"); + + if(mouse_press(mb_left, _focus)) { + jun.setVisibleManual(_visi? -1 : 1); + visi_hold = jun.visible_manual; + } + } + + } else + draw_sprite_ui_uniform(THEME.node_use_expression, 0, butx, lb_y, 1,, 0.8); + + if(visi_hold != noone && mouse_release(mb_left)) visi_hold = noone; + + var cc = COLORS._main_text; + if(jun.expUse) { + var expValid = jun.expTree != noone && jun.expTree.validate(); + cc = expValid? COLORS._main_value_positive : COLORS._main_value_negative; } - return [ 0, true, cHov ]; - } - - draw_text_add(lb_x, lb_y, _name); + if(global_var) { + if(string_pos(" ", _name)) cc = COLORS._main_value_negative; + } else { + if(jun.is_anim) cc = COLORS._main_value_positive; + if(jun.hasJunctionFrom()) cc = COLORS._main_accent; + } + + draw_set_text(_font, fa_left, fa_center, cc); + var lb_w = ui(40 + 16) + string_width(_name); + var lb_x = ui(40) + xx; + + if(jun.color != -1) { + draw_sprite_ext(THEME.timeline_color, 1, lb_x + ui(8), lb_y, 1, 1, 0, jun.color, 1); + lb_x += ui(24); + lb_w += ui(24); + } + + if(!jun.active) { + draw_set_text(_font, fa_left, fa_center, COLORS._main_text_sub_inner); + draw_text_add(lb_x, lb_y - ui(2), _name); - #region tooltip - if(jun.tooltip != "") { + if(jun.active_tooltip != "") { + var tx = xx + ui(40) + string_width(_name) + ui(16); + var ty = lb_y - ui(1); + + if(point_in_circle(_m[0], _m[1], tx, ty, ui(10))) { + cHov = true; + + TOOLTIP = jun.active_tooltip; + draw_sprite_ui(THEME.info, 0, tx, ty,,,, COLORS._main_icon_light, 1); + } else + draw_sprite_ui(THEME.info, 0, tx, ty,,,, COLORS._main_icon_light, 0.75); + } + + return [ 0, true, cHov ]; + } + #endregion + + #region label + draw_text_add(lb_x, lb_y, _name); + + if(jun.tooltip != "") { // Tooltip var tx = xx + ui(40) + string_width(_name) + ui(16); var ty = lb_y - ui(1); @@ -151,8 +155,10 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc if(is_string(jun.tooltip)) TOOLTIP = jun.tooltip; + else if(mouse_click(mb_left, _focus)) dialogCall(jun.tooltip); + draw_sprite_ui(THEME.info, 0, tx, ty,,,, COLORS._main_icon_light, 1); } else draw_sprite_ui(THEME.info, 0, tx, ty,,,, COLORS._main_icon_light, 0.75); @@ -160,14 +166,13 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc lb_w += ui(32); } #endregion - - #region anim - if(jun.connect_type == CONNECT_TYPE.input && breakLine && jun.is_anim) { - var _anim = jun.animator; + + #region right buttons + if(jun.connect_type == CONNECT_TYPE.input && breakLine && jun.is_anim) { // Animation var bx = xx + ww - ui(12); var by = lb_y; - var b = buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _focus, _hover, "", THEME.prop_keyframe, 2) + var b = buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _hover, _focus, "", THEME.prop_keyframe, 2) if(b) cHov = true; if(b == 2) { @@ -193,7 +198,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc } var _tlp = kfFocus? __txtx("panel_inspector_remove_key", "Remove keyframe") : __txtx("panel_inspector_add_key", "Add keyframe"); - var b = buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _focus, _hover, _tlp, THEME.prop_keyframe, 1, cc) + var b = buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _hover, _focus, _tlp, THEME.prop_keyframe, 1, cc) if(b) cHov = true; if(b == 2) { @@ -212,7 +217,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc } bx -= ui(26); - var b = buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _focus, _hover, "", THEME.prop_keyframe, 0) + var b = buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _hover, _focus, "", THEME.prop_keyframe, 0) if(b) cHov = true; if(b == 2) { @@ -236,15 +241,13 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc bx -= ui(26 + 12); tooltip_loop_type.index = jun.on_end; - var b = buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _focus, _hover, tooltip_loop_type, THEME.prop_on_end, jun.on_end) + var b = buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _hover, _focus, tooltip_loop_type, THEME.prop_on_end, jun.on_end) if(b) cHov = true; if(b == 2) jun.on_end = safe_mod(jun.on_end + 1, sprite_get_number(THEME.prop_on_end)); } - #endregion - #region right buttons - if(jun.connect_type == CONNECT_TYPE.input && breakLine && !jun.is_anim && !global_var) { + if(jun.connect_type == CONNECT_TYPE.input && breakLine && !jun.is_anim && !global_var) { // Right buttons var bx = xx + ww + ui(16); var by = lb_y; var bs = ui(24); @@ -252,7 +255,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc bx -= bs + ui(4); if(jun.is_modified) { - var b = buttonInstant(THEME.button_hide, bx - bsh, by - bsh, bs, bs, _m, _focus, _hover, __txtx("panel_inspector_reset", "Reset value"), THEME.refresh_16, 0, COLORS._main_icon) + var b = buttonInstant(THEME.button_hide, bx - bsh, by - bsh, bs, bs, _m, _hover, _focus, __txtx("panel_inspector_reset", "Reset value"), THEME.refresh_16, 0, COLORS._main_icon) if(b) cHov = true; if(b == 2) jun.resetValue(); @@ -261,7 +264,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc bx -= bs + ui(4); var ic_b = jun.expUse? c_white : COLORS._main_icon; - var b = buttonInstant(THEME.button_hide, bx - bsh, by - bsh, bs, bs, _m, _focus, _hover, __txtx("panel_inspector_use_expression", "Use expression"), THEME.node_use_expression, jun.expUse, ic_b) + var b = buttonInstant(THEME.button_hide, bx - bsh, by - bsh, bs, bs, _m, _hover, _focus, __txtx("panel_inspector_use_expression", "Use expression"), THEME.node_use_expression, jun.expUse, ic_b) if(b) cHov = true; if(b == 2) { @@ -273,7 +276,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc if(jun.expUse) { bx -= bs + ui(4); var cc = NODE_DROPPER_TARGET == jun? COLORS._main_value_positive : COLORS._main_icon; - var b = buttonInstant(THEME.button_hide, bx - bsh, by - bsh, bs, bs, _m, _focus, _hover, __txtx("panel_inspector_dropper", "Node Dropper"), THEME.node_dropper, 0, cc) + var b = buttonInstant(THEME.button_hide, bx - bsh, by - bsh, bs, bs, _m, _hover, _focus, __txtx("panel_inspector_dropper", "Node Dropper"), THEME.node_dropper, 0, cc) if(b) cHov = true; if(b == 2) NODE_DROPPER_TARGET = NODE_DROPPER_TARGET == jun? noone : jun; @@ -282,7 +285,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc if(jun.expUse || jun.type == VALUE_TYPE.text) { bx -= bs + ui(4); var cc = jun.popup_dialog == noone? COLORS._main_icon : COLORS._main_value_positive; - var b = buttonInstant(THEME.button_hide, bx - bsh, by - bsh, bs, bs, _m, _focus, _hover, __txtx("panel_inspector_pop_text", "Pop up Editor"), THEME.text_popup, 0, cc) + var b = buttonInstant(THEME.button_hide, bx - bsh, by - bsh, bs, bs, _m, _hover, _focus, __txtx("panel_inspector_pop_text", "Pop up Editor"), THEME.text_popup, 0, cc) if(b) cHov = true; if(b == 2) { @@ -295,7 +298,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc if(jun.bypass_junc) { bx -= bs + ui(4); var ic_b = jun.bypass_junc.visible? COLORS._main_icon_light : COLORS._main_icon; - var b = buttonInstant(THEME.button_hide, bx - bsh, by - bsh, bs, bs, _m, _focus, _hover, __txt("Bypass"), THEME.junction_bypass, jun.bypass_junc.visible, ic_b) + var b = buttonInstant(THEME.button_hide, bx - bsh, by - bsh, bs, bs, _m, _hover, _focus, __txt("Bypass"), THEME.junction_bypass, jun.bypass_junc.visible, ic_b) if(b) cHov = true; if(b == 2) { @@ -306,102 +309,103 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc } #endregion - var _hsy = yy + lb_h; - var padd = ui(8); - var labelWidth = max(lb_w, min(ww * 0.4, ui(200))); - var widExtend = breakLine || jun.type == VALUE_TYPE.curve; - - var editBoxX = xx + !widExtend * labelWidth; - var editBoxY = widExtend? _hsy : yy; - var editBoxW = (xx + ww) - editBoxX; - var editBoxH = widExtend? TEXTBOX_HEIGHT : lb_h; - - var widH = widExtend? editBoxH : 0; - var mbRight = true; + #region draw widget + var _hsy = yy + lb_h; + var padd = ui(8); + var labelWidth = max(lb_w, min(ww * 0.4, ui(200))); + var widExtend = breakLine || jun.type == VALUE_TYPE.curve; - if(jun.expUse) { // expression editor - var expValid = jun.expTree != noone && jun.expTree.validate(); - jun.express_edit.boxColor = expValid? COLORS._main_value_positive : COLORS._main_value_negative; - jun.express_edit.rx = rx; - jun.express_edit.ry = ry; + var editBoxX = xx + !widExtend * labelWidth; + var editBoxY = widExtend? _hsy : yy; + var editBoxW = (xx + ww) - editBoxX; + var editBoxH = widExtend? TEXTBOX_HEIGHT : lb_h; - jun.express_edit.setFocusHover(_focus, _hover); - if(_focus) jun.express_edit.register(_scrollPane); + var widH = widExtend? editBoxH : 0; + var mbRight = true; + + if(jun.expUse) { + var expValid = jun.expTree != noone && jun.expTree.validate(); + jun.express_edit.boxColor = expValid? COLORS._main_value_positive : COLORS._main_value_negative; + jun.express_edit.rx = rx; + jun.express_edit.ry = ry; - var wd_h = jun.express_edit.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.expression, _m); - widH = wd_h - (TEXTBOX_HEIGHT * !widExtend); - cHov |= jun.express_edit.inBBOX(_m); - - var un = jun.unit; - if(un.reference != noone) { - un.triggerButton.icon_index = un.mode; - un.triggerButton.tooltip.index = un.mode; - } - - } else if(wid && jun.display_type != VALUE_DISPLAY.none) { // edit widget - wid.setFocusHover(_focus, _hover); - - if(jun.connect_type == CONNECT_TYPE.input) { - wid.setInteract(jun.editable && !jun.hasJunctionFrom()); - if(_focus) wid.register(_scrollPane); - - if(is_instanceof(jun, __NodeValue_Dimension)) { - var _proj = jun.attributes.use_project_dimension; + jun.express_edit.setFocusHover(_focus, _hover); + if(_focus) jun.express_edit.register(_scrollPane); - wid.side_button.icon_index = _proj; - wid.side_button.icon_blend = _proj? c_white : COLORS._main_icon; + var wd_h = jun.express_edit.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.expression, _m); + widH = wd_h - (TEXTBOX_HEIGHT * !widExtend); + cHov |= jun.express_edit.inBBOX(_m); + + var un = jun.unit; + if(un.reference != noone) { + un.triggerButton.icon_index = un.mode; + un.triggerButton.tooltip.index = un.mode; } - } else { - wid.setInteract(false); - } - var _show = jun.showValue(); - var param = new widgetParam(editBoxX, editBoxY, editBoxW, editBoxH, _show, jun.display_data, _m, rx, ry); - param.font = viewMode == INSP_VIEW_MODE.spacious? f_p1 : f_p2; - param.sep_axis = jun.sep_axis; - - switch(jun.type) { - case VALUE_TYPE.float : - case VALUE_TYPE.integer : - switch(jun.display_type) { - case VALUE_DISPLAY.puppet_control : - case VALUE_DISPLAY.transform : - param.h = viewMode == INSP_VIEW_MODE.spacious? param.h : lb_h; - break; - } - break; + } else if(wid && jun.display_type != VALUE_DISPLAY.none) { + wid.setFocusHover(_focus, _hover); - case VALUE_TYPE.boolean : - if(is_instanceof(wid, checkBoxActive)) break; + if(jun.connect_type == CONNECT_TYPE.input) { + wid.setInteract(jun.editable && !jun.hasJunctionFrom()); + if(_focus) wid.register(_scrollPane); - param.halign = widExtend? fa_left : fa_center; - param.s = editBoxH; - - if(!widExtend) { - param.w = ww - min(ui(80) + ww * 0.2, ui(200)); - param.x = editBoxX + editBoxW - param.w; + if(is_instanceof(jun, __NodeValue_Dimension)) { + var _proj = jun.attributes.use_project_dimension; + + wid.side_button.icon_index = _proj; + wid.side_button.icon_blend = _proj? c_white : COLORS._main_icon; } - break; - - case VALUE_TYPE.surface : - case VALUE_TYPE.d3Material : - case VALUE_TYPE.dynaSurface : - param.h = widExtend? ui(96) : ui(48); - break; + } else { + wid.setInteract(false); + } - case VALUE_TYPE.curve : - if(point_in_rectangle(_m[0], _m[1], ui(32), _hsy, ui(32) + ww - ui(16), _hsy + wid.h)) - mbRight = false; - break; + var _show = jun.showValue(); + var param = new widgetParam(editBoxX, editBoxY, editBoxW, editBoxH, _show, jun.display_data, _m, rx, ry); + param.font = viewMode == INSP_VIEW_MODE.spacious? f_p1 : f_p2; + param.sep_axis = jun.sep_axis; + + switch(jun.type) { + case VALUE_TYPE.float : + case VALUE_TYPE.integer : + switch(jun.display_type) { + case VALUE_DISPLAY.puppet_control : + case VALUE_DISPLAY.transform : + param.h = viewMode == INSP_VIEW_MODE.spacious? param.h : lb_h; + break; + } + break; + + case VALUE_TYPE.boolean : + if(is_instanceof(wid, checkBoxActive)) break; + + param.halign = widExtend? fa_left : fa_center; + param.s = editBoxH; + + if(!widExtend) { + param.w = ww - min(ui(80) + ww * 0.2, ui(200)); + param.x = editBoxX + editBoxW - param.w; + } + break; + + case VALUE_TYPE.surface : + case VALUE_TYPE.d3Material : + case VALUE_TYPE.dynaSurface : + param.h = widExtend? ui(96) : ui(48); + break; + + case VALUE_TYPE.curve : + if(point_in_rectangle(_m[0], _m[1], ui(32), _hsy, ui(32) + ww - ui(16), _hsy + wid.h)) + mbRight = false; + break; + } + + var _widH = wid.drawParam(param) ?? 0; + widH = _widH - (TEXTBOX_HEIGHT * !widExtend); + cHov |= wid.inBBOX(_m) + + mbRight &= wid.right_click_block; } - - var _widH = wid.drawParam(param) ?? 0; - widH = _widH - (TEXTBOX_HEIGHT * !widExtend); - cHov |= wid.inBBOX(_m) - - mbRight &= wid.right_click_block; - - } + #endregion return [ widH, mbRight, cHov ]; } \ No newline at end of file diff --git a/scripts/node_2d_light/node_2d_light.gml b/scripts/node_2d_light/node_2d_light.gml index 3f37d9960..0d41bf917 100644 --- a/scripts/node_2d_light/node_2d_light.gml +++ b/scripts/node_2d_light/node_2d_light.gml @@ -102,7 +102,7 @@ function Node_2D_light(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var bs = ui(24); var bx = _x + ui(20); var by = _y; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.add_16, 0, COLORS._main_value_positive) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "", THEME.add_16, 0, COLORS._main_value_positive) == 2) { createNewInput(); triggerRender(); } @@ -145,7 +145,7 @@ function Node_2D_light(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var bs = ui(24); var bx = _x1 - bs; var by = _yy - bs / 2; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.minus_16, 0, hov? COLORS._main_value_negative : COLORS._main_icon) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "", THEME.minus_16, 0, hov? COLORS._main_value_negative : COLORS._main_icon) == 2) del_light = i; } } diff --git a/scripts/node_canvas/node_canvas.gml b/scripts/node_canvas/node_canvas.gml index be0c69ce2..c42d77589 100644 --- a/scripts/node_canvas/node_canvas.gml +++ b/scripts/node_canvas/node_canvas.gml @@ -162,7 +162,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor var _bx = _x1 + _aw / 2 - _bs / 2; var _by = _y + _h / 2 - _bs / 2; - if(buttonInstant(noone, _bx, _by, _bs, _bs, _m, _focus, _hover, "", THEME.add_16, 0, [ COLORS._main_icon, COLORS._main_value_positive ]) == 2) { + if(buttonInstant(noone, _bx, _by, _bs, _bs, _m, _hover, _focus, "", THEME.add_16, 0, [ COLORS._main_icon, COLORS._main_value_positive ]) == 2) { attributes.frames++; refreshFrames(); update(); diff --git a/scripts/node_canvas_group/node_canvas_group.gml b/scripts/node_canvas_group/node_canvas_group.gml index f8df22150..a6e04e772 100644 --- a/scripts/node_canvas_group/node_canvas_group.gml +++ b/scripts/node_canvas_group/node_canvas_group.gml @@ -40,7 +40,7 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection(_x, _y, _group) con var bx = _x; var by = _yy; var bs = ui(24); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.add_16, 0, COLORS._main_value_positive) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "", THEME.add_16, 0, COLORS._main_value_positive) == 2) layerAdd(); _h += bs + ui(8); diff --git a/scripts/node_colors_replace/node_colors_replace.gml b/scripts/node_colors_replace/node_colors_replace.gml index bcdb5dbe0..ed162a80d 100644 --- a/scripts/node_colors_replace/node_colors_replace.gml +++ b/scripts/node_colors_replace/node_colors_replace.gml @@ -52,22 +52,22 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g var by = _y; var bs = ui(24); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover,, THEME.refresh_16) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus,, THEME.refresh_16) == 2) refreshPalette(); bx += bs + ui(4); var jun = inputs[2]; var index = jun.value_from == noone? jun.is_anim : 2; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover,, THEME.animate_clock, index, index == 2? COLORS._main_accent : COLORS._main_icon) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus,, THEME.animate_clock, index, index == 2? COLORS._main_accent : COLORS._main_icon) == 2) jun.setAnim(!jun.is_anim); bx += bs + ui(4); var vis = jun.visible; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover,, THEME.junc_visible, vis) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus,, THEME.junc_visible, vis) == 2) jun.visible = !vis; bx += bs + ui(4); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover,, THEME.sort_16) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus,, THEME.sort_16) == 2) menuCall("", sort_menu); var _from = getInputData(1); @@ -109,7 +109,7 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g bx = _x2 - ui(32); _x2 -= ui(32 + 4); by = _y0 + ss / 2 - ui(32) / 2; - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), _m, _focus, _hover,, THEME.color_picker_dropper,, c_white) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), _m, _hover, _focus,, THEME.color_picker_dropper,, c_white) == 2) { var dialog = dialogCall(o_dialog_color_selector, WIN_W / 2, WIN_H / 2); dialog.selector.dropper_active = true; dialog.selector.dropper_close = true; @@ -121,7 +121,7 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g bx = _x2 - ui(32); _x2 -= ui(32 + 4); - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), _m, _focus, _hover,, THEME.color_wheel,, c_white) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), _m, _hover, _focus,, THEME.color_wheel,, c_white) == 2) { var pick = instance_create(mouse_mx, mouse_my, o_dialog_color_quick_pick); array_insert(pick.palette, 0, to); pick.onApply = setColor; diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index e224f0596..b4a68122b 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -1131,19 +1131,15 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { static triggerRender = function(resetSelf = true) { LOG_BLOCK_START(); - LOG_IF(global.FLAG.render == 1, $"Trigger render for {self}"); + LOG_IF(global.FLAG.render == 1, $"Trigger render for {getFullName()}"); if(resetSelf) resetRender(false); RENDER_PARTIAL - if(is_instanceof(group, Node_Collection)) { + if(is(group, Node_Collection)) group.triggerRender(); - } else { - - var nodes = getNextNodesRaw(); - for(var i = 0; i < array_length(nodes); i++) - nodes[i].triggerRender(); - } + else + array_foreach(getNextNodesRaw(), function(n) /*=>*/ {return n.triggerRender()}); LOG_BLOCK_END(); } diff --git a/scripts/node_gm_room/node_gm_room.gml b/scripts/node_gm_room/node_gm_room.gml index f42f07af9..dea76ca4b 100644 --- a/scripts/node_gm_room/node_gm_room.gml +++ b/scripts/node_gm_room/node_gm_room.gml @@ -6,18 +6,92 @@ function Node_GMRoom(_x, _y, _group = noone) : Node(_x, _y, _group) constructor layers = []; layerMap = {}; - newInput( 0, nodeValue_Vec2("Room size", self, [ 16, 16 ])); + maxTileSize = [ 1, 1 ]; - newInput( 1, nodeValue_Bool("Persistance", self, false)); + newOutput( 0, nodeValue_Surface("Room Preview", self, noone)); layer_selecting = noone; - tb_depth = new textBox(TEXTBOX_INPUT.number, function(v) /*=>*/ { - if(layer_selecting == noone) return; - layer_selecting.raw.depth = round(v); - }); + tb_depth = new textBox(TEXTBOX_INPUT.number, function(v) /*=>*/ { if(layer_selecting == noone) return; layer_selecting.raw.depth = round(v); }) + .setLabel("Depth").setFont(f_p3); - tb_depth.label = "Depth"; - tb_depth.font = f_p3; + #region room resize + room_resizing = false; + room_resizing_area = [ 0, 0, 0, 0 ]; + room_resizing_hov = array_create(4); + room_resizing_t = noone; + room_resizing_mx = 0; room_resizing_my = 0; + room_resizing_ss = 0; + + room_resize_apply = button( function() { applyResizeRoom(); } ).setIcon(THEME.toolbar_check, 0); + room_resize_cancel = button( function() { room_resizing = false; } ).setIcon(THEME.toolbar_check, 1); + + tb_room_resize_w = new textBox(TEXTBOX_INPUT.number, function(v) /*=>*/ { room_resizing_area[2] = room_resizing_area[0] + round(v); }).setHide(1).setFont(f_p3); + tb_room_resize_h = new textBox(TEXTBOX_INPUT.number, function(v) /*=>*/ { room_resizing_area[3] = room_resizing_area[1] + round(v); }).setHide(1).setFont(f_p3); + #endregion + + room_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { + var hh = ui(40); + var _yy = _y + ui(8); + draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, hh, COLORS.node_composite_bg_blend, 1); + + var _wdx = _x + ui(128); + var _wdy = _yy; + var _wdw = _w - ui(128 + 8); + var _wdh = ui(24); + + draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text_sub); + draw_text_add(_x + ui(16), _wdy + _wdh / 2, "Room Size"); + + var _wdw = _w - ui(128 + 8) - (room_resizing? _wdh * 2 : _wdh); + + draw_sprite_stretched_ext(THEME.textbox, 3, _wdx, _wdy, _wdw / 2, _wdh, COLORS._main_icon_light); + draw_sprite_stretched_ext(THEME.textbox, 3, _wdx + _wdw / 2, _wdy, _wdw / 2, _wdh, COLORS._main_icon_light); + + var _ww = gmRoom.roomSettings.Width; + var _hh = gmRoom.roomSettings.Height; + + if(room_resizing) { + _ww = room_resizing_area[2] - room_resizing_area[0]; + _hh = room_resizing_area[3] - room_resizing_area[1]; + + var _wpr = new widgetParam(_wdx, _wdy, _wdw / 2, _wdh, _ww, {}, _m, room_renderer.rx, room_renderer.ry).setFont(f_p2).setFocusHover(_focus, _hover); + tb_room_resize_w.drawParam(_wpr); + + var _wpr = new widgetParam(_wdx + _wdw / 2, _wdy, _wdw / 2, _wdh, _hh, {}, _m, room_renderer.rx, room_renderer.ry).setFont(f_p2).setFocusHover(_focus, _hover); + tb_room_resize_h.drawParam(_wpr); + + } else { + draw_set_text(f_p2, fa_center, fa_center, COLORS._main_text); + draw_text_add(_wdx + _wdw / 4, _wdy + _wdh / 2, _ww); + draw_text_add(_wdx + _wdw / 2 + _wdw / 4, _wdy + _wdh / 2, _hh); + } + + if(room_resizing) { + var _bx = _wdx + _wdw; + if(buttonInstant(THEME.button_def, _bx, _wdy, _wdh, _wdh, _m, _hover, _focus, __txt("Cancel"), THEME.toolbar_check, 1, + COLORS._main_value_negative, 1, 1, COLORS._main_icon_light) == 2) + room_resizing = false; + + var misalign = (room_resizing_area[0] % maxTileSize[0] != 0) || (room_resizing_area[1] % maxTileSize[1] != 0) || + (room_resizing_area[2] % maxTileSize[0] != 0) || (room_resizing_area[3] % maxTileSize[1] != 0); + var _tooltip = misalign? __txt("Warning: room size not divisible by tile size. May cause tile shifting.") : __txt("Apply"); + + _bx += _wdh; + if(buttonInstant(THEME.button_def, _bx, _wdy, _wdh, _wdh, _m, _hover, _focus, _tooltip, THEME.toolbar_check, 0, + COLORS._main_value_positive, 1, 1, COLORS._main_icon_light) == 2) + applyResizeRoom(); + + } else { + if(buttonInstant(THEME.button_def, _wdx + _wdw, _wdy, _wdh, _wdh, _m, _hover, _focus, __txt("Resize"), THEME.canvas_resize, 0, + COLORS._main_icon_light, 1, 1, COLORS._main_icon_light) == 2) { + + room_resizing = true; + room_resizing_area = [ 0, 0, gmRoom.roomSettings.Width, gmRoom.roomSettings.Height ]; + } + } + + return hh; + }); layers_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { if(gmRoom == noone) { @@ -28,16 +102,20 @@ function Node_GMRoom(_x, _y, _group = noone) : Node(_x, _y, _group) constructor return ui(28); } - var _amo = array_length(gmRoom.layers); + var _amo = array_length(layers); var hh = ui(28); var _h = hh * _amo + ui(16); draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, _h, COLORS.node_composite_bg_blend, 1); - for( var i = 0, n = array_length(gmRoom.layers); i < n; i++ ) { - var _yy = _y + ui(8) + i * hh; - var _l = gmRoom.layers[i]; - var _exposed = struct_has(inputMap, _l.name); + for( var i = 0, n = array_length(layers); i < n; i++ ) { + var _ld = layers[i]; + var _l = _ld.layer; + var _d = _ld.depth; + var _xx = _x + _d * ui(32); + var _yy = _y + ui(8) + i * hh; + + var _exposed = struct_has(inputMap, _l.name); var cc = layer_selecting == _l? COLORS._main_text_accent : COLORS._main_text_sub; if(_hover && point_in_rectangle(_m[0], _m[1], _x, _yy, _x + _w, _yy + hh - 1)) { @@ -49,9 +127,9 @@ function Node_GMRoom(_x, _y, _group = noone) : Node(_x, _y, _group) constructor if(_exposed) draw_sprite_ui_uniform(THEME.animate_clock, 2, _x + ui(20),_yy + hh / 2, 1, COLORS._main_accent); - draw_sprite_ui_uniform(s_gmlayer, _l.index, _x + ui(44), _yy + hh / 2, 1, cc); + draw_sprite_ui_uniform(s_gmlayer, _l.index, _xx + ui(44), _yy + hh / 2, 1, cc); draw_set_text(f_p2, fa_left, fa_center, cc); - draw_text_add(_x + ui(64), _yy + hh / 2, _l.name); + draw_text_add(_xx + ui(64), _yy + hh / 2, _l.name); } return _h; @@ -80,10 +158,9 @@ function Node_GMRoom(_x, _y, _group = noone) : Node(_x, _y, _group) constructor var _yy = _y + ui(8); var _wdy = _yy; var _wdh = ui(32); - var _wpr = new widgetParam(_wdx, _wdy, _wdw, _wdh, _l.raw.depth, {}, _m, layer_renderer.rx, layer_renderer.ry); - _wpr.color = COLORS._main_icon_light; - - tb_depth.setFocusHover(_focus, _hover); + var _wpr = new widgetParam(_wdx, _wdy, _wdw, _wdh, _l.raw.depth, {}, _m, layer_renderer.rx, layer_renderer.ry) + .setColor(COLORS._main_icon_light) + .setFocusHover(_focus, _hover); tb_depth.drawParam(_wpr); _yy += _wdh + ui(8); @@ -119,12 +196,9 @@ function Node_GMRoom(_x, _y, _group = noone) : Node(_x, _y, _group) constructor draw_sprite_stretched_ext(THEME.textbox, 3, _wdx, _wdy, _wdw / 2, _wdh, COLORS._main_icon_light); draw_sprite_stretched_ext(THEME.textbox, 3, _wdx + _wdw / 2, _wdy, _wdw / 2, _wdh, COLORS._main_icon_light); - var _tw = _l.tiles.SerialiseWidth; - var _th = _l.tiles.SerialiseHeight; - draw_set_text(f_p2, fa_center, fa_center, COLORS._main_text); - draw_text_add(_wdx + _wdw / 4, _wdy + _wdh / 2, _tw); - draw_text_add(_wdx + _wdw / 2 + _wdw / 4, _wdy + _wdh / 2, _th); + draw_text_add(_wdx + _wdw / 4, _wdy + _wdh / 2, _l.tiles.SerialiseWidth); + draw_text_add(_wdx + _wdw / 2 + _wdw / 4, _wdy + _wdh / 2, _l.tiles.SerialiseHeight); _yy += _wdh + ui(8); _h += _wdh + ui(8); @@ -164,14 +238,9 @@ function Node_GMRoom(_x, _y, _group = noone) : Node(_x, _y, _group) constructor }); input_display_list = [ - ["Room settings", false], 0, 1, - ["Layers", false], - - layers_renderer, - new Inspector_Spacer(ui(4)), - layer_renderer, - - ["Data", true], + ["Room", false], room_renderer, + ["Layers", false], layers_renderer, new Inspector_Spacer(ui(4)), layer_renderer, + ["Data", true], ]; static createNewInput = function() { @@ -186,25 +255,41 @@ function Node_GMRoom(_x, _y, _group = noone) : Node(_x, _y, _group) constructor ////- GM + static roomLayerExtract = function(_layer, _depth = 0) { + var _arr = []; + + for( var i = 0, n = array_length(_layer.layers); i < n; i++ ) { + var _l = _layer.layers[i]; + array_push(_arr, { layer: _l, depth: _depth }); + array_append(_arr, roomLayerExtract(_l, _depth + 1)); + } + + return _arr; + } + static bindRoom = function(_gmRoom) { gmRoom = _gmRoom; layers = []; layerMap = {}; if(_gmRoom == noone) return; + display_name = gmRoom.name; gmRoom.gmBinder.nodeMap[$ gmRoom.key] = self; - layers = gmRoom.layers; - for( var i = 0, n = array_length(layers); i < n; i++ ) - layerMap[$ layers[i].name] = layers[i]; + layers = roomLayerExtract(gmRoom); + maxTileSize = [ 1, 1 ]; - var _settings = gmRoom.raw.roomSettings; - var _width = _settings.Width; - var _height = _settings.Height; - var _persistance = _settings.persistent; + for( var i = 0, n = array_length(layers); i < n; i++ ) { + var _l = layers[i].layer; + layerMap[$ _l.name] = _l; + _l.refreshPreview(); + + if(is(_l, GMRoom_Tile) && _l.tileset != noone) { + maxTileSize[0] = max(maxTileSize[0], _l.tileset.raw.tileWidth); + maxTileSize[1] = max(maxTileSize[1], _l.tileset.raw.tileHeight); + } + } - inputs[0].setValue([_width, _height]); - inputs[1].setValue(_persistance); } static exposeData = function(_layer) { @@ -213,7 +298,8 @@ function Node_GMRoom(_x, _y, _group = noone) : Node(_x, _y, _group) constructor _in.attributes.layerName = _layer.name; if(is(_layer, GMRoom_Tile)) { - _in.setType(VALUE_TYPE.integer); + _in.setType(VALUE_TYPE.struct); + _in.editWidget.shorted = true; var _tileset = gmRoom.gmBinder.getNodeFromPath(_layer.tileset.key, x - ui(320), y); _tileset.bindTile(_layer.tileset); @@ -227,8 +313,197 @@ function Node_GMRoom(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } + static applyResizeRoom = function() { + room_resizing = false; + + var _area = room_resizing_area; + var _dx = -_area[0]; + var _dy = -_area[1]; + var _ww = _area[2] - _area[0]; + var _hh = _area[3] - _area[1]; + + gmRoom.roomSettings.Width = _ww; + gmRoom.roomSettings.Height = _hh; + + for( var i = 0, n = array_length(layers); i < n; i++ ) { + var _l = layers[i].layer; + + switch(instanceof(_l)) { + case "GMRoom_Tile" : + var _inp = inputMap[$ _l.name]; + var _tw = _l.tileset.raw.tileWidth; + var _th = _l.tileset.raw.tileHeight; + var _trea = [ floor(_area[0] / _tw), floor(_area[1] / _tw), + ceil( _area[2] / _tw), ceil( _area[3] / _tw) ]; + + if(is_undefined(_inp)) { + _l.resizeBBOX(_trea); + + } else if(_inp.value_from) { + var _nd = _inp.value_from.node; + if(is(_nd, Node_Tile_Drawer)) + _nd.resizeBBOX(_trea); + } + break; + + case "GMRoom_Instance" : + for( var j = 0, m = array_length(_l.instances); j < m; j++ ) { + var _ins = _l.instances[j]; + _ins.data.x += _dx; + _ins.data.y += _dy; + } + break; + + case "GMRoom_Asset" : + for( var j = 0, m = array_length(_l.assets); j < m; j++ ) { + var _ass = _l.assets[j]; + _ass.data.x += _dx; + _ass.data.y += _dy; + } + break; + + } + + _l.refreshPreview(); + } + + triggerRender(); + } + ////- Update + static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { + preview_alpha = room_resizing? .5 : 1; + if(!room_resizing) return; + + var rw = gmRoom.roomSettings.Width; + var rh = gmRoom.roomSettings.Height; + + var _x0 = _x; + var _y0 = _y; + var _x1 = _x + rw * _s; + var _y1 = _y + rh * _s; + + var _area = room_resizing_area; + + var _cx0 = _x + _area[0] * _s; + var _cy0 = _y + _area[1] * _s; + var _cx1 = _x + _area[2] * _s; + var _cy1 = _y + _area[3] * _s; + + var _hov = noone; + if(hover) { + if(point_in_circle(_mx, _my, _cx0, _cy0, 10)) _hov = 0; + else if(point_in_circle(_mx, _my, _cx1, _cy0, 10)) _hov = 1; + else if(point_in_circle(_mx, _my, _cx0, _cy1, 10)) _hov = 2; + else if(point_in_circle(_mx, _my, _cx1, _cy1, 10)) _hov = 3; + else if(point_in_rectangle(_mx, _my, _cx0, _cy0, _cx1, _cy1)) _hov = 4; + } + + for( var i = 0; i < 4; i++ ) room_resizing_hov[i] = lerp_float(room_resizing_hov[i], i == _hov, 5); + if(room_resizing_t != noone) _hov = room_resizing_t; + + draw_set_color(_hov == 4? COLORS._main_accent : COLORS._main_icon); + draw_rectangle_dashed(_cx0, _cy0, _cx1, _cy1, 1 + (_hov == 4)); + + draw_anchor(room_resizing_hov[0], _cx0, _cy0, 10); + draw_anchor(room_resizing_hov[1], _cx1, _cy0, 10); + draw_anchor(room_resizing_hov[2], _cx0, _cy1, 10); + draw_anchor(room_resizing_hov[3], _cx1, _cy1, 10); + + if(room_resizing_t == noone) { + if(_hov > noone && mouse_press(mb_left, active)) { + room_resizing_t = _hov; + room_resizing_ss = [ _area[0], _area[1], _area[2], _area[3] ]; + room_resizing_mx = _mx; + room_resizing_my = _my; + } + + } else { + var _dx = (_mx - room_resizing_mx) / _s; + var _dy = (_my - room_resizing_my) / _s; + var _sn = 8 / _s; + var _arss = room_resizing_ss; + var _dgx = undefined; + var _dgy = undefined; + + switch(room_resizing_t) { + case 0 : + _area[0] = value_snap(round(_arss[0] + _dx), _snx); + _area[1] = value_snap(round(_arss[1] + _dy), _sny); + + if(abs(_area[0]) < _sn) { _area[0] = 0; _dgx = 0; } + if(abs(_area[1]) < _sn) { _area[1] = 0; _dgy = 0; } + break; + + case 1 : + _area[2] = value_snap(round(_arss[2] + _dx), _snx); + _area[1] = value_snap(round(_arss[1] + _dy), _sny); + + if(abs(_area[2] - rw) < _sn) { _area[2] = rw; _dgx = rw; } + if(abs(_area[1]) < _sn) { _area[1] = 0; _dgy = 0; } + break; + + case 2 : + _area[0] = value_snap(round(_arss[0] + _dx), _snx); + _area[3] = value_snap(round(_arss[3] + _dy), _sny); + + if(abs(_area[0]) < _sn) { _area[0] = 0; _dgx = 0; } + if(abs(_area[3] - rh) < _sn) { _area[3] = rh; _dgy = rh; } + break; + + case 3 : + _area[2] = value_snap(round(_arss[2] + _dx), _snx); + _area[3] = value_snap(round(_arss[3] + _dy), _sny); + + if(abs(_area[2] - rw) < _sn) { _area[2] = rw; _dgx = rw; } + if(abs(_area[3] - rh) < _sn) { _area[3] = rh; _dgy = rh; } + break; + + case 4 : + var _ww = _area[2] - _area[0]; + var _hh = _area[3] - _area[1]; + + _area[0] = value_snap(round(_arss[0] + _dx), _snx); + _area[1] = value_snap(round(_arss[1] + _dy), _sny); + _area[2] = value_snap(round(_arss[2] + _dx), _snx); + _area[3] = value_snap(round(_arss[3] + _dy), _sny); + + if(abs(_area[0]) < _sn) { + _area[0] = 0; + _area[2] = _ww; + _dgx = 0; + + } else if(abs(_area[2] - rw) < _sn) { + _area[2] = rw; + _area[0] = rw - _ww; + _dgx = rw; + + } + + if(abs(_area[1]) < _sn) { + _area[1] = 0; + _area[3] = _hh; + _dgy = 0; + + } else if(abs(_area[3] - rh) < _sn) { + _area[3] = rh; + _area[1] = rh - _hh; + _dgy = rh; + + } + break; + } + + draw_set_color(COLORS._main_accent); + if(_dgx != undefined) draw_line_width(_x + _dgx * _s, 0, _x + _dgx * _s, WIN_H, 2); + if(_dgy != undefined) draw_line_width(0, _y + _dgy * _s, WIN_W, _y + _dgy * _s, 2); + + if(mouse_release(mb_left)) + room_resizing_t = noone; + } + } + static step = function() { } @@ -236,6 +511,12 @@ function Node_GMRoom(_x, _y, _group = noone) : Node(_x, _y, _group) constructor static update = function() { if(gmRoom == noone) return; + var _width = gmRoom.roomSettings.Width; + var _height = gmRoom.roomSettings.Height; + + var _prev = outputs[0].getValue(); + _prev = surface_verify(_prev, _width, _height); + for( var i = input_fix_len, n = array_length(inputs); i < n; i++ ) { var _in = inputs[i]; var _val = _in.getValue(); @@ -244,38 +525,41 @@ function Node_GMRoom(_x, _y, _group = noone) : Node(_x, _y, _group) constructor inputMap[$ _key] = _in; if(is(_lay, GMRoom_Tile)) { - _in.setType(VALUE_TYPE.integer); + _in.name = _lay.name; + _in.setType(VALUE_TYPE.struct); + _in.editWidget.shorted = true; var _tw = _lay.tiles.SerialiseWidth; var _th = _lay.tiles.SerialiseHeight; - var _tile = array_verify(_val, _tw * _th); - var _ctil = []; - var _type = _tile[0]; - var _runn = 1; - for( var j = 1, m = array_length(_tile); j < m; j++ ) { - if(_tile[j] == _type) _runn++ - else { - array_push(_ctil, -_runn, _type); - _type = _tile[j]; - _runn = 1; - } + var _tdata = struct_try_get(_val, "data", []); + var _tset = struct_try_get(_val, "tileset", noone); + var _tprev = struct_try_get(_val, "preview", noone); + + _lay.preview = _tprev; + + if(_tset && _tset.gmTile) { + _lay.tilesetId.name = _tset.gmTile.name; + _lay.tilesetId.path = _tset.gmTile.key; } - array_push(_ctil, -_runn, _type); - - if(array_length(_ctil) < array_length(_tile)) { - _lay.raw.tiles.TileCompressedData = _ctil; - _lay.raw.tiles.TileDataFormat = 1; - - } else { - _lay.raw.tiles.TileSerialiseData = _tile; - struct_remove(_lay.raw.tiles, "TileDataFormat"); - } + _lay.setArray(_tdata); } } - // gmRoom.sync(); + surface_set_target(_prev); + DRAW_CLEAR + + for( var i = array_length(layers) - 1; i >= 0; i-- ) { + var _l = layers[i].layer; + var _p = _l.preview; + draw_surface_safe(_p); + } + + surface_reset_target(); + + outputs[0].setValue(_prev); + gmRoom.sync(); } ////- Serialize diff --git a/scripts/node_image/node_image.gml b/scripts/node_image/node_image.gml index 306401df8..69761b22e 100644 --- a/scripts/node_image/node_image.gml +++ b/scripts/node_image/node_image.gml @@ -48,7 +48,6 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { static on_drop_file = function(path) { inputs[0].setValue(path); - if(updatePaths(path)) { doUpdate(); return true; } return false; } diff --git a/scripts/node_level/node_level.gml b/scripts/node_level/node_level.gml index d9d8501c5..d022d58d1 100644 --- a/scripts/node_level/node_level.gml +++ b/scripts/node_level/node_level.gml @@ -58,7 +58,7 @@ function Node_Level(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con var _bx = x1 - 20 - i * 24; var _by = y0; - if(buttonInstant(THEME.button_hide, _bx, _by, 20, 20, _m, _focus, _hover) == 2) + if(buttonInstant(THEME.button_hide, _bx, _by, 20, 20, _m, _hover, _focus) == 2) histShow[i] = !histShow[i]; draw_sprite_ui_uniform(THEME.circle, 0, _bx + 10, _by + 10, 1, COLORS.histogram[i], 0.5 + histShow[i] * 0.5); } diff --git a/scripts/node_level_selector/node_level_selector.gml b/scripts/node_level_selector/node_level_selector.gml index 4510680ff..dbb76f7c1 100644 --- a/scripts/node_level_selector/node_level_selector.gml +++ b/scripts/node_level_selector/node_level_selector.gml @@ -62,7 +62,7 @@ function Node_Level_Selector(_x, _y, _group = noone) : Node_Processor(_x, _y, _g var _bx = x1 - 20 - i * 24; var _by = y0; - if(buttonInstant(THEME.button_hide, _bx, _by, 20, 20, _m, _focus, _hover) == 2) + if(buttonInstant(THEME.button_hide, _bx, _by, 20, 20, _m, _hover, _focus) == 2) histShow[i] = !histShow[i]; draw_sprite_ui_uniform(THEME.circle, 0, _bx + 10, _by + 10, 1, COLORS.histogram[i], 0.5 + histShow[i] * 0.5); } diff --git a/scripts/node_liquefy/node_liquefy.gml b/scripts/node_liquefy/node_liquefy.gml index c3c90b49f..08c18811a 100644 --- a/scripts/node_liquefy/node_liquefy.gml +++ b/scripts/node_liquefy/node_liquefy.gml @@ -75,7 +75,7 @@ function Node_Liquefy(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c var bs = ui(24); var bx = _x + ui(20); var by = _y; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.add_16, 0, COLORS._main_value_positive) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "", THEME.add_16, 0, COLORS._main_value_positive) == 2) { createNewInput(); triggerRender(); } @@ -118,7 +118,7 @@ function Node_Liquefy(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c var bs = ui(24); var bx = _x1 - bs; var by = _yy - bs / 2; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.minus_16, 0, hov? COLORS._main_value_negative : COLORS._main_icon) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "", THEME.minus_16, 0, hov? COLORS._main_value_negative : COLORS._main_icon) == 2) del_light = i; } } diff --git a/scripts/node_midi_in/node_midi_in.gml b/scripts/node_midi_in/node_midi_in.gml index bb682e8cb..a2feb7041 100644 --- a/scripts/node_midi_in/node_midi_in.gml +++ b/scripts/node_midi_in/node_midi_in.gml @@ -62,7 +62,7 @@ function Node_MIDI_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor var bs = TEXTBOX_HEIGHT; var bx = _x; var by = _wy; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus) == 2) index_watching = index_watching == i? noone : i; var cc = index_watching == i? COLORS._main_value_negative : COLORS._main_icon; draw_sprite_ext(THEME.circle_16, 0, bx + bs / 2, by + bs / 2, 1, 1, 0, cc, 1); diff --git a/scripts/node_mk_flare/node_mk_flare.gml b/scripts/node_mk_flare/node_mk_flare.gml index 5e15057a2..8431cde5f 100644 --- a/scripts/node_mk_flare/node_mk_flare.gml +++ b/scripts/node_mk_flare/node_mk_flare.gml @@ -259,7 +259,7 @@ function Node_MK_Flare(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var by = _fy; var bs = ui(24); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.add_16, 0, COLORS._main_value_positive) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "", THEME.add_16, 0, COLORS._main_value_positive) == 2) { array_push(_flares, new __FlarePart()); inputs[5].setValue(_flares); triggerRender(); @@ -267,7 +267,7 @@ function Node_MK_Flare(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) bx += bs + ui(8); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.minus_16, 0, COLORS._main_value_negative) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "", THEME.minus_16, 0, COLORS._main_value_negative) == 2) { array_delete(_flares, array_length(_flares) - 1, 1); inputs[5].setValue(_flares); triggerRender(); diff --git a/scripts/node_normal_light/node_normal_light.gml b/scripts/node_normal_light/node_normal_light.gml index 31a2fe7b6..b720e784b 100644 --- a/scripts/node_normal_light/node_normal_light.gml +++ b/scripts/node_normal_light/node_normal_light.gml @@ -49,7 +49,7 @@ function Node_Normal_Light(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro var bs = ui(24); var bx = _x + ui(20); var by = _y; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.add_16, 0, COLORS._main_value_positive) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "", THEME.add_16, 0, COLORS._main_value_positive) == 2) { createNewInput(); triggerRender(); } @@ -92,7 +92,7 @@ function Node_Normal_Light(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro var bs = ui(24); var bx = _x1 - bs; var by = _yy - bs / 2; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.minus_16, 0, hov? COLORS._main_value_negative : COLORS._main_icon) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "", THEME.minus_16, 0, hov? COLORS._main_value_negative : COLORS._main_icon) == 2) del_light = i; } } diff --git a/scripts/node_number/node_number.gml b/scripts/node_number/node_number.gml index f1e3d0f9c..2eddafd1c 100644 --- a/scripts/node_number/node_number.gml +++ b/scripts/node_number/node_number.gml @@ -418,7 +418,7 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor var by = bbox.y0 + 4 * _s; var cc = colorMultiply(CDEF.main_white, _col); - var b = buttonInstant(THEME.button_def, bx, by, bw, bh, [ _mx, _my ], _focus, _hover, "", THEME.minus, 0, COLORS._main_value_negative, 1, .75 * _s, cc); + var b = buttonInstant(THEME.button_def, bx, by, bw, bh, [ _mx, _my ], _hover, _focus, "", THEME.minus, 0, COLORS._main_value_negative, 1, .75 * _s, cc); if(b) draggable = false; if(b == 2) { val -= stp; @@ -427,7 +427,7 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } var bx = bbox.x1 - 4 * _s - bw; - var b = buttonInstant(THEME.button_def, bx, by, bw, bh, [ _mx, _my ], _focus, _hover, "", THEME.add, 0, COLORS._main_value_positive, 1, .75 * _s, cc); + var b = buttonInstant(THEME.button_def, bx, by, bw, bh, [ _mx, _my ], _hover, _focus, "", THEME.add, 0, COLORS._main_value_positive, 1, .75 * _s, cc); if(b) draggable = false; if(b == 2) { val += stp; diff --git a/scripts/node_repeat/node_repeat.gml b/scripts/node_repeat/node_repeat.gml index 004098e61..44b3efe06 100644 --- a/scripts/node_repeat/node_repeat.gml +++ b/scripts/node_repeat/node_repeat.gml @@ -174,7 +174,7 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co var bs = ui(24); var bx = _x + ui(20); var by = _y; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.add_16, 0, COLORS._main_value_positive) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "", THEME.add_16, 0, COLORS._main_value_positive) == 2) { createNewInput(); triggerRender(); } @@ -219,7 +219,7 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co var bs = ui(24); var bx = _x1 - bs; var by = _yy - bs / 2; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.minus_16, 0, hov? COLORS._main_value_negative : COLORS._main_icon) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "", THEME.minus_16, 0, hov? COLORS._main_value_negative : COLORS._main_icon) == 2) del_animator = i; } diff --git a/scripts/node_tiler/node_tiler.gml b/scripts/node_tiler/node_tiler.gml index 6255f7ea4..62371d1e2 100644 --- a/scripts/node_tiler/node_tiler.gml +++ b/scripts/node_tiler/node_tiler.gml @@ -27,7 +27,8 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou newOutput(2, nodeValue_Output("Tileset", self, VALUE_TYPE.tileset, noone)); - newOutput(3, nodeValue_Output("Tile Data", self, VALUE_TYPE.integer, 0)); + newOutput(3, nodeValue_Output("Tile Data", self, VALUE_TYPE.struct, {})); + outputs[3].editWidget.shorted = true; output_display_list = [ 2, 1, 0, 3 ]; @@ -349,7 +350,7 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou var amo = _mapSize[0] * _mapSize[1]; if(gmTileLayer != noone) { - tileData = array_verify(tileData, amo); + var tileArr = array_verify(struct_try_get(tileData, "data"), amo); var i = 0; var b; @@ -364,13 +365,16 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou b = round(b); switch(b) { - case 0 : tileData[i] = 0; break; - default : tileData[i] = b - 1; break; + case 0 : tileArr[i] = 0; break; + default : tileArr[i] = b - 1; break; } i++; } + tileData.tileset = tileset; + tileData.data = tileArr; + tileData.preview = _tileOut; } return [ _tileOut, _tileMap, tileset, tileData ]; @@ -392,6 +396,8 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou if(gmTileLayer == noone) return; + display_name = gmTileLayer.name; + var _w = gmTileLayer.tiles.SerialiseWidth; var _h = gmTileLayer.tiles.SerialiseHeight; inputs[1].setValue([ _w, _h ]); @@ -433,11 +439,9 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou canvas_buffer = _b; canvas_surface = surface_verify(canvas_surface, _w, _h, surface_rgba16float); buffer_set_surface(canvas_buffer, canvas_surface, 0); - - triggerRender(); } - ////- Serialzie + ////- Serialize static attributeSerialize = function() { var _attr = { @@ -470,4 +474,29 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou } } + + ////- Actions + + static resizeBBOX = function(bbox) { + var _nw = bbox[2] - bbox[0]; + var _nh = bbox[3] - bbox[1]; + var _dx = -bbox[0]; + var _dy = -bbox[1]; + + inputs[1].setValue([_nw, _nh]); + + var _newSurf = surface_create(_nw, _nh, surface_rgba16float); + surface_set_target(_newSurf); + DRAW_CLEAR + BLEND_OVERRIDE + draw_surface_safe(canvas_surface, _dx, _dy); + BLEND_NORMAL + surface_reset_target(); + + surface_free_safe(canvas_surface); + canvas_surface = _newSurf; + + triggerRender(); + } + } \ No newline at end of file diff --git a/scripts/node_tiler_convert/node_tiler_convert.gml b/scripts/node_tiler_convert/node_tiler_convert.gml index 426a14953..8df1a26ca 100644 --- a/scripts/node_tiler_convert/node_tiler_convert.gml +++ b/scripts/node_tiler_convert/node_tiler_convert.gml @@ -30,7 +30,7 @@ function Node_Tile_Convert(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro var by = _y; var bs = ui(24); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover,, THEME.refresh_16) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus,, THEME.refresh_16) == 2) refreshPalette(); var _cmap = attributes.colorMap; diff --git a/scripts/node_tiler_tileset/node_tiler_tileset.gml b/scripts/node_tiler_tileset/node_tiler_tileset.gml index 323d1d4a8..48a02d8fb 100644 --- a/scripts/node_tiler_tileset/node_tiler_tileset.gml +++ b/scripts/node_tiler_tileset/node_tiler_tileset.gml @@ -14,6 +14,12 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr tb_rename.font = f_p2; tb_rename.hide = true; + gmTile = noone; + texture = noone; + tileSize = [ 1, 1 ]; + tileAmount = [ 1, 1 ]; + rules = new Tileset_Rule(self); + newInput( 0, nodeValue_Surface("Texture", self, noone)); newInput( 1, nodeValue_Vec2("Tile size", self, [ 16, 16 ])); @@ -50,7 +56,8 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr _n.tool_pencil.toggle(); } - #region ++++ tile selector ++++ + ////- Tile selector + #region Tile selector tile_selector_surface = 0; tile_selector_mask = 0; tile_selector_h = ui(320); @@ -84,132 +91,143 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr grid_draw = true; brush = new tiler_brush(self); - tile_selector = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus, _panel = noone) { + tile_selector = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus, _panel = noone) { var _tileSet = texture; var _tileSiz = tileSize; var _pd = ui(4); var _yy = _y; var _tsh = tile_selector.fixHeight > 0? tile_selector.fixHeight - ui(24 + 4 + 48 + 8) : tile_selector_h; - var _h = _tsh; + var _h = _tsh; - var bx = _x; - var by = _yy; - var bs = ui(24); - - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "Clear selection", THEME.canvas_tools_selection_rectangle, 0, COLORS._main_icon_light) == 2) { - brush.brush_indices = [[]]; - brush.brush_width = 0; - brush.brush_height = 0; - } - - var _lx = bx + bs + ui(8); - - bx = _x + _w - bs; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "Zoom to fit", THEME.path_tools_transform, 0, COLORS._main_icon_light) == 2) { - if(is_surface(_tileSet)) { - var _tdim = surface_get_dimension(_tileSet); - var _sw = _w - _pd * 2; - var _sh = _tsh - _pd * 2; - - var _ss = min(_sw / (_tdim[0] + 16), _sh / (_tdim[1] + 16)); - tile_selector_s = _ss; - tile_selector_s_to = _ss; - - tile_selector_x = _w / 2 - _tdim[0] * _ss / 2; - tile_selector_y = _tsh / 2 - _tdim[1] * _ss / 2; - } - } - - var _rx = bx - ui(8); - - var _zw = ui(128); - var _zh = ui(12); - var _zx1 = _rx; - var _zx0 = max(_lx, _zx1 - _zw); - _zw = _zx1 - _zx0; - var _zy = by + bs / 2 - _zh / 2; - - if(_zw) { //zoom - var _zcc = (tile_selector_s_to - 0.5) / 3.5; - var _zcw = _zw * _zcc; + #region top bar + var bx = _x; + var by = _yy; + var bs = ui(24); - draw_sprite_stretched_ext(THEME.textbox, 3, _zx0, _zy, _zw, _zh, c_white, 1); - draw_sprite_stretched_ext(THEME.textbox, 4, _zx0, _zy, _zcw, _zh, c_white, 1); + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "Clear selection", THEME.canvas_tools_selection_rectangle, 0, COLORS._main_icon_light) == 2) { + brush.brush_indices = [[]]; + brush.brush_width = 0; + brush.brush_height = 0; + } - if(_hover && point_in_rectangle(_m[0], _m[1], _zx0, _zy, _zx0 + _zw, _zy + _zh)) { - draw_sprite_stretched_ext(THEME.textbox, 1, _zx0, _zy, _zw, _zh, c_white, 1); + var _lx = bx + bs + ui(8); + + bx = _x + _w - bs; + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "Zoom to fit", THEME.path_tools_transform, 0, COLORS._main_icon_light) == 2) { + if(is_surface(_tileSet)) { + var _tdim = surface_get_dimension(_tileSet); + var _sw = _w - _pd * 2; + var _sh = _tsh - _pd * 2; + + var _ss = min(_sw / (_tdim[0] + 16), _sh / (_tdim[1] + 16)); + tile_selector_s = _ss; + tile_selector_s_to = _ss; + + tile_selector_x = _w / 2 - _tdim[0] * _ss / 2; + tile_selector_y = _tsh / 2 - _tdim[1] * _ss / 2; + } + } + + var _rx = bx - ui(8); + + var _zw = ui(128); + var _zh = ui(12); + var _zx1 = _rx; + var _zx0 = max(_lx, _zx1 - _zw); + _zw = _zx1 - _zx0; + var _zy = by + bs / 2 - _zh / 2; + + if(_zw) { //zoom + var _zcc = (tile_selector_s_to - 0.5) / 3.5; + var _zcw = _zw * _zcc; - if(mouse_press(mb_left, _focus)) { - tile_zoom_drag = true; - tile_zoom_mx = _m[0]; - tile_zoom_sx = tile_selector_s_to; + draw_sprite_stretched_ext(THEME.textbox, 3, _zx0, _zy, _zw, _zh, c_white, 1); + draw_sprite_stretched_ext(THEME.textbox, 4, _zx0, _zy, _zcw, _zh, c_white, 1); + + if(_hover && point_in_rectangle(_m[0], _m[1], _zx0, _zy, _zx0 + _zw, _zy + _zh)) { + draw_sprite_stretched_ext(THEME.textbox, 1, _zx0, _zy, _zw, _zh, c_white, 1); + + if(mouse_press(mb_left, _focus)) { + tile_zoom_drag = true; + tile_zoom_mx = _m[0]; + tile_zoom_sx = tile_selector_s_to; + } + } + + if(tile_zoom_drag) { + var _zl = clamp(tile_zoom_sx + (_m[0] - tile_zoom_mx) / _zw * 3.5, .5, 4); + + var _s = tile_selector_s; + tile_selector_s_to = _zl; + tile_selector_s = _zl; + + if(_s != tile_selector_s) { + var _ds = tile_selector_s - _s; + + var _msx = (_w / 2 - _pd) - tile_selector_x; + var _msy = (_tsh / 2 - _pd) - tile_selector_y; + + tile_selector_x -= _msx * _ds / _s; + tile_selector_y -= _msy * _ds / _s; + } + + if(mouse_release(mb_left)) + tile_zoom_drag = false; } } + #endregion + + #region draw tile surface + _h += bs + ui(4); + _yy += bs + ui(4); - if(tile_zoom_drag) { - var _zl = clamp(tile_zoom_sx + (_m[0] - tile_zoom_mx) / _zw * 3.5, .5, 4); - - var _s = tile_selector_s; - tile_selector_s_to = _zl; - tile_selector_s = _zl; - - if(_s != tile_selector_s) { - var _ds = tile_selector_s - _s; - - var _msx = (_w / 2 - _pd) - tile_selector_x; - var _msy = (_tsh / 2 - _pd) - tile_selector_y; - - tile_selector_x -= _msx * _ds / _s; - tile_selector_y -= _msy * _ds / _s; - } - - if(mouse_release(mb_left)) - tile_zoom_drag = false; + var _sx = _x + _pd; + var _sy = _yy + _pd; + var _sw = _w - _pd * 2; + var _sh = _tsh - _pd * 2; + + draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _yy, _w, _tsh, COLORS.node_composite_bg_blend, 1); + tile_selector_surface = surface_verify(tile_selector_surface, _sw, _sh); + tile_selector_mask = surface_verify(tile_selector_mask, _sw, _sh); + autoterrain_selector_mask = surface_verify(autoterrain_selector_mask, _sw, _sh); + + if(!is_surface(_tileSet)) return _h; + var _tdim = surface_get_dimension(_tileSet); + var _tileAmo = [ floor(_tdim[0] / _tileSiz[0]), floor(_tdim[1] / _tileSiz[1]) ]; + + var _tileSel_w = _tileSiz[0] * tile_selector_s; + var _tileSel_h = _tileSiz[1] * tile_selector_s; + + var _msx = _m[0] - _sx - tile_selector_x; + var _msy = _m[1] - _sy - tile_selector_y; + + var _mtx = floor(_msx / tile_selector_s / _tileSiz[0]); + var _mty = floor(_msy / tile_selector_s / _tileSiz[1]); + var _mid = _mtx >= 0 && _mtx < _tileAmo[0] && _mty >= 0 && _mty < _tileAmo[1]? _mty * _tileAmo[0] + _mtx : noone; + + var _tileHov_x = tile_selector_x + _mtx * _tileSiz[0] * tile_selector_s; + var _tileHov_y = tile_selector_y + _mty * _tileSiz[1] * tile_selector_s; + + var _hov = _hover && point_in_rectangle(_m[0], _m[1], _x, _yy, _x + _w, _yy + _tsh); + var _bg0 = colorMultiply(COLORS.panel_bg_clear, COLORS.node_composite_bg_blend); + var _bg1 = colorMultiply(COLORS.panel_preview_transparent, COLORS.node_composite_bg_blend); + + surface_set_target(tile_selector_surface); + draw_clear(_bg0); + draw_sprite_tiled_ext(s_transparent, 0, tile_selector_x, tile_selector_y, tile_selector_s, tile_selector_s, _bg1, 1); + + draw_surface_ext(_tileSet, tile_selector_x, tile_selector_y, tile_selector_s, tile_selector_s, 0, c_white, 1); + + if(gmTile != noone) { + var ssw = _tileSel_w / 16; + var ssh = _tileSel_h / 16; // non uniform tile size anyone? + draw_sprite_ext(s_transparent, 0, tile_selector_x + _tileSel_w / 2, tile_selector_y + _tileSel_h / 2, -ssw, ssh, 0, _bg0); + draw_sprite_ext(s_transparent, 0, tile_selector_x + _tileSel_w / 2, tile_selector_y + _tileSel_h / 2, ssw, ssh, 0, _bg1); } - } - - _h += bs + ui(4); - _yy += bs + ui(4); - - var _sx = _x + _pd; - var _sy = _yy + _pd; - var _sw = _w - _pd * 2; - var _sh = _tsh - _pd * 2; - - draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _yy, _w, _tsh, COLORS.node_composite_bg_blend, 1); - tile_selector_surface = surface_verify(tile_selector_surface, _sw, _sh); - tile_selector_mask = surface_verify(tile_selector_mask, _sw, _sh); - autoterrain_selector_mask = surface_verify(autoterrain_selector_mask, _sw, _sh); - - if(!is_surface(_tileSet)) return _h; - var _tdim = surface_get_dimension(_tileSet); - var _tileAmo = [ floor(_tdim[0] / _tileSiz[0]), floor(_tdim[1] / _tileSiz[1]) ]; - - var _tileSel_w = _tileSiz[0] * tile_selector_s; - var _tileSel_h = _tileSiz[1] * tile_selector_s; - - var _msx = _m[0] - _sx - tile_selector_x; - var _msy = _m[1] - _sy - tile_selector_y; - - var _mtx = floor(_msx / tile_selector_s / _tileSiz[0]); - var _mty = floor(_msy / tile_selector_s / _tileSiz[1]); - var _mid = _mtx >= 0 && _mtx < _tileAmo[0] && _mty >= 0 && _mty < _tileAmo[1]? _mty * _tileAmo[0] + _mtx : noone; - - var _tileHov_x = tile_selector_x + _mtx * _tileSiz[0] * tile_selector_s; - var _tileHov_y = tile_selector_y + _mty * _tileSiz[1] * tile_selector_s; - - var _hov = _hover && point_in_rectangle(_m[0], _m[1], _x, _yy, _x + _w, _yy + _tsh); - - #region surface_set_target(tile_selector_surface); - surface_set_target(tile_selector_surface); - draw_clear(colorMultiply(COLORS.panel_bg_clear, COLORS.node_composite_bg_blend)); - draw_sprite_tiled_ext(s_transparent, 0, tile_selector_x, tile_selector_y, tile_selector_s, tile_selector_s, colorMultiply(COLORS.panel_preview_transparent, COLORS.node_composite_bg_blend), 1); - - draw_surface_ext(_tileSet, tile_selector_x, tile_selector_y, tile_selector_s, tile_selector_s, 0, c_white, 1); - - if(grid_draw) { - var _gw = _tileSiz[0] * tile_selector_s; + + if(grid_draw) { + var _gw = _tileSiz[0] * tile_selector_s; var _gh = _tileSiz[1] * tile_selector_s; var gw = _tdim[0] / _tileSiz[0]; @@ -232,12 +250,12 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr } draw_set_alpha(1); - } - - draw_set_color(COLORS.panel_preview_surface_outline); - draw_rectangle(tile_selector_x, tile_selector_y, tile_selector_x + _tdim[0] * tile_selector_s - 1, tile_selector_y + _tdim[1] * tile_selector_s - 1, true); - - if(_hov && _mid > noone) { + } + + draw_set_color(COLORS.panel_preview_surface_outline); + draw_rectangle(tile_selector_x, tile_selector_y, tile_selector_x + _tdim[0] * tile_selector_s - 1, tile_selector_y + _tdim[1] * tile_selector_s - 1, true); + + if(_hov && _mid > noone) { draw_set_color(c_white); draw_rectangle_width(_tileHov_x - 1, _tileHov_y - 1, _tileHov_x + _tileSel_w, _tileHov_y + _tileSel_h, 1); @@ -246,102 +264,104 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr draw_rectangle_width(_tileHov_x, _tileHov_y, _tileHov_x + _tileSel_w - 1, _tileHov_y + _tileSel_h - 1, 1); if(is(object_selecting, tiler_brush_autoterrain) && object_select_id != noone) TOOLTIP = "Set Autoterrain"; - else if(is(object_selecting, tiler_brush_animated) && object_select_id != noone) TOOLTIP = "Set Animated tile"; - else if(is(object_selecting, tiler_rule) && object_select_id != noone) TOOLTIP = "Set Rule selector"; - else if(is(object_selecting, tiler_rule_replacement)) TOOLTIP = "Set Rule replacement"; - else if(is(object_selecting, tilemap_convert_object)) TOOLTIP = "Set Replacement target"; - - if(mouse_press(mb_left, _focus)) { - if((is(object_selecting, tiler_brush_autoterrain) || is(object_selecting, tiler_brush_animated)) && object_select_id != noone) { - object_selecting.index[object_select_id] = _mid; - do { object_select_id++; } until(object_select_id == array_length(object_selecting.index) || object_selecting.index[object_select_id] == -1) + else if(is(object_selecting, tiler_brush_animated) && object_select_id != noone) TOOLTIP = "Set Animated tile"; + else if(is(object_selecting, tiler_rule) && object_select_id != noone) TOOLTIP = "Set Rule selector"; + else if(is(object_selecting, tiler_rule_replacement)) TOOLTIP = "Set Rule replacement"; + else if(is(object_selecting, tilemap_convert_object)) TOOLTIP = "Set Replacement target"; + + if(mouse_press(mb_left, _focus)) { + if((is(object_selecting, tiler_brush_autoterrain) || is(object_selecting, tiler_brush_animated)) && object_select_id != noone) { + object_selecting.index[object_select_id] = _mid; + do { object_select_id++; } until(object_select_id == array_length(object_selecting.index) || object_selecting.index[object_select_id] == -1) if(object_select_id >= array_length(object_selecting.index)) object_select_id = noone; - - } else if(is(object_selecting, tiler_rule)) { - if(object_select_id != noone) - object_selecting.selection_rules[object_select_id] = _mid; - object_selecting = noone; - triggerRender(); - - } else if(is(object_selecting, tiler_rule_replacement)) { - tile_selecting = true; + + } else if(is(object_selecting, tiler_rule)) { + if(object_select_id != noone) + object_selecting.selection_rules[object_select_id] = _mid; + object_selecting = noone; + triggerRender(); + + } else if(is(object_selecting, tiler_rule_replacement)) { + tile_selecting = true; tile_select_ss = [ _mtx, _mty ]; - - } else if(is(object_selecting, tilemap_convert_object)) { - object_selecting.target = _mid; - object_selecting = noone; - if(node_edit) node_edit.triggerRender(); - - } else { - object_selecting = noone; - object_select_id = noone; - tile_selecting = true; + + } else if(is(object_selecting, tilemap_convert_object)) { + object_selecting.target = _mid; + object_selecting = noone; + if(node_edit) node_edit.triggerRender(); + + } else { + object_selecting = noone; + object_select_id = noone; + tile_selecting = true; tile_select_ss = [ _mtx, _mty ]; - } - - palette_using = false; - } - } - surface_reset_target(); - #endregion - - #region surface_set_target(tile_selector_mask); - surface_set_target(tile_selector_mask); - DRAW_CLEAR - draw_set_color(c_white); - - for( var i = 0, n = array_length(brush.brush_indices); i < n; i++ ) - for( var j = 0, m = array_length(brush.brush_indices[i]); j < m; j++ ) { - var _bindex = floor(brush.brush_indices[i][j][0]); - - var _tileSel_row = floor(_bindex / _tileAmo[0]); - var _tileSel_col = safe_mod(_bindex, _tileAmo[0]); - - var _tileSel_x = tile_selector_x + _tileSel_col * _tileSiz[0] * tile_selector_s; - var _tileSel_y = tile_selector_y + _tileSel_row * _tileSiz[1] * tile_selector_s; - - draw_rectangle(_tileSel_x, _tileSel_y, _tileSel_x + _tileSel_w, _tileSel_y + _tileSel_h, false); - } - surface_reset_target(); - #endregion - - if(tile_selecting) { // tile selection - var _ts_sx = clamp(min(tile_select_ss[0], _mtx), 0, _tileAmo[0] - 1); - var _ts_sy = clamp(min(tile_select_ss[1], _mty), 0, _tileAmo[1] - 1); - var _ts_ex = clamp(max(tile_select_ss[0], _mtx), 0, _tileAmo[0] - 1); - var _ts_ey = clamp(max(tile_select_ss[1], _mty), 0, _tileAmo[1] - 1); - - brush.brush_indices = []; - brush.brush_width = _ts_ex - _ts_sx + 1; - brush.brush_height = _ts_ey - _ts_sy + 1; - - for( var i = _ts_sy; i <= _ts_ey; i++ ) - for( var j = _ts_sx; j <= _ts_ex; j++ ) - brush.brush_indices[i - _ts_sy][j - _ts_sx] = [ i * _tileAmo[0] + j, 0 ]; - - if(mouse_release(mb_left)) { - if(is(object_selecting, tiler_rule_replacement)) { - object_select_id.size[0] = max(object_select_id.size[0], brush.brush_width); - object_select_id.size[1] = max(object_select_id.size[1], brush.brush_height); - - var _ind = 0; - for( var i = _ts_sy; i <= _ts_ey; i++ ) - for( var j = _ts_sx; j <= _ts_ex; j++ ) - object_selecting.index[_ind++] = i * _tileAmo[0] + j; - object_selecting = noone; - object_select_id = noone; - triggerRender(); + } - } - - setPencil(); - tile_selecting = false; - } - } - - #region pan zoom + palette_using = false; + } + } + surface_reset_target(); + #endregion + + #region draw selector mask + surface_set_target(tile_selector_mask); + DRAW_CLEAR + draw_set_color(c_white); + + for( var i = 0, n = array_length(brush.brush_indices); i < n; i++ ) + for( var j = 0, m = array_length(brush.brush_indices[i]); j < m; j++ ) { + var _bindex = floor(brush.brush_indices[i][j][0]); + + var _tileSel_row = floor(_bindex / _tileAmo[0]); + var _tileSel_col = safe_mod(_bindex, _tileAmo[0]); + + var _tileSel_x = tile_selector_x + _tileSel_col * _tileSiz[0] * tile_selector_s; + var _tileSel_y = tile_selector_y + _tileSel_row * _tileSiz[1] * tile_selector_s; + + draw_rectangle(_tileSel_x, _tileSel_y, _tileSel_x + _tileSel_w, _tileSel_y + _tileSel_h, false); + } + surface_reset_target(); + #endregion + + #region tile selection + if(tile_selecting) { + var _ts_sx = clamp(min(tile_select_ss[0], _mtx), 0, _tileAmo[0] - 1); + var _ts_sy = clamp(min(tile_select_ss[1], _mty), 0, _tileAmo[1] - 1); + var _ts_ex = clamp(max(tile_select_ss[0], _mtx), 0, _tileAmo[0] - 1); + var _ts_ey = clamp(max(tile_select_ss[1], _mty), 0, _tileAmo[1] - 1); + + brush.brush_indices = []; + brush.brush_width = _ts_ex - _ts_sx + 1; + brush.brush_height = _ts_ey - _ts_sy + 1; + + for( var i = _ts_sy; i <= _ts_ey; i++ ) + for( var j = _ts_sx; j <= _ts_ex; j++ ) + brush.brush_indices[i - _ts_sy][j - _ts_sx] = [ i * _tileAmo[0] + j, 0 ]; + + if(mouse_release(mb_left)) { + if(is(object_selecting, tiler_rule_replacement)) { + object_select_id.size[0] = max(object_select_id.size[0], brush.brush_width); + object_select_id.size[1] = max(object_select_id.size[1], brush.brush_height); + + var _ind = 0; + for( var i = _ts_sy; i <= _ts_ey; i++ ) + for( var j = _ts_sx; j <= _ts_ex; j++ ) + object_selecting.index[_ind++] = i * _tileAmo[0] + j; + object_selecting = noone; + object_select_id = noone; + triggerRender(); + + } + + setPencil(); + tile_selecting = false; + } + } + #endregion + + #region pan zoom if(tile_dragging) { var _tdx = _m[0] - tile_drag_mx; var _tdy = _m[1] - tile_drag_my; @@ -389,41 +409,43 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr tile_selector_x = clamp(tile_selector_x, _minx, _maxx); tile_selector_y = clamp(tile_selector_y, _miny, _maxy); #endregion - + draw_surface(tile_selector_surface, _sx, _sy); - - shader_set(sh_brush_outline); - var _brush_tiles = brush.brush_width * brush.brush_height; - var _cc = c_white; - if(_brush_tiles == 9 || _brush_tiles == 15 || _brush_tiles == 48 || _brush_tiles == 55) _cc = COLORS._main_value_positive; - - shader_set_f("dimension", _sw, _sh); - draw_surface_ext(tile_selector_mask, _sx, _sy, 1, 1, 0, _cc, 1); - shader_reset(); - - if(is(object_selecting, tiler_brush_autoterrain)) { // autoterrain - surface_set_target(autoterrain_selector_mask); - DRAW_CLEAR - - draw_set_color(c_white); - for( var j = 0, m = array_length(object_selecting.index); j < m; j++ ) { - var _bindex = object_selecting.index[j]; - if(_bindex < 0) continue; - - var _tileSel_row = floor(_bindex / _tileAmo[0]); - var _tileSel_col = safe_mod(_bindex, _tileAmo[0]); - var _tileSel_x = tile_selector_x + _tileSel_col * _tileSiz[0] * tile_selector_s; - var _tileSel_y = tile_selector_y + _tileSel_row * _tileSiz[1] * tile_selector_s; - draw_rectangle(_tileSel_x, _tileSel_y, _tileSel_x + _tileSel_w, _tileSel_y + _tileSel_h, false); - } - surface_reset_target(); + #region misc shader_set(sh_brush_outline); + var _brush_tiles = brush.brush_width * brush.brush_height; + var _cc = c_white; + if(_brush_tiles == 9 || _brush_tiles == 15 || _brush_tiles == 48 || _brush_tiles == 55) _cc = COLORS._main_value_positive; + shader_set_f("dimension", _sw, _sh); - draw_surface_ext(autoterrain_selector_mask, _sx, _sy, 1, 1, 0, COLORS._main_accent, 1); + draw_surface_ext(tile_selector_mask, _sx, _sy, 1, 1, 0, _cc, 1); shader_reset(); - } - + + if(is(object_selecting, tiler_brush_autoterrain)) { // autoterrain + surface_set_target(autoterrain_selector_mask); + DRAW_CLEAR + + draw_set_color(c_white); + for( var j = 0, m = array_length(object_selecting.index); j < m; j++ ) { + var _bindex = object_selecting.index[j]; + if(_bindex < 0) continue; + + var _tileSel_row = floor(_bindex / _tileAmo[0]); + var _tileSel_col = safe_mod(_bindex, _tileAmo[0]); + var _tileSel_x = tile_selector_x + _tileSel_col * _tileSiz[0] * tile_selector_s; + var _tileSel_y = tile_selector_y + _tileSel_row * _tileSiz[1] * tile_selector_s; + draw_rectangle(_tileSel_x, _tileSel_y, _tileSel_x + _tileSel_w, _tileSel_y + _tileSel_h, false); + } + surface_reset_target(); + + shader_set(sh_brush_outline); + shader_set_f("dimension", _sw, _sh); + draw_surface_ext(autoterrain_selector_mask, _sx, _sy, 1, 1, 0, COLORS._main_accent, 1); + shader_reset(); + } + #endregion + #region varients var _bw = 1; var _bh = 1; @@ -440,14 +462,14 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr var _sx = _x + ui(8); var _sy = _ty + ui(8); - var _ss = (_th - ui(16)) / _sel_sh; - var _sw = _ss * _sel_sw; - var _sh = _ss * _sel_sh; + var _ss = (_th - ui(16)) / _sel_sh; + var _sw = _ss * _sel_sw; + var _sh = _ss * _sel_sh; draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _ty, _w, _th, COLORS.node_composite_bg_blend, 1); var _shov = _hover && point_in_rectangle(_m[0], _m[1], _sx, _sy, _sx + _sw, _sy + _sh); - var _aa = 0.5 + 0.5 * _shov; + var _aa = 0.5 + 0.5 * _shov; draw_sprite_stretched_ext(THEME.ui_panel, 1, _sx, _sy, _sw, _sh, COLORS._main_icon, _aa); draw_sprite_uniform(THEME.cross, 0, _sx + _sw / 2, _sy + _sh / 2, 1, COLORS._main_icon, _aa); @@ -464,10 +486,10 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr if(mouse_press(mb_left, _focus)) { if(object_select_id != noone) - object_selecting.selection_rules[object_select_id] = -10000; - object_selecting = noone; - triggerRender(); - + object_selecting.selection_rules[object_select_id] = -10000; + object_selecting = noone; + triggerRender(); + } } } @@ -515,19 +537,20 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr _sx += _sw + ui(8); } - #endregion - + #endregion + return _h; }); tile_selector.setName("Tileset"); - #endregion + #endregion - #region ++++ auto terrain ++++ + ////- Auto terrain + #region Auto terrain autoterrain = []; autoterrain_selector_h = 0; - autoterrain_selector = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus, _panel = noone) { + autoterrain_selector = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus, _panel = noone) { var _yy = _y; var _h = 0; @@ -538,37 +561,40 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr var _tdim = surface_get_dimension(_tileSet); var _tileAmo = [ floor(_tdim[0] / _tileSiz[0]), floor(_tdim[1] / _tileSiz[1]) ]; - var bx = _x; - var by = _yy; - var bs = ui(24); - var _brush_tiles = brush.brush_width * brush.brush_height; - var _fromSel = _brush_tiles == 9 || _brush_tiles == 15 || _brush_tiles == 25 ||_brush_tiles == 48 || _brush_tiles == 55; - - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, _fromSel? "New autoterrain from selection" : "New autoterrain", THEME.add_16, 0, COLORS._main_value_positive) == 2) { - var _new_at = noone; - var _indx = array_create(brush.brush_width * brush.brush_height); + #region top bar + var bx = _x; + var by = _yy; + var bs = ui(24); + var _brush_tiles = brush.brush_width * brush.brush_height; + var _fromSel = _brush_tiles == 9 || _brush_tiles == 15 || _brush_tiles == 25 ||_brush_tiles == 48 || _brush_tiles == 55; - for( var i = 0, n = brush.brush_height; i < n; i++ ) - for( var j = 0, m = brush.brush_width; j < m; j++ ) - _indx[i * brush.brush_width + j] = brush.brush_indices[i][j][0]; - - if(_brush_tiles == 9) _new_at = new tiler_brush_autoterrain(AUTOTERRAIN_TYPE.box9, _indx); - else if(_brush_tiles == 25) _new_at = new tiler_brush_autoterrain(AUTOTERRAIN_TYPE.box25, _indx); - else if(_brush_tiles == 15) _new_at = new tiler_brush_autoterrain(AUTOTERRAIN_TYPE.side15, _indx); - else if(_brush_tiles == 48) _new_at = new tiler_brush_autoterrain(AUTOTERRAIN_TYPE.top48, _indx); - else if(_brush_tiles == 55) _new_at = new tiler_brush_autoterrain(AUTOTERRAIN_TYPE.top55, _indx); - else _new_at = new tiler_brush_autoterrain(AUTOTERRAIN_TYPE.box9, _indx); - - object_selecting = _new_at; - object_select_id = noone; - array_push(autoterrain, _new_at); - - if(!array_empty(_indx)) { - brush.brush_indices = [[ [ _new_at.index[0], 0 ] ]]; - brush.brush_width = 1; - brush.brush_height = 1; + var _txt = _fromSel? "New autoterrain from selection" : "New autoterrain"; + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, _txt, THEME.add_16, 0, COLORS._main_value_positive) == 2) { + var _new_at = noone; + var _indx = array_create(brush.brush_width * brush.brush_height); + + for( var i = 0, n = brush.brush_height; i < n; i++ ) + for( var j = 0, m = brush.brush_width; j < m; j++ ) + _indx[i * brush.brush_width + j] = brush.brush_indices[i][j][0]; + + if(_brush_tiles == 9) _new_at = new tiler_brush_autoterrain(AUTOTERRAIN_TYPE.box9, _indx); + else if(_brush_tiles == 25) _new_at = new tiler_brush_autoterrain(AUTOTERRAIN_TYPE.box25, _indx); + else if(_brush_tiles == 15) _new_at = new tiler_brush_autoterrain(AUTOTERRAIN_TYPE.side15, _indx); + else if(_brush_tiles == 48) _new_at = new tiler_brush_autoterrain(AUTOTERRAIN_TYPE.top48, _indx); + else if(_brush_tiles == 55) _new_at = new tiler_brush_autoterrain(AUTOTERRAIN_TYPE.top55, _indx); + else _new_at = new tiler_brush_autoterrain(AUTOTERRAIN_TYPE.box9, _indx); + + object_selecting = _new_at; + object_select_id = noone; + array_push(autoterrain, _new_at); + + if(!array_empty(_indx)) { + brush.brush_indices = [[ [ _new_at.index[0], 0 ] ]]; + brush.brush_width = 1; + brush.brush_height = 1; + } } - } + #endregion _h += bs + ui(4); _yy += bs + ui(4); @@ -590,6 +616,7 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr var _px = _x + ui(8); var _py = _yy + ui(4); + #region header var _prin = array_safe_get(_at.index, _at.prevInd, undefined); if(_prin == undefined) draw_sprite_stretched_ext(THEME.ui_panel, 1, _px, _py, _pw, _ph, COLORS._main_icon); @@ -610,8 +637,10 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr var bs = ui(24); var bx = _w - bs - ui(4); var by = _yy + _hg / 2 - bs / 2; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.minus_16, 0, _hov? COLORS._main_value_negative : COLORS._main_icon) == 2) - del = i; + var bc = _hov? COLORS._main_value_negative : COLORS._main_icon; + + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "", THEME.minus_16, 0, bc) == 2) + del = i; } if(_hov && _m[0] < _x + _w - ui(32)) { @@ -663,156 +692,158 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr _yy += _hg; _ah += _hg; + #endregion - if(_at.open) { - _yy += ui(4); - _ah += ui(4); - - var _atWid = _at.sc_type; - var _scx = _x + ui(8); - var _scy = _yy; - var _scw = ui(200); - var _sch = ui(24); - - _atWid.setFocusHover(_focus, _hover); - _atWid.draw(_scx, _scy, _scw, _sch, _at.type, _m, autoterrain_selector.rx, autoterrain_selector.ry); - - _yy += _sch + ui(8); - _ah += _sch + ui(8); - - var _atIdx = _at.index; - var _coll = floor(_w - ui(16)) / _tileSiz[0]; - var _over = noone; - var _roww; - - switch(_at.type) { - case AUTOTERRAIN_TYPE.box9 : _coll = 3; _roww = 3; _over = s_autoterrain_3x3; break; - case AUTOTERRAIN_TYPE.box25 : _coll = 5; _roww = 5; _over = s_autoterrain_5x5; break; - case AUTOTERRAIN_TYPE.side15 : _coll = 5; _roww = 3; _over = s_autoterrain_5x3; break; - case AUTOTERRAIN_TYPE.top48 : _coll = 12; _roww = 4; _over = s_autoterrain_8x6; break; - case AUTOTERRAIN_TYPE.top55 : _coll = 11; _roww = 5; _over = s_autoterrain_11x5; break; - } - - var _pre_sx = _x + ui(8); - var _pre_sy = _yy; - var _pre_sw = _coll * _tileSiz[0]; - var _pre_sh = _roww * _tileSiz[1]; - - var _ss = min((_w - ui(16)) / _pre_sw, ui(64) / _tileSiz[1]); - - var _bw = power(2, ceil(log2(_coll))); - var _bh = power(2, ceil(log2(_roww))); + if(!_at.open) continue; + + #region content + _yy += ui(4); + _ah += ui(4); + + var _atWid = _at.sc_type; + var _scx = _x + ui(8); + var _scy = _yy; + var _scw = ui(200); + var _sch = ui(24); + + _atWid.setFocusHover(_focus, _hover); + _atWid.draw(_scx, _scy, _scw, _sch, _at.type, _m, autoterrain_selector.rx, autoterrain_selector.ry); + + _yy += _sch + ui(8); + _ah += _sch + ui(8); + + var _atIdx = _at.index; + var _coll = floor(_w - ui(16)) / _tileSiz[0]; + var _over = noone; + var _roww; + + switch(_at.type) { + case AUTOTERRAIN_TYPE.box9 : _coll = 3; _roww = 3; _over = s_autoterrain_3x3; break; + case AUTOTERRAIN_TYPE.box25 : _coll = 5; _roww = 5; _over = s_autoterrain_5x5; break; + case AUTOTERRAIN_TYPE.side15 : _coll = 5; _roww = 3; _over = s_autoterrain_5x3; break; + case AUTOTERRAIN_TYPE.top48 : _coll = 12; _roww = 4; _over = s_autoterrain_8x6; break; + case AUTOTERRAIN_TYPE.top55 : _coll = 11; _roww = 5; _over = s_autoterrain_11x5; break; + } + + var _pre_sx = _x + ui(8); + var _pre_sy = _yy; + var _pre_sw = _coll * _tileSiz[0]; + var _pre_sh = _roww * _tileSiz[1]; + + var _ss = min((_w - ui(16)) / _pre_sw, ui(64) / _tileSiz[1]); + + var _bw = power(2, ceil(log2(_coll))); + var _bh = power(2, ceil(log2(_roww))); + + _at.preview_surface = surface_verify(_at.preview_surface, _bw, _bh, surface_rgba16float); + _at.preview_surface_tile = surface_verify(_at.preview_surface_tile, _pre_sw, _pre_sh); + + surface_set_shader(_at.preview_surface, sh_draw_tile_brush, true, BLEND.over); + for( var j = 0, m = array_length(_atIdx); j < m; j++ ) { + var _til_row = floor(j / _coll); + var _til_col = j % _coll; + + var _bindex = _atIdx[j]; + shader_set_f("index", _bindex); + shader_set_f("varient", 0); + draw_point(_til_col, _til_row); + } + surface_reset_shader(); + + surface_set_shader(_at.preview_surface_tile, sh_draw_tile_map, true, BLEND.over); + shader_set_2("dimension", surface_get_dimension(_at.preview_surface_tile)); + + shader_set_surface("indexTexture", _at.preview_surface); + shader_set_2("indexTextureDim", surface_get_dimension(_at.preview_surface)); + + shader_submit(); - _at.preview_surface = surface_verify(_at.preview_surface, _bw, _bh, surface_rgba16float); - _at.preview_surface_tile = surface_verify(_at.preview_surface_tile, _pre_sw, _pre_sh); - - surface_set_shader(_at.preview_surface, sh_draw_tile_brush, true, BLEND.over); - for( var j = 0, m = array_length(_atIdx); j < m; j++ ) { - var _til_row = floor(j / _coll); - var _til_col = j % _coll; - - var _bindex = _atIdx[j]; - shader_set_f("index", _bindex); - shader_set_f("varient", 0); - draw_point(_til_col, _til_row); - } - surface_reset_shader(); - - surface_set_shader(_at.preview_surface_tile, sh_draw_tile_map, true, BLEND.over); - shader_set_2("dimension", surface_get_dimension(_at.preview_surface_tile)); - - shader_set_surface("indexTexture", _at.preview_surface); - shader_set_2("indexTextureDim", surface_get_dimension(_at.preview_surface)); - - shader_submit(); - - draw_empty(); - surface_reset_shader(); - - if(_over != noone) draw_sprite_ext(_over, 0, _pre_sx, _pre_sy, _ss * _tileSiz[0] / 4, _ss * _tileSiz[1] / 4, 0, COLORS._main_icon, 0.5); - draw_surface_ext(_at.preview_surface_tile, _pre_sx, _pre_sy, _ss, _ss, 0, c_white, 1); - - draw_set_text(f_p3, fa_left, fa_top, COLORS._main_text); - BLEND_ADD - for( var iy = 0; iy < _roww; iy++ ) - for( var ix = 0; ix < _coll; ix++ ) { - var _indx = iy * _coll + ix; - var _inx = _pre_sx + ix * _ss * _tileSiz[0]; - var _iny = _pre_sy + iy * _ss * _tileSiz[1]; - - draw_text(_inx + 4, _iny + 4, _indx); - } - BLEND_NORMAL - - if(grid_draw) { - var _gw = _tileSiz[0] * _ss; - var _gh = _tileSiz[1] * _ss; - - var gw = _pre_sw / _tileSiz[0]; - var gh = _pre_sh / _tileSiz[1]; - - var cx = _pre_sx - 1; - var cy = _pre_sy - 1; - - draw_set_color(PROJECT.previewGrid.color); - draw_set_alpha(PROJECT.previewGrid.opacity); - - for( var j = 1; j < gw; j++ ) { - var _lxx = cx + j * _gw; - draw_line(_lxx, cy, _lxx, cy + _pre_sh * _ss); - } - - for( var j = 1; j < gh; j++ ) { - var _lyy = cy + j * _gh; - draw_line(cx, _lyy, cx + _pre_sw * _ss, _lyy); - } - - draw_set_alpha(1); - } - - draw_set_color(COLORS._main_icon); - draw_rectangle(_pre_sx, _pre_sy, _pre_sx + _pre_sw * _ss, _pre_sy + _pre_sh * _ss, true); - - var _dtile_w = _tileSiz[0] * _ss; - var _dtile_h = _tileSiz[1] * _ss; - - if(_hover && point_in_rectangle(_m[0], _m[1], _pre_sx, _pre_sy, _pre_sx + _pre_sw * _ss, _pre_sy + _pre_sh * _ss)) { - var _at_cx = clamp(floor((_m[0] - _pre_sx) / _dtile_w), 0, _coll - 1); - var _at_cy = clamp(floor((_m[1] - _pre_sy) / _dtile_h), 0, _roww - 1); - - var _at_id = _at_cy * _coll + _at_cx; - if(_at_id >= 0 && _at_id < array_length(_atIdx)) { - var _at_c_sx = _pre_sx + _at_cx * _dtile_w; - var _at_c_sy = _pre_sy + _at_cy * _dtile_h; - - draw_set_color(COLORS._main_icon_light); - draw_rectangle(_at_c_sx, _at_c_sy, _at_c_sx + _dtile_w, _at_c_sy + _dtile_h, true); - - if(mouse_press(mb_left, _focus)) { - object_selecting = _at; - object_select_id = object_select_id == _at_id? noone : _at_id; - } - - if(mouse_press(mb_right, _focus)) - _at.index[_at_id] = -1; - } - } - - if(object_selecting == _at && object_select_id != noone) { - var _at_sl_x = object_select_id % _coll; - var _at_sl_y = floor(object_select_id / _coll); - - var _at_c_sx = _pre_sx + _at_sl_x * _dtile_w; - var _at_c_sy = _pre_sy + _at_sl_y * _dtile_h; - - draw_set_color(COLORS._main_accent); - draw_rectangle(_at_c_sx, _at_c_sy, _at_c_sx + _dtile_w, _at_c_sy + _dtile_h, true); - } - - _yy += _pre_sh * _ss + ui(4); - _ah += _pre_sh * _ss + ui(4); - + draw_empty(); + surface_reset_shader(); + + if(_over != noone) draw_sprite_ext(_over, 0, _pre_sx, _pre_sy, _ss * _tileSiz[0] / 4, _ss * _tileSiz[1] / 4, 0, COLORS._main_icon, 0.5); + draw_surface_ext(_at.preview_surface_tile, _pre_sx, _pre_sy, _ss, _ss, 0, c_white, 1); + + draw_set_text(f_p3, fa_left, fa_top, COLORS._main_text); + BLEND_ADD + for( var iy = 0; iy < _roww; iy++ ) + for( var ix = 0; ix < _coll; ix++ ) { + var _indx = iy * _coll + ix; + var _inx = _pre_sx + ix * _ss * _tileSiz[0]; + var _iny = _pre_sy + iy * _ss * _tileSiz[1]; + + draw_text(_inx + 4, _iny + 4, _indx); + } + BLEND_NORMAL + + if(grid_draw) { + var _gw = _tileSiz[0] * _ss; + var _gh = _tileSiz[1] * _ss; + + var gw = _pre_sw / _tileSiz[0]; + var gh = _pre_sh / _tileSiz[1]; + + var cx = _pre_sx - 1; + var cy = _pre_sy - 1; + + draw_set_color(PROJECT.previewGrid.color); + draw_set_alpha(PROJECT.previewGrid.opacity); + + for( var j = 1; j < gw; j++ ) { + var _lxx = cx + j * _gw; + draw_line(_lxx, cy, _lxx, cy + _pre_sh * _ss); + } + + for( var j = 1; j < gh; j++ ) { + var _lyy = cy + j * _gh; + draw_line(cx, _lyy, cx + _pre_sw * _ss, _lyy); + } + + draw_set_alpha(1); } + + draw_set_color(COLORS._main_icon); + draw_rectangle(_pre_sx, _pre_sy, _pre_sx + _pre_sw * _ss, _pre_sy + _pre_sh * _ss, true); + + var _dtile_w = _tileSiz[0] * _ss; + var _dtile_h = _tileSiz[1] * _ss; + + if(_hover && point_in_rectangle(_m[0], _m[1], _pre_sx, _pre_sy, _pre_sx + _pre_sw * _ss, _pre_sy + _pre_sh * _ss)) { + var _at_cx = clamp(floor((_m[0] - _pre_sx) / _dtile_w), 0, _coll - 1); + var _at_cy = clamp(floor((_m[1] - _pre_sy) / _dtile_h), 0, _roww - 1); + + var _at_id = _at_cy * _coll + _at_cx; + if(_at_id >= 0 && _at_id < array_length(_atIdx)) { + var _at_c_sx = _pre_sx + _at_cx * _dtile_w; + var _at_c_sy = _pre_sy + _at_cy * _dtile_h; + + draw_set_color(COLORS._main_icon_light); + draw_rectangle(_at_c_sx, _at_c_sy, _at_c_sx + _dtile_w, _at_c_sy + _dtile_h, true); + + if(mouse_press(mb_left, _focus)) { + object_selecting = _at; + object_select_id = object_select_id == _at_id? noone : _at_id; + } + + if(mouse_press(mb_right, _focus)) + _at.index[_at_id] = -1; + } + } + + if(object_selecting == _at && object_select_id != noone) { + var _at_sl_x = object_select_id % _coll; + var _at_sl_y = floor(object_select_id / _coll); + + var _at_c_sx = _pre_sx + _at_sl_x * _dtile_w; + var _at_c_sy = _pre_sy + _at_sl_y * _dtile_h; + + draw_set_color(COLORS._main_accent); + draw_rectangle(_at_c_sx, _at_c_sy, _at_c_sx + _dtile_w, _at_c_sy + _dtile_h, true); + } + + _yy += _pre_sh * _ss + ui(4); + _ah += _pre_sh * _ss + ui(4); + #endregion } if(del != -1) { @@ -828,7 +859,8 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr autoterrain_selector.setName("Autoterrain"); #endregion - #region ++++ brush palette ++++ + ////- Brush palette + #region Brush palette brush_palette_h = ui(320); brush_palette = surface_create(64, 64, surface_rgba16float); @@ -859,7 +891,7 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr palette_tool_using = false; palette_using = false; - palette_viewer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus, _panel = noone) { + palette_viewer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus, _panel = noone) { var _yy = _y; var _h = 0; var _pd = ui(4); @@ -867,23 +899,24 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr var _tileSet = texture; var _tileSiz = tileSize; + #region top bar var bx = _x; var by = _yy; var bs = ui(24); var _tsh = palette_viewer.fixHeight > 0? palette_viewer.fixHeight - ui(24 + 4) : brush_palette_h; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "Pencil", THEME.canvas_tools_pencil, 0, palette_tool == 1? COLORS._main_accent : c_white) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "Pencil", THEME.canvas_tools_pencil, 0, palette_tool == 1? COLORS._main_accent : c_white) == 2) palette_tool = palette_tool == 1? 0 : 1; draw_sprite_ui_uniform(THEME.canvas_tools_pencil, 1, bx + bs / 2, by + bs / 2, 1, palette_tool == 1? COLORS._main_accent : c_white); bx += bs + ui(4); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "Eraser", THEME.canvas_tools_eraser, 0, palette_tool == 2? COLORS._main_accent : c_white) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "Eraser", THEME.canvas_tools_eraser, 0, palette_tool == 2? COLORS._main_accent : c_white) == 2) palette_tool = palette_tool == 2? 0 : 2; bx = _x + _w - bs; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "Zoom to fit", THEME.path_tools_transform, 0, COLORS._main_icon_light) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "Zoom to fit", THEME.path_tools_transform, 0, COLORS._main_icon_light) == 2) { if(is_surface(brush_palette_tile)) { var _tdim = surface_get_dimension(brush_palette_tile); var _sw = _w - _pd * 2; @@ -900,6 +933,7 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr _h += bs + ui(4); _yy += bs + ui(4); + #endregion var _sx = _x + _pd; var _sy = _yy + _pd; @@ -912,6 +946,7 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr palette_selector_surface = surface_verify(palette_selector_surface, _sw, _sh); palette_selector_mask = surface_verify(palette_selector_mask, _sw, _sh); + #region draw palette if(!is_surface(_tileSet)) return _h; if(!is_surface(brush_palette)) { if(brush_palette_buffer && buffer_exists(brush_palette_buffer)) @@ -959,7 +994,6 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr var _hov = _hover && point_in_rectangle(_m[0], _m[1], _x, _yy, _x + _w, _yy + _tsh); - #region surface_set_target(palette_selector_surface); surface_set_target(palette_selector_surface); draw_clear(colorMultiply(COLORS.panel_bg_clear, COLORS.node_composite_bg_blend)); draw_sprite_tiled_ext(s_transparent, 0, palette_selector_x, palette_selector_y, palette_selector_s, palette_selector_s, @@ -1019,7 +1053,8 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr surface_reset_target(); #endregion - if(palette_selecting) { //tile selection + #region selection + if(palette_selecting) { var _ts_sx = clamp(min(palette_select_ss[0], _mtx), 0, _tileAmo[0] - 1); var _ts_sy = clamp(min(palette_select_ss[1], _mty), 0, _tileAmo[1] - 1); var _ts_ex = clamp(max(palette_select_ss[0], _mtx), 0, _tileAmo[0] - 1); @@ -1041,57 +1076,59 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr if(mouse_release(mb_left)) palette_selecting = false; } + #endregion #region pan zoom - if(palette_dragging) { - var _tdx = _m[0] - palette_drag_mx; - var _tdy = _m[1] - palette_drag_my; - - palette_selector_x = palette_drag_sx + _tdx; - palette_selector_y = palette_drag_sy + _tdy; - - if(mouse_release(mb_middle)) - palette_dragging = false; - } - - if(_hov) { - if(mouse_press(mb_middle, _focus)) { - palette_dragging = true; - palette_drag_sx = palette_selector_x; - palette_drag_sy = palette_selector_y; - palette_drag_mx = _m[0]; - palette_drag_my = _m[1]; - } - - var _s = palette_selector_s; - if(key_mod_press(CTRL) || palette_viewer.popupPanel != noone) { - if(mouse_wheel_up()) { palette_selector_s_to = clamp(palette_selector_s_to * 1.2, 0.5, 4); } - if(mouse_wheel_down()) { palette_selector_s_to = clamp(palette_selector_s_to / 1.2, 0.5, 4); } - } - palette_selector_s = lerp_float(palette_selector_s, palette_selector_s_to, 2); - - if(_s != palette_selector_s) { - var _ds = palette_selector_s - _s; - - palette_selector_x -= _msx * _ds / _s; - palette_selector_y -= _msy * _ds / _s; - } - } - - var _tdim_ws = _tdim[0] * palette_selector_s; - var _tdim_hs = _tdim[1] * palette_selector_s; - var _minx = -(_tdim_ws - _w) - 32; - var _miny = -(_tdim_hs - _tsh) - 32; - var _maxx = 32; - var _maxy = 32; - if(_minx > _maxx) { _minx = (_minx + _maxx) / 2; _maxx = _minx; } - if(_miny > _maxy) { _miny = (_miny + _maxy) / 2; _maxy = _miny; } - - palette_selector_x = clamp(palette_selector_x, _minx, _maxx); - palette_selector_y = clamp(palette_selector_y, _miny, _maxy); + if(palette_dragging) { + var _tdx = _m[0] - palette_drag_mx; + var _tdy = _m[1] - palette_drag_my; + + palette_selector_x = palette_drag_sx + _tdx; + palette_selector_y = palette_drag_sy + _tdy; + + if(mouse_release(mb_middle)) + palette_dragging = false; + } + + if(_hov) { + if(mouse_press(mb_middle, _focus)) { + palette_dragging = true; + palette_drag_sx = palette_selector_x; + palette_drag_sy = palette_selector_y; + palette_drag_mx = _m[0]; + palette_drag_my = _m[1]; + } + + var _s = palette_selector_s; + if(key_mod_press(CTRL) || palette_viewer.popupPanel != noone) { + if(mouse_wheel_up()) { palette_selector_s_to = clamp(palette_selector_s_to * 1.2, 0.5, 4); } + if(mouse_wheel_down()) { palette_selector_s_to = clamp(palette_selector_s_to / 1.2, 0.5, 4); } + } + palette_selector_s = lerp_float(palette_selector_s, palette_selector_s_to, 2); + + if(_s != palette_selector_s) { + var _ds = palette_selector_s - _s; + + palette_selector_x -= _msx * _ds / _s; + palette_selector_y -= _msy * _ds / _s; + } + } + + var _tdim_ws = _tdim[0] * palette_selector_s; + var _tdim_hs = _tdim[1] * palette_selector_s; + var _minx = -(_tdim_ws - _w) - 32; + var _miny = -(_tdim_hs - _tsh) - 32; + var _maxx = 32; + var _maxy = 32; + if(_minx > _maxx) { _minx = (_minx + _maxx) / 2; _maxx = _minx; } + if(_miny > _maxy) { _miny = (_miny + _maxy) / 2; _maxy = _miny; } + + palette_selector_x = clamp(palette_selector_x, _minx, _maxx); + palette_selector_y = clamp(palette_selector_y, _miny, _maxy); #endregion - if(palette_tool == 1) { + if(palette_tool == 1) { + #region // pencil tool surface_set_target(palette_selector_mask); DRAW_CLEAR draw_set_color(c_white); @@ -1150,8 +1187,10 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr buffer_delete_safe(brush_palette_buffer); brush_palette_buffer = buffer_from_surface(brush_palette); } + #endregion - } else if(palette_tool == 2) { + } else if(palette_tool == 2) { + #region eraser tool surface_set_target(brush_palette_prev); DRAW_CLEAR @@ -1191,8 +1230,10 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr buffer_delete_safe(brush_palette_buffer); brush_palette_buffer = buffer_from_surface(brush_palette); } - - } else if(palette_using) { + #endregion + + } else if(palette_using) { + #region no tool surface_set_target(palette_selector_mask); DRAW_CLEAR draw_set_color(c_white); @@ -1204,6 +1245,7 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr draw_rectangle(_tileSel_x, _tileSel_y, _tileSel_x + _tileSel_w, _tileSel_y + _tileSel_h, false); } surface_reset_target(); + #endregion } if(palette_tool) { @@ -1232,7 +1274,8 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr palette_viewer.setName("Tile Palette"); #endregion - #region ++++ animated tiles ++++ + ////- Animated tiles + #region Animated tiles animatedTiles = []; animated_selector_h = 0; @@ -1265,6 +1308,8 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr var _tdim = surface_get_dimension(_tileSet); var _tileAmo = [ floor(_tdim[0] / _tileSiz[0]), floor(_tdim[1] / _tileSiz[1]) ]; + #region top bar + var bx = _x; var by = _yy; var bs = ui(24); @@ -1272,7 +1317,8 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr if(_brush_tiles < 1) draw_sprite_uniform(THEME.add_16, 0, bx + bs / 2, by + bs / 2, 1, COLORS._main_icon); - else if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "New animated tiles", THEME.add_16, 0, COLORS._main_value_positive) == 2) { + + else if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "New animated tiles", THEME.add_16, 0, COLORS._main_value_positive) == 2) { var _new_at = noone; var _indx = array_create(brush.brush_width * brush.brush_height); @@ -1297,6 +1343,7 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr _h += bs + ui(4); _yy += bs + ui(4); + #endregion var _pd = ui(4); var _ah = _pd * 2; @@ -1310,6 +1357,7 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr var _hg = ui(32); var _at = animatedTiles[i]; + #region header var _pw = ui(24); var _ph = ui(24); var _px = _x + ui(8); @@ -1337,7 +1385,7 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr var bs = ui(24); var bx = _w - bs - ui(4); var by = _yy + _hg / 2 - bs / 2; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.minus_16, 0, _hov? COLORS._main_value_negative : COLORS._main_icon) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _hover, _focus, "", THEME.minus_16, 0, _hov? COLORS._main_value_negative : COLORS._main_icon) == 2) del = i; } @@ -1397,95 +1445,97 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr _yy += _hg; _ah += _hg; + #endregion - if(_at.open) { - _yy += ui(4); - _ah += ui(4); - - var _atIdx = _at.index; - var _coll = floor(_w - ui(16)) / max(32, _tileSiz[0]); - var _roww = ceil(array_length(_atIdx) / _coll); - - var _pre_sx = _x + ui(8); - var _pre_sy = _yy; - var _pre_sw = _coll * _tileSiz[0]; - var _pre_sh = _roww * _tileSiz[1]; - - var _ss = (_w - ui(16)) / _pre_sw; - - var _bw = power(2, ceil(log2(_coll))); - var _bh = power(2, ceil(log2(_roww))); + if(!_at.open) continue; + + #region content + _yy += ui(4); + _ah += ui(4); + + var _atIdx = _at.index; + var _coll = floor(_w - ui(16)) / max(32, _tileSiz[0]); + var _roww = ceil(array_length(_atIdx) / _coll); + + var _pre_sx = _x + ui(8); + var _pre_sy = _yy; + var _pre_sw = _coll * _tileSiz[0]; + var _pre_sh = _roww * _tileSiz[1]; + + var _ss = (_w - ui(16)) / _pre_sw; + + var _bw = power(2, ceil(log2(_coll))); + var _bh = power(2, ceil(log2(_roww))); + + _at.preview_surface = surface_verify(_at.preview_surface, _bw, _bh, surface_rgba16float); + _at.preview_surface_tile = surface_verify(_at.preview_surface_tile, _pre_sw, _pre_sh); + + surface_set_shader(_at.preview_surface, sh_draw_tile_brush, true, BLEND.over); + for( var j = 0, m = array_length(_atIdx); j < m; j++ ) { + var _til_row = floor(j / _coll); + var _til_col = j % _coll; + + var _bindex = _atIdx[j]; + shader_set_f("index", _bindex); + shader_set_f("varient", 0); + draw_point(_til_col, _til_row); + } + surface_reset_shader(); + + var _tileSetDim = surface_get_dimension(_tileSet); + + surface_set_shader(_at.preview_surface_tile, sh_draw_tile_map, true, BLEND.over); + shader_set_2("dimension", surface_get_dimension(_at.preview_surface_tile)); + + shader_set_surface("indexTexture", _at.preview_surface); + shader_set_2("indexTextureDim", surface_get_dimension(_at.preview_surface)); + + shader_submit(); - _at.preview_surface = surface_verify(_at.preview_surface, _bw, _bh, surface_rgba16float); - _at.preview_surface_tile = surface_verify(_at.preview_surface_tile, _pre_sw, _pre_sh); - - surface_set_shader(_at.preview_surface, sh_draw_tile_brush, true, BLEND.over); - for( var j = 0, m = array_length(_atIdx); j < m; j++ ) { - var _til_row = floor(j / _coll); - var _til_col = j % _coll; - - var _bindex = _atIdx[j]; - shader_set_f("index", _bindex); - shader_set_f("varient", 0); - draw_point(_til_col, _til_row); - } - surface_reset_shader(); - - var _tileSetDim = surface_get_dimension(_tileSet); - - surface_set_shader(_at.preview_surface_tile, sh_draw_tile_map, true, BLEND.over); - shader_set_2("dimension", surface_get_dimension(_at.preview_surface_tile)); - - shader_set_surface("indexTexture", _at.preview_surface); - shader_set_2("indexTextureDim", surface_get_dimension(_at.preview_surface)); - - shader_submit(); - - draw_empty(); - surface_reset_shader(); - - draw_surface_ext(_at.preview_surface_tile, _pre_sx, _pre_sy, _ss, _ss, 0, c_white, 1); - draw_sprite_stretched_ext(THEME.ui_panel, 1, _pre_sx, _pre_sy, _pre_sw * _ss, _pre_sh * _ss, COLORS._main_icon); - - var _dtile_w = _tileSiz[0] * _ss; - var _dtile_h = _tileSiz[1] * _ss; - - if(_hover && point_in_rectangle(_m[0], _m[1], _pre_sx, _pre_sy, _pre_sx + _pre_sw * _ss, _pre_sy + _pre_sh * _ss)) { - var _at_cx = clamp(floor((_m[0] - _pre_sx) / _dtile_w), 0, _coll - 1); - var _at_cy = clamp(floor((_m[1] - _pre_sy) / _dtile_h), 0, _roww - 1); - - var _at_id = _at_cy * _coll + _at_cx; - if(_at_id >= 0 && _at_id < array_length(_atIdx)) { - var _at_c_sx = _pre_sx + _at_cx * _dtile_w; - var _at_c_sy = _pre_sy + _at_cy * _dtile_h; - - draw_set_color(COLORS._main_icon_light); - draw_rectangle(_at_c_sx, _at_c_sy, _at_c_sx + _dtile_w, _at_c_sy + _dtile_h, true); - - if(mouse_press(mb_left, _focus)) { - object_selecting = _at; - object_select_id = object_select_id == _at_id? noone : _at_id; - } - - if(mouse_press(mb_right, _focus)) - _at.index[_at_id] = -1; - } - } - - if(object_selecting == _at && object_select_id != noone) { - var _at_sl_x = object_select_id % _coll; - var _at_sl_y = floor(object_select_id / _coll); - - var _at_c_sx = _pre_sx + _at_sl_x * _dtile_w; - var _at_c_sy = _pre_sy + _at_sl_y * _dtile_h; + draw_empty(); + surface_reset_shader(); + + draw_surface_ext(_at.preview_surface_tile, _pre_sx, _pre_sy, _ss, _ss, 0, c_white, 1); + draw_sprite_stretched_ext(THEME.ui_panel, 1, _pre_sx, _pre_sy, _pre_sw * _ss, _pre_sh * _ss, COLORS._main_icon); + + var _dtile_w = _tileSiz[0] * _ss; + var _dtile_h = _tileSiz[1] * _ss; + + if(_hover && point_in_rectangle(_m[0], _m[1], _pre_sx, _pre_sy, _pre_sx + _pre_sw * _ss, _pre_sy + _pre_sh * _ss)) { + var _at_cx = clamp(floor((_m[0] - _pre_sx) / _dtile_w), 0, _coll - 1); + var _at_cy = clamp(floor((_m[1] - _pre_sy) / _dtile_h), 0, _roww - 1); + + var _at_id = _at_cy * _coll + _at_cx; + if(_at_id >= 0 && _at_id < array_length(_atIdx)) { + var _at_c_sx = _pre_sx + _at_cx * _dtile_w; + var _at_c_sy = _pre_sy + _at_cy * _dtile_h; - draw_sprite_stretched_ext(THEME.ui_panel, 1, _at_c_sx, _at_c_sy, _dtile_w, _dtile_h, COLORS._main_accent); - } - - _yy += _pre_sh * _ss + ui(4); - _ah += _pre_sh * _ss + ui(4); - - } + draw_set_color(COLORS._main_icon_light); + draw_rectangle(_at_c_sx, _at_c_sy, _at_c_sx + _dtile_w, _at_c_sy + _dtile_h, true); + + if(mouse_press(mb_left, _focus)) { + object_selecting = _at; + object_select_id = object_select_id == _at_id? noone : _at_id; + } + + if(mouse_press(mb_right, _focus)) + _at.index[_at_id] = -1; + } + } + + if(object_selecting == _at && object_select_id != noone) { + var _at_sl_x = object_select_id % _coll; + var _at_sl_y = floor(object_select_id / _coll); + + var _at_c_sx = _pre_sx + _at_sl_x * _dtile_w; + var _at_c_sy = _pre_sy + _at_sl_y * _dtile_h; + + draw_sprite_stretched_ext(THEME.ui_panel, 1, _at_c_sx, _at_c_sy, _dtile_w, _dtile_h, COLORS._main_accent); + } + + _yy += _pre_sh * _ss + ui(4); + _ah += _pre_sh * _ss + ui(4); + #endregion } if(del != -1) { @@ -1502,12 +1552,6 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr animated_viewer.setName("Animated Tile"); #endregion - gmTile = noone; - texture = noone; - tileSize = [ 1, 1 ]; - tileAmount = [ 1, 1 ]; - rules = new Tileset_Rule(self); - input_display_list = [ 1, 0, ["Tileset", false, noone, tile_selector.b_toggle ], tile_selector, ["Autoterrains", true, noone, autoterrain_selector.b_toggle ], autoterrain_selector, @@ -1516,6 +1560,8 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr ["Rules", true, noone, rules.b_toggle ], rules, ]; + ////- Update + static shader_submit = function() { shader_set_2("tileSize", tileSize); @@ -1527,8 +1573,6 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr shader_set_f("animatedTilesLength", aTilesLength); } - ////- Update - static update = function(frame = CURRENT_FRAME) { texture = inputs[0].getValue(); tileSize = inputs[1].getValue(); @@ -1568,12 +1612,22 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr ////- GM + static droppable = function(obj) { return struct_try_get(obj, "type", "") == "GMTileSet"; } + static onDrop = function(obj) { + if(!droppable(obj)) return; + bindTile(obj.data); + } + static bindTile = function(_gmTile) { gmTile = _gmTile; - if(gmTile == noone) { - return; - } + if(gmTile == noone) return; + display_name = gmTile.name; + + var _tw = _gmTile.raw.tileWidth; + var _th = _gmTile.raw.tileHeight; + + inputs[1].setValue([ _tw, _th ]); } ////- Serialize diff --git a/scripts/outputBox/outputBox.gml b/scripts/outputBox/outputBox.gml index 0e8752f56..01832cbaf 100644 --- a/scripts/outputBox/outputBox.gml +++ b/scripts/outputBox/outputBox.gml @@ -59,7 +59,7 @@ function outputBox() : widget() constructor { var _bx = _x + _w - ui(8) - _bs; var _by = _y + ui(8); - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, iactive, ihover, "", THEME.arrow, expand? 3 : 0) == 2) + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, ihover, iactive, "", THEME.arrow, expand? 3 : 0) == 2) expand = !expand; } @@ -111,7 +111,7 @@ function outputStructBox() : widget() constructor { var _bx = _x + _w - ui(8) - _bs; var _by = _y + ui(8); - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, iactive, ihover, "", THEME.arrow, expand? 3 : 0) == 2) + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, ihover, iactive, "", THEME.arrow, expand? 3 : 0) == 2) expand = !expand; } diff --git a/scripts/panel_addon/panel_addon.gml b/scripts/panel_addon/panel_addon.gml index 8ad06937d..543c6c2db 100644 --- a/scripts/panel_addon/panel_addon.gml +++ b/scripts/panel_addon/panel_addon.gml @@ -116,12 +116,12 @@ function Panel_Addon() : PanelContent() constructor { var _bx = bx - ui(4); var _by = by + ui(4); - var b = buttonInstant(THEME.button_hide, _bx, _by, ui(32), ui(32), _m, pFOCUS, pHOVER, __txt("Open in explorer"), THEME.folder_content); + var b = buttonInstant(THEME.button_hide, _bx, _by, ui(32), ui(32), _m, pHOVER, pFOCUS, __txt("Open in explorer"), THEME.folder_content); if(b) hover = false; if(b == 2) shellOpenExplorer(DIRECTORY + "Addons/" + _addon.name); _bx -= ui(36) - if(_act && buttonInstant(THEME.button_hide, _bx, _by, ui(32), ui(32), _m, pFOCUS, pHOVER, __txt("Addon settings"), THEME.addon_setting) == 2) { + if(_act && buttonInstant(THEME.button_hide, _bx, _by, ui(32), ui(32), _m, pHOVER, pFOCUS, __txt("Addon settings"), THEME.addon_setting) == 2) { var _addObj = noone; with(_addon_custom) if(name == _addon.name) _addObj = self; diff --git a/scripts/panel_animation/panel_animation.gml b/scripts/panel_animation/panel_animation.gml index e11828585..1e4ef2d6e 100644 --- a/scripts/panel_animation/panel_animation.gml +++ b/scripts/panel_animation/panel_animation.gml @@ -1544,7 +1544,7 @@ function Panel_Animation() : PanelContent() constructor { var _gx = ui(20); var _gy = ty; if(hov) - if(buttonInstant(noone, _gx - ui(10), _gy - ui(9), ui(20), ui(17), [msx, msy], pFOCUS, pHOVER, "", THEME.animate_prop_go, 0, [COLORS._main_icon, COLORS._main_icon_on_inner], 0.75) == 2) { + if(buttonInstant(noone, _gx - ui(10), _gy - ui(9), ui(20), ui(17), [msx, msy], pHOVER, pFOCUS, "", THEME.animate_prop_go, 0, [COLORS._main_icon, COLORS._main_icon_on_inner], 0.75) == 2) { graphFocusNode(_node); PANEL_INSPECTOR.highlightProp(prop); } @@ -1576,7 +1576,7 @@ function Panel_Animation() : PanelContent() constructor { #region keyframe control tx = tool_width - ui(20 + 16 * 3); - if(buttonInstant(noone, tx - ui(10), ty - ui(9), ui(20), ui(17), [msx, msy], pFOCUS, pHOVER, "", THEME.prop_keyframe, 0, [COLORS._main_icon, COLORS._main_icon_on_inner], _tool_a) == 2) { + if(buttonInstant(noone, tx - ui(10), ty - ui(9), ui(20), ui(17), [msx, msy], pHOVER, pFOCUS, "", THEME.prop_keyframe, 0, [COLORS._main_icon, COLORS._main_icon_on_inner], _tool_a) == 2) { var _t = -1; for(var k = 0; k < array_length(animator.values); k++) { var _key = animator.values[k]; @@ -1587,7 +1587,7 @@ function Panel_Animation() : PanelContent() constructor { } tx = tool_width - ui(20 + 16 * 1); - if(buttonInstant(noone, tx - ui(10), ty - ui(9), ui(20), ui(17), [msx, msy], pFOCUS, pHOVER, "", THEME.prop_keyframe, 2, [COLORS._main_icon, COLORS._main_icon_on_inner], _tool_a) == 2) { + if(buttonInstant(noone, tx - ui(10), ty - ui(9), ui(20), ui(17), [msx, msy], pHOVER, pFOCUS, "", THEME.prop_keyframe, 2, [COLORS._main_icon, COLORS._main_icon_on_inner], _tool_a) == 2) { for(var k = 0; k < array_length(animator.values); k++) { var _key = animator.values[k]; if(_key.time > CURRENT_FRAME) { @@ -1600,7 +1600,7 @@ function Panel_Animation() : PanelContent() constructor { #region add keyframe tx = tool_width - ui(20 + 16 * 2); - if(buttonInstant(noone, tx - ui(10), ty - ui(9), ui(20), ui(17), [msx, msy], pFOCUS, pHOVER, "", THEME.prop_keyframe, 1, [COLORS._main_accent, COLORS._main_icon_on_inner], _tool_a) == 2) { + if(buttonInstant(noone, tx - ui(10), ty - ui(9), ui(20), ui(17), [msx, msy], pHOVER, pFOCUS, "", THEME.prop_keyframe, 1, [COLORS._main_accent, COLORS._main_icon_on_inner], _tool_a) == 2) { var _add = false; for(var k = 0; k < array_length(animator.values); k++) { var _key = animator.values[k]; @@ -2519,7 +2519,7 @@ function Panel_Animation() : PanelContent() constructor { var cc = IS_RENDERING? COLORS._main_icon_dark : but[2](); var fnc = but[3]; - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS && !IS_RENDERING, pHOVER && !IS_RENDERING, txt, THEME.sequence_control, ind, cc) == 2) + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pHOVER && !IS_RENDERING, pFOCUS && !IS_RENDERING, txt, THEME.sequence_control, ind, cc) == 2) fnc(); bx += ui(36); @@ -2569,11 +2569,11 @@ function Panel_Animation() : PanelContent() constructor { by += ui(36); bx = w - ui(44); - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_animation_animation_settings", "Animation settings"), THEME.gear, 2) == 2) + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pHOVER, pFOCUS, __txtx("panel_animation_animation_settings", "Animation settings"), THEME.gear, 2) == 2) dialogPanelCall(new Panel_Animation_Setting(), x + bx + ui(32), y + by - ui(8), { anchor: ANCHOR.right | ANCHOR.bottom }); by -= ui(40); if(by < 8) return; - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_animation_scale_animation", "Scale animation"), THEME.animation_timing, 2) == 2) + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pHOVER, pFOCUS, __txtx("panel_animation_scale_animation", "Scale animation"), THEME.animation_timing, 2) == 2) dialogPanelCall(new Panel_Animation_Scaler(), x + bx + ui(32), y + by - ui(8), { anchor: ANCHOR.right | ANCHOR.bottom }); var max_y = by - ui(28); @@ -2581,7 +2581,7 @@ function Panel_Animation() : PanelContent() constructor { by = ui(8); var txt = __txt("New folder"); - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(28), [mx, my], pFOCUS, pHOVER, txt, THEME.folder_content) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(28), [mx, my], pHOVER, pFOCUS, txt, THEME.folder_content) == 2) { var _dir = new timelineItemGroup(); PROJECT.timelines.addItem(_dir); } @@ -2589,21 +2589,21 @@ function Panel_Animation() : PanelContent() constructor { by += ui(32); if(by > max_y) return; node_name_tooltip.index = node_name_type; - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(28), [mx, my], pFOCUS, pHOVER, node_name_tooltip, THEME.node_name_type, node_name_type) == 2) + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(28), [mx, my], pHOVER, pFOCUS, node_name_tooltip, THEME.node_name_type, node_name_type) == 2) node_name_type = (node_name_type + 1) % 3; by += ui(32); if(by > max_y) return; - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(28), [mx, my], pFOCUS, pHOVER, tooltip_toggle_nodes, THEME.junc_visible, show_nodes) == 2) + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(28), [mx, my], pHOVER, pFOCUS, tooltip_toggle_nodes, THEME.junc_visible, show_nodes) == 2) show_nodes = !show_nodes; by += ui(32); if(by > max_y) return; txt = __txtx("panel_animation_keyframe_override", "Override Keyframe"); - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(28), [mx, my], pFOCUS, pHOVER, txt, THEME.keyframe_override, global.FLAG.keyframe_override) == 2) + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(28), [mx, my], pHOVER, pFOCUS, txt, THEME.keyframe_override, global.FLAG.keyframe_override) == 2) global.FLAG.keyframe_override = !global.FLAG.keyframe_override; by += ui(32); if(by > max_y) return; txt = __txt("Onion skin"); - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(28), [mx, my], pFOCUS, pHOVER, txt, THEME.onion_skin,, PROJECT.onion_skin.enabled? c_white : COLORS._main_icon) == 2) + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(28), [mx, my], pHOVER, pFOCUS, txt, THEME.onion_skin,, PROJECT.onion_skin.enabled? c_white : COLORS._main_icon) == 2) PROJECT.onion_skin.enabled = !PROJECT.onion_skin.enabled; } diff --git a/scripts/panel_collection/panel_collection.gml b/scripts/panel_collection/panel_collection.gml index 7004eb8b3..f39dc0119 100644 --- a/scripts/panel_collection/panel_collection.gml +++ b/scripts/panel_collection/panel_collection.gml @@ -818,7 +818,7 @@ function Panel_Collection() : PanelContent() constructor { var by = ui(9); var bs = ui(32); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, __txt("Search"), THEME.search_24, 0, searching? COLORS._main_accent : COLORS._main_icon) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pHOVER, pFOCUS, __txt("Search"), THEME.search_24, 0, searching? COLORS._main_accent : COLORS._main_icon) == 2) search_toggle(); bx -= ui(36); @@ -837,7 +837,7 @@ function Panel_Collection() : PanelContent() constructor { if(bx < rootx) return; if(context != root) { var txt = __txtx("panel_collection_add_node", "Add selecting node as collection"); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, txt, THEME.add_20, 0, COLORS._main_value_positive) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pHOVER, pFOCUS, txt, THEME.add_20, 0, COLORS._main_value_positive) == 2) { if(PANEL_INSPECTOR.getInspecting() != noone) { data_path = context.path; var dia = dialogCall(o_dialog_file_name_collection, mouse_mx + ui(8), mouse_my + ui(8)); @@ -854,7 +854,7 @@ function Panel_Collection() : PanelContent() constructor { if(bx < rootx) return; var txt = __txtx("panel_collection_add_folder", "Add folder"); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, txt) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pHOVER, pFOCUS, txt) == 2) { fileNameCall(context.path, function (txt) { directory_create(txt); refreshContext(); @@ -868,20 +868,20 @@ function Panel_Collection() : PanelContent() constructor { if(pageStr[page] != "Nodes") { if(bx < rootx) return; var txt = __txtx("panel_collection_open_file", "Open in file explorer"); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, txt, THEME.path_open) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pHOVER, pFOCUS, txt, THEME.path_open) == 2) shellOpenExplorer(context.path); draw_sprite_ui_uniform(THEME.path_open, 1, bx + bs / 2, by + bs / 2, 1, c_white); bx -= ui(36); if(bx < rootx) return; var txt = __txt("Refresh"); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, txt, THEME.refresh_icon) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pHOVER, pFOCUS, txt, THEME.refresh_icon) == 2) refreshContext(); bx -= ui(36); if(bx < rootx) return; var txt = __txt("Settings"); - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, txt, THEME.gear) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pHOVER, pFOCUS, txt, THEME.gear) == 2) dialogPanelCall(new Panel_Collections_Setting(), x + bx, y + by - 8, { anchor: ANCHOR.bottom | ANCHOR.left }); bx -= ui(36); diff --git a/scripts/panel_file_explorer/panel_file_explorer.gml b/scripts/panel_file_explorer/panel_file_explorer.gml index 8104fc44b..641fa473a 100644 --- a/scripts/panel_file_explorer/panel_file_explorer.gml +++ b/scripts/panel_file_explorer/panel_file_explorer.gml @@ -427,11 +427,11 @@ function Panel_File_Explorer() : PanelContent() constructor { var _ppw = _pw; if(point_in_rectangle(_m[0], _m[1], _px, _py, _px + _pw, _py + _ph)) { - if(buttonInstant(THEME.button_hide, _px + _ppw - _ph, _py, _ph, _ph, _m, pFOCUS, pHOVER, "Set as root", THEME.path_open_20) == 2) + if(buttonInstant(THEME.button_hide, _px + _ppw - _ph, _py, _ph, _ph, _m, pHOVER, pFOCUS, "Set as root", THEME.path_open_20) == 2) setRoot(_dir.path); _ppw -= _ph + ui(2); - if(buttonInstant(THEME.button_hide, _px + _ppw - _ph, _py, _ph, _ph, _m, pFOCUS, pHOVER, "Copy path", THEME.copy_20) == 2) + if(buttonInstant(THEME.button_hide, _px + _ppw - _ph, _py, _ph, _ph, _m, pHOVER, pFOCUS, "Copy path", THEME.copy_20) == 2) clipboard_set_text(_dir.path); _ppw -= _ph + ui(2); @@ -507,12 +507,12 @@ function Panel_File_Explorer() : PanelContent() constructor { var _bx = _px + _tw + ui(4); if(path_is_image(_fil.path)) { - if(buttonInstant(noone, _bx, _py, _ph, _ph, _m, pFOCUS, pHOVER, "", THEME.image_20, 0, [ COLORS._main_icon, c_white ]) == 2) { + if(buttonInstant(noone, _bx, _py, _ph, _ph, _m, pHOVER, pFOCUS, "", THEME.image_20, 0, [ COLORS._main_icon, c_white ]) == 2) { Node_create_Image_path(_graph_x, _graph_y, _fil.path); draggable = false; } _bx += _ph + ui(2); - if(buttonInstant(noone, _bx, _py, _ph, _ph, _m, pFOCUS, pHOVER, "", THEME.canvas_20, 0, [ COLORS._main_icon, c_white ]) == 2) { + if(buttonInstant(noone, _bx, _py, _ph, _ph, _m, pHOVER, pFOCUS, "", THEME.canvas_20, 0, [ COLORS._main_icon, c_white ]) == 2) { var node = nodeBuild("Node_Canvas", _graph_x, _graph_y).loadImagePath(_fil.path); PANEL_PREVIEW.setNodePreview(node); PANEL_INSPECTOR.inspecting = node; @@ -521,7 +521,7 @@ function Panel_File_Explorer() : PanelContent() constructor { } _bx += _ph + ui(2); } else if(path_is_project(_fil.path)) { - if(buttonInstant(noone, _bx, _py, _ph, _ph, _m, pFOCUS, pHOVER, "", THEME.path_open_20, 0, [ COLORS._main_icon, c_white ]) == 2) { + if(buttonInstant(noone, _bx, _py, _ph, _ph, _m, pHOVER, pFOCUS, "", THEME.path_open_20, 0, [ COLORS._main_icon, c_white ]) == 2) { LOAD_AT(_fil.path); draggable = false; } _bx += _ph + ui(2); @@ -665,7 +665,7 @@ function Panel_File_Explorer() : PanelContent() constructor { draw_sprite_stretched(THEME.ui_panel_bg, 1, cnt_x, cnt_y, cnt_w, cnt_h); var bs = top_bar - pad - ui(8); - if(buttonInstant(THEME.button_hide, pad, pad, bs, bs, [mx, my], pFOCUS, pHOVER, "Go up", THEME.arrow, 1, root != ""? COLORS._main_icon : COLORS._main_icon_dark) == 2) + if(buttonInstant(THEME.button_hide, pad, pad, bs, bs, [mx, my], pHOVER, pFOCUS, "Go up", THEME.arrow, 1, root != ""? COLORS._main_icon : COLORS._main_icon_dark) == 2) if(root != "") setRoot(filename_dir(root)); var tb_x = cnt_x + ui(32); @@ -673,7 +673,7 @@ function Panel_File_Explorer() : PanelContent() constructor { var tb_w = w - pad - tb_x - bs - ui(4); var tb_h = top_bar - pad - ui(8); - if(buttonInstant(THEME.button_hide, w - pad - bs, pad, bs, bs, [mx, my], pFOCUS, pHOVER, view_mode_tooltip, THEME.view_mode, !view_mode) == 2) { + if(buttonInstant(THEME.button_hide, w - pad - bs, pad, bs, bs, [mx, my], pHOVER, pFOCUS, view_mode_tooltip, THEME.view_mode, !view_mode) == 2) { view_mode = !view_mode; PREFERENCES.file_explorer_view = view_mode; } diff --git a/scripts/panel_gm_explorer/panel_gm_explorer.gml b/scripts/panel_gm_explorer/panel_gm_explorer.gml index 703ca81c1..dd5a0f658 100644 --- a/scripts/panel_gm_explorer/panel_gm_explorer.gml +++ b/scripts/panel_gm_explorer/panel_gm_explorer.gml @@ -52,7 +52,7 @@ function Panel_GM_Explore(gmBinder) : PanelContent() constructor { var _bx = px + pw - _bs; var _by = py; - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pFOCUS, pHOVER, "", THEME.refresh_16) == 2) + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pHOVER, pFOCUS, "", THEME.refresh_16) == 2) gmBinder.refreshResources(); sc_content.setFocusHover(pFOCUS, pHOVER); diff --git a/scripts/panel_gradient/panel_gradient.gml b/scripts/panel_gradient/panel_gradient.gml index 9d28989d0..92b4b0f52 100644 --- a/scripts/panel_gradient/panel_gradient.gml +++ b/scripts/panel_gradient/panel_gradient.gml @@ -74,7 +74,7 @@ function Panel_Gradient() : PanelContent() constructor { // var bx = w - ui(32 + 16); // var by = padding / 2 - ui(16 + !in_dialog * 2); - // if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txt("Refresh"), THEME.refresh_icon, 1, COLORS._main_icon) == 2) + // if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pHOVER, pFOCUS, __txt("Refresh"), THEME.refresh_icon, 1, COLORS._main_icon) == 2) // __initGradient(); } } \ No newline at end of file diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index f7b7b9ff3..6cf0a504e 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -2160,7 +2160,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { th = string_height(tt); if(i < array_length(node_context) - 1) { - if(buttonInstant(THEME.button_hide_fill, xx - ui(6), tbh - bh / 2, tw + ui(12), bh, [mx, my], pFOCUS, pHOVER) == 2) { + if(buttonInstant(THEME.button_hide_fill, xx - ui(6), tbh - bh / 2, tw + ui(12), bh, [mx, my], pHOVER, pFOCUS) == 2) { node_hover = noone; nodes_selecting = []; PANEL_PREVIEW.resetNodePreview(); @@ -2238,7 +2238,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var bs = ui(28); if(tbx - (bs + ui(4)) < cont_x) break; - var b = buttonInstant(THEME.button_hide, tbx - bs, tby - bs / 2, bs, bs, _m, pFOCUS, pHOVER, tbTooltip, tbObj, tbInd); + var b = buttonInstant(THEME.button_hide, tbx - bs, tby - bs / 2, bs, bs, _m, pHOVER, pFOCUS, tbTooltip, tbObj, tbInd); if(b == 2) tb[3]( { x: x + tbx - bs, y: y + tby - bs / 2 } ); tbx -= bs + ui(4); } @@ -2400,13 +2400,13 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var bs = ui(24); var bx = x1 - bs - pd; var by = y0 + pd; - if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, [ mx, my ], pFOCUS, pHOVER, "", THEME.cross_16) == 2 + if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, [ mx, my ], pHOVER, pFOCUS, "", THEME.cross_16) == 2 || keyboard_check_pressed(vk_escape) || keyboard_check_pressed(vk_enter)) is_searching = false; bx -= bs + ui(4); - if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, [ mx, my ], pFOCUS, pHOVER, "", THEME.arrow_wire_16, 0) == 2) { + if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, [ mx, my ], pHOVER, pFOCUS, "", THEME.arrow_wire_16, 0) == 2) { if(!array_empty(search_result)) { search_index = safe_mod(search_index + 1, array_length(search_result)); nodes_selecting = [ search_result[search_index] ]; @@ -2415,7 +2415,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { } bx -= bs + ui(4); - if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, [ mx, my ], pFOCUS, pHOVER, "", THEME.arrow_wire_16, 2) == 2) { + if(buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, [ mx, my ], pHOVER, pFOCUS, "", THEME.arrow_wire_16, 2) == 2) { if(!array_empty(search_result)) { search_index = safe_mod(search_index - 1 + array_length(search_result), array_length(search_result)); nodes_selecting = [ search_result[search_index] ]; 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 60f8799ab..1f9ec2d2b 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 @@ -161,7 +161,7 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor { var bx = _sx1 - ui(24) - ui(4); var by = _sy + ui(1) + ui(4); - if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, pFOCUS, pHOVER) == 2) + if(buttonInstant(THEME.button_hide, bx, by, ui(24), ui(24), _m, pHOVER, pFOCUS) == 2) refresh(); draw_sprite_ui(THEME.refresh_16, 0, bx + ui(12), by + ui(12),,,, COLORS._main_icon, 1); diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index 2437978ec..10aa26d22 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -1220,10 +1220,10 @@ function Panel_Inspector() : PanelContent() constructor { draw_set_font(f_p1); var lx = w / 2 - string_width(inspecting.name) / 2 - ui(10); var ly = ui(56 - 8); - if(buttonInstant(THEME.button_hide, lx, ly, ui(16), ui(16), [mx, my], pFOCUS, pHOVER, __txt("Lock"), THEME.lock_12, !locked, locked? COLORS._main_icon_light : COLORS._main_icon) == 2) + if(buttonInstant(THEME.button_hide, lx, ly, ui(16), ui(16), [mx, my], pHOVER, pFOCUS, __txt("Lock"), THEME.lock_12, !locked, locked? COLORS._main_icon_light : COLORS._main_icon) == 2) locked = !locked; - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txt("Presets"), THEME.preset, 1) == 2) + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pHOVER, pFOCUS, __txt("Presets"), THEME.preset, 1) == 2) dialogPanelCall(new Panel_Presets(inspecting), x + bx, y + by + ui(36)); } else { draw_sprite_ui_uniform(THEME.preset, 1, bx + ui(32) / 2, by + ui(32) / 2, 1, COLORS._main_icon_dark); @@ -1241,7 +1241,7 @@ function Panel_Inspector() : PanelContent() constructor { var tt = inspecting.insp1UpdateTooltip; if(inspectGroup) tt += " [All]"; - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS && ac, pHOVER && ac, tt, icon[0], icon[1], cc) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pHOVER && ac, pFOCUS && ac, tt, icon[0], icon[1], cc) == 2) { if(inspectGroup == 1) { for( var i = 0, n = array_length(inspectings); i < n; i++ ) inspectings[i].inspector1Update(); } else @@ -1258,7 +1258,7 @@ function Panel_Inspector() : PanelContent() constructor { var tt = inspecting.insp2UpdateTooltip; if(inspectGroup) tt += " [All]"; - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS && ac, pHOVER && ac, tt, icon[0], icon[1], cc) = 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pHOVER && ac, pFOCUS && ac, tt, icon[0], icon[1], cc) = 2) { if(inspectGroup) { for( var i = 0, n = array_length(inspectings); i < n; i++ ) inspectings[i].inspector2Update(); } else @@ -1274,7 +1274,7 @@ function Panel_Inspector() : PanelContent() constructor { if(inspecting && !inspecting.active) inspecting = noone; view_mode_tooltip.index = viewMode; - if(buttonInstant(THEME.button_hide, ui(8), ui(48), ui(32), ui(32), [mx, my], pFOCUS, pHOVER, view_mode_tooltip, THEME.inspector_view, viewMode) == 2) { + if(buttonInstant(THEME.button_hide, ui(8), ui(48), ui(32), ui(32), [mx, my], pHOVER, pFOCUS, view_mode_tooltip, THEME.inspector_view, viewMode) == 2) { viewMode = !viewMode; PREFERENCES.inspector_view_default = viewMode; } @@ -1323,16 +1323,16 @@ function Panel_Inspector() : PanelContent() constructor { var bx = w - ui(44); var by = ui(12); - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_inspector_set_default", "Set Metadata as default"), THEME.save, 0, COLORS._main_icon) == 2) + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pHOVER, pFOCUS, __txtx("panel_inspector_set_default", "Set Metadata as default"), THEME.save, 0, COLORS._main_icon) == 2) json_save_struct(DIRECTORY + "meta.json", PROJECT.meta.serialize()); by += ui(36); if(STEAM_ENABLED && !workshop_uploading) { if(PROJECT.path == "") { - buttonInstant(noone, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_inspector_workshop_save", "Save file before upload"), THEME.workshop_upload, 0, COLORS._main_icon, 0.5); + buttonInstant(noone, bx, by, ui(32), ui(32), [mx, my], pHOVER, pFOCUS, __txtx("panel_inspector_workshop_save", "Save file before upload"), THEME.workshop_upload, 0, COLORS._main_icon, 0.5); } else { if(PROJECT.meta.steam == FILE_STEAM_TYPE.local) { //project made locally - if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_inspector_workshop_upload", "Upload to Steam Workshop"), THEME.workshop_upload, 0, COLORS._main_icon) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pHOVER, pFOCUS, __txtx("panel_inspector_workshop_upload", "Upload to Steam Workshop"), THEME.workshop_upload, 0, COLORS._main_icon) == 2) { var s = PANEL_PREVIEW.getNodePreviewSurface(); if(is_surface(s)) { PROJECT.meta.author_steam_id = STEAM_USER_ID; @@ -1349,7 +1349,7 @@ function Panel_Inspector() : PanelContent() constructor { if(PROJECT.meta.steam && PROJECT.meta.author_steam_id == STEAM_USER_ID) { if(PROJECT.meta.steam == FILE_STEAM_TYPE.steamUpload) { buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], false, pHOVER, __txtx("panel_inspector_workshop_restart", "Open project from the workshop tab to update."), THEME.workshop_update, 0, COLORS._main_icon); - } else if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_inspector_workshop_update", "Update Steam Workshop content"), THEME.workshop_update, 0, COLORS._main_icon) == 2) { + } else if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pHOVER, pFOCUS, __txtx("panel_inspector_workshop_update", "Update Steam Workshop content"), THEME.workshop_update, 0, COLORS._main_icon) == 2) { SAVE_AT(PROJECT, PROJECT.path); steam_ugc_update_project(); workshop_uploading = true; diff --git a/scripts/panel_menu/panel_menu.gml b/scripts/panel_menu/panel_menu.gml index 6c96a6d76..a0186b6bb 100644 --- a/scripts/panel_menu/panel_menu.gml +++ b/scripts/panel_menu/panel_menu.gml @@ -546,7 +546,7 @@ function Panel_Menu() : PanelContent() constructor { switch(action) { case "exit": - var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], true, pHOVER,, THEME.window_exit, 0, COLORS._main_accent); + var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], pHOVER, true,, THEME.window_exit, 0, COLORS._main_accent); if(b) _draggable = false; if(b == 2) window_close(); break; @@ -556,7 +556,7 @@ function Panel_Menu() : PanelContent() constructor { if(OS == os_macosx) win_max = __win_is_maximized; - var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], true, pHOVER,, THEME.window_maximize, win_max, [ COLORS._main_icon, CDEF.lime ]); + var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], pHOVER, true,, THEME.window_maximize, win_max, [ COLORS._main_icon, CDEF.lime ]); if(b) _draggable = false; if(b == 2) { if(OS == os_windows) { @@ -581,7 +581,7 @@ function Panel_Menu() : PanelContent() constructor { break; case "minimize": - var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], true, pHOVER,, THEME.window_minimize, 0, [ COLORS._main_icon, CDEF.yellow ]); + var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], pHOVER, true,, THEME.window_minimize, 0, [ COLORS._main_icon, CDEF.yellow ]); if(b) _draggable = false; if(b == -2) { if(OS == os_windows) winMan_Minimize(); @@ -591,7 +591,7 @@ function Panel_Menu() : PanelContent() constructor { case "fullscreen": var win_full = window_is_fullscreen; - var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], true, pHOVER,, THEME.window_fullscreen, win_full, [ COLORS._main_icon, CDEF.cyan ]); + var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], pHOVER, true,, THEME.window_fullscreen, win_full, [ COLORS._main_icon, CDEF.cyan ]); if(b) _draggable = false; if(b == 2) { if(OS == os_windows) @@ -724,7 +724,7 @@ function Panel_Menu() : PanelContent() constructor { } if(full_name) tw += string_width(".pxc"); - var _b = buttonInstant(THEME.button_hide_fill, tbx0, tby0, tw, th, [mx, my], pFOCUS, pHOVER); + var _b = buttonInstant(THEME.button_hide_fill, tbx0, tby0, tw, th, [mx, my], pHOVER, pFOCUS); var _hov = _b > 0; if(_b) _draggable = false; diff --git a/scripts/panel_node_align/panel_node_align.gml b/scripts/panel_node_align/panel_node_align.gml index 257e2a01c..6b46774c1 100644 --- a/scripts/panel_node_align/panel_node_align.gml +++ b/scripts/panel_node_align/panel_node_align.gml @@ -11,15 +11,15 @@ function Panel_Node_Align() : PanelContent() constructor { ///////////////////////////// - if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pFOCUS, pHOVER,, THEME.object_halign, 0, c_white) == 2) + if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pHOVER, pFOCUS,, THEME.object_halign, 0, c_white) == 2) node_halign(PANEL_GRAPH.nodes_selecting, fa_left); xx += 34 - if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pFOCUS, pHOVER,, THEME.object_halign, 1, c_white) == 2) + if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pHOVER, pFOCUS,, THEME.object_halign, 1, c_white) == 2) node_halign(PANEL_GRAPH.nodes_selecting, fa_center); xx += 34 - if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pFOCUS, pHOVER,, THEME.object_halign, 2, c_white) == 2) + if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pHOVER, pFOCUS,, THEME.object_halign, 2, c_white) == 2) node_halign(PANEL_GRAPH.nodes_selecting, fa_right); xx += 34 @@ -30,15 +30,15 @@ function Panel_Node_Align() : PanelContent() constructor { ///////////////////////////// - if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pFOCUS, pHOVER,, THEME.object_valign, 0, c_white) == 2) + if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pHOVER, pFOCUS,, THEME.object_valign, 0, c_white) == 2) node_valign(PANEL_GRAPH.nodes_selecting, fa_top); xx += 34 - if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pFOCUS, pHOVER,, THEME.object_valign, 1, c_white) == 2) + if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pHOVER, pFOCUS,, THEME.object_valign, 1, c_white) == 2) node_valign(PANEL_GRAPH.nodes_selecting, fa_middle); xx += 34 - if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pFOCUS, pHOVER,, THEME.object_valign, 2, c_white) == 2) + if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pHOVER, pFOCUS,, THEME.object_valign, 2, c_white) == 2) node_valign(PANEL_GRAPH.nodes_selecting, fa_bottom); xx += 34 @@ -49,11 +49,11 @@ function Panel_Node_Align() : PanelContent() constructor { ///////////////////////////// - if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pFOCUS, pHOVER,, THEME.obj_distribute_h, 0, c_white) == 2) + if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pHOVER, pFOCUS,, THEME.obj_distribute_h, 0, c_white) == 2) node_hdistribute(PANEL_GRAPH.nodes_selecting); xx += 34 - if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pFOCUS, pHOVER,, THEME.obj_distribute_v, 0, c_white) == 2) + if(buttonInstant(THEME.button_hide, xx, yy, 32, 32, [mx, my], pHOVER, pFOCUS,, THEME.obj_distribute_v, 0, c_white) == 2) node_vdistribute(PANEL_GRAPH.nodes_selecting); xx += 34 } diff --git a/scripts/panel_nodes/panel_nodes.gml b/scripts/panel_nodes/panel_nodes.gml index f38a72492..b37fc13e6 100644 --- a/scripts/panel_nodes/panel_nodes.gml +++ b/scripts/panel_nodes/panel_nodes.gml @@ -71,7 +71,7 @@ function Panel_Nodes() : PanelContent() constructor { var bx = _x1 - ui(4) - bw; var by = _y + (hg - bh) / 2; - if(buttonInstant(THEME.button_hide, bx, by, bw, bh, _m, sc_nodes.active, sc_nodes.hover, __txtx("panel_node_goto", "Go to node"), THEME.node_goto,, COLORS._main_icon, 0.75, 0.75) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, _m, sc_nodes.hover, sc_nodes.active, __txtx("panel_node_goto", "Go to node"), THEME.node_goto,, COLORS._main_icon, 0.75, 0.75) == 2) graphFocusNode(node); bx -= ui(32); diff --git a/scripts/panel_palette_mixer/panel_palette_mixer.gml b/scripts/panel_palette_mixer/panel_palette_mixer.gml index e89886da0..9ca1f2aed 100644 --- a/scripts/panel_palette_mixer/panel_palette_mixer.gml +++ b/scripts/panel_palette_mixer/panel_palette_mixer.gml @@ -185,7 +185,7 @@ function Panel_Palette_Mixer() : PanelContent() constructor { var _by = pal_y; var _bs = ui(24); - var _b = buttonInstant(THEME.button_hide, _bx, _by, _bs, pal_h, [ mx, my ], pFOCUS, pHOVER, "", THEME.hamburger_s); + var _b = buttonInstant(THEME.button_hide, _bx, _by, _bs, pal_h, [ mx, my ], pHOVER, pFOCUS, "", THEME.hamburger_s); if(_b == 2) { menuCall("", [ menuItem("Save palette as...", function() { diff --git a/scripts/panel_patreon/panel_patreon.gml b/scripts/panel_patreon/panel_patreon.gml index cebb98d87..3c670fa21 100644 --- a/scripts/panel_patreon/panel_patreon.gml +++ b/scripts/panel_patreon/panel_patreon.gml @@ -90,7 +90,7 @@ function Panel_Patreon() : PanelContent() constructor { var _bh = TEXTBOX_HEIGHT + ui(8); var _bx = w / 2 - _bw / 2; - if(buttonInstant(THEME.button_def, _bx, _y, _bw, _bh, [ mx, my ], pFOCUS, pHOVER) == 2) { + if(buttonInstant(THEME.button_def, _bx, _y, _bw, _bh, [ mx, my ], pHOVER, pFOCUS) == 2) { var path = DIRECTORY + "patreon"; file_delete(path); IS_PATREON = false; @@ -119,7 +119,7 @@ function Panel_Patreon() : PanelContent() constructor { _yy += TEXTBOX_HEIGHT + 12; if(!mail_checking) { - if(buttonInstant(THEME.button_def, _bx, _yy, _bw, _bh, [ mx, my ], pFOCUS, pHOVER) == 2) { + if(buttonInstant(THEME.button_def, _bx, _yy, _bw, _bh, [ mx, my ], pHOVER, pFOCUS) == 2) { patreon_email_check(mail, mailCallback); mail_checking = true; result = ""; @@ -143,7 +143,7 @@ function Panel_Patreon() : PanelContent() constructor { tb_code.drawParam(_tb_param); _yy += TEXTBOX_HEIGHT + 12; - if(buttonInstant(THEME.button_def, _bx, _yy, _bw, _bh, [ mx, my ], pFOCUS, pHOVER) == 2) { + if(buttonInstant(THEME.button_def, _bx, _yy, _bw, _bh, [ mx, my ], pHOVER, pFOCUS) == 2) { if(code == global.PATREON_VERIFY_CODE) { result = "Patreon verified, thank you for suporting Pixel Composer!"; result_color = COLORS._main_value_positive; diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index de163e3ca..4bc5662b1 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -2121,10 +2121,11 @@ function Panel_Preview() : PanelContent() constructor { for( var i = 0, n = array_length(settings); i < n; i++ ) { var sett = settings[i]; + var nme = sett[0]; var wdg = sett[1]; - var key = sett[2]; - var atr = sett[3]; + var key = array_safe_get_fast(sett, 2); + var atr = array_safe_get_fast(sett, 3); if(nme != "") { tolx += ui(8) + bool(i == 0) * ui(8); @@ -2210,7 +2211,7 @@ function Panel_Preview() : PanelContent() constructor { if(is_instanceof(tbTooltip, tooltipSelector)) tbTooltip.index = tbInd; - var b = buttonInstant(THEME.button_hide, tbx - ui(14), tby - ui(14), ui(28), ui(28), [mx, my], pFOCUS, pHOVER, tooltip, tbSpr, tbInd); + var b = buttonInstant(THEME.button_hide, tbx - ui(14), tby - ui(14), ui(28), ui(28), [mx, my], pHOVER, pFOCUS, tooltip, tbSpr, tbInd); if(b == 2) tbActive(tbData); if(tbRight != 0 && b == 3) tbRight(tbData); @@ -2224,7 +2225,7 @@ function Panel_Preview() : PanelContent() constructor { var tbTooltip = tb[1]; var tbIndex = tb[3](); - var b = buttonInstant(THEME.button_hide, tbx - ui(14), tby - ui(14), ui(28), ui(28), [mx, my], pFOCUS, pHOVER, tbTooltip, tbSpr, tbIndex); + var b = buttonInstant(THEME.button_hide, tbx - ui(14), tby - ui(14), ui(28), ui(28), [mx, my], pHOVER, pFOCUS, tbTooltip, tbSpr, tbIndex); if(b == 2) tb[2]( { x: x + tbx - ui(14), y: y + tby - ui(14) } ); tbx -= ui(32); diff --git a/scripts/panel_profile_render/panel_profile_render.gml b/scripts/panel_profile_render/panel_profile_render.gml index e85dc61c2..ae211cfee 100644 --- a/scripts/panel_profile_render/panel_profile_render.gml +++ b/scripts/panel_profile_render/panel_profile_render.gml @@ -596,7 +596,7 @@ function Panel_Profile_Render() : PanelContent() constructor { var _bx = _pd; var _by = _pd; - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pFOCUS, pHOVER, "Render all", s_run, 1, COLORS._main_value_positive, 1, 1) == 2) { + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pHOVER, pFOCUS, "Render all", s_run, 1, COLORS._main_value_positive, 1, 1) == 2) { PROFILER_STAT = 1; PROFILER_DATA = []; setReport(noone); @@ -611,7 +611,7 @@ function Panel_Profile_Render() : PanelContent() constructor { } _bx += _bs + ui(2); - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pFOCUS, pHOVER, "Render partial", s_run_partial, 1, COLORS._main_value_positive, 1, 1) == 2) { + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pHOVER, pFOCUS, "Render partial", s_run_partial, 1, COLORS._main_value_positive, 1, 1) == 2) { PROFILER_STAT = 1; PROFILER_DATA = []; setReport(noone); @@ -637,19 +637,19 @@ function Panel_Profile_Render() : PanelContent() constructor { var _bx = _pd + list_w - _bs; var _by = _pd; - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pFOCUS, pHOVER, $"Log level {show_log_level}", s_filter_log_level, show_log_level, COLORS._main_icon, 1, 1) == 2) + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pHOVER, pFOCUS, $"Log level {show_log_level}", s_filter_log_level, show_log_level, COLORS._main_icon, 1, 1) == 2) show_log_level = (show_log_level + 1) % 5; _bx -= _bs + ui(4); if(report_selecting == noone) draw_sprite_ext(s_filter_node, 0, _bx + _bs / 2, _by + _bs / 2, 1, 1, 0, COLORS._main_icon, 0.25); - else if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pFOCUS, pHOVER, "Filter node", s_filter_node, 0, filter_node == noone? COLORS._main_icon : COLORS._main_accent, 1, 1) == 2) { + else if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pHOVER, pFOCUS, "Filter node", s_filter_node, 0, filter_node == noone? COLORS._main_icon : COLORS._main_accent, 1, 1) == 2) { filter_node = filter_node == report_selecting.node? noone : report_selecting.node; searchData(); } _bx -= _bs + ui(4); - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pFOCUS, pHOVER, "Match selecting", s_filter_node_inspector, 0, set_selecting_node? COLORS._main_accent : COLORS._main_icon, 1, 1) == 2) + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mx, my ], pHOVER, pFOCUS, "Match selecting", s_filter_node_inspector, 0, set_selecting_node? COLORS._main_accent : COLORS._main_icon, 1, 1) == 2) set_selecting_node = !set_selecting_node; _bx -= ui(4); diff --git a/scripts/panel_test/panel_test.gml b/scripts/panel_test/panel_test.gml index 9947f2d14..69b596240 100644 --- a/scripts/panel_test/panel_test.gml +++ b/scripts/panel_test/panel_test.gml @@ -389,7 +389,7 @@ function Panel_Test() : PanelContent() constructor { doTesting(); } else { - if(buttonInstant(THEME.button_def, bx, by, bw, bh, [ mx, my ], pFOCUS, pHOVER) == 2) + if(buttonInstant(THEME.button_def, bx, by, bw, bh, [ mx, my ], pHOVER, pFOCUS) == 2) startTesting(); draw_set_text(f_p2, fa_center, fa_center, COLORS._main_text); diff --git a/scripts/panel_text_editor/panel_text_editor.gml b/scripts/panel_text_editor/panel_text_editor.gml index c161e7a14..6fcb17a85 100644 --- a/scripts/panel_text_editor/panel_text_editor.gml +++ b/scripts/panel_text_editor/panel_text_editor.gml @@ -27,27 +27,27 @@ function Panel_Text_Editor(_textArea, _inputFunc, _context) : PanelContent() con var bs = ui(32); var txt = shift_new_line? "New line with Shift + Enter" : "New line with Enter"; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [ mx, my ], pFOCUS, pHOVER, txt, THEME.new_line_shift, shift_new_line) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [ mx, my ], pHOVER, pFOCUS, txt, THEME.new_line_shift, shift_new_line) == 2) shift_new_line = !shift_new_line; bx += bs + ui(4); var txt = _textArea.show_line_number? "Hide line number" : "Show line number"; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [ mx, my ], pFOCUS, pHOVER, txt, THEME.code_show_line, _textArea.show_line_number) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [ mx, my ], pHOVER, pFOCUS, txt, THEME.code_show_line, _textArea.show_line_number) == 2) _textArea.show_line_number = !_textArea.show_line_number; bx += bs + ui(4); var txt = _textArea.use_autocomplete? "Disable Autocomplete" : "Enable Autocomplete"; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [ mx, my ], pFOCUS, pHOVER, txt, THEME.code_show_auto, _textArea.use_autocomplete) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [ mx, my ], pHOVER, pFOCUS, txt, THEME.code_show_auto, _textArea.use_autocomplete) == 2) _textArea.use_autocomplete = !_textArea.use_autocomplete; bx += bs + ui(4); var txt = "Syntax Highlight"; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [ mx, my ], pFOCUS, pHOVER, txt, THEME.code_syntax_highlight, _textArea.syntax_highlight) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [ mx, my ], pHOVER, pFOCUS, txt, THEME.code_syntax_highlight, _textArea.syntax_highlight) == 2) _textArea.syntax_highlight = !_textArea.syntax_highlight; bx += bs + ui(4); var bx = w - ui(8) - bs; - if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [ mx, my ], pFOCUS, pHOVER, "Apply", THEME.accept,, COLORS._main_value_positive) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [ mx, my ], pHOVER, pFOCUS, "Apply", THEME.accept,, COLORS._main_value_positive) == 2) _textArea.apply(); bx -= bs + ui(4); diff --git a/scripts/panel_tunnels/panel_tunnels.gml b/scripts/panel_tunnels/panel_tunnels.gml index ec297b01b..4f579c0f0 100644 --- a/scripts/panel_tunnels/panel_tunnels.gml +++ b/scripts/panel_tunnels/panel_tunnels.gml @@ -84,11 +84,11 @@ function Panel_Tunnels() : PanelContent() constructor { var bx = ww - ui(4) - bw; var by = _y + (hg - bh) / 2; - if(buttonInstant(THEME.button_hide, bx, by, bw, bh, _m, sc_tunnel.active, sc_tunnel.hover, __txtx("panel_node_goto", "Go to node"), THEME.node_goto) == 2) + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, _m, sc_tunnel.hover, sc_tunnel.active, __txtx("panel_node_goto", "Go to node"), THEME.node_goto) == 2) graphFocusNode(node); bx -= ui(32); - if(buttonInstant(THEME.button_hide, bx, by, bw, bh, _m, sc_tunnel.active, sc_tunnel.hover, __txtx("panel_tunnel_create_tunnel", "Create tunnel out"), THEME.tunnel) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, bw, bh, _m, sc_tunnel.hover, sc_tunnel.active, __txtx("panel_tunnel_create_tunnel", "Create tunnel out"), THEME.tunnel) == 2) { var _node = nodeBuild("Node_Tunnel_Out", build_x, build_y - 8); _node.inputs[0].setValue(key); diff --git a/scripts/pathAnchorBox/pathAnchorBox.gml b/scripts/pathAnchorBox/pathAnchorBox.gml index 5b1da07d4..430cf109e 100644 --- a/scripts/pathAnchorBox/pathAnchorBox.gml +++ b/scripts/pathAnchorBox/pathAnchorBox.gml @@ -76,7 +76,7 @@ function pathAnchorBox(_onModify) : widget() constructor { var bx = _x + _w / 2 - _bw / 2 - 2; var by = _ty + _th / 2 - _bw / 2; - if(buttonInstant(THEME.button_hide, bx, by, _bw, _bw, _m, active, hover, "Linked", THEME.value_link, !_linked, _blend) == 2) + if(buttonInstant(THEME.button_hide, bx, by, _bw, _bw, _m, hover, active, "Linked", THEME.value_link, !_linked, _blend) == 2) onModify(!_linked, 6); resetFocus(); diff --git a/scripts/quarternionBox/quarternionBox.gml b/scripts/quarternionBox/quarternionBox.gml index 44abd4335..90e303e71 100644 --- a/scripts/quarternionBox/quarternionBox.gml +++ b/scripts/quarternionBox/quarternionBox.gml @@ -101,7 +101,7 @@ function quarternionBox(_onModify) : widget() constructor { var by = _y + _h / 2 - _bs / 2; tooltip.index = _disp; - if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, iactive, ihover, tooltip, THEME.unit_angle, _disp, c_white) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, ihover, iactive, tooltip, THEME.unit_angle, _disp, c_white) == 2) { clickable = false; attributes.angle_display = (_disp + 1) % 2; onModify([ 0, 0, 0, 1 ]); diff --git a/scripts/rangeBox/rangeBox.gml b/scripts/rangeBox/rangeBox.gml index 77087d28a..3519418bb 100644 --- a/scripts/rangeBox/rangeBox.gml +++ b/scripts/rangeBox/rangeBox.gml @@ -82,7 +82,7 @@ function rangeBox(_type, _onModify) : widget() constructor { var bx = _x; var by = _y + _h / 2 - _bs / 2; - if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, tooltip, THEME.value_link, linked, _icon_blend) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, hover, active, tooltip, THEME.value_link, linked, _icon_blend) == 2) { linked = !linked; _display_data.linked = linked; diff --git a/scripts/rotatorRandom/rotatorRandom.gml b/scripts/rotatorRandom/rotatorRandom.gml index f43ac32b0..aadf14038 100644 --- a/scripts/rotatorRandom/rotatorRandom.gml +++ b/scripts/rotatorRandom/rotatorRandom.gml @@ -85,7 +85,7 @@ function rotatorRandom(_onModify) : widget() constructor { if(_drawRot) { if((_w - _r) / 2 > ui(48)) { tooltip.index = mode; - if(buttonInstant(noone, _x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, active, hover, tooltip, THEME.rotator_random_mode, mode, [ COLORS._main_icon, c_white ]) == 2) { #region + if(buttonInstant(noone, _x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, hover, active, tooltip, THEME.rotator_random_mode, mode, [ COLORS._main_icon, c_white ]) == 2) { #region mode = (mode + 1) % 4; onModify(mode, 0); diff --git a/scripts/string_functions/string_functions.gml b/scripts/string_functions/string_functions.gml index 45147333a..424e2e385 100644 --- a/scripts/string_functions/string_functions.gml +++ b/scripts/string_functions/string_functions.gml @@ -64,6 +64,8 @@ function string_to_var(str) { INLINE return string_replace_all(string function string_to_var2(context, name) { INLINE return string_to_var(context == ""? name : $"{context} {name}"); } function string_quote(str) { INLINE return $"\"{str}\""; } +function string_multiply(str, amo) { var s = ""; repeat(amo) s += str; return s; } + function string_compare(s1, s2) { s1 = string_lower(s1); s2 = string_lower(s2); diff --git a/scripts/textBox/textBox.gml b/scripts/textBox/textBox.gml index b9bfbc3e7..0abc7bb05 100644 --- a/scripts/textBox/textBox.gml +++ b/scripts/textBox/textBox.gml @@ -101,6 +101,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { return self; } + static setHide = function(hide) { self.hide = hide; return self; } static setFont = function(font) { self.font = font; return self; } static setLabel = function(label) { self.label = label; return self; } static setPrecision = function(precision) { self.precision = precision; return self; } diff --git a/scripts/timeline_data/timeline_data.gml b/scripts/timeline_data/timeline_data.gml index 0c53b818b..1d2887588 100644 --- a/scripts/timeline_data/timeline_data.gml +++ b/scripts/timeline_data/timeline_data.gml @@ -86,7 +86,7 @@ function timelineItemNode(node) : timelineItem() constructor { var tt = __txtx("panel_animation_goto", "Go to node"); var _m = [ _msx, _msy ]; - if(buttonInstant(noone, tx - ui(9), _y + ui(1), ui(18), ui(18), _m, focus, hover, tt, THEME.animate_node_go, 0, col == -1? COLORS._main_icon_light : col, 0.4) == 2) + if(buttonInstant(noone, tx - ui(9), _y + ui(1), ui(18), ui(18), _m, hover, focus, tt, THEME.animate_node_go, 0, col == -1? COLORS._main_icon_light : col, 0.4) == 2) graphFocusNode(node); if(_sel) draw_sprite_stretched_ext(THEME.s_box_r2, 1, _x, _y, _w, lh, COLORS._main_accent, 1); diff --git a/scripts/vectorBox/vectorBox.gml b/scripts/vectorBox/vectorBox.gml index 303c4a94a..c04e989d6 100644 --- a/scripts/vectorBox/vectorBox.gml +++ b/scripts/vectorBox/vectorBox.gml @@ -132,7 +132,7 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { var bx = _x; var by = _y + _h / 2 - _bs / 2; - if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, tooltip, THEME.value_link, linked, _icon_blend) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, hover, active, tooltip, THEME.value_link, linked, _icon_blend) == 2) { linked = !linked; _display_data.linked = linked; diff --git a/scripts/vectorRangeBox/vectorRangeBox.gml b/scripts/vectorRangeBox/vectorRangeBox.gml index 34976afbb..67fb60357 100644 --- a/scripts/vectorRangeBox/vectorRangeBox.gml +++ b/scripts/vectorRangeBox/vectorRangeBox.gml @@ -94,7 +94,7 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const var by = _y + _h / 2 - _bs / 2; var bc = linked? COLORS._main_accent : COLORS._main_icon; - if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, __txt("Link axis"), THEME.value_link, linked, bc) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, hover, active, __txt("Link axis"), THEME.value_link, linked, bc) == 2) { linked = !linked; _display_data.linked = linked; @@ -107,7 +107,7 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const by += _h + ui(4); tooltip_ranged.index = ranged; - if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, tooltip_ranged, THEME.value_range, ranged, COLORS._main_icon) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, hover, active, tooltip_ranged, THEME.value_range, ranged, COLORS._main_icon) == 2) { ranged = !ranged; _display_data.ranged = ranged; diff --git a/scripts/widget/widget.gml b/scripts/widget/widget.gml index 8531d7d26..b73d35bbe 100644 --- a/scripts/widget/widget.gml +++ b/scripts/widget/widget.gml @@ -150,8 +150,9 @@ function widgetParam(x, y, w, h, data, display_data = {}, m = mouse_ui, rx = 0, interact = undefined; scrollpane = undefined; - static setFont = function(f) { font = f; return self; } - static setScrollpane = function(s) { scrollpane = s; return self; } + static setColor = function(c) { color = c; return self; } + static setFont = function(f) { font = f; return self; } + static setScrollpane = function(s) { scrollpane = s; return self; } static setFocusHover = function(f, h, i = undefined) { focus = f;