diff --git a/scripts/startup/bl_ui/properties_grease_pencil_common.py b/scripts/startup/bl_ui/properties_grease_pencil_common.py index 800dfcb5f7b..ed6ba382948 100644 --- a/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -117,12 +117,12 @@ class GreasePencilDisplayPanel: gp_settings = brush.gpencil_settings ob = context.active_object - if self.is_popover and ob.mode not in {'PAINT_GPENCIL', 'VERTEX_GPENCIL'}: + if self.is_popover and ob.mode not in {'PAINT_GREASE_PENCIL', 'VERTEX_GREASE_PENCIL'}: row = layout.row(align=True) row.use_property_split = False row.prop(settings, "show_brush", text="Display Cursor") - if ob.mode == 'PAINT_GPENCIL' or ob.mode == 'PAINT_GREASE_PENCIL': + if ob.mode == 'PAINT_GREASE_PENCIL': if self.is_popover: row = layout.row(align=True) row.prop(settings, "show_brush", text="Display Cursor") @@ -132,7 +132,7 @@ class GreasePencilDisplayPanel: row.active = settings.show_brush row.prop(gp_settings, "show_lasso", text="Show Fill Color While Drawing") - elif ob.mode == 'SCULPT_GPENCIL' or ob.mode == 'SCULPT_GREASE_PENCIL': + elif ob.mode == 'SCULPT_GREASE_PENCIL': col = layout.column(align=True) col.active = settings.show_brush @@ -140,13 +140,13 @@ class GreasePencilDisplayPanel: if brush.gpencil_sculpt_tool in {'THICKNESS', 'STRENGTH', 'PINCH', 'TWIST'}: col.prop(brush, "cursor_color_subtract", text="Inverse Color") - elif ob.mode == 'WEIGHT_GPENCIL' or ob.mode == 'WEIGHT_GREASE_PENCIL': + elif ob.mode == 'WEIGHT_GREASE_PENCIL': col = layout.column(align=True) col.active = settings.show_brush col.prop(brush, "cursor_color_add", text="Cursor Color") - elif ob.mode == 'VERTEX_GPENCIL' or ob.mode == 'VERTEX_GREASE_PENCIL': + elif ob.mode == 'VERTEX_GREASE_PENCIL': row = layout.row(align=True) row.prop(settings, "show_brush", text="Display Cursor") diff --git a/scripts/startup/bl_ui/space_view3d.py b/scripts/startup/bl_ui/space_view3d.py index 434547eb509..3ab0bbdb7c8 100644 --- a/scripts/startup/bl_ui/space_view3d.py +++ b/scripts/startup/bl_ui/space_view3d.py @@ -721,7 +721,7 @@ class VIEW3D_HT_header(Header): ) # Pivot - if has_pose_mode or object_mode in {'OBJECT', 'EDIT', 'EDIT_GPENCIL', 'SCULPT_GPENCIL'}: + if has_pose_mode or object_mode in {'OBJECT', 'EDIT', 'EDIT_GPENCIL', 'SCULPT_GREASE_PENCIL'}: layout.prop(tool_settings, "transform_pivot_point", text="", icon_only=True) # Snap @@ -732,7 +732,7 @@ class VIEW3D_HT_header(Header): if has_pose_mode or (object_mode not in { 'SCULPT', 'SCULPT_CURVES', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT', - 'PAINT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL', 'VERTEX_GPENCIL', + 'PAINT_GREASE_PENCIL', 'SCULPT_GREASE_PENCIL', 'WEIGHT_GREASE_PENCIL', 'VERTEX_GREASE_PENCIL', }): show_snap = True else: @@ -772,7 +772,7 @@ class VIEW3D_HT_header(Header): if object_mode in { 'EDIT', 'PARTICLE_EDIT', - 'SCULPT_GPENCIL', + 'SCULPT_GREASE_PENCIL', 'EDIT_GPENCIL', 'OBJECT', } and context.mode != 'EDIT_ARMATURE': @@ -889,13 +889,13 @@ class VIEW3D_HT_header(Header): depress=(tool_settings.gpencil_selectmode_edit == 'SEGMENT'), ).mode = 'SEGMENT' - if object_mode == 'SCULPT_GPENCIL': + if object_mode == 'SCULPT_GREASE_PENCIL': row = layout.row(align=True) row.prop(tool_settings, "use_gpencil_select_mask_point", text="") row.prop(tool_settings, "use_gpencil_select_mask_stroke", text="") row.prop(tool_settings, "use_gpencil_select_mask_segment", text="") - if object_mode == 'VERTEX_GPENCIL': + if object_mode == 'VERTEX_GREASE_PENCIL': row = layout.row(align=True) row.prop(tool_settings, "use_gpencil_vertex_select_mask_point", text="") row.prop(tool_settings, "use_gpencil_vertex_select_mask_stroke", text="") @@ -907,9 +907,9 @@ class VIEW3D_HT_header(Header): layout.separator_spacer() - if object_mode in {'PAINT_GPENCIL', 'SCULPT_GPENCIL'}: + if object_mode in {'PAINT_GREASE_PENCIL', 'SCULPT_GREASE_PENCIL'}: # Grease pencil - if object_mode == 'PAINT_GPENCIL': + if object_mode == 'PAINT_GREASE_PENCIL': sub = layout.row(align=True) sub.prop_with_popover( tool_settings, @@ -918,7 +918,7 @@ class VIEW3D_HT_header(Header): panel="VIEW3D_PT_grease_pencil_origin", ) - if object_mode in {'PAINT_GPENCIL', 'SCULPT_GPENCIL'}: + if object_mode in {'PAINT_GREASE_PENCIL', 'SCULPT_GREASE_PENCIL'}: sub = layout.row(align=True) sub.active = tool_settings.gpencil_stroke_placement_view3d != 'SURFACE' sub.prop_with_popover( @@ -956,7 +956,7 @@ class VIEW3D_HT_header(Header): icon=icon, ) - if object_mode == 'PAINT_GPENCIL': + if object_mode == 'PAINT_GREASE_PENCIL': # FIXME: this is bad practice! # Tool options are to be displayed in the top-bar. tool = context.workspace.tools.from_space_view3d_mode(object_mode) @@ -970,7 +970,7 @@ class VIEW3D_HT_header(Header): panel="VIEW3D_PT_grease_pencil_guide", text="Guides", ) - if object_mode == 'SCULPT_GPENCIL': + if object_mode == 'SCULPT_GREASE_PENCIL': layout.popover( panel="VIEW3D_PT_grease_pencil_sculpt_automasking", text="", @@ -1013,11 +1013,11 @@ class VIEW3D_HT_header(Header): row = layout.row() row.popover(panel="VIEW3D_PT_slots_color_attributes", icon='GROUP_VCOL') - elif object_mode in {'WEIGHT_PAINT', 'WEIGHT_GPENCIL'}: + elif object_mode in {'WEIGHT_PAINT', 'WEIGHT_GREASE_PENCIL'}: row = layout.row() row.popover(panel="VIEW3D_PT_slots_vertex_groups", icon='GROUP_VERTEX') - if object_mode != 'WEIGHT_GPENCIL': + if object_mode != 'WEIGHT_GREASE_PENCIL': layout.popover( panel="VIEW3D_PT_sculpt_snapping", icon="SNAP_INCREMENT", @@ -7724,7 +7724,7 @@ class VIEW3D_PT_overlay_grease_pencil_options(Panel): sub.prop(overlay, "gpencil_fade_objects", text="Fade Inactive Objects", slider=True) sub.prop(overlay, "use_gpencil_fade_gp_objects", text="", icon='OUTLINER_OB_GREASEPENCIL') - if ob.mode in {'EDIT', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL', 'VERTEX_GPENCIL'}: + if ob.mode in {'EDIT', 'SCULPT_GREASE_PENCIL', 'WEIGHT_GREASE_PENCIL', 'VERTEX_GREASE_PENCIL'}: split = layout.split() col = split.column() col.prop(overlay, "use_gpencil_edit_lines", text="Edit Lines") @@ -7738,7 +7738,7 @@ class VIEW3D_PT_overlay_grease_pencil_options(Panel): col = split.column() col.prop(overlay, "use_gpencil_show_material_name", text="Material Name") - if ob.mode in {'PAINT_GPENCIL', 'VERTEX_GPENCIL'}: + if ob.mode in {'PAINT_GREASE_PENCIL', 'VERTEX_GREASE_PENCIL'}: layout.label(text="Vertex Paint") row = layout.row() shading = VIEW3D_PT_shading.get_shading(context) @@ -8571,9 +8571,9 @@ class TOPBAR_PT_grease_pencil_vertex_color(Panel): layout.use_property_decorate = False ob = context.object - if ob.mode == 'PAINT_GPENCIL': + if ob.mode == 'PAINT_GREASE_PENCIL': paint = context.scene.tool_settings.gpencil_paint - elif ob.mode == 'VERTEX_GPENCIL': + elif ob.mode == 'VERTEX_GREASE_PENCIL': paint = context.scene.tool_settings.gpencil_vertex_paint ups = context.tool_settings.unified_paint_settings @@ -8735,13 +8735,6 @@ class VIEW3D_AST_brush_texture_paint(View3DAssetShelf, bpy.types.AssetShelf): class VIEW3D_AST_brush_gpencil_paint(View3DAssetShelf, bpy.types.AssetShelf): - mode = 'PAINT_GPENCIL' - mode_prop = "use_paint_grease_pencil" - brush_type_prop = "gpencil_brush_type" - tool_prop = "gpencil_tool" - - -class VIEW3D_AST_brush_grease_pencil_paint(View3DAssetShelf, bpy.types.AssetShelf): mode = 'PAINT_GREASE_PENCIL' mode_prop = "use_paint_grease_pencil" brush_type_prop = "gpencil_brush_type" @@ -8749,21 +8742,21 @@ class VIEW3D_AST_brush_grease_pencil_paint(View3DAssetShelf, bpy.types.AssetShel class VIEW3D_AST_brush_gpencil_sculpt(View3DAssetShelf, bpy.types.AssetShelf): - mode = 'SCULPT_GPENCIL' + mode = 'SCULPT_GREASE_PENCIL' mode_prop = "use_sculpt_grease_pencil" brush_type_prop = "gpencil_sculpt_brush_type" tool_prop = "gpencil_sculpt_tool" class VIEW3D_AST_brush_gpencil_vertex(AssetShelfHiddenByDefault, View3DAssetShelf, bpy.types.AssetShelf): - mode = 'VERTEX_GPENCIL' + mode = 'VERTEX_GREASE_PENCIL' mode_prop = "use_vertex_grease_pencil" brush_type_prop = "gpencil_vertex_brush_type" tool_prop = "gpencil_vertex_tool" class VIEW3D_AST_brush_gpencil_weight(AssetShelfHiddenByDefault, View3DAssetShelf, bpy.types.AssetShelf): - mode = 'WEIGHT_GPENCIL' + mode = 'WEIGHT_GREASE_PENCIL' mode_prop = "use_weight_grease_pencil" brush_type_prop = "gpencil_weight_brush_type" tool_prop = "gpencil_weight_tool" @@ -9023,7 +9016,6 @@ classes = ( VIEW3D_AST_brush_weight_paint, VIEW3D_AST_brush_texture_paint, VIEW3D_AST_brush_gpencil_paint, - VIEW3D_AST_brush_grease_pencil_paint, VIEW3D_AST_brush_gpencil_sculpt, VIEW3D_AST_brush_gpencil_vertex, VIEW3D_AST_brush_gpencil_weight, diff --git a/scripts/startup/bl_ui/space_view3d_toolbar.py b/scripts/startup/bl_ui/space_view3d_toolbar.py index 99d48db32cb..1ac7eed4dd9 100644 --- a/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -109,9 +109,11 @@ def draw_vpaint_symmetry(layout, vpaint, obj): # Most of these panels should not be visible in GP edit modes def is_not_gpencil_edit_mode(context): is_gpmode = ( - context.active_object and - context.active_object.mode in {'EDIT_GPENCIL', 'PAINT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'} - ) + context.active_object and context.active_object.mode in { + 'EDIT_GPENCIL', + 'PAINT_GREASE_PENCIL', + 'SCULPT_GREASE_PENCIL', + 'WEIGHT_GREASE_PENCIL'}) return not is_gpmode diff --git a/source/blender/blenkernel/intern/brush.cc b/source/blender/blenkernel/intern/brush.cc index 4587b903956..7b650472108 100644 --- a/source/blender/blenkernel/intern/brush.cc +++ b/source/blender/blenkernel/intern/brush.cc @@ -399,13 +399,13 @@ static void brush_asset_metadata_ensure(void *asset_ptr, AssetMetaData *asset_da std::tuple{"use_paint_image", OB_MODE_TEXTURE_PAINT, "image_brush_type"}, /* Sculpt UVs in the image editor while in edit mode. */ std::tuple{"use_paint_uv_sculpt", OB_MODE_EDIT, "image_brush_type"}, - std::tuple{"use_paint_grease_pencil", OB_MODE_PAINT_GPENCIL_LEGACY, "gpencil_brush_type"}, + std::tuple{"use_paint_grease_pencil", OB_MODE_PAINT_GREASE_PENCIL, "gpencil_brush_type"}, /* Note: Not defined in brush RNA, own name. */ std::tuple{ - "use_sculpt_grease_pencil", OB_MODE_SCULPT_GPENCIL_LEGACY, "gpencil_sculpt_brush_type"}, + "use_sculpt_grease_pencil", OB_MODE_SCULPT_GREASE_PENCIL, "gpencil_sculpt_brush_type"}, std::tuple{ - "use_vertex_grease_pencil", OB_MODE_VERTEX_GPENCIL_LEGACY, "gpencil_vertex_brush_type"}, - std::tuple{"use_weight_gpencil", OB_MODE_WEIGHT_GPENCIL_LEGACY, "gpencil_weight_brush_type"}, + "use_vertex_grease_pencil", OB_MODE_VERTEX_GREASE_PENCIL, "gpencil_vertex_brush_type"}, + std::tuple{"use_weight_gpencil", OB_MODE_WEIGHT_GREASE_PENCIL, "gpencil_weight_brush_type"}, std::tuple{"use_paint_sculpt_curves", OB_MODE_SCULPT_CURVES, "curves_sculpt_brush_type"}, }; @@ -547,10 +547,10 @@ Brush *BKE_brush_add(Main *bmain, const char *name, const eObjectMode ob_mode) BKE_brush_init_curves_sculpt_settings(brush); } else if (ELEM(ob_mode, - OB_MODE_PAINT_GPENCIL_LEGACY, - OB_MODE_SCULPT_GPENCIL_LEGACY, - OB_MODE_WEIGHT_GPENCIL_LEGACY, - OB_MODE_VERTEX_GPENCIL_LEGACY)) + OB_MODE_PAINT_GREASE_PENCIL, + OB_MODE_SCULPT_GREASE_PENCIL, + OB_MODE_WEIGHT_GREASE_PENCIL, + OB_MODE_VERTEX_GREASE_PENCIL)) { BKE_brush_init_gpencil_settings(brush); } diff --git a/source/blender/blenkernel/intern/context.cc b/source/blender/blenkernel/intern/context.cc index 6ae69e4b102..d82da4ba657 100644 --- a/source/blender/blenkernel/intern/context.cc +++ b/source/blender/blenkernel/intern/context.cc @@ -1226,7 +1226,7 @@ enum eContextObjectMode CTX_data_mode_enum_ex(const Object *obedit, if (object_mode & OB_MODE_PARTICLE_EDIT) { return CTX_MODE_PARTICLE; } - if (object_mode & OB_MODE_PAINT_GPENCIL_LEGACY) { + if (object_mode & OB_MODE_PAINT_GREASE_PENCIL) { if (ob->type == OB_GPENCIL_LEGACY) { return CTX_MODE_PAINT_GPENCIL_LEGACY; } @@ -1237,7 +1237,7 @@ enum eContextObjectMode CTX_data_mode_enum_ex(const Object *obedit, if (object_mode & OB_MODE_EDIT_GPENCIL_LEGACY) { return CTX_MODE_EDIT_GPENCIL_LEGACY; } - if (object_mode & OB_MODE_SCULPT_GPENCIL_LEGACY) { + if (object_mode & OB_MODE_SCULPT_GREASE_PENCIL) { if (ob->type == OB_GPENCIL_LEGACY) { return CTX_MODE_SCULPT_GPENCIL_LEGACY; } @@ -1245,7 +1245,7 @@ enum eContextObjectMode CTX_data_mode_enum_ex(const Object *obedit, return CTX_MODE_SCULPT_GREASE_PENCIL; } } - if (object_mode & OB_MODE_WEIGHT_GPENCIL_LEGACY) { + if (object_mode & OB_MODE_WEIGHT_GREASE_PENCIL) { if (ob->type == OB_GPENCIL_LEGACY) { return CTX_MODE_WEIGHT_GPENCIL_LEGACY; } @@ -1253,7 +1253,7 @@ enum eContextObjectMode CTX_data_mode_enum_ex(const Object *obedit, return CTX_MODE_WEIGHT_GREASE_PENCIL; } } - if (object_mode & OB_MODE_VERTEX_GPENCIL_LEGACY) { + if (object_mode & OB_MODE_VERTEX_GREASE_PENCIL) { if (ob->type == OB_GPENCIL_LEGACY) { return CTX_MODE_VERTEX_GPENCIL_LEGACY; } diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc index 58e9f7021b5..97f00ccb23d 100644 --- a/source/blender/blenkernel/intern/object.cc +++ b/source/blender/blenkernel/intern/object.cc @@ -2409,7 +2409,7 @@ Object *BKE_object_pose_armature_get_with_wpaint_check(Object *ob) break; } case OB_GPENCIL_LEGACY: { - if ((ob->mode & OB_MODE_WEIGHT_GPENCIL_LEGACY) == 0) { + if ((ob->mode & OB_MODE_WEIGHT_GREASE_PENCIL) == 0) { return nullptr; } break; diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc index 119834313d1..aac8388b673 100644 --- a/source/blender/blenkernel/intern/paint.cc +++ b/source/blender/blenkernel/intern/paint.cc @@ -452,13 +452,13 @@ Paint *BKE_paint_get_active(Scene *sce, ViewLayer *view_layer) return &ts->wpaint->paint; case OB_MODE_TEXTURE_PAINT: return &ts->imapaint.paint; - case OB_MODE_PAINT_GPENCIL_LEGACY: + case OB_MODE_PAINT_GREASE_PENCIL: return &ts->gp_paint->paint; - case OB_MODE_VERTEX_GPENCIL_LEGACY: + case OB_MODE_VERTEX_GREASE_PENCIL: return &ts->gp_vertexpaint->paint; - case OB_MODE_SCULPT_GPENCIL_LEGACY: + case OB_MODE_SCULPT_GREASE_PENCIL: return &ts->gp_sculptpaint->paint; - case OB_MODE_WEIGHT_GPENCIL_LEGACY: + case OB_MODE_WEIGHT_GREASE_PENCIL: return &ts->gp_weightpaint->paint; case OB_MODE_SCULPT_CURVES: return &ts->curves_sculpt->paint; @@ -527,7 +527,7 @@ PaintMode BKE_paintmode_get_active_from_context(const bContext *C) switch (obact->mode) { case OB_MODE_SCULPT: return PaintMode::Sculpt; - case OB_MODE_SCULPT_GPENCIL_LEGACY: + case OB_MODE_SCULPT_GREASE_PENCIL: if (obact->type == OB_GPENCIL_LEGACY) { return PaintMode::SculptGPencil; } @@ -535,11 +535,11 @@ PaintMode BKE_paintmode_get_active_from_context(const bContext *C) return PaintMode::SculptGreasePencil; } return PaintMode::Invalid; - case OB_MODE_PAINT_GPENCIL_LEGACY: + case OB_MODE_PAINT_GREASE_PENCIL: return PaintMode::GPencil; - case OB_MODE_WEIGHT_GPENCIL_LEGACY: + case OB_MODE_WEIGHT_GREASE_PENCIL: return PaintMode::WeightGPencil; - case OB_MODE_VERTEX_GPENCIL_LEGACY: + case OB_MODE_VERTEX_GREASE_PENCIL: return PaintMode::VertexGPencil; case OB_MODE_VERTEX_PAINT: return PaintMode::Vertex; @@ -728,13 +728,13 @@ static const char *paint_brush_essentials_asset_file_name_from_obmode(const eObj return "essentials_brushes-mesh_weight.blend"; case OB_MODE_TEXTURE_PAINT: return "essentials_brushes-mesh_texture.blend"; - case OB_MODE_PAINT_GPENCIL_LEGACY: + case OB_MODE_PAINT_GREASE_PENCIL: return "essentials_brushes-gp_draw.blend"; - case OB_MODE_SCULPT_GPENCIL_LEGACY: + case OB_MODE_SCULPT_GREASE_PENCIL: return "essentials_brushes-gp_sculpt.blend"; - case OB_MODE_WEIGHT_GPENCIL_LEGACY: + case OB_MODE_WEIGHT_GREASE_PENCIL: return "essentials_brushes-gp_weight.blend"; - case OB_MODE_VERTEX_GPENCIL_LEGACY: + case OB_MODE_VERTEX_GREASE_PENCIL: return "essentials_brushes-gp_vertex.blend"; case OB_MODE_SCULPT_CURVES: return "essentials_brushes-curve_sculpt.blend"; @@ -929,7 +929,7 @@ static void paint_brush_default_essentials_name_get( } } break; - case OB_MODE_PAINT_GPENCIL_LEGACY: + case OB_MODE_PAINT_GREASE_PENCIL: name = "Pencil"; /* Different default brush for some brush types. */ if (brush_type) { @@ -948,7 +948,7 @@ static void paint_brush_default_essentials_name_get( } eraser_name = "Eraser Soft"; break; - case OB_MODE_VERTEX_GPENCIL_LEGACY: + case OB_MODE_VERTEX_GREASE_PENCIL: name = "Paint"; if (brush_type) { switch (eBrushGPVertexType(*brush_type)) { @@ -974,7 +974,7 @@ static void paint_brush_default_essentials_name_get( } } break; - case OB_MODE_SCULPT_GPENCIL_LEGACY: + case OB_MODE_SCULPT_GREASE_PENCIL: name = "Smooth"; if (brush_type) { switch (eBrushGPSculptType(*brush_type)) { @@ -986,7 +986,7 @@ static void paint_brush_default_essentials_name_get( } } break; - case OB_MODE_WEIGHT_GPENCIL_LEGACY: + case OB_MODE_WEIGHT_GREASE_PENCIL: name = "Paint"; if (brush_type) { switch (eBrushGPWeightType(*brush_type)) { @@ -1215,16 +1215,16 @@ static void paint_runtime_init(const ToolSettings *ts, Paint *paint) paint->runtime.ob_mode = OB_MODE_WEIGHT_PAINT; } else if (ts->gp_paint && paint == &ts->gp_paint->paint) { - paint->runtime.ob_mode = OB_MODE_PAINT_GPENCIL_LEGACY; + paint->runtime.ob_mode = OB_MODE_PAINT_GREASE_PENCIL; } else if (ts->gp_vertexpaint && paint == &ts->gp_vertexpaint->paint) { - paint->runtime.ob_mode = OB_MODE_VERTEX_GPENCIL_LEGACY; + paint->runtime.ob_mode = OB_MODE_VERTEX_GREASE_PENCIL; } else if (ts->gp_sculptpaint && paint == &ts->gp_sculptpaint->paint) { - paint->runtime.ob_mode = OB_MODE_SCULPT_GPENCIL_LEGACY; + paint->runtime.ob_mode = OB_MODE_SCULPT_GREASE_PENCIL; } else if (ts->gp_weightpaint && paint == &ts->gp_weightpaint->paint) { - paint->runtime.ob_mode = OB_MODE_WEIGHT_GPENCIL_LEGACY; + paint->runtime.ob_mode = OB_MODE_WEIGHT_GREASE_PENCIL; } else if (ts->curves_sculpt && paint == &ts->curves_sculpt->paint) { paint->runtime.ob_mode = OB_MODE_SCULPT_CURVES; @@ -1279,13 +1279,13 @@ std::optional BKE_paint_get_brush_type_from_obmode(const Brush *brush, return brush->vertex_brush_type; case OB_MODE_WEIGHT_PAINT: return brush->weight_brush_type; - case OB_MODE_PAINT_GPENCIL_LEGACY: + case OB_MODE_PAINT_GREASE_PENCIL: return brush->gpencil_brush_type; - case OB_MODE_VERTEX_GPENCIL_LEGACY: + case OB_MODE_VERTEX_GREASE_PENCIL: return brush->gpencil_vertex_brush_type; - case OB_MODE_SCULPT_GPENCIL_LEGACY: + case OB_MODE_SCULPT_GREASE_PENCIL: return brush->gpencil_sculpt_brush_type; - case OB_MODE_WEIGHT_GPENCIL_LEGACY: + case OB_MODE_WEIGHT_GREASE_PENCIL: return brush->gpencil_weight_brush_type; case OB_MODE_SCULPT_CURVES: return brush->curves_sculpt_brush_type; @@ -1613,7 +1613,7 @@ bool BKE_paint_select_grease_pencil_test(const Object *ob) return false; } if (ob->type == OB_GREASE_PENCIL) { - return (ob->mode & (OB_MODE_SCULPT_GPENCIL_LEGACY | OB_MODE_VERTEX_GPENCIL_LEGACY)); + return (ob->mode & (OB_MODE_SCULPT_GREASE_PENCIL | OB_MODE_VERTEX_GREASE_PENCIL)); } return false; } @@ -1662,9 +1662,9 @@ eObjectMode BKE_paint_object_mode_from_paintmode(const PaintMode mode) case PaintMode::SculptCurves: return OB_MODE_SCULPT_CURVES; case PaintMode::GPencil: - return OB_MODE_PAINT_GPENCIL_LEGACY; + return OB_MODE_PAINT_GREASE_PENCIL; case PaintMode::SculptGreasePencil: - return OB_MODE_SCULPT_GPENCIL_LEGACY; + return OB_MODE_SCULPT_GREASE_PENCIL; case PaintMode::Invalid: default: return OB_MODE_OBJECT; diff --git a/source/blender/blenloader/intern/versioning_defaults.cc b/source/blender/blenloader/intern/versioning_defaults.cc index df1255bebfe..75be1b792d9 100644 --- a/source/blender/blenloader/intern/versioning_defaults.cc +++ b/source/blender/blenloader/intern/versioning_defaults.cc @@ -312,7 +312,7 @@ void BLO_update_defaults_workspace(WorkSpace *workspace, const char *app_templat /* For 2D animation template. */ if (STREQ(workspace->id.name + 2, "Drawing")) { - workspace->object_mode = OB_MODE_PAINT_GPENCIL_LEGACY; + workspace->object_mode = OB_MODE_PAINT_GREASE_PENCIL; } /* For Sculpting template. */ @@ -600,7 +600,7 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template) if (object->type == OB_GPENCIL_LEGACY) { /* Set grease pencil object in drawing mode */ bGPdata *gpd = (bGPdata *)object->data; - object->mode = OB_MODE_PAINT_GPENCIL_LEGACY; + object->mode = OB_MODE_PAINT_GREASE_PENCIL; gpd->flag |= GP_DATA_STROKE_PAINTMODE; break; } diff --git a/source/blender/draw/engines/gpencil/gpencil_engine_c.cc b/source/blender/draw/engines/gpencil/gpencil_engine_c.cc index 50168496981..c66be1ec5ad 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine_c.cc +++ b/source/blender/draw/engines/gpencil/gpencil_engine_c.cc @@ -119,7 +119,7 @@ void GPENCIL_engine_init(void *ved) stl->pd->v3d_color_type = (v3d->shading.type == OB_SOLID) ? v3d->shading.color_type : -1; /* Special case: If we're in Draw or Vertex Paint mode, show vertex colors. */ if (v3d->shading.type == OB_SOLID && ctx->obact && - ELEM(ctx->obact->mode, OB_MODE_PAINT_GPENCIL_LEGACY, OB_MODE_VERTEX_GPENCIL_LEGACY)) + ELEM(ctx->obact->mode, OB_MODE_PAINT_GREASE_PENCIL, OB_MODE_VERTEX_GREASE_PENCIL)) { stl->pd->v3d_color_type = V3D_SHADING_VERTEX_COLOR; } @@ -779,9 +779,9 @@ static GPENCIL_tObject *grease_pencil_object_cache_populate(GPENCIL_PrivateData "material_index", bke::AttrDomain::Curve, 0); const bool only_lines = !ELEM(ob->mode, - OB_MODE_PAINT_GPENCIL_LEGACY, - OB_MODE_WEIGHT_GPENCIL_LEGACY, - OB_MODE_VERTEX_GPENCIL_LEGACY) && + OB_MODE_PAINT_GREASE_PENCIL, + OB_MODE_WEIGHT_GREASE_PENCIL, + OB_MODE_VERTEX_GREASE_PENCIL) && info.frame_number != pd->cfra && pd->use_multiedit_lines_only; const bool is_onion = info.onion_id != 0; diff --git a/source/blender/draw/engines/overlay/overlay_engine.cc b/source/blender/draw/engines/overlay/overlay_engine.cc index 0bac4015290..fe90aa50e1c 100644 --- a/source/blender/draw/engines/overlay/overlay_engine.cc +++ b/source/blender/draw/engines/overlay/overlay_engine.cc @@ -300,7 +300,7 @@ static bool overlay_object_is_edit_mode(const OVERLAY_PrivateData *pd, const Obj static bool overlay_object_is_paint_mode(const DRWContextState *draw_ctx, const Object *ob) { if (ob->type == OB_GREASE_PENCIL && - draw_ctx->object_mode & (OB_MODE_WEIGHT_GPENCIL_LEGACY | OB_MODE_VERTEX_GPENCIL_LEGACY)) + draw_ctx->object_mode & (OB_MODE_WEIGHT_GREASE_PENCIL | OB_MODE_VERTEX_GREASE_PENCIL)) { return true; } @@ -357,8 +357,7 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob) const bool in_sculpt_mode = (ob == draw_ctx->obact) && (ob->sculpt != nullptr) && (ob->sculpt->mode_type == OB_MODE_SCULPT); const bool in_grease_pencil_sculpt_mode = (ob->type == OB_GREASE_PENCIL) && - (draw_ctx->object_mode & - OB_MODE_SCULPT_GPENCIL_LEGACY); + (draw_ctx->object_mode & OB_MODE_SCULPT_GREASE_PENCIL); const bool has_surface = ELEM(ob->type, OB_MESH, OB_CURVES_LEGACY, @@ -479,10 +478,10 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob) case OB_MODE_TEXTURE_PAINT: OVERLAY_paint_texture_cache_populate(data, ob); break; - case OB_MODE_WEIGHT_GPENCIL_LEGACY: + case OB_MODE_WEIGHT_GREASE_PENCIL: OVERLAY_weight_grease_pencil_cache_populate(data, ob); break; - case OB_MODE_VERTEX_GPENCIL_LEGACY: + case OB_MODE_VERTEX_GREASE_PENCIL: OVERLAY_vertex_grease_pencil_cache_populate(data, ob); break; default: diff --git a/source/blender/draw/engines/overlay/overlay_gpencil_legacy.cc b/source/blender/draw/engines/overlay/overlay_gpencil_legacy.cc index 7b74de036c7..d4ce478d51a 100644 --- a/source/blender/draw/engines/overlay/overlay_gpencil_legacy.cc +++ b/source/blender/draw/engines/overlay/overlay_gpencil_legacy.cc @@ -160,7 +160,7 @@ void OVERLAY_edit_gpencil_legacy_cache_init(OVERLAY_Data *vedata) /* control points for primitives and speed guide */ const bool is_cppoint = (gpd->runtime.tot_cp_points > 0); const bool is_speed_guide = (ts->gp_sculpt.guide.use_guide && - (draw_ctx->object_mode == OB_MODE_PAINT_GPENCIL_LEGACY)); + (draw_ctx->object_mode == OB_MODE_PAINT_GREASE_PENCIL)); const bool is_show_gizmo = (((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) && ((v3d->gizmo_flag & V3D_GIZMO_HIDE_TOOL) == 0)); diff --git a/source/blender/draw/engines/overlay/overlay_grease_pencil.cc b/source/blender/draw/engines/overlay/overlay_grease_pencil.cc index 201b3d81cc0..16807e2f9a2 100644 --- a/source/blender/draw/engines/overlay/overlay_grease_pencil.cc +++ b/source/blender/draw/engines/overlay/overlay_grease_pencil.cc @@ -23,9 +23,9 @@ static void is_selection_visible(bool &r_show_points, bool &r_show_lines) const DRWContextState *draw_ctx = DRW_context_state_get(); const ToolSettings *ts = draw_ctx->scene->toolsettings; - const bool in_sculpt_mode = (draw_ctx->object_mode & OB_MODE_SCULPT_GPENCIL_LEGACY) != 0; - const bool in_weight_mode = (draw_ctx->object_mode & OB_MODE_WEIGHT_GPENCIL_LEGACY) != 0; - const bool in_vertex_mode = (draw_ctx->object_mode & OB_MODE_VERTEX_GPENCIL_LEGACY) != 0; + const bool in_sculpt_mode = (draw_ctx->object_mode & OB_MODE_SCULPT_GREASE_PENCIL) != 0; + const bool in_weight_mode = (draw_ctx->object_mode & OB_MODE_WEIGHT_GREASE_PENCIL) != 0; + const bool in_vertex_mode = (draw_ctx->object_mode & OB_MODE_VERTEX_GREASE_PENCIL) != 0; const bool flag_show_lines = (draw_ctx->v3d->gp_flag & V3D_GP_SHOW_EDIT_LINES) != 0; if (in_weight_mode) { @@ -64,7 +64,7 @@ void OVERLAY_edit_grease_pencil_cache_init(OVERLAY_Data *vedata) OVERLAY_PassList *psl = vedata->psl; OVERLAY_PrivateData *pd = vedata->stl->pd; const DRWContextState *draw_ctx = DRW_context_state_get(); - const bool use_weight = (draw_ctx->object_mode & OB_MODE_WEIGHT_GPENCIL_LEGACY) != 0; + const bool use_weight = (draw_ctx->object_mode & OB_MODE_WEIGHT_GREASE_PENCIL) != 0; GPUShader *sh; DRWShadingGroup *grp; diff --git a/source/blender/draw/engines/overlay/overlay_next_grease_pencil.hh b/source/blender/draw/engines/overlay/overlay_next_grease_pencil.hh index 0af25498975..079c07001eb 100644 --- a/source/blender/draw/engines/overlay/overlay_next_grease_pencil.hh +++ b/source/blender/draw/engines/overlay/overlay_next_grease_pencil.hh @@ -62,10 +62,10 @@ class GreasePencil { show_points_ = show_lines_ = show_weight_ = false; switch (state.object_mode) { - case OB_MODE_PAINT_GPENCIL_LEGACY: + case OB_MODE_PAINT_GREASE_PENCIL: /* Draw mode. */ break; - case OB_MODE_VERTEX_GPENCIL_LEGACY: + case OB_MODE_VERTEX_GREASE_PENCIL: /* Vertex paint mode. */ break; case OB_MODE_EDIT: @@ -73,13 +73,13 @@ class GreasePencil { show_points_ = show_edit_point; show_lines_ = show_lines; break; - case OB_MODE_WEIGHT_GPENCIL_LEGACY: + case OB_MODE_WEIGHT_GREASE_PENCIL: /* Weight paint mode. */ show_points_ = true; show_lines_ = show_lines; show_weight_ = true; break; - case OB_MODE_SCULPT_GPENCIL_LEGACY: + case OB_MODE_SCULPT_GREASE_PENCIL: /* Sculpt mode. */ show_points_ = (selection_domain_edit == bke::AttrDomain::Point); show_lines_ = show_lines && (ts->gpencil_selectmode_sculpt != 0); diff --git a/source/blender/draw/intern/draw_view_c.cc b/source/blender/draw/intern/draw_view_c.cc index 6c942ca1861..66caa0d9ca3 100644 --- a/source/blender/draw/intern/draw_view_c.cc +++ b/source/blender/draw/intern/draw_view_c.cc @@ -87,7 +87,7 @@ static bool is_cursor_visible(const DRWContextState *draw_ctx, Scene *scene, Vie /* no exception met? then don't draw cursor! */ return false; } - if (draw_ctx->object_mode & OB_MODE_WEIGHT_GPENCIL_LEGACY) { + if (draw_ctx->object_mode & OB_MODE_WEIGHT_GREASE_PENCIL) { /* grease pencil hide always in some modes */ return false; } diff --git a/source/blender/editors/gpencil_legacy/gpencil_edit.cc b/source/blender/editors/gpencil_legacy/gpencil_edit.cc index 4e705624654..a0ed92a5bac 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_edit.cc +++ b/source/blender/editors/gpencil_legacy/gpencil_edit.cc @@ -427,9 +427,9 @@ bool ED_object_gpencil_exit(Main *bmain, Object *ob) GP_DATA_STROKE_WEIGHTMODE | GP_DATA_STROKE_VERTEXMODE); ob->restore_mode = ob->mode; - ob->mode &= ~(OB_MODE_PAINT_GPENCIL_LEGACY | OB_MODE_EDIT_GPENCIL_LEGACY | - OB_MODE_SCULPT_GPENCIL_LEGACY | OB_MODE_WEIGHT_GPENCIL_LEGACY | - OB_MODE_VERTEX_GPENCIL_LEGACY); + ob->mode &= ~(OB_MODE_PAINT_GREASE_PENCIL | OB_MODE_EDIT_GPENCIL_LEGACY | + OB_MODE_SCULPT_GREASE_PENCIL | OB_MODE_WEIGHT_GREASE_PENCIL | + OB_MODE_VERTEX_GREASE_PENCIL); /* Inform all evaluated versions that we changed the mode. */ DEG_id_tag_update_ex(bmain, &ob->id, ID_RECALC_SYNC_TO_EVAL); diff --git a/source/blender/editors/gpencil_legacy/gpencil_utils.cc b/source/blender/editors/gpencil_legacy/gpencil_utils.cc index bf08c442545..d107bbdd5fe 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_utils.cc +++ b/source/blender/editors/gpencil_legacy/gpencil_utils.cc @@ -1784,7 +1784,7 @@ float ED_gpencil_radial_control_scale(bContext *C, const int mval[2]) { float scale_fac = 1.0f; - if ((brush && brush->gpencil_settings) && (brush->ob_mode == OB_MODE_PAINT_GPENCIL_LEGACY) && + if ((brush && brush->gpencil_settings) && (brush->ob_mode == OB_MODE_PAINT_GREASE_PENCIL) && (brush->gpencil_brush_type == GPAINT_BRUSH_TYPE_DRAW)) { float cursor_radius = ED_gpencil_cursor_radius(C, mval[0], mval[1]); @@ -2032,7 +2032,7 @@ void ED_gpencil_setup_modes(bContext *C, bGPdata *gpd, int newmode) gpd->flag &= ~GP_DATA_STROKE_VERTEXMODE; ED_gpencil_toggle_brush_cursor(C, false, nullptr); break; - case OB_MODE_PAINT_GPENCIL_LEGACY: + case OB_MODE_PAINT_GREASE_PENCIL: gpd->flag &= ~GP_DATA_STROKE_EDITMODE; gpd->flag |= GP_DATA_STROKE_PAINTMODE; gpd->flag &= ~GP_DATA_STROKE_SCULPTMODE; @@ -2040,7 +2040,7 @@ void ED_gpencil_setup_modes(bContext *C, bGPdata *gpd, int newmode) gpd->flag &= ~GP_DATA_STROKE_VERTEXMODE; ED_gpencil_toggle_brush_cursor(C, true, nullptr); break; - case OB_MODE_SCULPT_GPENCIL_LEGACY: + case OB_MODE_SCULPT_GREASE_PENCIL: gpd->flag &= ~GP_DATA_STROKE_EDITMODE; gpd->flag &= ~GP_DATA_STROKE_PAINTMODE; gpd->flag |= GP_DATA_STROKE_SCULPTMODE; @@ -2048,7 +2048,7 @@ void ED_gpencil_setup_modes(bContext *C, bGPdata *gpd, int newmode) gpd->flag &= ~GP_DATA_STROKE_VERTEXMODE; ED_gpencil_toggle_brush_cursor(C, true, nullptr); break; - case OB_MODE_WEIGHT_GPENCIL_LEGACY: + case OB_MODE_WEIGHT_GREASE_PENCIL: gpd->flag &= ~GP_DATA_STROKE_EDITMODE; gpd->flag &= ~GP_DATA_STROKE_PAINTMODE; gpd->flag &= ~GP_DATA_STROKE_SCULPTMODE; @@ -2056,7 +2056,7 @@ void ED_gpencil_setup_modes(bContext *C, bGPdata *gpd, int newmode) gpd->flag &= ~GP_DATA_STROKE_VERTEXMODE; ED_gpencil_toggle_brush_cursor(C, true, nullptr); break; - case OB_MODE_VERTEX_GPENCIL_LEGACY: + case OB_MODE_VERTEX_GREASE_PENCIL: gpd->flag &= ~GP_DATA_STROKE_EDITMODE; gpd->flag &= ~GP_DATA_STROKE_PAINTMODE; gpd->flag &= ~GP_DATA_STROKE_SCULPTMODE; diff --git a/source/blender/editors/grease_pencil/intern/grease_pencil_modes.cc b/source/blender/editors/grease_pencil/intern/grease_pencil_modes.cc index 24033b824d8..ba89304d0ba 100644 --- a/source/blender/editors/grease_pencil/intern/grease_pencil_modes.cc +++ b/source/blender/editors/grease_pencil/intern/grease_pencil_modes.cc @@ -60,25 +60,25 @@ static int paintmode_toggle_exec(bContext *C, wmOperator *op) Object *ob = CTX_data_active_object(C); BLI_assert(ob != nullptr); - const bool is_mode_set = (ob->mode & OB_MODE_PAINT_GPENCIL_LEGACY) != 0; + const bool is_mode_set = (ob->mode & OB_MODE_PAINT_GREASE_PENCIL) != 0; if (!is_mode_set) { Scene *scene = CTX_data_scene(C); BKE_paint_init(bmain, scene, PaintMode::GPencil, PAINT_CURSOR_PAINT_GREASE_PENCIL); Paint *paint = BKE_paint_get_active_from_paintmode(scene, PaintMode::GPencil); ED_paint_cursor_start(paint, brush_cursor_poll); - mode = OB_MODE_PAINT_GPENCIL_LEGACY; + mode = OB_MODE_PAINT_GREASE_PENCIL; } else { mode = OB_MODE_OBJECT; } - if ((ob->restore_mode) && ((ob->mode & OB_MODE_PAINT_GPENCIL_LEGACY) == 0) && (back == 1)) { + if ((ob->restore_mode) && ((ob->mode & OB_MODE_PAINT_GREASE_PENCIL) == 0) && (back == 1)) { mode = ob->restore_mode; } ob->restore_mode = ob->mode; ob->mode = mode; - if (mode == OB_MODE_PAINT_GPENCIL_LEGACY) { + if (mode == OB_MODE_PAINT_GREASE_PENCIL) { /* Be sure we have brushes and Paint settings. * Need Draw and Vertex (used for Tint). */ BKE_paint_ensure(bmain, ts, (Paint **)&ts->gp_paint); @@ -149,7 +149,7 @@ static bool sculptmode_toggle_poll(bContext *C) static bool sculpt_poll_view3d(bContext *C) { const Object *ob = CTX_data_active_object(C); - if (ob == nullptr || (ob->mode & OB_MODE_SCULPT_GPENCIL_LEGACY) == 0) { + if (ob == nullptr || (ob->mode & OB_MODE_SCULPT_GREASE_PENCIL) == 0) { return false; } if (CTX_wm_region_view3d(C) == nullptr) { @@ -169,7 +169,7 @@ static int sculptmode_toggle_exec(bContext *C, wmOperator *op) short mode; Object *ob = CTX_data_active_object(C); BLI_assert(ob != nullptr); - const bool is_mode_set = (ob->mode & OB_MODE_SCULPT_GPENCIL_LEGACY) != 0; + const bool is_mode_set = (ob->mode & OB_MODE_SCULPT_GREASE_PENCIL) != 0; if (is_mode_set) { mode = OB_MODE_OBJECT; } @@ -178,16 +178,16 @@ static int sculptmode_toggle_exec(bContext *C, wmOperator *op) BKE_paint_init(bmain, scene, PaintMode::SculptGreasePencil, PAINT_CURSOR_SCULPT_GREASE_PENCIL); Paint *paint = BKE_paint_get_active_from_paintmode(scene, PaintMode::SculptGreasePencil); ED_paint_cursor_start(paint, sculpt_poll_view3d); - mode = OB_MODE_SCULPT_GPENCIL_LEGACY; + mode = OB_MODE_SCULPT_GREASE_PENCIL; } - if ((ob->restore_mode) && ((ob->mode & OB_MODE_SCULPT_GPENCIL_LEGACY) == 0) && (back == 1)) { + if ((ob->restore_mode) && ((ob->mode & OB_MODE_SCULPT_GREASE_PENCIL) == 0) && (back == 1)) { mode = ob->restore_mode; } ob->restore_mode = ob->mode; ob->mode = mode; - if (mode == OB_MODE_SCULPT_GPENCIL_LEGACY) { + if (mode == OB_MODE_SCULPT_GREASE_PENCIL) { BKE_paint_ensure(bmain, ts, (Paint **)&ts->gp_sculptpaint); BKE_paint_brushes_validate(bmain, &ts->gp_sculptpaint->paint); } @@ -234,7 +234,7 @@ static void GREASE_PENCIL_OT_sculptmode_toggle(wmOperatorType *ot) static bool grease_pencil_poll_weight_cursor(bContext *C) { Object *ob = CTX_data_active_object(C); - return ob && (ob->mode & OB_MODE_WEIGHT_GPENCIL_LEGACY) && (ob->type == OB_GREASE_PENCIL) && + return ob && (ob->mode & OB_MODE_WEIGHT_GREASE_PENCIL) && (ob->type == OB_GREASE_PENCIL) && CTX_wm_region_view3d(C) && WM_toolsystem_active_tool_is_brush(C); } @@ -259,15 +259,15 @@ static int weightmode_toggle_exec(bContext *C, wmOperator *op) short mode; Object *ob = CTX_data_active_object(C); BLI_assert(ob != nullptr); - const bool is_mode_set = (ob->mode & OB_MODE_WEIGHT_GPENCIL_LEGACY) != 0; + const bool is_mode_set = (ob->mode & OB_MODE_WEIGHT_GREASE_PENCIL) != 0; if (!is_mode_set) { - mode = OB_MODE_WEIGHT_GPENCIL_LEGACY; + mode = OB_MODE_WEIGHT_GREASE_PENCIL; } else { mode = OB_MODE_OBJECT; } - if ((ob->restore_mode) && ((ob->mode & OB_MODE_WEIGHT_GPENCIL_LEGACY) == 0) && (back == 1)) { + if ((ob->restore_mode) && ((ob->mode & OB_MODE_WEIGHT_GREASE_PENCIL) == 0) && (back == 1)) { mode = ob->restore_mode; } ob->restore_mode = ob->mode; @@ -276,7 +276,7 @@ static int weightmode_toggle_exec(bContext *C, wmOperator *op) /* Prepare armature posemode. */ blender::ed::object::posemode_set_for_weight_paint(C, bmain, ob, is_mode_set); - if (mode == OB_MODE_WEIGHT_GPENCIL_LEGACY) { + if (mode == OB_MODE_WEIGHT_GREASE_PENCIL) { /* Be sure we have brushes. */ BKE_paint_ensure(bmain, ts, (Paint **)&ts->gp_weightpaint); Paint *weight_paint = BKE_paint_get_active_from_paintmode(scene, PaintMode::WeightGPencil); @@ -329,7 +329,7 @@ static void GREASE_PENCIL_OT_weightmode_toggle(wmOperatorType *ot) static bool grease_pencil_poll_vertex_cursor(bContext *C) { Object *ob = CTX_data_active_object(C); - return ob && (ob->mode & OB_MODE_VERTEX_GPENCIL_LEGACY) && (ob->type == OB_GREASE_PENCIL) && + return ob && (ob->mode & OB_MODE_VERTEX_GREASE_PENCIL) && (ob->type == OB_GREASE_PENCIL) && CTX_wm_region_view3d(C) && WM_toolsystem_active_tool_is_brush(C); } @@ -354,21 +354,21 @@ static int vertexmode_toggle_exec(bContext *C, wmOperator *op) short mode; Object *ob = CTX_data_active_object(C); BLI_assert(ob != nullptr); - const bool is_mode_set = (ob->mode & OB_MODE_VERTEX_GPENCIL_LEGACY) != 0; + const bool is_mode_set = (ob->mode & OB_MODE_VERTEX_GREASE_PENCIL) != 0; if (!is_mode_set) { - mode = OB_MODE_VERTEX_GPENCIL_LEGACY; + mode = OB_MODE_VERTEX_GREASE_PENCIL; } else { mode = OB_MODE_OBJECT; } - if ((ob->restore_mode) && ((ob->mode & OB_MODE_VERTEX_GPENCIL_LEGACY) == 0) && (back == 1)) { + if ((ob->restore_mode) && ((ob->mode & OB_MODE_VERTEX_GREASE_PENCIL) == 0) && (back == 1)) { mode = ob->restore_mode; } ob->restore_mode = ob->mode; ob->mode = mode; - if (mode == OB_MODE_VERTEX_GPENCIL_LEGACY) { + if (mode == OB_MODE_VERTEX_GREASE_PENCIL) { /* Be sure we have brushes. * Need Draw as well (used for Palettes). */ BKE_paint_ensure(bmain, ts, (Paint **)&ts->gp_paint); diff --git a/source/blender/editors/grease_pencil/intern/grease_pencil_ops.cc b/source/blender/editors/grease_pencil/intern/grease_pencil_ops.cc index 5372ce59d76..9063380b7ba 100644 --- a/source/blender/editors/grease_pencil/intern/grease_pencil_ops.cc +++ b/source/blender/editors/grease_pencil/intern/grease_pencil_ops.cc @@ -87,10 +87,8 @@ bool grease_pencil_selection_poll(bContext *C) Object *object = CTX_data_active_object(C); /* Selection operators are available in multiple modes, e.g. for masking in sculpt and vertex * paint mode. */ - if (!ELEM(object->mode, - OB_MODE_EDIT, - OB_MODE_SCULPT_GPENCIL_LEGACY, - OB_MODE_VERTEX_GPENCIL_LEGACY)) + if (!ELEM( + object->mode, OB_MODE_EDIT, OB_MODE_SCULPT_GREASE_PENCIL, OB_MODE_VERTEX_GREASE_PENCIL)) { return false; } @@ -103,7 +101,7 @@ bool grease_pencil_painting_poll(bContext *C) return false; } Object *object = CTX_data_active_object(C); - if ((object->mode & OB_MODE_PAINT_GPENCIL_LEGACY) == 0) { + if ((object->mode & OB_MODE_PAINT_GREASE_PENCIL) == 0) { return false; } ToolSettings *ts = CTX_data_tool_settings(C); @@ -131,7 +129,7 @@ bool grease_pencil_sculpting_poll(bContext *C) return false; } Object *object = CTX_data_active_object(C); - if ((object->mode & OB_MODE_SCULPT_GPENCIL_LEGACY) == 0) { + if ((object->mode & OB_MODE_SCULPT_GREASE_PENCIL) == 0) { return false; } ToolSettings *ts = CTX_data_tool_settings(C); @@ -147,7 +145,7 @@ bool grease_pencil_weight_painting_poll(bContext *C) return false; } Object *object = CTX_data_active_object(C); - if ((object->mode & OB_MODE_WEIGHT_GPENCIL_LEGACY) == 0) { + if ((object->mode & OB_MODE_WEIGHT_GREASE_PENCIL) == 0) { return false; } ToolSettings *ts = CTX_data_tool_settings(C); @@ -163,7 +161,7 @@ bool grease_pencil_vertex_painting_poll(bContext *C) return false; } Object *object = CTX_data_active_object(C); - if ((object->mode & OB_MODE_VERTEX_GPENCIL_LEGACY) == 0) { + if ((object->mode & OB_MODE_VERTEX_GREASE_PENCIL) == 0) { return false; } ToolSettings *ts = CTX_data_tool_settings(C); diff --git a/source/blender/editors/grease_pencil/intern/grease_pencil_select.cc b/source/blender/editors/grease_pencil/intern/grease_pencil_select.cc index 278522a99d3..1ace7123609 100644 --- a/source/blender/editors/grease_pencil/intern/grease_pencil_select.cc +++ b/source/blender/editors/grease_pencil/intern/grease_pencil_select.cc @@ -1047,10 +1047,10 @@ blender::bke::AttrDomain ED_grease_pencil_selection_domain_get(const ToolSetting if (object->mode & OB_MODE_EDIT) { return ED_grease_pencil_edit_selection_domain_get(tool_settings); } - if (object->mode & OB_MODE_SCULPT_GPENCIL_LEGACY) { + if (object->mode & OB_MODE_SCULPT_GREASE_PENCIL) { return ED_grease_pencil_sculpt_selection_domain_get(tool_settings); } - if (object->mode & OB_MODE_VERTEX_GPENCIL_LEGACY) { + if (object->mode & OB_MODE_VERTEX_GREASE_PENCIL) { return ED_grease_pencil_vertex_selection_domain_get(tool_settings); } return blender::bke::AttrDomain::Point; @@ -1077,10 +1077,10 @@ bool ED_grease_pencil_segment_selection_enabled(const ToolSettings *tool_setting if (object->mode & OB_MODE_EDIT) { return ED_grease_pencil_edit_segment_selection_enabled(tool_settings); } - if (object->mode & OB_MODE_SCULPT_GPENCIL_LEGACY) { + if (object->mode & OB_MODE_SCULPT_GREASE_PENCIL) { return ED_grease_pencil_sculpt_segment_selection_enabled(tool_settings); } - if (object->mode & OB_MODE_VERTEX_GPENCIL_LEGACY) { + if (object->mode & OB_MODE_VERTEX_GREASE_PENCIL) { return ED_grease_pencil_vertex_segment_selection_enabled(tool_settings); } return false; diff --git a/source/blender/editors/interface/interface_icons.cc b/source/blender/editors/interface/interface_icons.cc index cce882183d6..f9e56b1ab67 100644 --- a/source/blender/editors/interface/interface_icons.cc +++ b/source/blender/editors/interface/interface_icons.cc @@ -1921,14 +1921,14 @@ int UI_icon_from_object_mode(const int mode) case OB_MODE_EDIT_GPENCIL_LEGACY: return ICON_EDITMODE_HLT; case OB_MODE_SCULPT: - case OB_MODE_SCULPT_GPENCIL_LEGACY: + case OB_MODE_SCULPT_GREASE_PENCIL: case OB_MODE_SCULPT_CURVES: return ICON_SCULPTMODE_HLT; case OB_MODE_VERTEX_PAINT: - case OB_MODE_VERTEX_GPENCIL_LEGACY: + case OB_MODE_VERTEX_GREASE_PENCIL: return ICON_VPAINT_HLT; case OB_MODE_WEIGHT_PAINT: - case OB_MODE_WEIGHT_GPENCIL_LEGACY: + case OB_MODE_WEIGHT_GREASE_PENCIL: return ICON_WPAINT_HLT; case OB_MODE_TEXTURE_PAINT: return ICON_TPAINT_HLT; @@ -1936,7 +1936,7 @@ int UI_icon_from_object_mode(const int mode) return ICON_PARTICLEMODE; case OB_MODE_POSE: return ICON_POSE_HLT; - case OB_MODE_PAINT_GPENCIL_LEGACY: + case OB_MODE_PAINT_GREASE_PENCIL: return ICON_GREASEPENCIL; } return ICON_NONE; diff --git a/source/blender/editors/object/object_modes.cc b/source/blender/editors/object/object_modes.cc index 195421990cf..77e604e6740 100644 --- a/source/blender/editors/object/object_modes.cc +++ b/source/blender/editors/object/object_modes.cc @@ -78,16 +78,16 @@ static const char *object_mode_op_string(eObjectMode mode) if (mode == OB_MODE_POSE) { return "OBJECT_OT_posemode_toggle"; } - if (mode == OB_MODE_PAINT_GPENCIL_LEGACY) { + if (mode == OB_MODE_PAINT_GREASE_PENCIL) { return "GREASE_PENCIL_OT_paintmode_toggle"; } - if (mode == OB_MODE_SCULPT_GPENCIL_LEGACY) { + if (mode == OB_MODE_SCULPT_GREASE_PENCIL) { return "GREASE_PENCIL_OT_sculptmode_toggle"; } - if (mode == OB_MODE_WEIGHT_GPENCIL_LEGACY) { + if (mode == OB_MODE_WEIGHT_GREASE_PENCIL) { return "GREASE_PENCIL_OT_weightmode_toggle"; } - if (mode == OB_MODE_VERTEX_GPENCIL_LEGACY) { + if (mode == OB_MODE_VERTEX_GREASE_PENCIL) { return "GREASE_PENCIL_OT_vertexmode_toggle"; } if (mode == OB_MODE_SCULPT_CURVES) { @@ -141,8 +141,8 @@ bool mode_compat_test(const Object *ob, eObjectMode mode) } break; case OB_GREASE_PENCIL: - if (mode & (OB_MODE_EDIT | OB_MODE_PAINT_GPENCIL_LEGACY | OB_MODE_SCULPT_GPENCIL_LEGACY | - OB_MODE_WEIGHT_GPENCIL_LEGACY | OB_MODE_VERTEX_GPENCIL_LEGACY)) + if (mode & (OB_MODE_EDIT | OB_MODE_PAINT_GREASE_PENCIL | OB_MODE_SCULPT_GREASE_PENCIL | + OB_MODE_WEIGHT_GREASE_PENCIL | OB_MODE_VERTEX_GREASE_PENCIL)) { return true; } @@ -306,8 +306,8 @@ static bool ed_object_mode_generic_exit_ex( return true; } ob->restore_mode = ob->mode; - ob->mode &= ~(OB_MODE_PAINT_GPENCIL_LEGACY | OB_MODE_EDIT | OB_MODE_SCULPT_GPENCIL_LEGACY | - OB_MODE_WEIGHT_GPENCIL_LEGACY | OB_MODE_VERTEX_GPENCIL_LEGACY); + ob->mode &= ~(OB_MODE_PAINT_GREASE_PENCIL | OB_MODE_EDIT | OB_MODE_SCULPT_GREASE_PENCIL | + OB_MODE_WEIGHT_GREASE_PENCIL | OB_MODE_VERTEX_GREASE_PENCIL); /* Inform all evaluated versions that we changed the mode. */ DEG_id_tag_update_ex(bmain, &ob->id, ID_RECALC_SYNC_TO_EVAL); diff --git a/source/blender/editors/sculpt_paint/paint_ops.cc b/source/blender/editors/sculpt_paint/paint_ops.cc index d2c173aab3e..c5b92a31661 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.cc +++ b/source/blender/editors/sculpt_paint/paint_ops.cc @@ -58,7 +58,7 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op) /* Grease Pencil brushes in Paint mode do not use unified size. */ const bool use_unified_size = !(brush && brush->gpencil_settings && - brush->ob_mode == OB_MODE_PAINT_GPENCIL_LEGACY); + brush->ob_mode == OB_MODE_PAINT_GREASE_PENCIL); if (brush) { /* Pixel radius. */ diff --git a/source/blender/editors/space_view3d/view3d_select.cc b/source/blender/editors/space_view3d/view3d_select.cc index a4c40cd697b..6f17b7397a1 100644 --- a/source/blender/editors/space_view3d/view3d_select.cc +++ b/source/blender/editors/space_view3d/view3d_select.cc @@ -465,8 +465,7 @@ static bool view3d_selectable_data(bContext *C) if (ob->mode & OB_MODE_EDIT) { return ob->type != OB_FONT; } - if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT | OB_MODE_SCULPT_GPENCIL_LEGACY)) - { + if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT | OB_MODE_SCULPT_GREASE_PENCIL)) { return BKE_paint_select_elem_test(ob); } if (ob->mode & OB_MODE_WEIGHT_PAINT) { diff --git a/source/blender/makesdna/DNA_object_enums.h b/source/blender/makesdna/DNA_object_enums.h index 0984bf1579e..2463fb3e2fc 100644 --- a/source/blender/makesdna/DNA_object_enums.h +++ b/source/blender/makesdna/DNA_object_enums.h @@ -21,10 +21,10 @@ typedef enum eObjectMode { OB_MODE_PARTICLE_EDIT = 1 << 5, OB_MODE_POSE = 1 << 6, OB_MODE_EDIT_GPENCIL_LEGACY = 1 << 7, - OB_MODE_PAINT_GPENCIL_LEGACY = 1 << 8, - OB_MODE_SCULPT_GPENCIL_LEGACY = 1 << 9, - OB_MODE_WEIGHT_GPENCIL_LEGACY = 1 << 10, - OB_MODE_VERTEX_GPENCIL_LEGACY = 1 << 11, + OB_MODE_PAINT_GREASE_PENCIL = 1 << 8, + OB_MODE_SCULPT_GREASE_PENCIL = 1 << 9, + OB_MODE_WEIGHT_GREASE_PENCIL = 1 << 10, + OB_MODE_VERTEX_GREASE_PENCIL = 1 << 11, OB_MODE_SCULPT_CURVES = 1 << 12, } eObjectMode; @@ -43,14 +43,14 @@ typedef enum eDrawType { (OB_MODE_SCULPT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT) #define OB_MODE_ALL_PAINT_GPENCIL \ - (OB_MODE_PAINT_GPENCIL_LEGACY | OB_MODE_SCULPT_GPENCIL_LEGACY | OB_MODE_WEIGHT_GPENCIL_LEGACY | \ - OB_MODE_VERTEX_GPENCIL_LEGACY) + (OB_MODE_PAINT_GREASE_PENCIL | OB_MODE_SCULPT_GREASE_PENCIL | OB_MODE_WEIGHT_GREASE_PENCIL | \ + OB_MODE_VERTEX_GREASE_PENCIL) /** Any mode that uses Object.sculpt. */ #define OB_MODE_ALL_SCULPT (OB_MODE_SCULPT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT) /** Any mode that uses weight-paint. */ -#define OB_MODE_ALL_WEIGHT_PAINT (OB_MODE_WEIGHT_PAINT | OB_MODE_WEIGHT_GPENCIL_LEGACY) +#define OB_MODE_ALL_WEIGHT_PAINT (OB_MODE_WEIGHT_PAINT | OB_MODE_WEIGHT_GREASE_PENCIL) /** * Any mode that has data or for Grease Pencil modes, we need to free when switching modes, @@ -58,5 +58,5 @@ typedef enum eDrawType { */ #define OB_MODE_ALL_MODE_DATA \ (OB_MODE_EDIT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_SCULPT | OB_MODE_POSE | \ - OB_MODE_PAINT_GPENCIL_LEGACY | OB_MODE_EDIT_GPENCIL_LEGACY | OB_MODE_SCULPT_GPENCIL_LEGACY | \ - OB_MODE_WEIGHT_GPENCIL_LEGACY | OB_MODE_VERTEX_GPENCIL_LEGACY | OB_MODE_SCULPT_CURVES) + OB_MODE_PAINT_GREASE_PENCIL | OB_MODE_EDIT_GPENCIL_LEGACY | OB_MODE_SCULPT_GREASE_PENCIL | \ + OB_MODE_WEIGHT_GREASE_PENCIL | OB_MODE_VERTEX_GREASE_PENCIL | OB_MODE_SCULPT_CURVES) diff --git a/source/blender/makesrna/intern/rna_brush.cc b/source/blender/makesrna/intern/rna_brush.cc index 4b075b2b41c..f35cd095ee4 100644 --- a/source/blender/makesrna/intern/rna_brush.cc +++ b/source/blender/makesrna/intern/rna_brush.cc @@ -3660,11 +3660,11 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Use Texture", "Use this brush in texture paint mode"); prop = RNA_def_property(srna, "use_paint_grease_pencil", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, nullptr, "ob_mode", OB_MODE_PAINT_GPENCIL_LEGACY); + RNA_def_property_boolean_sdna(prop, nullptr, "ob_mode", OB_MODE_PAINT_GREASE_PENCIL); RNA_def_property_ui_text(prop, "Use Paint", "Use this brush in grease pencil drawing mode"); prop = RNA_def_property(srna, "use_vertex_grease_pencil", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, nullptr, "ob_mode", OB_MODE_VERTEX_GPENCIL_LEGACY); + RNA_def_property_boolean_sdna(prop, nullptr, "ob_mode", OB_MODE_VERTEX_GREASE_PENCIL); RNA_def_property_ui_text( prop, "Use Vertex", "Use this brush in grease pencil vertex color mode"); diff --git a/source/blender/makesrna/intern/rna_object.cc b/source/blender/makesrna/intern/rna_object.cc index 96c74a51363..09aa19d6c9a 100644 --- a/source/blender/makesrna/intern/rna_object.cc +++ b/source/blender/makesrna/intern/rna_object.cc @@ -68,23 +68,23 @@ const EnumPropertyItem rna_enum_object_mode_items[] = { ICON_EDITMODE_HLT, "Edit Mode", "Edit Grease Pencil Strokes"}, - {OB_MODE_SCULPT_GPENCIL_LEGACY, - "SCULPT_GPENCIL", + {OB_MODE_SCULPT_GREASE_PENCIL, + "SCULPT_GREASE_PENCIL", ICON_SCULPTMODE_HLT, "Sculpt Mode", "Sculpt Grease Pencil Strokes"}, - {OB_MODE_PAINT_GPENCIL_LEGACY, - "PAINT_GPENCIL", + {OB_MODE_PAINT_GREASE_PENCIL, + "PAINT_GREASE_PENCIL", ICON_GREASEPENCIL, "Draw Mode", "Paint Grease Pencil Strokes"}, - {OB_MODE_WEIGHT_GPENCIL_LEGACY, - "WEIGHT_GPENCIL", + {OB_MODE_WEIGHT_GREASE_PENCIL, + "WEIGHT_GREASE_PENCIL", ICON_WPAINT_HLT, "Weight Paint", "Grease Pencil Weight Paint Strokes"}, - {OB_MODE_VERTEX_GPENCIL_LEGACY, - "VERTEX_GPENCIL", + {OB_MODE_VERTEX_GREASE_PENCIL, + "VERTEX_GREASE_PENCIL", ICON_VPAINT_HLT, "Vertex Paint", "Grease Pencil Vertex Paint Strokes"}, @@ -106,23 +106,23 @@ const EnumPropertyItem rna_enum_workspace_object_mode_items[] = { ICON_EDITMODE_HLT, "Grease Pencil Edit Mode", "Edit Grease Pencil Strokes"}, - {OB_MODE_SCULPT_GPENCIL_LEGACY, - "SCULPT_GPENCIL", + {OB_MODE_SCULPT_GREASE_PENCIL, + "SCULPT_GREASE_PENCIL", ICON_SCULPTMODE_HLT, "Grease Pencil Sculpt Mode", "Sculpt Grease Pencil Strokes"}, - {OB_MODE_PAINT_GPENCIL_LEGACY, - "PAINT_GPENCIL", + {OB_MODE_PAINT_GREASE_PENCIL, + "PAINT_GREASE_PENCIL", ICON_GREASEPENCIL, "Grease Pencil Draw", "Paint Grease Pencil Strokes"}, - {OB_MODE_VERTEX_GPENCIL_LEGACY, - "VERTEX_GPENCIL", + {OB_MODE_VERTEX_GREASE_PENCIL, + "VERTEX_GREASE_PENCIL", ICON_VPAINT_HLT, "Grease Pencil Vertex Paint", "Grease Pencil Vertex Paint Strokes"}, - {OB_MODE_WEIGHT_GPENCIL_LEGACY, - "WEIGHT_GPENCIL", + {OB_MODE_WEIGHT_GREASE_PENCIL, + "WEIGHT_GREASE_PENCIL", ICON_WPAINT_HLT, "Grease Pencil Weight Paint", "Grease Pencil Weight Paint Strokes"}, diff --git a/source/blender/windowmanager/intern/wm_operators.cc b/source/blender/windowmanager/intern/wm_operators.cc index de5e214272c..6a8da90cda0 100644 --- a/source/blender/windowmanager/intern/wm_operators.cc +++ b/source/blender/windowmanager/intern/wm_operators.cc @@ -2638,7 +2638,7 @@ static void radial_control_set_initial_mouse(bContext *C, RadialControl *rc, con rc->scale_fac = 1.0f; if (rc->ptr.owner_id && GS(rc->ptr.owner_id->name) == ID_BR && rc->prop == &rna_Brush_size) { Brush *brush = reinterpret_cast(rc->ptr.owner_id); - if ((brush && brush->gpencil_settings) && (brush->ob_mode == OB_MODE_PAINT_GPENCIL_LEGACY) && + if ((brush && brush->gpencil_settings) && (brush->ob_mode == OB_MODE_PAINT_GREASE_PENCIL) && (brush->gpencil_brush_type == GPAINT_BRUSH_TYPE_DRAW) && (brush->flag & BRUSH_LOCK_SIZE) != 0) { diff --git a/tools/utils_maintenance/blender_menu_search_coverage.py b/tools/utils_maintenance/blender_menu_search_coverage.py index b4d247c65e8..8e3c5f00d54 100644 --- a/tools/utils_maintenance/blender_menu_search_coverage.py +++ b/tools/utils_maintenance/blender_menu_search_coverage.py @@ -480,23 +480,23 @@ def ctx_gpencil_edit(): def ctx_gpencil_sculpt(): - bpy.ops.object.gpencil_add(type='STROKE') - bpy.ops.object.mode_set(mode='SCULPT_GPENCIL') + bpy.ops.object.grease_pencil_add(type='STROKE') + bpy.ops.object.mode_set(mode='SCULPT_GREASE_PENCIL') def ctx_gpencil_paint_weight(): - bpy.ops.object.gpencil_add(type='STROKE') - bpy.ops.object.mode_set(mode='WEIGHT_GPENCIL') + bpy.ops.object.grease_pencil_add(type='STROKE') + bpy.ops.object.mode_set(mode='WEIGHT_GREASE_PENCIL') def ctx_gpencil_paint_vertex(): - bpy.ops.object.gpencil_add(type='STROKE') - bpy.ops.object.mode_set(mode='VERTEX_GPENCIL') + bpy.ops.object.grease_pencil_add(type='STROKE') + bpy.ops.object.mode_set(mode='VERTEX_GREASE_PENCIL') def ctx_gpencil_paint_draw(): - bpy.ops.object.gpencil_add(type='STROKE') - bpy.ops.object.mode_set(mode='PAINT_GPENCIL') + bpy.ops.object.grease_pencil_add(type='STROKE') + bpy.ops.object.mode_set(mode='PAINT_GREASE_PENCIL') # ------------