From d76c1e30e7bc5c22e0929a6c9dbaec21bd77e0f1 Mon Sep 17 00:00:00 2001 From: Sean Kim Date: Thu, 15 Feb 2024 16:24:39 +0100 Subject: [PATCH 1/6] Sculpt: Disable mask operators on invisible objects This PR disables the `SCULPT_OT_mask_init`, `SCULPT_OT_mask_filter`, `SCULPT_OT_mask_by_color`, and `SCULPT_OT_mask_from_cavity` operators and the following actions that correspond to them when attempting to operate on invisible objects: * Random Mesh * Per Vertex * Per Face Set * Per Loose Part * Smooth Mask * Sharpen Mask * Grow Mask * Shrink Mask * Increase Contrast * Decrease Contrast * Mask By Color * Mask From Cavity | Init | Filter | By Color | From Cavity | | ---- | --- | --- | --- | | ![](/attachments/fc2ea68e-0af9-4887-b1a3-b2aa2eacaf21) | ![](attachments/3e94f48c-b463-417c-9ad9-bdc74e24bd70) | ![](/attachments/16029e7c-d973-483e-8c4a-164133d0fe11) | ![](/attachments/b356a248-354b-4c68-bf5b-c49907edcaff) ### Limitations * All of the operators invoked by a menu option do not indicate to the user that they are currently invalid or will not operate due to the mesh being invisible, potentially leading to a confusing user experience. Addresses part of #112371 Pull Request: https://projects.blender.org/blender/blender/pulls/118173 --- .../editors/sculpt_paint/sculpt_filter_mask.cc | 7 +++++++ .../editors/sculpt_paint/sculpt_mask_init.cc | 7 +++++++ source/blender/editors/sculpt_paint/sculpt_ops.cc | 13 ++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mask.cc b/source/blender/editors/sculpt_paint/sculpt_filter_mask.cc index e756b2adad8..28be463b2a3 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_mask.cc +++ b/source/blender/editors/sculpt_paint/sculpt_filter_mask.cc @@ -14,6 +14,7 @@ #include "DNA_modifier_types.h" #include "BKE_context.hh" +#include "BKE_layer.hh" #include "BKE_paint.hh" #include "BKE_pbvh_api.hh" #include "BKE_scene.h" @@ -166,6 +167,12 @@ static int sculpt_mask_filter_exec(bContext *C, wmOperator *op) const Scene *scene = CTX_data_scene(C); int filter_type = RNA_enum_get(op->ptr, "filter_type"); + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + MultiresModifierData *mmd = BKE_sculpt_multires_active(scene, ob); BKE_sculpt_mask_layers_ensure(CTX_data_depsgraph_pointer(C), CTX_data_main(C), ob, mmd); diff --git a/source/blender/editors/sculpt_paint/sculpt_mask_init.cc b/source/blender/editors/sculpt_paint/sculpt_mask_init.cc index 3273bccebe3..6ed8b76a0b6 100644 --- a/source/blender/editors/sculpt_paint/sculpt_mask_init.cc +++ b/source/blender/editors/sculpt_paint/sculpt_mask_init.cc @@ -19,6 +19,7 @@ #include "BKE_ccg.h" #include "BKE_context.hh" +#include "BKE_layer.hh" #include "BKE_multires.hh" #include "BKE_paint.hh" #include "BKE_pbvh_api.hh" @@ -85,6 +86,12 @@ static int sculpt_mask_init_exec(bContext *C, wmOperator *op) SculptSession *ss = ob->sculpt; Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + const int mode = RNA_enum_get(op->ptr, "mode"); MultiresModifierData *mmd = BKE_sculpt_multires_active(CTX_data_scene(C), ob); diff --git a/source/blender/editors/sculpt_paint/sculpt_ops.cc b/source/blender/editors/sculpt_paint/sculpt_ops.cc index 71791c340d7..dd47de81f6c 100644 --- a/source/blender/editors/sculpt_paint/sculpt_ops.cc +++ b/source/blender/editors/sculpt_paint/sculpt_ops.cc @@ -904,14 +904,19 @@ static int sculpt_mask_by_color_invoke(bContext *C, wmOperator *op, const wmEven Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; + View3D *v3d = CTX_wm_view3d(C); { - View3D *v3d = CTX_wm_view3d(C); if (v3d && v3d->shading.type == OB_SOLID) { v3d->shading.color_type = V3D_SHADING_VERTEX_COLOR; } } + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + /* Color data is not available in multi-resolution or dynamic topology. */ if (!SCULPT_handles_colors_report(ss, op->reports)) { return OPERATOR_CANCELLED; @@ -1069,6 +1074,12 @@ static int sculpt_bake_cavity_exec(bContext *C, wmOperator *op) Sculpt *sd = CTX_data_tool_settings(C)->sculpt; const Brush *brush = BKE_paint_brush(&sd->paint); + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + MultiresModifierData *mmd = BKE_sculpt_multires_active(CTX_data_scene(C), ob); BKE_sculpt_mask_layers_ensure(depsgraph, CTX_data_main(C), ob, mmd); From fca979e2377f127529cb80c350c52a9e55b292bf Mon Sep 17 00:00:00 2001 From: Sean Kim Date: Thu, 15 Feb 2024 16:26:38 +0100 Subject: [PATCH 2/6] Sculpt: Disable modal filter operators on invisible objects This PR disables the `SCULPT_OT_mesh_filter`, `SCULPT_OT_cloth_filter`, and `SCULPT_OT_color_filter` operators and the following actions that correspond to them when attempting to operate on invisible objects: * Mesh Filter * Color FIlter * Cloth Filter | Mesh & Cloth | Color | | ---- | --- | | ![invisible_filter_mesh.gif](/attachments/87d2dfe2-be27-40bf-bb58-e9aa761a3f0a) | ![invisible_filter_color.gif](/attachments/ac51584e-bd87-4392-9bda-6ad5191cf38f) | Addresses part of #112371 Pull Request: https://projects.blender.org/blender/blender/pulls/118172 --- source/blender/editors/sculpt_paint/sculpt_cloth.cc | 7 +++++++ .../blender/editors/sculpt_paint/sculpt_filter_color.cc | 6 ++++++ source/blender/editors/sculpt_paint/sculpt_filter_mesh.cc | 8 ++++++++ 3 files changed, 21 insertions(+) diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.cc b/source/blender/editors/sculpt_paint/sculpt_cloth.cc index c4397e63f1f..f693f655934 100644 --- a/source/blender/editors/sculpt_paint/sculpt_cloth.cc +++ b/source/blender/editors/sculpt_paint/sculpt_cloth.cc @@ -25,6 +25,7 @@ #include "BKE_collision.h" #include "BKE_colortools.hh" #include "BKE_context.hh" +#include "BKE_layer.hh" #include "BKE_mesh.hh" #include "BKE_modifier.hh" #include "BKE_paint.hh" @@ -1529,6 +1530,12 @@ static int sculpt_cloth_filter_invoke(bContext *C, wmOperator *op, const wmEvent Sculpt *sd = CTX_data_tool_settings(C)->sculpt; SculptSession *ss = ob->sculpt; + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + const eSculptClothFilterType filter_type = eSculptClothFilterType(RNA_enum_get(op->ptr, "type")); /* Update the active vertex */ diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_color.cc b/source/blender/editors/sculpt_paint/sculpt_filter_color.cc index 44319a12fa0..743658151f6 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_color.cc +++ b/source/blender/editors/sculpt_paint/sculpt_filter_color.cc @@ -18,6 +18,7 @@ #include "DNA_userdef_types.h" #include "BKE_context.hh" +#include "BKE_layer.hh" #include "BKE_paint.hh" #include "BKE_pbvh_api.hh" @@ -332,6 +333,11 @@ static int sculpt_color_filter_init(bContext *C, wmOperator *op) SculptSession *ss = ob->sculpt; View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + int mval[2]; RNA_int_get_array(op->ptr, "start_mouse", mval); float mval_fl[2] = {float(mval[0]), float(mval[1])}; diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.cc b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.cc index 05d7b1f774d..614878d9be7 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.cc +++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.cc @@ -24,6 +24,7 @@ #include "BKE_brush.hh" #include "BKE_context.hh" +#include "BKE_layer.hh" #include "BKE_modifier.hh" #include "BKE_paint.hh" #include "BKE_pbvh_api.hh" @@ -959,6 +960,13 @@ static int sculpt_mesh_filter_start(bContext *C, wmOperator *op) Object *ob = CTX_data_active_object(C); Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); Sculpt *sd = CTX_data_tool_settings(C)->sculpt; + + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + int mval[2]; RNA_int_get_array(op->ptr, "start_mouse", mval); From 1e3e5c5ac20e90d0c34d053b7310ab065852df3a Mon Sep 17 00:00:00 2001 From: Sean Kim Date: Thu, 15 Feb 2024 16:29:08 +0100 Subject: [PATCH 3/6] Sculpt: Disable face set operators on invisible objects This PR disables the `SCULPT_OT_face_sets_init`, `SCULPT_OT_face_sets_create`, `SCULPT_OT_face_sets_edit`, `SCULPT_OT_face_sets_randomize_colors`, `SCULPT_OT_face_set_change_visibility`, `SCULPT_OT_face_set_box_gesture`, and `SCULPT_OT_face_set_lasso_gesture` operators and the following actions that correspond to them when attempting to operate on invisible objects: * Face Set From Masked * Face Set from Visible * Face Set from Edit Mode Selection * Initialize Face Sets * Grow Face Set * Shrink Face Set * Randomize Colors * Toggle Visibility * Hide Active Face SEt * Box Face Set * Lasso Face Set | Init | Create | Edit | | --- | --- | --- | | ![fs_init.gif](/attachments/f44e96ab-e1c9-4279-9f69-80ea9503c830) | ![fs_create.gif](/attachments/3992b8fc-bd59-4aee-a2f6-6d7aa507f0b9) | ![fs_edit.gif](/attachments/78a7c447-8fd8-41dc-846a-5617751e5594) | | Randomize Colors | Visibility | Gestures | | --- | --- | --- | | ![fs_color.gif](/attachments/43230f6b-4a39-4417-ac90-b94e3f33e724) | ![fs_hide.gif](/attachments/fe6fcdac-eda9-4f55-b013-f132f373fe65) | ![fs_gesture.gif](/attachments/5f36d7ed-c5bf-4154-af9e-0f19fb24249c) | ### Limitations * All of the operators invoked by a menu option do not indicate to the user that they are currently invalid or will not operate due to the mesh being invisible, potentially leading to a confusing user experience. Addresses part of #112371 Pull Request: https://projects.blender.org/blender/blender/pulls/118228 --- .../editors/sculpt_paint/paint_mask.cc | 26 ++++++++++++++-- .../editors/sculpt_paint/sculpt_face_set.cc | 31 +++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/sculpt_paint/paint_mask.cc b/source/blender/editors/sculpt_paint/paint_mask.cc index fdd5aa06fe5..faa5c855f51 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.cc +++ b/source/blender/editors/sculpt_paint/paint_mask.cc @@ -2022,6 +2022,17 @@ static int paint_mask_gesture_line_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } +static int face_set_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event) +{ + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + + return WM_gesture_box_invoke(C, op, event); +} + static int face_set_gesture_box_exec(bContext *C, wmOperator *op) { SculptGestureContext *sgcontext = sculpt_gesture_init_from_box(C, op); @@ -2034,6 +2045,17 @@ static int face_set_gesture_box_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } +static int face_set_gesture_lasso_invoke(bContext *C, wmOperator *op, const wmEvent *event) +{ + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + + return WM_gesture_lasso_invoke(C, op, event); +} + static int face_set_gesture_lasso_exec(bContext *C, wmOperator *op) { SculptGestureContext *sgcontext = sculpt_gesture_init_from_lasso(C, op); @@ -2226,7 +2248,7 @@ void SCULPT_OT_face_set_lasso_gesture(wmOperatorType *ot) ot->idname = "SCULPT_OT_face_set_lasso_gesture"; ot->description = "Add face set within the lasso as you move the brush"; - ot->invoke = WM_gesture_lasso_invoke; + ot->invoke = face_set_gesture_lasso_invoke; ot->modal = WM_gesture_lasso_modal; ot->exec = face_set_gesture_lasso_exec; @@ -2245,7 +2267,7 @@ void SCULPT_OT_face_set_box_gesture(wmOperatorType *ot) ot->idname = "SCULPT_OT_face_set_box_gesture"; ot->description = "Add face set within the box as you move the brush"; - ot->invoke = WM_gesture_box_invoke; + ot->invoke = face_set_gesture_box_invoke; ot->modal = WM_gesture_box_modal; ot->exec = face_set_gesture_box_exec; diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.cc b/source/blender/editors/sculpt_paint/sculpt_face_set.cc index 31bc14f506f..7e701a1d082 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.cc +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.cc @@ -37,6 +37,7 @@ #include "BKE_colortools.hh" #include "BKE_context.hh" #include "BKE_customdata.hh" +#include "BKE_layer.hh" #include "BKE_mesh.hh" #include "BKE_mesh_fair.hh" #include "BKE_mesh_mapping.hh" @@ -557,6 +558,12 @@ static int sculpt_face_set_create_exec(bContext *C, wmOperator *op) const CreateMode mode = CreateMode(RNA_enum_get(op->ptr, "mode")); + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + if (BKE_pbvh_type(ss.pbvh) == PBVH_BMESH) { /* Dyntopo not supported. */ return OPERATOR_CANCELLED; @@ -780,6 +787,12 @@ static int sculpt_face_set_init_exec(bContext *C, wmOperator *op) const InitMode mode = InitMode(RNA_enum_get(op->ptr, "mode")); + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + BKE_sculpt_update_object_for_edit(depsgraph, ob, false); /* Dyntopo not supported. */ @@ -1126,6 +1139,12 @@ static int sculpt_face_set_change_visibility_invoke(bContext *C, Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + /* Update the active vertex and Face Set using the cursor position to avoid relying on the paint * cursor updates. */ SculptCursorGeometryInfo sgi; @@ -1174,6 +1193,12 @@ static int sculpt_face_sets_randomize_colors_exec(bContext *C, wmOperator * /*op Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + /* Dyntopo not supported. */ if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) { return OPERATOR_CANCELLED; @@ -1546,6 +1571,12 @@ static int sculpt_face_set_edit_invoke(bContext *C, wmOperator *op, const wmEven Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + BKE_sculpt_update_object_for_edit(depsgraph, ob, false); /* Update the current active Face Set and Vertex as the operator can be used directly from the From a2f49b05f804719c4bde8f79392d82bc76ab1155 Mon Sep 17 00:00:00 2001 From: Sean Kim Date: Thu, 15 Feb 2024 16:30:31 +0100 Subject: [PATCH 4/6] Sculpt: Disable set pivot and select color for invisible objects This PR disables the `SCULPT_OT_sample_color` and `SCULPT_OT_set_pivot_position` operators and the following actions that correspond to them when attempting to operate on invisible objects: * Set Pivot * Sample Color | Set Pivot | Sample Color | | --- | --- | | ![invisible_set_pivot.gif](/attachments/0dd23857-abdf-4214-a08d-ce986f15e16f) | ![invisible_set_color.gif](/attachments/84950810-1c3d-4f02-8e84-67425d80754d) | ### Limitations * All of the operators invoked by a menu option do not indicate to the user that they are currently invalid or will not operate due to the mesh being invisible, potentially leading to a confusing user experience. Addresses part of #112371 Pull Request: https://projects.blender.org/blender/blender/pulls/118306 --- source/blender/editors/sculpt_paint/sculpt_ops.cc | 6 ++++++ source/blender/editors/sculpt_paint/sculpt_transform.cc | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/source/blender/editors/sculpt_paint/sculpt_ops.cc b/source/blender/editors/sculpt_paint/sculpt_ops.cc index dd47de81f6c..15893210704 100644 --- a/source/blender/editors/sculpt_paint/sculpt_ops.cc +++ b/source/blender/editors/sculpt_paint/sculpt_ops.cc @@ -640,6 +640,12 @@ static int sculpt_sample_color_invoke(bContext *C, wmOperator *op, const wmEvent return OPERATOR_CANCELLED; } + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + BKE_sculpt_update_object_for_edit(CTX_data_depsgraph_pointer(C), ob, false); /* No color attribute? Set color to white. */ diff --git a/source/blender/editors/sculpt_paint/sculpt_transform.cc b/source/blender/editors/sculpt_paint/sculpt_transform.cc index 3eab4dba818..541577f85cf 100644 --- a/source/blender/editors/sculpt_paint/sculpt_transform.cc +++ b/source/blender/editors/sculpt_paint/sculpt_transform.cc @@ -16,6 +16,7 @@ #include "BKE_brush.hh" #include "BKE_context.hh" #include "BKE_kelvinlet.h" +#include "BKE_layer.hh" #include "BKE_paint.hh" #include "BKE_pbvh_api.hh" @@ -387,6 +388,12 @@ static int sculpt_set_pivot_position_exec(bContext *C, wmOperator *op) int mode = RNA_enum_get(op->ptr, "mode"); + const View3D *v3d = CTX_wm_view3d(C); + const Base *base = CTX_data_active_base(C); + if (!BKE_base_is_visible(v3d, base)) { + return OPERATOR_CANCELLED; + } + BKE_sculpt_update_object_for_edit(depsgraph, ob, false); /* Pivot to center. */ From 0c560fb7ef3aadca5a4f9c47ce4b7f88da0056ef Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 15 Feb 2024 16:50:34 +0100 Subject: [PATCH 5/6] Fix #112395: Proportional editing indicator in Graph Editor and Dope Sheet When using proportional editing in the Graph Editor or the Dope Sheet, the GUI displays a circle suggesting that the influence is limited in x and y. In reality those editors only look at the x-axis to determine which keys to influence. This PR fixes that by adding a new drawing function for those editors that draws 2 lines to indicate a range. In theory this can be a feature in other 2D editors in the future. I assume the VSE would benefit from this as well. Pull Request: https://projects.blender.org/blender/blender/pulls/118196 --- source/blender/editors/transform/transform.cc | 15 ++++++- .../transform/transform_constraints.cc | 43 +++++++++++++++---- .../transform/transform_constraints.hh | 4 ++ 3 files changed, 52 insertions(+), 10 deletions(-) diff --git a/source/blender/editors/transform/transform.cc b/source/blender/editors/transform/transform.cc index b17eafd9c24..d1bce428b2c 100644 --- a/source/blender/editors/transform/transform.cc +++ b/source/blender/editors/transform/transform.cc @@ -1496,7 +1496,20 @@ static void drawTransformView(const bContext * /*C*/, ARegion *region, void *arg GPU_line_width(1.0f); drawConstraint(t); - drawPropCircle(t); + + switch (t->spacetype) { + case SPACE_GRAPH: + case SPACE_ACTION: + /* Different visualization because the proportional editing in these editors only looks at + * the x-axis. */ + drawPropRange(t); + break; + + default: + drawPropCircle(t); + break; + } + drawSnapping(t); if (region == t->region && t->mode_info && t->mode_info->draw_fn) { diff --git a/source/blender/editors/transform/transform_constraints.cc b/source/blender/editors/transform/transform_constraints.cc index 917d866ae3c..c8e9b626b34 100644 --- a/source/blender/editors/transform/transform_constraints.cc +++ b/source/blender/editors/transform/transform_constraints.cc @@ -905,15 +905,6 @@ void drawPropCircle(TransInfo *t) else if (t->spacetype == SPACE_IMAGE) { GPU_matrix_scale_2f(1.0f / t->aspect[0], 1.0f / t->aspect[1]); } - else if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_ACTION)) { - /* only scale y */ - float xscale, yscale; - UI_view2d_scale_get(&t->region->v2d, &xscale, &yscale); - - const float fac_scale = xscale / yscale; - GPU_matrix_scale_2f(1.0f, fac_scale); - GPU_matrix_translate_2f(0.0f, (t->center_global[1] / fac_scale) - t->center_global[1]); - } eGPUDepthTest depth_test_enabled = GPU_depth_test_get(); if (depth_test_enabled) { @@ -948,6 +939,40 @@ void drawPropCircle(TransInfo *t) } } +void drawPropRange(TransInfo *t) +{ + if ((t->flag & T_PROP_EDIT) == 0) { + return; + } + + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); + + immBindBuiltinProgram(GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR); + + float viewport[4]; + GPU_viewport_size_get_f(viewport); + GPU_blend(GPU_BLEND_ALPHA); + + immUniform2fv("viewportSize", &viewport[2]); + + View2D *v2d = &t->region->v2d; + const float x1 = t->center_global[0] - t->prop_size; + const float y1 = v2d->cur.ymin; + const float x2 = t->center_global[0] + t->prop_size; + const float y2 = v2d->cur.ymax; + + immUniform1f("lineWidth", 3.0f * U.pixelsize); + immUniformThemeColorShadeAlpha(TH_GRID, -20, 255); + imm_draw_box_wire_3d(pos, x1, y1, x2, y2); + + immUniform1f("lineWidth", 1.0f * U.pixelsize); + immUniformThemeColorShadeAlpha(TH_GRID, 20, 255); + imm_draw_box_wire_3d(pos, x1, y1, x2, y2); + + immUnbindProgram(); + GPU_blend(GPU_BLEND_NONE); +} + static void drawObjectConstraint(TransInfo *t) { /* Draw the first one lighter because that's the one who controls the others. diff --git a/source/blender/editors/transform/transform_constraints.hh b/source/blender/editors/transform/transform_constraints.hh index 1dc224df693..2a55fc5487a 100644 --- a/source/blender/editors/transform/transform_constraints.hh +++ b/source/blender/editors/transform/transform_constraints.hh @@ -41,6 +41,10 @@ void drawConstraint(TransInfo *t); * Called from drawview.c, as an extra per-window draw option. */ void drawPropCircle(TransInfo *t); +/** + * Draws two lines to indicate a proportional editing range that is only defined in one axis. + */ +void drawPropRange(TransInfo *t); void startConstraint(TransInfo *t); void stopConstraint(TransInfo *t); void initSelectConstraint(TransInfo *t); From 91b727028a476c1ecfbcc4e2eab58416e11a5775 Mon Sep 17 00:00:00 2001 From: Miguel Pozo Date: Thu, 15 Feb 2024 17:57:20 +0100 Subject: [PATCH 6/6] EEVEE: Remove Thickness output --- .../blender/nodes/shader/nodes/node_shader_output_material.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.cc b/source/blender/nodes/shader/nodes/node_shader_output_material.cc index 1cf832b5c77..0427c38788f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_material.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_material.cc @@ -13,7 +13,9 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_input("Surface"); b.add_input("Volume").translation_context(BLT_I18NCONTEXT_ID_ID); b.add_input("Displacement").hide_value(); - b.add_input("Thickness").hide_value(); + b.add_input("Thickness") + .hide_value() + .unavailable() /* EEVEE-Next only. Does nothing in 4.1. */; } static int node_shader_gpu_output_material(GPUMaterial *mat,