diff options
-rw-r--r-- | source/blender/blenkernel/BKE_paint.h | 30 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/paint.c | 124 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 14 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_cursor.c | 16 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_curve.c | 12 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 10 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 24 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_stroke.c | 16 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 8 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 8 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_uv.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 12 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_toolsystem.c | 2 |
13 files changed, 140 insertions, 138 deletions
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 6f54e2b3b17..e09aed4b372 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -75,33 +75,35 @@ extern const char PAINT_CURSOR_WEIGHT_PAINT[3]; extern const char PAINT_CURSOR_TEXTURE_PAINT[3]; typedef enum ePaintMode { - ePaintSculpt = 0, + PAINT_MODE_SCULPT = 0, /** Vertex color. */ - ePaintVertex = 1, - ePaintWeight = 2, + PAINT_MODE_VERTEX = 1, + PAINT_MODE_WEIGHT = 2, /** 3D view (projection painting). */ - ePaintTexture3D = 3, + PAINT_MODE_TEXTURE_3D = 3, /** Image space (2D painting). */ - ePaintTexture2D = 4, - ePaintSculptUV = 5, - ePaintGpencil = 6, + PAINT_MODE_TEXTURE_2D = 4, + PAINT_MODE_SCULPT_UV = 5, + PAINT_MODE_GPENCIL = 6, - ePaintInvalid = 7, + /** Keep last. */ + PAINT_MODE_INVALID = 7, } ePaintMode; /* overlay invalidation */ typedef enum eOverlayControlFlags { - PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY = 1, - PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY = (1 << 2), - PAINT_INVALID_OVERLAY_CURVE = (1 << 3), + PAINT_OVERLAY_INVALID_TEXTURE_PRIMARY = 1, + PAINT_OVERLAY_INVALID_TEXTURE_SECONDARY = (1 << 2), + PAINT_OVERLAY_INVALID_CURVE = (1 << 3), PAINT_OVERLAY_OVERRIDE_CURSOR = (1 << 4), PAINT_OVERLAY_OVERRIDE_PRIMARY = (1 << 5), PAINT_OVERLAY_OVERRIDE_SECONDARY = (1 << 6) } eOverlayControlFlags; -#define PAINT_OVERRIDE_MASK (PAINT_OVERLAY_OVERRIDE_SECONDARY | \ - PAINT_OVERLAY_OVERRIDE_PRIMARY | \ - PAINT_OVERLAY_OVERRIDE_CURSOR) +#define PAINT_OVERRIDE_MASK \ + (PAINT_OVERLAY_OVERRIDE_SECONDARY | \ + PAINT_OVERLAY_OVERRIDE_PRIMARY | \ + PAINT_OVERLAY_OVERRIDE_CURSOR) void BKE_paint_invalidate_overlay_tex(struct Scene *scene, struct ViewLayer *view_layer, const struct Tex *tex); void BKE_paint_invalidate_cursor_overlay(struct Scene *scene, struct ViewLayer *view_layer, struct CurveMapping *curve); diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index e31021d7d48..24782af4d22 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -99,9 +99,9 @@ void BKE_paint_invalidate_overlay_tex(Scene *scene, ViewLayer *view_layer, const return; if (br->mtex.tex == tex) - overlay_flags |= PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY; + overlay_flags |= PAINT_OVERLAY_INVALID_TEXTURE_PRIMARY; if (br->mask_mtex.tex == tex) - overlay_flags |= PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY; + overlay_flags |= PAINT_OVERLAY_INVALID_TEXTURE_SECONDARY; } void BKE_paint_invalidate_cursor_overlay(Scene *scene, ViewLayer *view_layer, CurveMapping *curve) @@ -110,14 +110,14 @@ void BKE_paint_invalidate_cursor_overlay(Scene *scene, ViewLayer *view_layer, Cu Brush *br = p->brush; if (br && br->curve == curve) - overlay_flags |= PAINT_INVALID_OVERLAY_CURVE; + overlay_flags |= PAINT_OVERLAY_INVALID_CURVE; } void BKE_paint_invalidate_overlay_all(void) { - overlay_flags |= (PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY | - PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY | - PAINT_INVALID_OVERLAY_CURVE); + overlay_flags |= (PAINT_OVERLAY_INVALID_TEXTURE_SECONDARY | + PAINT_OVERLAY_INVALID_TEXTURE_PRIMARY | + PAINT_OVERLAY_INVALID_CURVE); } eOverlayControlFlags BKE_paint_get_overlay_flags(void) @@ -151,20 +151,20 @@ Paint *BKE_paint_get_active_from_paintmode(Scene *sce, ePaintMode mode) ToolSettings *ts = sce->toolsettings; switch (mode) { - case ePaintSculpt: + case PAINT_MODE_SCULPT: return &ts->sculpt->paint; - case ePaintVertex: + case PAINT_MODE_VERTEX: return &ts->vpaint->paint; - case ePaintWeight: + case PAINT_MODE_WEIGHT: return &ts->wpaint->paint; - case ePaintTexture2D: - case ePaintTexture3D: + case PAINT_MODE_TEXTURE_2D: + case PAINT_MODE_TEXTURE_3D: return &ts->imapaint.paint; - case ePaintSculptUV: + case PAINT_MODE_SCULPT_UV: return &ts->uvsculpt->paint; - case ePaintGpencil: + case PAINT_MODE_GPENCIL: return &ts->gp_paint->paint; - case ePaintInvalid: + case PAINT_MODE_INVALID: return NULL; default: return &ts->imapaint.paint; @@ -177,20 +177,20 @@ Paint *BKE_paint_get_active_from_paintmode(Scene *sce, ePaintMode mode) const EnumPropertyItem *BKE_paint_get_tool_enum_from_paintmode(ePaintMode mode) { switch (mode) { - case ePaintSculpt: + case PAINT_MODE_SCULPT: return rna_enum_brush_sculpt_tool_items; - case ePaintVertex: + case PAINT_MODE_VERTEX: return rna_enum_brush_vertex_tool_items; - case ePaintWeight: + case PAINT_MODE_WEIGHT: return rna_enum_brush_weight_tool_items; - case ePaintTexture2D: - case ePaintTexture3D: + case PAINT_MODE_TEXTURE_2D: + case PAINT_MODE_TEXTURE_3D: return rna_enum_brush_image_tool_items; - case ePaintSculptUV: + case PAINT_MODE_SCULPT_UV: return NULL; - case ePaintGpencil: + case PAINT_MODE_GPENCIL: return rna_enum_brush_gpencil_types_items; - case ePaintInvalid: + case PAINT_MODE_INVALID: break; } return NULL; @@ -199,12 +199,12 @@ const EnumPropertyItem *BKE_paint_get_tool_enum_from_paintmode(ePaintMode mode) const char *BKE_paint_get_tool_prop_id_from_paintmode(ePaintMode mode) { switch (mode) { - case ePaintSculpt: return "sculpt_tool"; - case ePaintVertex: return "vertex_tool"; - case ePaintWeight: return "weight_tool"; - case ePaintTexture2D: - case ePaintTexture3D: return "image_tool"; - case ePaintGpencil: return "gpencil_tool"; + case PAINT_MODE_SCULPT: return "sculpt_tool"; + case PAINT_MODE_VERTEX: return "vertex_tool"; + case PAINT_MODE_WEIGHT: return "weight_tool"; + case PAINT_MODE_TEXTURE_2D: + case PAINT_MODE_TEXTURE_3D: return "image_tool"; + case PAINT_MODE_GPENCIL: return "gpencil_tool"; default: /* invalid paint mode */ return NULL; @@ -292,39 +292,39 @@ ePaintMode BKE_paintmode_get_active_from_context(const bContext *C) if ((sima = CTX_wm_space_image(C)) != NULL) { if (obact && obact->mode == OB_MODE_EDIT) { if (sima->mode == SI_MODE_PAINT) - return ePaintTexture2D; + return PAINT_MODE_TEXTURE_2D; else if (ts->use_uv_sculpt) - return ePaintSculptUV; + return PAINT_MODE_SCULPT_UV; } else { - return ePaintTexture2D; + return PAINT_MODE_TEXTURE_2D; } } else if (obact) { switch (obact->mode) { case OB_MODE_SCULPT: - return ePaintSculpt; + return PAINT_MODE_SCULPT; case OB_MODE_VERTEX_PAINT: - return ePaintVertex; + return PAINT_MODE_VERTEX; case OB_MODE_WEIGHT_PAINT: - return ePaintWeight; + return PAINT_MODE_WEIGHT; case OB_MODE_TEXTURE_PAINT: - return ePaintTexture3D; + return PAINT_MODE_TEXTURE_3D; case OB_MODE_EDIT: if (ts->use_uv_sculpt) - return ePaintSculptUV; - return ePaintTexture2D; + return PAINT_MODE_SCULPT_UV; + return PAINT_MODE_TEXTURE_2D; default: - return ePaintTexture2D; + return PAINT_MODE_TEXTURE_2D; } } else { /* default to image paint */ - return ePaintTexture2D; + return PAINT_MODE_TEXTURE_2D; } } - return ePaintInvalid; + return PAINT_MODE_INVALID; } ePaintMode BKE_paintmode_get_from_tool(const struct bToolRef *tref) @@ -332,25 +332,25 @@ ePaintMode BKE_paintmode_get_from_tool(const struct bToolRef *tref) if (tref->space_type == SPACE_VIEW3D) { switch (tref->mode) { case CTX_MODE_SCULPT: - return ePaintSculpt; + return PAINT_MODE_SCULPT; case CTX_MODE_PAINT_VERTEX: - return ePaintVertex; + return PAINT_MODE_VERTEX; case CTX_MODE_PAINT_WEIGHT: - return ePaintWeight; + return PAINT_MODE_WEIGHT; case CTX_MODE_GPENCIL_PAINT: - return ePaintGpencil; + return PAINT_MODE_GPENCIL; case CTX_MODE_PAINT_TEXTURE: - return ePaintTexture3D; + return PAINT_MODE_TEXTURE_3D; } } else if (tref->space_type == SPACE_IMAGE) { switch (tref->mode) { case SI_MODE_PAINT: - return ePaintTexture2D; + return PAINT_MODE_TEXTURE_2D; } } - return ePaintInvalid; + return PAINT_MODE_INVALID; } Brush *BKE_paint_brush(Paint *p) @@ -404,19 +404,19 @@ void BKE_paint_runtime_init(const ToolSettings *ts, Paint *paint) uint BKE_paint_get_brush_tool_offset_from_paintmode(const ePaintMode mode) { switch (mode) { - case ePaintTexture2D: - case ePaintTexture3D: + case PAINT_MODE_TEXTURE_2D: + case PAINT_MODE_TEXTURE_3D: return offsetof(Brush, imagepaint_tool); - case ePaintSculpt: + case PAINT_MODE_SCULPT: return offsetof(Brush, sculpt_tool); - case ePaintVertex: + case PAINT_MODE_VERTEX: return offsetof(Brush, vertexpaint_tool); - case ePaintWeight: + case PAINT_MODE_WEIGHT: return offsetof(Brush, weightpaint_tool); - case ePaintGpencil: + case PAINT_MODE_GPENCIL: return offsetof(Brush, gpencil_tool); - case ePaintSculptUV: - case ePaintInvalid: + case PAINT_MODE_SCULPT_UV: + case PAINT_MODE_INVALID: break; /* We don't use these yet. */ } return 0; @@ -620,18 +620,18 @@ void BKE_paint_cavity_curve_preset(Paint *p, int preset) eObjectMode BKE_paint_object_mode_from_paintmode(ePaintMode mode) { switch (mode) { - case ePaintSculpt: + case PAINT_MODE_SCULPT: return OB_MODE_SCULPT; - case ePaintVertex: + case PAINT_MODE_VERTEX: return OB_MODE_VERTEX_PAINT; - case ePaintWeight: + case PAINT_MODE_WEIGHT: return OB_MODE_WEIGHT_PAINT; - case ePaintTexture2D: - case ePaintTexture3D: + case PAINT_MODE_TEXTURE_2D: + case PAINT_MODE_TEXTURE_3D: return OB_MODE_TEXTURE_PAINT; - case ePaintSculptUV: + case PAINT_MODE_SCULPT_UV: return OB_MODE_EDIT; - case ePaintInvalid: + case PAINT_MODE_INVALID: default: return 0; } diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 69f42fbfc07..d8bdeaa8159 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1676,7 +1676,7 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id) WorkSpace *workspace = CTX_wm_workspace(C); Object *ob = CTX_data_active_object(C); const EnumPropertyItem *items = NULL; - ePaintMode paint_mode = ePaintInvalid; + ePaintMode paint_mode = PAINT_MODE_INVALID; ScrArea *sa = CTX_wm_area(C); char space_type = sa->spacetype; /* When in an unsupported space. */ @@ -1690,16 +1690,16 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id) if ((space_type == SPACE_VIEW3D) && ob) { if (ob->mode & OB_MODE_SCULPT) { - paint_mode = ePaintSculpt; + paint_mode = PAINT_MODE_SCULPT; } else if (ob->mode & OB_MODE_VERTEX_PAINT) { - paint_mode = ePaintVertex; + paint_mode = PAINT_MODE_VERTEX; } else if (ob->mode & OB_MODE_WEIGHT_PAINT) { - paint_mode = ePaintWeight; + paint_mode = PAINT_MODE_WEIGHT; } else if (ob->mode & OB_MODE_TEXTURE_PAINT) { - paint_mode = ePaintTexture3D; + paint_mode = PAINT_MODE_TEXTURE_3D; } } else if (space_type == SPACE_IMAGE) { @@ -1713,7 +1713,7 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id) } if (sima_mode == SI_MODE_PAINT) { - paint_mode = ePaintTexture2D; + paint_mode = PAINT_MODE_TEXTURE_2D; } } @@ -1759,7 +1759,7 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id) } return id->icon_id; } - else if (paint_mode != ePaintInvalid) { + else if (paint_mode != PAINT_MODE_INVALID) { items = BKE_paint_get_tool_enum_from_paintmode(paint_mode); const uint tool_offset = BKE_paint_get_brush_tool_offset_from_paintmode(paint_mode); const int tool_type = *(char *)POINTER_OFFSET(br, tool_offset); diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index dfad5afc9dc..6a2a374f87d 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -261,8 +261,8 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima bool refresh; eOverlayControlFlags invalid = ( (primary) ? - (overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY) : - (overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY)); + (overlay_flags & PAINT_OVERLAY_INVALID_TEXTURE_PRIMARY) : + (overlay_flags & PAINT_OVERLAY_INVALID_TEXTURE_SECONDARY)); target = (primary) ? &primary_snap : &secondary_snap; refresh = @@ -415,7 +415,7 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom) int size; const bool refresh = !cursor_snap.overlay_texture || - (overlay_flags & PAINT_INVALID_OVERLAY_CURVE) || + (overlay_flags & PAINT_OVERLAY_INVALID_CURVE) || cursor_snap.zoom != zoom; init = (cursor_snap.overlay_texture != 0); @@ -489,7 +489,7 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); - BKE_paint_reset_overlay_invalid(PAINT_INVALID_OVERLAY_CURVE); + BKE_paint_reset_overlay_invalid(PAINT_OVERLAY_INVALID_CURVE); return 1; } @@ -802,7 +802,7 @@ static void paint_draw_alpha_overlay( ViewContext *vc, int x, int y, float zoom, ePaintMode mode) { /* color means that primary brush texture is colured and secondary is used for alpha/mask control */ - bool col = ELEM(mode, ePaintTexture3D, ePaintTexture2D, ePaintVertex) ? true : false; + bool col = ELEM(mode, PAINT_MODE_TEXTURE_3D, PAINT_MODE_TEXTURE_2D, PAINT_MODE_VERTEX) ? true : false; eOverlayControlFlags flags = BKE_paint_get_overlay_flags(); gpuPushAttrib(GPU_DEPTH_BUFFER_BIT | GPU_BLEND_BIT); @@ -822,7 +822,7 @@ static void paint_draw_alpha_overlay( paint_draw_cursor_overlay(ups, brush, vc, x, y, zoom); } else { - if (!(flags & PAINT_OVERLAY_OVERRIDE_PRIMARY) && (mode != ePaintWeight)) + if (!(flags & PAINT_OVERLAY_OVERRIDE_PRIMARY) && (mode != PAINT_MODE_WEIGHT)) paint_draw_tex_overlay(ups, brush, vc, x, y, zoom, false, true); if (!(flags & PAINT_OVERLAY_OVERRIDE_CURSOR)) paint_draw_cursor_overlay(ups, brush, vc, x, y, zoom); @@ -1033,7 +1033,7 @@ static void paint_cursor_on_hit( static bool ommit_cursor_drawing(Paint *paint, ePaintMode mode, Brush *brush) { if (paint->flags & PAINT_SHOW_BRUSH) { - if (ELEM(mode, ePaintTexture2D, ePaintTexture3D) && brush->imagepaint_tool == PAINT_TOOL_FILL) { + if (ELEM(mode, PAINT_MODE_TEXTURE_2D, PAINT_MODE_TEXTURE_3D) && brush->imagepaint_tool == PAINT_TOOL_FILL) { return true; } return false; @@ -1090,7 +1090,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) /* TODO: as sculpt and other paint modes are unified, this * special mode of drawing will go away */ - if ((mode == ePaintSculpt) && vc.obact->sculpt) { + if ((mode == PAINT_MODE_SCULPT) && vc.obact->sculpt) { float location[3]; int pixel_radius; diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c index 90e068ab17a..e9918481408 100644 --- a/source/blender/editors/sculpt_paint/paint_curve.c +++ b/source/blender/editors/sculpt_paint/paint_curve.c @@ -660,17 +660,17 @@ static int paintcurve_draw_exec(bContext *C, wmOperator *UNUSED(op)) const char *name; switch (mode) { - case ePaintTexture2D: - case ePaintTexture3D: + case PAINT_MODE_TEXTURE_2D: + case PAINT_MODE_TEXTURE_3D: name = "PAINT_OT_image_paint"; break; - case ePaintWeight: + case PAINT_MODE_WEIGHT: name = "PAINT_OT_weight_paint"; break; - case ePaintVertex: + case PAINT_MODE_VERTEX: name = "PAINT_OT_vertex_paint"; break; - case ePaintSculpt: + case PAINT_MODE_SCULPT: name = "SCULPT_OT_brush_stroke"; break; default: @@ -700,7 +700,7 @@ static int paintcurve_cursor_invoke(bContext *C, wmOperator *UNUSED(op), const w ePaintMode mode = BKE_paintmode_get_active_from_context(C); switch (mode) { - case ePaintTexture2D: + case PAINT_MODE_TEXTURE_2D: { ARegion *ar = CTX_wm_region(C); SpaceImage *sima = CTX_wm_space_image(C); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index e528c64b6e2..f9b2e0bbb01 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -770,7 +770,7 @@ void ED_space_image_paint_update(Main *bmain, wmWindowManager *wm, Scene *scene) } if (enabled) { - BKE_paint_init(bmain, scene, ePaintTexture2D, PAINT_CURSOR_TEXTURE_PAINT); + BKE_paint_init(bmain, scene, PAINT_MODE_TEXTURE_2D, PAINT_CURSOR_TEXTURE_PAINT); paint_cursor_start_explicit(&imapaint->paint, wm, image_paint_poll); } @@ -919,7 +919,7 @@ static int sample_color_exec(bContext *C, wmOperator *op) RNA_int_get_array(op->ptr, "location", location); const bool use_palette = RNA_boolean_get(op->ptr, "palette"); - const bool use_sample_texture = (mode == ePaintTexture3D) && !RNA_boolean_get(op->ptr, "merged"); + const bool use_sample_texture = (mode == PAINT_MODE_TEXTURE_3D) && !RNA_boolean_get(op->ptr, "merged"); paint_sample_color(C, ar, location[0], location[1], use_sample_texture, use_palette); @@ -959,7 +959,7 @@ static int sample_color_invoke(bContext *C, wmOperator *op, const wmEvent *event RNA_int_set_array(op->ptr, "location", event->mval); ePaintMode mode = BKE_paintmode_get_active_from_context(C); - const bool use_sample_texture = (mode == ePaintTexture3D) && !RNA_boolean_get(op->ptr, "merged"); + const bool use_sample_texture = (mode == PAINT_MODE_TEXTURE_3D) && !RNA_boolean_get(op->ptr, "merged"); paint_sample_color(C, ar, event->mval[0], event->mval[1], use_sample_texture, false); WM_cursor_modal_set(win, BC_EYEDROPPER_CURSOR); @@ -993,7 +993,7 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event) } ePaintMode mode = BKE_paintmode_get_active_from_context(C); - const bool use_sample_texture = (mode == ePaintTexture3D) && !RNA_boolean_get(op->ptr, "merged"); + const bool use_sample_texture = (mode == PAINT_MODE_TEXTURE_3D) && !RNA_boolean_get(op->ptr, "merged"); switch (event->type) { case MOUSEMOVE: @@ -1130,7 +1130,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) ob->mode |= mode_flag; - BKE_paint_init(bmain, scene, ePaintTexture3D, PAINT_CURSOR_TEXTURE_PAINT); + BKE_paint_init(bmain, scene, PAINT_MODE_TEXTURE_3D, PAINT_CURSOR_TEXTURE_PAINT); BKE_paint_toolslots_brush_validate(bmain, &imapaint->paint); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 316372ece4e..a48541c990f 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -113,7 +113,7 @@ static int brush_add_gpencil_exec(bContext *C, wmOperator *UNUSED(op)) Paint *paint = &ts->gp_paint->paint; Brush *br = BKE_paint_brush(paint); Main *bmain = CTX_data_main(C); - // ePaintMode mode = ePaintGpencil; + // ePaintMode mode = PAINT_MODE_GPENCIL; if (br) { br = BKE_brush_copy(bmain, br); @@ -253,11 +253,11 @@ static int palette_color_add_exec(bContext *C, wmOperator *UNUSED(op)) color = BKE_palette_color_add(palette); palette->active_color = BLI_listbase_count(&palette->colors) - 1; - if (ELEM(mode, ePaintTexture3D, ePaintTexture2D, ePaintVertex)) { + if (ELEM(mode, PAINT_MODE_TEXTURE_3D, PAINT_MODE_TEXTURE_2D, PAINT_MODE_VERTEX)) { copy_v3_v3(color->rgb, BKE_brush_color_get(scene, brush)); color->value = 0.0; } - else if (mode == ePaintWeight) { + else if (mode == PAINT_MODE_WEIGHT) { zero_v3(color->rgb); color->value = brush->weight; } @@ -458,9 +458,9 @@ static int brush_select_exec(bContext *C, wmOperator *op) const bool toggle = RNA_boolean_get(op->ptr, "toggle"); const char *tool_name = "Brush"; - if (paint_mode == ePaintInvalid) { + if (paint_mode == PAINT_MODE_INVALID) { paint_mode = BKE_paintmode_get_active_from_context(C); - if (paint_mode == ePaintInvalid) { + if (paint_mode == PAINT_MODE_INVALID) { return OPERATOR_CANCELLED; } } @@ -485,12 +485,12 @@ static void PAINT_OT_brush_select(wmOperatorType *ot) { /* Keep names matching 'rna_enum_object_mode_items' (besides active). */ static const EnumPropertyItem paint_mode_items[] = { - {ePaintInvalid, "ACTIVE", 0, "Current", "Set brush for active paint mode"}, - {ePaintSculpt, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt", ""}, - {ePaintVertex, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""}, - {ePaintWeight, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""}, - {ePaintTexture3D, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""}, - {ePaintGpencil, "GPENCIL_PAINT", ICON_GREASEPENCIL, "Grease Pencil Paint", ""}, + {PAINT_MODE_INVALID, "ACTIVE", 0, "Current", "Set brush for active paint mode"}, + {PAINT_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt", ""}, + {PAINT_MODE_VERTEX, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""}, + {PAINT_MODE_WEIGHT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""}, + {PAINT_MODE_TEXTURE_3D, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""}, + {PAINT_MODE_GPENCIL, "GPENCIL_PAINT", ICON_GREASEPENCIL, "Grease Pencil Paint", ""}, {0, NULL, 0, NULL, NULL} }; PropertyRNA *prop; @@ -508,7 +508,7 @@ static void PAINT_OT_brush_select(wmOperatorType *ot) /* props */ /* All properties are hidden, so as not to show the redo panel. */ - prop = RNA_def_enum(ot->srna, "paint_mode", paint_mode_items, ePaintInvalid, "Paint Mode", ""); + prop = RNA_def_enum(ot->srna, "paint_mode", paint_mode_items, PAINT_MODE_INVALID, "Paint Mode", ""); RNA_def_property_flag(prop, PROP_HIDDEN); for (const EnumPropertyItem *item = paint_mode_items + 1; item->identifier; item++) { diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index af2ed032931..15dd0438585 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -225,7 +225,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) static bool paint_tool_require_location(Brush *brush, ePaintMode mode) { switch (mode) { - case ePaintSculpt: + case PAINT_MODE_SCULPT: if (ELEM(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB)) @@ -459,7 +459,7 @@ static bool paint_stroke_use_jitter(ePaintMode mode, Brush *brush, bool invert) /* jitter-ed brush gives weird and unpredictable result for this * kinds of stroke, so manually disable jitter usage (sergey) */ use_jitter &= (brush->flag & (BRUSH_DRAG_DOT | BRUSH_ANCHORED)) == 0; - use_jitter &= (!ELEM(mode, ePaintTexture2D, ePaintTexture3D) || + use_jitter &= (!ELEM(mode, PAINT_MODE_TEXTURE_2D, PAINT_MODE_TEXTURE_3D) || !(invert && brush->imagepaint_tool == PAINT_TOOL_CLONE)); @@ -856,13 +856,13 @@ bool paint_supports_dynamic_size(Brush *br, ePaintMode mode) return false; switch (mode) { - case ePaintSculpt: + case PAINT_MODE_SCULPT: if (sculpt_is_grab_tool(br)) return false; break; - case ePaintTexture2D: /* fall through */ - case ePaintTexture3D: + case PAINT_MODE_TEXTURE_2D: /* fall through */ + case PAINT_MODE_TEXTURE_3D: if ((br->imagepaint_tool == PAINT_TOOL_FILL) && (br->flag & BRUSH_USE_GRADIENT)) { @@ -885,7 +885,7 @@ bool paint_supports_smooth_stroke(Brush *br, ePaintMode mode) } switch (mode) { - case ePaintSculpt: + case PAINT_MODE_SCULPT: if (sculpt_is_grab_tool(br)) return false; break; @@ -898,7 +898,7 @@ bool paint_supports_smooth_stroke(Brush *br, ePaintMode mode) bool paint_supports_texture(ePaintMode mode) { /* omit: PAINT_WEIGHT, PAINT_SCULPT_UV, PAINT_INVALID */ - return ELEM(mode, ePaintSculpt, ePaintVertex, ePaintTexture3D, ePaintTexture2D); + return ELEM(mode, PAINT_MODE_SCULPT, PAINT_MODE_VERTEX, PAINT_MODE_TEXTURE_3D, PAINT_MODE_TEXTURE_2D); } /* return true if the brush size can change during paint (normally used for pressure) */ @@ -908,7 +908,7 @@ bool paint_supports_dynamic_tex_coords(Brush *br, ePaintMode mode) return false; switch (mode) { - case ePaintSculpt: + case PAINT_MODE_SCULPT: if (sculpt_is_grab_tool(br)) return false; break; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 42c5aea152a..d6aaaf31c21 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1079,7 +1079,7 @@ static void ed_vwpaintmode_enter_generic( BKE_object_free_derived_caches(ob); if (mode_flag == OB_MODE_VERTEX_PAINT) { - const ePaintMode paint_mode = ePaintVertex; + const ePaintMode paint_mode = PAINT_MODE_VERTEX; ED_mesh_color_ensure(me, NULL); BKE_paint_ensure(scene->toolsettings, (Paint **)&scene->toolsettings->vpaint); @@ -1088,7 +1088,7 @@ static void ed_vwpaintmode_enter_generic( BKE_paint_init(bmain, scene, paint_mode, PAINT_CURSOR_VERTEX_PAINT); } else if (mode_flag == OB_MODE_WEIGHT_PAINT) { - const ePaintMode paint_mode = ePaintWeight; + const ePaintMode paint_mode = PAINT_MODE_WEIGHT; BKE_paint_ensure(scene->toolsettings, (Paint **)&scene->toolsettings->wpaint); Paint *paint = BKE_paint_get_active_from_paintmode(scene, paint_mode); @@ -1409,7 +1409,7 @@ static void vwpaint_update_cache_variants(bContext *C, VPaint *vp, Object *ob, P * brush coord/pressure/etc. * It's more an events design issue, which doesn't split coordinate/pressure/angle * changing events. We should avoid this after events system re-design */ - if (paint_supports_dynamic_size(brush, ePaintSculpt) || cache->first_time) { + if (paint_supports_dynamic_size(brush, PAINT_MODE_SCULPT) || cache->first_time) { cache->pressure = RNA_float_get(ptr, "pressure"); } @@ -1425,7 +1425,7 @@ static void vwpaint_update_cache_variants(bContext *C, VPaint *vp, Object *ob, P } } - if (BKE_brush_use_size_pressure(scene, brush) && paint_supports_dynamic_size(brush, ePaintSculpt)) { + if (BKE_brush_use_size_pressure(scene, brush) && paint_supports_dynamic_size(brush, PAINT_MODE_SCULPT)) { cache->radius = cache->initial_radius * cache->pressure; } else { diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index cfd42c71a66..fd1b331d76e 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4534,7 +4534,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, * brush coord/pressure/etc. * It's more an events design issue, which doesn't split coordinate/pressure/angle * changing events. We should avoid this after events system re-design */ - if (paint_supports_dynamic_size(brush, ePaintSculpt) || cache->first_time) { + if (paint_supports_dynamic_size(brush, PAINT_MODE_SCULPT) || cache->first_time) { cache->pressure = RNA_float_get(ptr, "pressure"); } @@ -4551,7 +4551,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, } } - if (BKE_brush_use_size_pressure(scene, brush) && paint_supports_dynamic_size(brush, ePaintSculpt)) { + if (BKE_brush_use_size_pressure(scene, brush) && paint_supports_dynamic_size(brush, PAINT_MODE_SCULPT)) { cache->radius = cache->initial_radius * cache->pressure; } else { @@ -5693,8 +5693,8 @@ void ED_object_sculptmode_enter_ex( "Object has negative scale, sculpting may be unpredictable"); } - Paint *paint = BKE_paint_get_active_from_paintmode(scene, ePaintSculpt); - BKE_paint_init(bmain, scene, ePaintSculpt, PAINT_CURSOR_SCULPT); + Paint *paint = BKE_paint_get_active_from_paintmode(scene, PAINT_MODE_SCULPT); + BKE_paint_init(bmain, scene, PAINT_MODE_SCULPT, PAINT_CURSOR_SCULPT); paint_cursor_start_explicit(paint, bmain->wm.first, sculpt_poll_view3d); diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index c5cebed0b8b..7fa7c7f37b5 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -242,7 +242,7 @@ void ED_space_image_uv_sculpt_update(Main *bmain, wmWindowManager *wm, Scene *sc settings->uv_relax_method = UV_SCULPT_TOOL_RELAX_LAPLACIAN; } BKE_paint_ensure(settings, (Paint **)&settings->uvsculpt); - BKE_paint_init(bmain, scene, ePaintSculptUV, PAINT_CURSOR_SCULPT); + BKE_paint_init(bmain, scene, PAINT_MODE_SCULPT_UV, PAINT_CURSOR_SCULPT); settings->uvsculpt->paint.paint_cursor = WM_paint_cursor_activate( wm, diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index d263ead29b3..fc443f6c2fc 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -579,7 +579,7 @@ static const EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, PointerRNA Brush *me = (Brush *)(ptr->data); switch (mode) { - case ePaintSculpt: + case PAINT_MODE_SCULPT: switch (me->sculpt_tool) { case SCULPT_TOOL_DRAW: case SCULPT_TOOL_CREASE: @@ -620,8 +620,8 @@ static const EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, PointerRNA return prop_default_items; } - case ePaintTexture2D: - case ePaintTexture3D: + case PAINT_MODE_TEXTURE_2D: + case PAINT_MODE_TEXTURE_3D: switch (me->imagepaint_tool) { case PAINT_TOOL_SOFTEN: return prop_soften_sharpen_items; @@ -650,9 +650,9 @@ static const EnumPropertyItem *rna_Brush_stroke_itemf(bContext *C, PointerRNA *U }; switch (mode) { - case ePaintSculpt: - case ePaintTexture2D: - case ePaintTexture3D: + case PAINT_MODE_SCULPT: + case PAINT_MODE_TEXTURE_2D: + case PAINT_MODE_TEXTURE_3D: return sculpt_stroke_method_items; default: diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index b1b5b5450fa..7b91f8360ff 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -281,7 +281,7 @@ static void toolsystem_ref_link(bContext *C, WorkSpace *workspace, bToolRef *tre } else { const ePaintMode paint_mode = BKE_paintmode_get_from_tool(tref); - BLI_assert(paint_mode != ePaintInvalid); + BLI_assert(paint_mode != PAINT_MODE_INVALID); const EnumPropertyItem *items = BKE_paint_get_tool_enum_from_paintmode(paint_mode); BLI_assert(items != NULL); |