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 | | --- | --- | |  |  | ### 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
This commit is contained in:
committed by
Raul Fernandez Hernandez
parent
1e3e5c5ac2
commit
a2f49b05f8
@@ -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. */
|
||||
|
||||
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user