Brush lock cleanup

This commit is contained in:
luboslenco
2025-09-22 21:08:38 +02:00
parent da99e6da86
commit a7ed646de6
4 changed files with 6 additions and 32 deletions
+5 -21
View File
@@ -942,7 +942,7 @@ function ui_base_update() {
let decal_mask: bool = context_is_decal_mask();
if ((context_raw.brush_can_lock || context_raw.brush_locked) && mouse_moved) {
if (context_raw.brush_locked && mouse_moved) {
if (operator_shortcut(map_get(config_keymap, "brush_radius"), shortcut_type_t.DOWN) ||
operator_shortcut(map_get(config_keymap, "brush_opacity"), shortcut_type_t.DOWN) ||
operator_shortcut(map_get(config_keymap, "brush_angle"), shortcut_type_t.DOWN) ||
@@ -976,10 +976,6 @@ function ui_base_update() {
}
ui_header_handle.redraws = 2;
}
else if (context_raw.brush_can_lock) {
context_raw.brush_can_lock = false;
context_raw.brush_locked = true;
}
}
}
@@ -1067,7 +1063,7 @@ function ui_base_update() {
operator_shortcut(map_get(config_keymap, "brush_opacity")) ||
operator_shortcut(map_get(config_keymap, "brush_angle")) ||
(decal_mask && operator_shortcut(map_get(config_keymap, "decal_mask") + "+" + map_get(config_keymap, "brush_radius")))) {
context_raw.brush_can_lock = true;
context_raw.brush_locked = true;
if (!pen_connected) {
iron_mouse_lock();
}
@@ -1205,13 +1201,8 @@ function ui_base_update() {
}
}
if (context_raw.brush_can_lock || context_raw.brush_locked) {
if (mouse_moved && context_raw.brush_can_unlock) {
context_raw.brush_locked = false;
context_raw.brush_can_unlock = false;
}
let b: bool = (context_raw.brush_can_lock || context_raw.brush_locked) &&
if (context_raw.brush_locked) {
let b: bool = context_raw.brush_locked &&
!operator_shortcut(map_get(config_keymap, "brush_radius"), shortcut_type_t.DOWN) &&
!operator_shortcut(map_get(config_keymap, "brush_opacity"), shortcut_type_t.DOWN) &&
!operator_shortcut(map_get(config_keymap, "brush_angle"), shortcut_type_t.DOWN) &&
@@ -1221,14 +1212,7 @@ function ui_base_update() {
iron_mouse_unlock();
context_raw.last_paint_x = -1;
context_raw.last_paint_y = -1;
if (context_raw.brush_can_lock) {
context_raw.brush_can_lock = false;
context_raw.brush_can_unlock = false;
context_raw.brush_locked = false;
}
else {
context_raw.brush_can_unlock = true;
}
context_raw.brush_locked = false;
}
}
@@ -130,12 +130,7 @@ function brush_output_node_run(self: brush_output_node_t, from: i32) {
return;
}
// Do not paint while scaling the brush
let brush_scaling: bool = operator_shortcut(map_get(config_keymap, "brush_radius"), shortcut_type_t.DOWN) ||
operator_shortcut(map_get(config_keymap, "brush_opacity"), shortcut_type_t.DOWN) ||
operator_shortcut(map_get(config_keymap, "brush_angle"), shortcut_type_t.DOWN);
if (context_raw.brush_locked || brush_scaling) {
if (context_raw.brush_locked) {
return;
}
-4
View File
@@ -76,8 +76,6 @@ type context_t = {
paint2d_view?: bool;
brush_locked?: bool;
brush_can_lock?: bool;
brush_can_unlock?: bool;
camera_type?: camera_type_t;
cam_handle?: ui_handle_t;
fov_handle?: ui_handle_t;
@@ -321,8 +319,6 @@ function context_create(): context_t {
c.frame = 0;
c.paint2d_view = false;
c.brush_locked = false;
c.brush_can_lock = false;
c.brush_can_unlock = false;
c.camera_type = camera_type_t.PERSPECTIVE;
c.cam_handle = ui_handle_create();
c.vxao_ext = 1.0;
-1
View File
@@ -372,7 +372,6 @@ function render_path_paint_commands_live_brush() {
ui_view2d_hwnd.redraws = 2;
let _x: f32 = context_raw.paint_vec.x;
let _y: f32 = context_raw.paint_vec.y;
let _last_x: f32 = context_raw.last_paint_vec_x;
let _last_y: f32 = context_raw.last_paint_vec_y;
let _pdirty: i32 = context_raw.pdirty;