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 | | ---- | --- | |  |  | Addresses part of #112371 Pull Request: https://projects.blender.org/blender/blender/pulls/118172
This commit is contained in:
committed by
Raul Fernandez Hernandez
parent
d76c1e30e7
commit
fca979e237
@@ -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 */
|
||||
|
||||
@@ -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])};
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user