diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 378c58aa3..99737d117 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -306,6 +306,7 @@ {"name":"s_node_rigidSim_object_spawner","order":5,"path":"sprites/s_node_rigidSim_object_spawner/s_node_rigidSim_object_spawner.yy",}, {"name":"node_pb_draw_roundrectangle","order":4,"path":"scripts/node_pb_draw_roundrectangle/node_pb_draw_roundrectangle.yy",}, {"name":"draw_text_function","order":11,"path":"scripts/draw_text_function/draw_text_function.yy",}, + {"name":"o_dialog_color_picker","order":6,"path":"objects/o_dialog_color_picker/o_dialog_color_picker.yy",}, {"name":"o_dialog_file_name_collection","order":6,"path":"objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy",}, {"name":"node_line","order":3,"path":"scripts/node_line/node_line.yy",}, {"name":"s_node_frame","order":1,"path":"sprites/s_node_frame/s_node_frame.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index d34792a5e..811d682b7 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -499,6 +499,7 @@ {"id":{"name":"s_node_rigidSim_object_spawner","path":"sprites/s_node_rigidSim_object_spawner/s_node_rigidSim_object_spawner.yy",},}, {"id":{"name":"node_pb_draw_roundrectangle","path":"scripts/node_pb_draw_roundrectangle/node_pb_draw_roundrectangle.yy",},}, {"id":{"name":"draw_text_function","path":"scripts/draw_text_function/draw_text_function.yy",},}, + {"id":{"name":"o_dialog_color_picker","path":"objects/o_dialog_color_picker/o_dialog_color_picker.yy",},}, {"id":{"name":"o_dialog_file_name_collection","path":"objects/o_dialog_file_name_collection/o_dialog_file_name_collection.yy",},}, {"id":{"name":"__node_3d_prim_cone","path":"scripts/__node_3d_prim_cone/__node_3d_prim_cone.yy",},}, {"id":{"name":"node_line","path":"scripts/node_line/node_line.yy",},}, diff --git a/datafiles/data/Theme.zip b/datafiles/data/Theme.zip index a69a23151..54f8ddee6 100644 Binary files a/datafiles/data/Theme.zip and b/datafiles/data/Theme.zip differ diff --git a/objects/o_dialog_color_picker/Create_0.gml b/objects/o_dialog_color_picker/Create_0.gml new file mode 100644 index 000000000..221d4201e --- /dev/null +++ b/objects/o_dialog_color_picker/Create_0.gml @@ -0,0 +1,6 @@ +/// @description Insert description here +onApply = noone; +def_c = noone; +cur_c = c_black; + +depth = -32000; \ No newline at end of file diff --git a/objects/o_dialog_color_picker/Draw_64.gml b/objects/o_dialog_color_picker/Draw_64.gml new file mode 100644 index 000000000..78603622b --- /dev/null +++ b/objects/o_dialog_color_picker/Draw_64.gml @@ -0,0 +1,7 @@ +/// @description Insert description here +MOUSE_BLOCK = true; + +var dx = mouse_mx + ui(36); +var dy = mouse_my + ui(36); +draw_sprite_stretched(THEME.color_picker_sample, 0, dx - ui(20), dy - ui(20), ui(40), ui(40)); +draw_sprite_stretched_ext(THEME.color_picker_sample, 0, dx - ui(18), dy - ui(18), ui(36), ui(36), cur_c, 1); \ No newline at end of file diff --git a/objects/o_dialog_color_picker/Draw_75.gml b/objects/o_dialog_color_picker/Draw_75.gml new file mode 100644 index 000000000..9f8b4eedb --- /dev/null +++ b/objects/o_dialog_color_picker/Draw_75.gml @@ -0,0 +1,14 @@ +/// @description Insert description here +cur_c = int64(cola(draw_getpixel(mouse_mx, mouse_my))); + +MOUSE_BLOCK = true; + +if(mouse_check_button_pressed(mb_right) || keyboard_check_released(ALT)) { + if(def_c != noone) onApply(def_c); + instance_destroy(); +} + +if(mouse_check_button_pressed(mb_left)) { + onApply(cur_c); + instance_destroy(); +} \ No newline at end of file diff --git a/objects/o_dialog_color_picker/o_dialog_color_picker.yy b/objects/o_dialog_color_picker/o_dialog_color_picker.yy new file mode 100644 index 000000000..131892bb1 --- /dev/null +++ b/objects/o_dialog_color_picker/o_dialog_color_picker.yy @@ -0,0 +1,35 @@ +{ + "resourceType": "GMObject", + "resourceVersion": "1.0", + "name": "o_dialog_color_picker", + "eventList": [ + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":75,"eventType":8,"isDnD":false,}, + ], + "managed": true, + "overriddenProperties": [], + "parent": { + "name": "color selector", + "path": "folders/dialog/color selector.yy", + }, + "parentObjectId": null, + "persistent": false, + "physicsAngularDamping": 0.1, + "physicsDensity": 0.5, + "physicsFriction": 0.2, + "physicsGroup": 1, + "physicsKinematic": false, + "physicsLinearDamping": 0.1, + "physicsObject": false, + "physicsRestitution": 0.1, + "physicsSensor": false, + "physicsShape": 1, + "physicsShapePoints": [], + "physicsStartAwake": true, + "properties": [], + "solid": false, + "spriteId": null, + "spriteMaskId": null, + "visible": true, +} \ No newline at end of file diff --git a/objects/o_main/Draw_64.gml b/objects/o_main/Draw_64.gml index 2f387af60..a904d0f68 100644 --- a/objects/o_main/Draw_64.gml +++ b/objects/o_main/Draw_64.gml @@ -1,6 +1,9 @@ /// @description init if(winMan_isMinimized()) exit; +_MOUSE_BLOCK = MOUSE_BLOCK; +MOUSE_BLOCK = false; + if(APP_SURF_OVERRIDE) { APP_SURF = surface_verify(APP_SURF, WIN_W, WIN_H); PRE_APP_SURF = surface_verify(PRE_APP_SURF, WIN_W, WIN_H); diff --git a/objects/rotator_Rotator/Step_0.gml b/objects/rotator_Rotator/Step_0.gml index 5ff0b9ea9..a964a948d 100644 --- a/objects/rotator_Rotator/Step_0.gml +++ b/objects/rotator_Rotator/Step_0.gml @@ -11,7 +11,4 @@ drag_sy += dy; var _dirr = point_direction(drag_cx, drag_cy, drag_sx, drag_sy); delta = angle_difference(_dirr, drag_sa); delta_acc += delta; -drag_sa = _dirr; - -FOCUS = noone; -HOVER = noone; \ No newline at end of file +drag_sa = _dirr; \ No newline at end of file diff --git a/objects/slider_Slider/Step_0.gml b/objects/slider_Slider/Step_0.gml index 025b4e160..19ab6665f 100644 --- a/objects/slider_Slider/Step_0.gml +++ b/objects/slider_Slider/Step_0.gml @@ -1,7 +1,4 @@ /// @description Insert description here var dx = mouse_mx - drag_mx; drag_mx = mouse_mx; -drag_sx += dx; - -FOCUS = self; -HOVER = self; \ No newline at end of file +drag_sx += dx; \ No newline at end of file diff --git a/objects/textBox_slider/Draw_64.gml b/objects/textBox_slider/Draw_64.gml index 621d632bc..3cf90a41a 100644 --- a/objects/textBox_slider/Draw_64.gml +++ b/objects/textBox_slider/Draw_64.gml @@ -19,7 +19,9 @@ if(slide_da == -1) { tb_de = 1; -if(mouse_press(mb_right)) { +MOUSE_BLOCK = true; + +if(mouse_check_button_pressed(mb_right)) { tb._input_text = string_real(tb.slide_sv); tb.apply(); tb.sliding = false; @@ -42,7 +44,8 @@ if(!MOUSE_WRAPPING) { var spd = (slide_da? _ady : _adx) * _s; val = value_snap(tb.slide_sv + spd, _s); - if(tb.slide_int) val = round(val); + if(tb.slide_int) val = round(val); + if(tb.slide_range != noone) val = clamp(val, tb.slide_range[0], tb.slide_range[1]); var _stp_sz = 50 * _s; var _stp_fl = round(val / _stp_sz) * _stp_sz; @@ -62,10 +65,12 @@ if(!MOUSE_WRAPPING) { val = _snp_v; if(slide_da) { + var _val_y = slide_dy - (val - tb.slide_sv); + var _sdw = _tw; var _sdh = 256; var _sdx = slide_dx - _sdw / 2; - var _sdy = mouse_my - _sdh / 2; + var _sdy = _val_y - _sdh / 2; draw_sprite_stretched_ext(THEME.textbox_number_slider, 0, _sdx, _sdy, _sdw, _sdh, COLORS.panel_inspector_group_bg, 1); @@ -79,11 +84,13 @@ if(!MOUSE_WRAPPING) { draw_set_color(val == tb.slide_sv? COLORS._main_accent : COLORS._main_text); draw_set_alpha(1); - draw_text(slide_dx, slide_dy - (val - tb.slide_sv) / _s, val); + draw_text(slide_dx, _val_y, val); } else { + var _val_x = slide_dx + (val - tb.slide_sv) / _s; + var _sdw = 240; var _sdh = 48; - var _sdx = mouse_mx - _sdw / 2; + var _sdx = _val_x - _sdw / 2; var _sdy = slide_dy - _sdh / 2; draw_sprite_stretched_ext(THEME.textbox_number_slider, 0, _sdx, _sdy, _sdw, _sdh, COLORS.panel_inspector_group_bg, 1); @@ -98,7 +105,7 @@ if(!MOUSE_WRAPPING) { draw_set_color(val == tb.slide_sv? COLORS._main_accent : COLORS._main_text); draw_set_alpha(1); - draw_text(slide_dx + (val - tb.slide_sv) / _s, slide_dy, val); + draw_text(_val_x, slide_dy, val); } tb._input_text = string_real(val); diff --git a/objects/textBox_slider/Step_0.gml b/objects/textBox_slider/Step_0.gml deleted file mode 100644 index 775fa79f6..000000000 --- a/objects/textBox_slider/Step_0.gml +++ /dev/null @@ -1,6 +0,0 @@ -/// @description Insert description here -if(tb_de) { - FOCUS = self; - HOVER = self; - tb_de--; -} \ No newline at end of file diff --git a/objects/textBox_slider/textBox_slider.yy b/objects/textBox_slider/textBox_slider.yy index 03c652d40..8c2b6365b 100644 --- a/objects/textBox_slider/textBox_slider.yy +++ b/objects/textBox_slider/textBox_slider.yy @@ -5,7 +5,6 @@ "eventList": [ {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,}, {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,}, - {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,}, ], "managed": true, "overriddenProperties": [], diff --git a/scripts/mouse_input/mouse_input.gml b/scripts/mouse_input/mouse_input.gml index a2758233c..5c5fc70fd 100644 --- a/scripts/mouse_input/mouse_input.gml +++ b/scripts/mouse_input/mouse_input.gml @@ -1,23 +1,10 @@ -function mouse_click(mouse, focus = true) { - INLINE - return focus && mouse_check_button(mouse); -} - -function mouse_press(mouse, focus = true) { - INLINE - return focus && mouse_check_button_pressed(mouse); -} - -function mouse_release(mouse, focus = true) { - INLINE - return focus && mouse_check_button_released(mouse); -} - #region mouse global - globalvar MOUSE_WRAP, MOUSE_WRAPPING; + globalvar MOUSE_WRAP, MOUSE_WRAPPING, MOUSE_BLOCK, _MOUSE_BLOCK; MOUSE_WRAP = false; MOUSE_WRAPPING = false; + MOUSE_BLOCK = false; + _MOUSE_BLOCK = false; #macro SCROLL_SPEED PREFERENCES.mouse_wheel_speed @@ -25,4 +12,19 @@ function mouse_release(mouse, focus = true) { INLINE MOUSE_WRAP = true; } -#endregion \ No newline at end of file +#endregion + +function mouse_click(mouse, focus = true) { + INLINE + return !_MOUSE_BLOCK && focus && mouse_check_button(mouse); +} + +function mouse_press(mouse, focus = true) { + INLINE + return !_MOUSE_BLOCK && focus && mouse_check_button_pressed(mouse); +} + +function mouse_release(mouse, focus = true) { + INLINE + return focus && mouse_check_button_released(mouse); +} \ No newline at end of file diff --git a/scripts/node_canvas/node_canvas.gml b/scripts/node_canvas/node_canvas.gml index 8d556baf8..a44a81408 100644 --- a/scripts/node_canvas/node_canvas.gml +++ b/scripts/node_canvas/node_canvas.gml @@ -224,12 +224,12 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor tool_settings = [ [ "Channel", tool_channel_edit, "channel", tool_attribute ] ]; tool_attribute.size = 1; - tool_size_edit = new textBox(TEXTBOX_INPUT.number, function(val) { tool_attribute.size = round(val); }).setSlidable(0.1, true); + tool_size_edit = new textBox(TEXTBOX_INPUT.number, function(val) { tool_attribute.size = max(1, round(val)); }).setSlidable(0.1, true, [ 1, 999999 ]); tool_size_edit.font = f_p3; tool_size = [ "Size", tool_size_edit, "size", tool_attribute ]; tool_attribute.thres = 0; - tool_thrs_edit = new textBox(TEXTBOX_INPUT.number, function(val) { tool_attribute.thres = clamp(val, 0, 1); }).setSlidable(0.01); + tool_thrs_edit = new textBox(TEXTBOX_INPUT.number, function(val) { tool_attribute.thres = clamp(val, 0, 1); }).setSlidable(0.01, false, [ 0, 1 ]); tool_thrs_edit.font = f_p3; tool_thrs = [ "Threshold", tool_thrs_edit, "thres", tool_attribute ]; @@ -292,6 +292,8 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor yy += _cw + ui(8); hh += _cw + ui(8); + var _sel = noone; + for( var i = 0, n = array_length(DEF_PALETTE); i < n; i++ ) { var _c = DEF_PALETTE[i]; @@ -301,6 +303,9 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor draw_sprite_stretched_ext(THEME.palette_mask, ii, _cx, yy, _cw, _ch, _c, 1); + if(_c == tool_attribute.color) + _sel = [ _cx, yy ]; + if(hover && point_in_rectangle(_mx, _my, _cx, yy, _cx + _cw, yy + _ch)) { if(mouse_click(mb_left, focus)) tool_attribute.color = _c; @@ -310,6 +315,9 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor hh += _ch; } + if(_sel != noone) + draw_sprite_stretched_ext(THEME.palette_selecting, 0, _sel[0] - _pd, _sel[1] - _pd, _cw + _pd * 2, _ch + _pd * 2, c_white, 1); + return hh + ui(4); } #endregion @@ -701,7 +709,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } #endregion static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region - if(instance_exists(o_dialog_color_selector)) return; + if(instance_exists(o_dialog_color_picker)) return; mouse_cur_x = round((_mx - _x) / _s - 0.5); mouse_cur_y = round((_my - _y) / _s - 0.5); @@ -734,7 +742,14 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } brush_rand_dir = _brushRotR; - if(key_mod_press(ALT)) return; + + #region color selector + if(active && key_mod_press(ALT)) { + var dialog = instance_create(0, 0, o_dialog_color_picker); + dialog.onApply = setToolColor; + dialog.def_c = _col; + } + #endregion var _canvas_surface = getCanvasSurface(); @@ -1083,7 +1098,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } surface_reset_shader(); - if(active && isUsingTool()) { + if((active || mouse_holding) && isUsingTool()) { if(isUsingTool("Selection")) { if(is_selected) { var pos_x = _x + selection_position[0] * _s; diff --git a/scripts/rotator/rotator.gml b/scripts/rotator/rotator.gml index 554f6394a..efc581630 100644 --- a/scripts/rotator/rotator.gml +++ b/scripts/rotator/rotator.gml @@ -76,14 +76,16 @@ function rotator(_onModify, _step = -1) : widget() constructor { if(onModify(val)) UNDO_HOLDING = true; - if(mouse_press(mb_right)) { + MOUSE_BLOCK = true; + + if(mouse_check_button_pressed(mb_right)) { onModify(drag_sv); instance_destroy(dragging); - dragging = noone; + dragging = noone; UNDO_HOLDING = false; } else if(mouse_release(mb_left)) { instance_destroy(dragging); - dragging = noone; + dragging = noone; UNDO_HOLDING = false; } diff --git a/scripts/rotatorRandom/rotatorRandom.gml b/scripts/rotatorRandom/rotatorRandom.gml index 5d67b6134..0bbcacaba 100644 --- a/scripts/rotatorRandom/rotatorRandom.gml +++ b/scripts/rotatorRandom/rotatorRandom.gml @@ -154,7 +154,9 @@ function rotatorRandom(_onModify) : widget() constructor { } } - if(mouse_press(mb_right)) { + MOUSE_BLOCK = true; + + if(mouse_check_button_pressed(mb_right)) { for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]); instance_destroy(rotator_Rotator); @@ -245,7 +247,9 @@ function rotatorRandom(_onModify) : widget() constructor { if(onModify(2, val)) UNDO_HOLDING = true; } - if(mouse_press(mb_right)) { + MOUSE_BLOCK = true; + + if(mouse_check_button_pressed(mb_right)) { for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]); instance_destroy(rotator_Rotator); @@ -328,7 +332,9 @@ function rotatorRandom(_onModify) : widget() constructor { if(onModify(ind, val)) UNDO_HOLDING = true; - if(mouse_press(mb_right)) { + MOUSE_BLOCK = true; + + if(mouse_check_button_pressed(mb_right)) { for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]); instance_destroy(rotator_Rotator); @@ -418,7 +424,9 @@ function rotatorRandom(_onModify) : widget() constructor { if(onModify(ind, val)) UNDO_HOLDING = true; - if(mouse_press(mb_right)) { + MOUSE_BLOCK = true; + + if(mouse_check_button_pressed(mb_right)) { for( var i = 0; i < 5; i++ ) onModify(i, drag_dat[i]); instance_destroy(rotator_Rotator); diff --git a/scripts/rotatorRange/rotatorRange.gml b/scripts/rotatorRange/rotatorRange.gml index 084602ada..0212c1791 100644 --- a/scripts/rotatorRange/rotatorRange.gml +++ b/scripts/rotatorRange/rotatorRange.gml @@ -115,14 +115,16 @@ function rotatorRange(_onModify) : widget() constructor { } } - if(mouse_press(mb_right)) { + MOUSE_BLOCK = true; + + if(mouse_check_button_pressed(mb_right)) { for( var i = 0; i < 2; i++ ) onModify(i, drag_dat[i]); instance_destroy(rotator_Rotator); dragging = noone; dragging_index = -1; UNDO_HOLDING = false; - + } else if(mouse_release(mb_left)) { instance_destroy(rotator_Rotator); dragging = noone; diff --git a/scripts/slider/slider.gml b/scripts/slider/slider.gml index 104d92219..e19869eb5 100644 --- a/scripts/slider/slider.gml +++ b/scripts/slider/slider.gml @@ -125,11 +125,14 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg if(update_stat == SLIDER_UPDATE.realtime && onModify != noone && onModify(val)) UNDO_HOLDING = true; - if(mouse_press(mb_right)) { + MOUSE_BLOCK = true; + + if(mouse_check_button_pressed(mb_right)) { onModify(drag_sv); instance_destroy(dragging); - dragging = noone; + dragging = noone; UNDO_HOLDING = false; + } else if(mouse_release(mb_left)) { if(update_stat == SLIDER_UPDATE.release && onModify != noone) onModify(val); diff --git a/scripts/sliderRange/sliderRange.gml b/scripts/sliderRange/sliderRange.gml index f5cddeaa4..9451d8796 100644 --- a/scripts/sliderRange/sliderRange.gml +++ b/scripts/sliderRange/sliderRange.gml @@ -85,11 +85,14 @@ function sliderRange(_min, _max, _step, _onModify) : widget() constructor { if(onModify(dragging_index, val)) UNDO_HOLDING = true; - if(mouse_press(mb_right)) { + MOUSE_BLOCK = true; + + if(mouse_check_button_pressed(mb_right)) { onModify(dragging_index, drag_sv); instance_destroy(dragging); - dragging = noone; + dragging = noone; UNDO_HOLDING = false; + } else if(mouse_release(mb_left)) { instance_destroy(dragging); dragging = noone; diff --git a/scripts/textBox/textBox.gml b/scripts/textBox/textBox.gml index 04956066f..87eb9384c 100644 --- a/scripts/textBox/textBox.gml +++ b/scripts/textBox/textBox.gml @@ -19,6 +19,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { slide_int = false; slide_sv = 0; slide_speed = 1 / 10; + slide_range = noone; starting_char = 1; @@ -58,10 +59,11 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor { onModify(value); } #endregion - static setSlidable = function(slideStep = slide_speed, _slide_int = false) { #region + static setSlidable = function(slideStep = slide_speed, _slide_int = false, _slide_range = noone) { #region slidable = true; slide_speed = slideStep; slide_int = _slide_int; + slide_range = _slide_range; return self; } #endregion