Fix #44834: Add bone selection icon next to face and vertex selection in weight paint mode #115409
|
@ -5245,6 +5245,8 @@ def km_weight_paint(params):
|
|||
{"properties": [("data_path", 'weight_paint_object.data.use_paint_mask')]}),
|
||||
("wm.context_toggle", {"type": 'TWO', "value": 'PRESS'},
|
||||
{"properties": [("data_path", 'weight_paint_object.data.use_paint_mask_vertex')]}),
|
||||
("wm.context_toggle", {"type": 'THREE', "value": 'PRESS'},
|
||||
{"properties": [("data_path", 'weight_paint_object.data.use_paint_bone_selection'), ("value", True)]}),
|
||||
("wm.context_toggle", {"type": 'S', "value": 'PRESS', "shift": True},
|
||||
{"properties": [("data_path", 'tool_settings.weight_paint.brush.use_smooth_stroke')]}),
|
||||
op_menu_pie("VIEW3D_MT_wpaint_vgroup_lock_pie", {"type": 'K', "value": 'PRESS'}),
|
||||
|
|
|
@ -1654,13 +1654,17 @@ class _defs_texture_paint:
|
|||
class _defs_weight_paint:
|
||||
|
||||
@staticmethod
|
||||
def poll_select_mask(context):
|
||||
def poll_select_tools(context):
|
||||
if context is None:
|
||||
return True
|
||||
return VIEW3D_PT_tools_active._tools_select
|
||||
ob = context.active_object
|
||||
return (ob and ob.type == 'MESH' and
|
||||
(ob.data.use_paint_mask or
|
||||
ob.data.use_paint_mask_vertex))
|
||||
if (ob and ob.type == 'MESH' and
|
||||
(ob.data.use_paint_mask or
|
||||
ob.data.use_paint_mask_vertex)):
|
||||
return VIEW3D_PT_tools_active._tools_select
|
||||
elif context.pose_object:
|
||||
return (_defs_view3d_select.select,)
|
||||
return ()
|
||||
|
||||
@staticmethod
|
||||
def generate_from_brushes(context):
|
||||
|
@ -3115,11 +3119,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
|
|||
else ()
|
||||
),
|
||||
None,
|
||||
lambda context: (
|
||||
VIEW3D_PT_tools_active._tools_select
|
||||
if _defs_weight_paint.poll_select_mask(context)
|
||||
else ()
|
||||
),
|
||||
_defs_weight_paint.poll_select_tools,
|
||||
*_tools_annotate,
|
||||
],
|
||||
'PAINT_GREASE_PENCIL': [
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "BKE_context.hh"
|
||||
#include "BKE_editmesh.hh"
|
||||
#include "BKE_layer.h"
|
||||
#include "BKE_object.hh"
|
||||
|
||||
#include "DEG_depsgraph.hh"
|
||||
|
||||
|
@ -138,6 +139,12 @@ static void uiTemplatePaintModeSelection(uiLayout *layout, bContext *C)
|
|||
uiLayout *row = uiLayoutRow(layout, true);
|
||||
uiItemR(row, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||
uiItemR(row, &meshptr, "use_paint_mask_vertex", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||
|
||||
/* Show the bone selection mode icon only if there is a pose mode armature */
|
||||
Object *ob_armature = BKE_object_pose_armature_get(ob);
|
||||
if (ob_armature) {
|
||||
uiItemR(row, &meshptr, "use_paint_bone_selection", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -228,6 +228,17 @@ void rna_Mesh_update_draw(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
|
|||
WM_main_add_notifier(NC_GEOM | ND_DATA, id);
|
||||
}
|
||||
|
||||
static void rna_Mesh_update_bone_selection_mode(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
{
|
||||
Mesh *me = static_cast<Mesh *>(ptr->data);
|
||||
me->editflag &= ~ME_EDIT_PAINT_VERT_SEL;
|
||||
me->editflag &= ~ME_EDIT_PAINT_FACE_SEL;
|
||||
|
||||
BKE_mesh_batch_cache_dirty_tag(me, BKE_MESH_BATCH_DIRTY_ALL);
|
||||
|
||||
rna_Mesh_update_draw(bmain, scene, ptr);
|
||||
}
|
||||
|
||||
static void rna_Mesh_update_vertmask(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
{
|
||||
Mesh *me = static_cast<Mesh *>(ptr->data);
|
||||
|
@ -3250,6 +3261,13 @@ static void rna_def_mesh(BlenderRNA *brna)
|
|||
"Use topology based mirroring "
|
||||
"(for when both sides of mesh have matching, unique topology)");
|
||||
|
||||
prop = RNA_def_property(srna, "use_paint_bone_selection", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(
|
||||
prop, nullptr, "editflag", ME_EDIT_PAINT_FACE_SEL | ME_EDIT_PAINT_VERT_SEL);
|
||||
RNA_def_property_ui_text(prop, "Bone Selection", "Bone selection during painting");
|
||||
RNA_def_property_ui_icon(prop, ICON_BONE_DATA, 0);
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Mesh_update_bone_selection_mode");
|
||||
|
||||
prop = RNA_def_property(srna, "use_paint_mask", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "editflag", ME_EDIT_PAINT_FACE_SEL);
|
||||
RNA_def_property_ui_text(prop, "Paint Mask", "Face selection masking for painting");
|
||||
|
|
Loading…
Reference in New Issue