From 44505b38df557a5711703613685a1dec9fc2c3d9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Jun 2018 09:31:30 +0200 Subject: Cleanup: strip trailing space in editors --- source/blender/editors/sculpt_paint/paint_cursor.c | 4 +- source/blender/editors/sculpt_paint/paint_curve.c | 8 +- source/blender/editors/sculpt_paint/paint_hide.c | 16 +-- source/blender/editors/sculpt_paint/paint_image.c | 46 ++++----- .../blender/editors/sculpt_paint/paint_image_2d.c | 8 +- .../editors/sculpt_paint/paint_image_proj.c | 108 ++++++++++----------- source/blender/editors/sculpt_paint/paint_ops.c | 24 ++--- source/blender/editors/sculpt_paint/paint_stroke.c | 24 ++--- source/blender/editors/sculpt_paint/paint_utils.c | 24 ++--- source/blender/editors/sculpt_paint/paint_vertex.c | 2 +- .../sculpt_paint/paint_vertex_weight_utils.c | 2 +- source/blender/editors/sculpt_paint/sculpt.c | 68 ++++++------- .../blender/editors/sculpt_paint/sculpt_intern.h | 2 +- source/blender/editors/sculpt_paint/sculpt_undo.c | 26 ++--- source/blender/editors/sculpt_paint/sculpt_uv.c | 2 +- 15 files changed, 182 insertions(+), 182 deletions(-) (limited to 'source/blender/editors/sculpt_paint') diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index e6219b4fae1..3c3b9e91ab9 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -262,7 +262,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima target = (primary) ? &primary_snap : &secondary_snap; - refresh = + refresh = !target->overlay_texture || (invalid != 0) || !same_tex_snap(target, mtex, vc, col, zoom); @@ -967,7 +967,7 @@ static void paint_cursor_on_hit(UnifiedPaintSettings *ups, Brush *brush, ViewCon else projected_radius = BKE_brush_size_get(vc->scene, brush); } - + /* convert brush radius from 2D to 3D */ unprojected_radius = paint_calc_object_space_radius(vc, location, projected_radius); diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c index 120514762f4..44abdc34ffb 100644 --- a/source/blender/editors/sculpt_paint/paint_curve.c +++ b/source/blender/editors/sculpt_paint/paint_curve.c @@ -695,17 +695,17 @@ void PAINTCURVE_OT_draw(wmOperatorType *ot) static int paintcurve_cursor_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) { ePaintMode mode = BKE_paintmode_get_active_from_context(C); - + switch (mode) { case ePaintTexture2D: { ARegion *ar = CTX_wm_region(C); SpaceImage *sima = CTX_wm_space_image(C); float location[2]; - + if (!sima) return OPERATOR_CANCELLED; - + UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]); copy_v2_v2(sima->cursor, location); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, NULL); @@ -715,7 +715,7 @@ static int paintcurve_cursor_invoke(bContext *C, wmOperator *UNUSED(op), const w ED_view3d_cursor3d_update(C, event->mval); break; } - + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index e2b318710a8..0bec71f0566 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -101,7 +101,7 @@ static void partialvis_update_mesh(Object *ob, const int *vert_indices; int totvert, i; bool any_changed = false, any_visible = false; - + BKE_pbvh_node_num_verts(pbvh, node, NULL, &totvert); BKE_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert); paint_mask = CustomData_get_layer(&me->vdata, CD_PAINT_MASK); @@ -153,7 +153,7 @@ static void partialvis_update_grids(Object *ob, &grids); grid_hidden = BKE_pbvh_grid_hidden(pbvh); BKE_pbvh_get_grid_key(pbvh, &key); - + sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN); for (i = 0; i < totgrid; i++) { @@ -324,7 +324,7 @@ static void clip_planes_from_rect(bContext *C, ViewContext vc; BoundBox bb; bglMats mats = {{0}}; - + view3d_operator_needs_opengl(C); ED_view3d_viewcontext_init(C, &vc); view3d_get_transformation(vc.ar, vc.rv3d, vc.obact, &mats); @@ -356,7 +356,7 @@ static void get_pbvh_nodes(PBVH *pbvh, case PARTIALVIS_MASKED: break; } - + BKE_pbvh_search_gather(pbvh, cb, clip_planes, nodes, totnode); } @@ -415,7 +415,7 @@ static int hide_show_exec(bContext *C, wmOperator *op) if (nodes) MEM_freeN(nodes); - + /* end undo */ sculpt_undo_push_end(); @@ -426,7 +426,7 @@ static int hide_show_exec(bContext *C, wmOperator *op) } ED_region_tag_redraw(ar); - + return OPERATOR_FINISHED; } @@ -455,7 +455,7 @@ void PAINT_OT_hide_show(struct wmOperatorType *ot) {PARTIALVIS_MASKED, "MASKED", 0, "Masked", "Hide or show vertices that are masked (minimum mask value of 0.5)"}, {0, NULL, 0, NULL, NULL} }; - + /* identifiers */ ot->name = "Hide/Show"; ot->idname = "PAINT_OT_hide_show"; @@ -475,6 +475,6 @@ void PAINT_OT_hide_show(struct wmOperatorType *ot) "Action", "Whether to hide or show vertices"); RNA_def_enum(ot->srna, "area", area_items, PARTIALVIS_INSIDE, "Area", "Which vertices to hide or show"); - + WM_operator_properties_border(ot); } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index ef4f598a6b7..c2b1fcaf460 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -167,7 +167,7 @@ void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, short te IMB_partial_display_buffer_update_delayed(ibuf, imapaintpartial.x1, imapaintpartial.y1, imapaintpartial.x2, imapaintpartial.y2); } - + if (ibuf->mipmap[0]) ibuf->userflags |= IB_MIPMAP_INVALID; @@ -193,7 +193,7 @@ BlurKernel *paint_new_blur_kernel(Brush *br, bool proj) if (proj) { radius = 0.5f; - + side = kernel->side = 2; kernel->side_squared = kernel->side * kernel->side; kernel->wdata = MEM_mallocN(sizeof(float) * kernel->side_squared, "blur kernel data"); @@ -202,15 +202,15 @@ BlurKernel *paint_new_blur_kernel(Brush *br, bool proj) else { if (br->blur_kernel_radius <= 0) br->blur_kernel_radius = 1; - + radius = br->blur_kernel_radius; - + side = kernel->side = radius * 2 + 1; kernel->side_squared = kernel->side * kernel->side; kernel->wdata = MEM_mallocN(sizeof(float) * kernel->side_squared, "blur kernel data"); kernel->pixel_len = br->blur_kernel_radius; } - + switch (type) { case KERNEL_BOX: for (i = 0; i < kernel->side_squared; i++) @@ -219,9 +219,9 @@ BlurKernel *paint_new_blur_kernel(Brush *br, bool proj) case KERNEL_GAUSSIAN: { - /* at 3.0 standard deviations distance, kernel is about zero */ - float standard_dev = radius / 3.0f; - + /* at 3.0 standard deviations distance, kernel is about zero */ + float standard_dev = radius / 3.0f; + /* make the necessary adjustment to the value for use in the normal distribution formula */ standard_dev = -standard_dev * standard_dev * 2; @@ -230,7 +230,7 @@ BlurKernel *paint_new_blur_kernel(Brush *br, bool proj) float idist = radius - i; float jdist = radius - j; float value = exp((idist * idist + jdist * jdist) / standard_dev); - + kernel->wdata[i + j * side] = value; } } @@ -298,7 +298,7 @@ static int image_paint_2d_clone_poll(bContext *C) if (brush && (brush->imagepaint_tool == PAINT_TOOL_CLONE)) if (brush->clone.image) return 1; - + return 0; } @@ -434,7 +434,7 @@ static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, const flo BKE_paint_data_warning(op->reports, uvs, mat, tex, stencil); MEM_freeN(pop); WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); - return NULL; + return NULL; } pop->mode = PAINT_MODE_3D_PROJECT; pop->custom_paint = paint_proj_new_stroke(C, ob, mouse, mode); @@ -452,7 +452,7 @@ static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, const flo if ((brush->imagepaint_tool == PAINT_TOOL_FILL) && (brush->flag & BRUSH_USE_GRADIENT)) { pop->cursor = WM_paint_cursor_activate(CTX_wm_manager(C), image_paint_poll, gradient_draw_line, pop); } - + settings->imapaint.flag |= IMAGEPAINT_DRAWING; ED_image_undo_push_begin(op->type->name); @@ -815,7 +815,7 @@ void PAINT_OT_grab_clone(wmOperatorType *ot) ot->name = "Grab Clone"; ot->idname = "PAINT_OT_grab_clone"; ot->description = "Move the clone source image"; - + /* api callbacks */ ot->exec = grab_clone_exec; ot->invoke = grab_clone_invoke; @@ -880,7 +880,7 @@ static int sample_color_exec(bContext *C, wmOperator *op) } WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, brush); - + return OPERATOR_FINISHED; } @@ -987,7 +987,7 @@ void PAINT_OT_sample_color(wmOperatorType *ot) ot->name = "Sample Color"; ot->idname = "PAINT_OT_sample_color"; ot->description = "Use the mouse to sample a color in the image"; - + /* api callbacks */ ot->exec = sample_color_exec; ot->invoke = sample_color_invoke; @@ -1055,7 +1055,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) BKE_texpaint_slots_refresh_object(scene, ob); BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); - + /* entering paint mode also sets image to editors */ if (imapaint->mode == IMAGEPAINT_MODE_MATERIAL) { Material *ma = give_current_material(ob, ob->actcol); /* set the current material active paint slot on image editor */ @@ -1065,8 +1065,8 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) } else if (imapaint->mode == IMAGEPAINT_MODE_IMAGE) { ima = imapaint->canvas; - } - + } + if (ima) { for (sc = bmain->screen.first; sc; sc = sc->id.next) { ScrArea *sa; @@ -1075,7 +1075,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)sl; - + if (!sima->pin) ED_space_image_set(bmain, sima, scene, scene->obedit, ima); } @@ -1083,7 +1083,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) } } } - + ob->mode |= mode_flag; BKE_paint_init(scene, ePaintTextureProjective, PAINT_CURSOR_TEXTURE_PAINT); @@ -1107,7 +1107,7 @@ void PAINT_OT_texture_paint_toggle(wmOperatorType *ot) ot->name = "Texture Paint Toggle"; ot->idname = "PAINT_OT_texture_paint_toggle"; ot->description = "Toggle texture paint mode in 3D view"; - + /* api callbacks */ ot->exec = texture_paint_toggle_exec; ot->poll = texture_paint_toggle_poll; @@ -1127,7 +1127,7 @@ static int brush_colors_flip_exec(bContext *C, wmOperator *UNUSED(op)) br = image_paint_brush(C); } else { - /* At the moment, wpaint does not support the color flipper. + /* At the moment, wpaint does not support the color flipper. * So for now we're only handling vpaint */ ToolSettings *ts = CTX_data_tool_settings(C); VPaint *vp = ts->vpaint; @@ -1200,7 +1200,7 @@ static int texture_paint_poll(bContext *C) if (texture_paint_toggle_poll(C)) if (CTX_data_active_object(C)->mode & OB_MODE_TEXTURE_PAINT) return 1; - + return 0; } diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 37096f9e660..ec1a6ebf7ed 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -581,7 +581,7 @@ static void brush_painter_imbuf_partial_update(BrushPainter *painter, const floa destx = desty = 0; w = h = 0; } - + x1 = min_ii(destx, ibuf->x); y1 = min_ii(desty, ibuf->y); x2 = min_ii(destx + w, ibuf->x); @@ -1131,13 +1131,13 @@ static int paint_2d_op(void *state, ImBuf *ibufb, unsigned short *curveb, unsign paint_2d_set_region(region, bpos[0], bpos[1], 0, 0, frombuf->x, frombuf->y); tot = 1; } - + /* blend into canvas */ for (a = 0; a < tot; a++) { ED_imapaint_dirty_region(s->image, s->canvas, region[a].destx, region[a].desty, region[a].width, region[a].height, true); - + if (s->do_masking) { /* masking, find original pixels tiles from undo buffer to composite over */ int tilex, tiley, tilew, tileh; @@ -1231,7 +1231,7 @@ static int paint_2d_canvas_set(ImagePaintState *s, Image *ima) /* set masking */ s->do_masking = paint_use_opacity_masking(s->brush); - + return 1; } diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index a284b17a0b4..8e1d47db61a 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -1053,7 +1053,7 @@ static bool check_seam( /* set up the other face */ *other_face = tri_index; - + /* we check if difference is 1 here, else we might have a case of edge 2-0 for a tri */ *orig_fidx = (i1_fidx < i2_fidx && (i2_fidx - i1_fidx == 1)) ? i1_fidx : i2_fidx; @@ -2115,7 +2115,7 @@ static void project_bucket_clip_face( int inside_face_flag = 0; int flip; bool collinear = false; - + float bucket_bounds_ss[4][2]; /* detect pathological case where face the three vertices are almost collinear in screen space. @@ -2126,12 +2126,12 @@ static void project_bucket_clip_face( { collinear = true; } - + /* get the UV space bounding box */ inside_bucket_flag |= BLI_rctf_isect_pt_v(bucket_bounds, v1coSS); inside_bucket_flag |= BLI_rctf_isect_pt_v(bucket_bounds, v2coSS) << 1; inside_bucket_flag |= BLI_rctf_isect_pt_v(bucket_bounds, v3coSS) << 2; - + if (inside_bucket_flag == ISECT_ALL3) { /* is_flip_object is used here because we use the face winding */ flip = (((line_point_side_v2(v1coSS, v2coSS, v3coSS) > 0.0f) != is_flip_object) != @@ -2148,20 +2148,20 @@ static void project_bucket_clip_face( copy_v2_v2(bucket_bounds_uv[0], uv1co); copy_v2_v2(bucket_bounds_uv[1], uv2co); copy_v2_v2(bucket_bounds_uv[2], uv3co); - } - + } + *tot = 3; return; } /* handle pathological case here, no need for further intersections below since tringle area is almost zero */ if (collinear) { int flag; - + (*tot) = 0; if (cull) return; - + if (inside_bucket_flag & ISECT_1) { copy_v2_v2(bucket_bounds_uv[*tot], uv1co); (*tot)++; } flag = inside_bucket_flag & (ISECT_1 | ISECT_2); @@ -2169,9 +2169,9 @@ static void project_bucket_clip_face( if (line_rect_clip(bucket_bounds, v1coSS, v2coSS, uv1co, uv2co, bucket_bounds_uv[*tot], is_ortho)) (*tot)++; } - + if (inside_bucket_flag & ISECT_2) { copy_v2_v2(bucket_bounds_uv[*tot], uv2co); (*tot)++; } - + flag = inside_bucket_flag & (ISECT_2 | ISECT_3); if (flag && flag != (ISECT_2 | ISECT_3)) { if (line_rect_clip(bucket_bounds, v2coSS, v3coSS, uv2co, uv3co, bucket_bounds_uv[*tot], is_ortho)) @@ -2185,7 +2185,7 @@ static void project_bucket_clip_face( if (line_rect_clip(bucket_bounds, v3coSS, v1coSS, uv3co, uv1co, bucket_bounds_uv[*tot], is_ortho)) (*tot)++; } - + if ((*tot) < 3) { /* no intersections to speak of, but more probable is that all face is just outside the * rectangle and culled due to float precision issues. Since above tests have failed, @@ -2350,7 +2350,7 @@ static void project_bucket_clip_face( (*tot)--; } } - + /* its possible there is only a few left after remove doubles */ if ((*tot) < 3) { // printf("removed too many doubles B\n"); @@ -2991,7 +2991,7 @@ static bool project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int buck int fidx; project_bucket_bounds(ps, bucket_x, bucket_y, &bucket_bounds); - + /* Is one of the faces verts in the bucket bounds? */ fidx = 2; @@ -3500,7 +3500,7 @@ static void proj_paint_layer_clone_init( /* get active instead */ mloopuv_clone_base = CustomData_get_layer(&ps->dm->loopData, CD_MLOOPUV); } - + } memset(layer_clone, 0, sizeof(*layer_clone)); @@ -3526,7 +3526,7 @@ static bool project_paint_clone_face_skip( if (ps->do_material_slots) { if (lc->slot_clone != lc->slot_last_clone) { - if (!slot->uvname || + if (!slot->uvname || !(lc->mloopuv_clone_base = CustomData_get_layer_named( &ps->dm->loopData, CD_MLOOPUV, lc->slot_clone->uvname))) @@ -3720,7 +3720,7 @@ static void project_paint_prepare_all_faces( ps->dm_mloopuv[lt->poly] = mloopuv_base; continue; } - + tpage = slot->ima; } } @@ -4412,7 +4412,7 @@ static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, con if (ps->is_texbrush) mul_v3_v3(rgba, texrgb); - + mul_v3_fl(rgba, mask); rgba[3] = mask; @@ -4621,7 +4621,7 @@ static void *do_projectpaint_thread(void *ph_v) projPixel->newColor.ch, ps->blend); } } - + if (lock_alpha) { if (is_floatbuf) { /* slightly more involved case since floats are in premultiplied space we need @@ -4699,7 +4699,7 @@ static void *do_projectpaint_thread(void *ph_v) /* masking to keep brush contribution to a pixel limited. note we do not do * a simple max(mask, mask_accum), as this is very sensitive to spacing and * gives poor results for strokes crossing themselves. - * + * * Instead we use a formula that adds up but approaches brush_alpha slowly * and never exceeds it, which gives nice smooth results. */ float mask_accum = *projPixel->mask_accum; @@ -4932,14 +4932,14 @@ static bool project_paint_op(void *state, const float lastpos[2], const float po touch_any = 1; } } - + /* calculate pivot for rotation around seletion if needed */ if (U.uiflag & USER_ORBIT_SELECTION) { float w[3]; int tri_index; - + tri_index = project_paint_PickFace(ps, pos, w); - + if (tri_index != -1) { const MLoopTri *lt = &ps->dm_mlooptri[tri_index]; const int lt_vtri[3] = { PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt) }; @@ -4952,14 +4952,14 @@ static bool project_paint_op(void *state, const float lastpos[2], const float po ps->dm_mvert[lt_vtri[1]].co, ps->dm_mvert[lt_vtri[2]].co, w); - + ups->average_stroke_counter++; mul_m4_v3(ps->obmat, world); add_v3_v3(ups->average_stroke_accum, world); ups->last_stroke_valid = true; } } - + return touch_any; } @@ -5095,9 +5095,9 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int ps->do_material_slots = (settings->imapaint.mode == IMAGEPAINT_MODE_MATERIAL); ps->stencil_ima = settings->imapaint.stencil; - ps->canvas_ima = (!ps->do_material_slots) ? + ps->canvas_ima = (!ps->do_material_slots) ? settings->imapaint.canvas : NULL; - ps->clone_ima = (!ps->do_material_slots) ? + ps->clone_ima = (!ps->do_material_slots) ? settings->imapaint.clone : NULL; ps->do_mask_cavity = (settings->imapaint.paint.flags & PAINT_USE_CAVITY_MASK) ? true : false; @@ -5329,7 +5329,7 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op) if (!BKE_paint_proj_mesh_data_check(scene, ob, &uvs, &mat, &tex, NULL)) { BKE_paint_data_warning(op->reports, uvs, mat, tex, true); WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); - return OPERATOR_CANCELLED; + return OPERATOR_CANCELLED; } project_state_init(C, ob, &ps, BRUSH_STROKE_NORMAL); @@ -5528,7 +5528,7 @@ void PAINT_OT_image_from_view(wmOperatorType *ot) void BKE_paint_data_warning(struct ReportList *reports, bool uvs, bool mat, bool tex, bool stencil) { - BKE_reportf(reports, RPT_WARNING, "Missing%s%s%s%s detected!", + BKE_reportf(reports, RPT_WARNING, "Missing%s%s%s%s detected!", !uvs ? " UVs," : "", !mat ? " Materials," : "", !tex ? " Textures," : "", @@ -5549,7 +5549,7 @@ bool BKE_paint_proj_mesh_data_check(Scene *scene, Object *ob, bool *uvs, bool *m bool hasuvs = true; imapaint->missing_data = 0; - + BLI_assert(ob->type == OB_MESH); if (imapaint->mode == IMAGEPAINT_MODE_MATERIAL) { @@ -5563,16 +5563,16 @@ bool BKE_paint_proj_mesh_data_check(Scene *scene, Object *ob, bool *uvs, bool *m int i; hasmat = false; hastex = false; - + for (i = 1; i < ob->totcol + 1; i++) { Material *ma = give_current_material(ob, i); - + if (ma) { hasmat = true; if (!ma->texpaintslot) { /* refresh here just in case */ BKE_texpaint_slot_refresh_cache(scene, ma); - + /* if still no slots, we have to add */ if (ma->texpaintslot) { hastex = true; @@ -5592,7 +5592,7 @@ bool BKE_paint_proj_mesh_data_check(Scene *scene, Object *ob, bool *uvs, bool *m hastex = false; } } - + me = BKE_mesh_from_object(ob); layernum = CustomData_number_of_layers(&me->pdata, CD_MTEXPOLY); @@ -5613,7 +5613,7 @@ bool BKE_paint_proj_mesh_data_check(Scene *scene, Object *ob, bool *uvs, bool *m if (!hasmat) imapaint->missing_data |= IMAGEPAINT_MISSING_MATERIAL; if (!hastex) imapaint->missing_data |= IMAGEPAINT_MISSING_TEX; if (!hasstencil) imapaint->missing_data |= IMAGEPAINT_MISSING_STENCIL; - + if (uvs) { *uvs = hasuvs; } @@ -5626,7 +5626,7 @@ bool BKE_paint_proj_mesh_data_check(Scene *scene, Object *ob, bool *uvs, bool *m if (stencil) { *stencil = hasstencil; } - + return hasuvs && hasmat && hastex && hasstencil; } @@ -5672,7 +5672,7 @@ static Image *proj_paint_image_create(wmOperator *op, Main *bmain) } ima = BKE_image_add_generated(bmain, width, height, imagename, alpha ? 32 : 24, use_float, gen_type, color, false); - + return ima; } @@ -5700,17 +5700,17 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op) ED_node_shader_default(C, &ma->id); ntree = ma->nodetree; } - + ma->use_nodes = true; - + /* try to add an image node */ imanode = nodeAddStaticNode(C, ntree, SH_NODE_TEX_IMAGE); - + ima = proj_paint_image_create(op, bmain); imanode->id = &ima->id; - + nodeSetActive(ntree, imanode); - + ntreeUpdateTree(CTX_data_main(C), ntree); } else { @@ -5738,20 +5738,20 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_TEXTURE | NA_ADDED, mtex->tex); } } - + if (ima) { BKE_texpaint_slot_refresh_cache(scene, ma); BKE_image_signal(ima, NULL, IMA_SIGNAL_USER_NEW_IMAGE); WM_event_add_notifier(C, NC_IMAGE | NA_ADDED, ima); DAG_id_tag_update(&ma->id, 0); ED_area_tag_redraw(CTX_wm_area(C)); - + BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); - + return true; } } - + return false; } @@ -5779,7 +5779,7 @@ static int texture_paint_add_texture_paint_slot_invoke(bContext *C, wmOperator * /* no material found, just assign to first slot */ assign_material(bmain, ob, ma, ob->actcol, BKE_MAT_ASSIGN_USERPREF); } - + type = RNA_enum_from_value(layer_type_items, type); /* get the name of the texture layer type */ @@ -5837,28 +5837,28 @@ static int texture_paint_delete_texture_paint_slot_exec(bContext *C, wmOperator Material *ma; bool is_bi = BKE_scene_uses_blender_internal(scene) || BKE_scene_uses_blender_game(scene); TexPaintSlot *slot; - + /* not supported for node-based engines */ if (!ob || !is_bi) return OPERATOR_CANCELLED; - + ma = give_current_material(ob, ob->actcol); - + if (!ma->texpaintslot || ma->use_nodes) return OPERATOR_CANCELLED; - + slot = ma->texpaintslot + ma->paint_active_slot; - + if (ma->mtex[slot->index]->tex) { id_us_min(&ma->mtex[slot->index]->tex->id); - + if (ma->mtex[slot->index]->tex->ima) { id_us_min(&ma->mtex[slot->index]->tex->ima->id); } } MEM_freeN(ma->mtex[slot->index]); ma->mtex[slot->index] = NULL; - + BKE_texpaint_slot_refresh_cache(scene, ma); DAG_id_tag_update(&ma->id, 0); WM_event_add_notifier(C, NC_MATERIAL, ma); @@ -5917,7 +5917,7 @@ static int add_simple_uvs_exec(bContext *C, wmOperator *UNUSED(op)) scene->toolsettings->uv_flag |= UV_SYNC_SELECTION; BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); - + DAG_id_tag_update(ob->data, 0); WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, scene); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 572d969dcca..f03c119a09e 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -87,10 +87,10 @@ static void BRUSH_OT_add(wmOperatorType *ot) ot->name = "Add Brush"; ot->description = "Add brush by mode type"; ot->idname = "BRUSH_OT_add"; - + /* api callbacks */ ot->exec = brush_add_exec; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -144,10 +144,10 @@ static void BRUSH_OT_scale_size(wmOperatorType *ot) ot->name = "Scale Sculpt/Paint Brush Size"; ot->description = "Change brush size by a scalar"; ot->idname = "BRUSH_OT_scale_size"; - + /* api callbacks */ ot->exec = brush_scale_size_exec; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -285,10 +285,10 @@ static void BRUSH_OT_reset(wmOperatorType *ot) ot->name = "Reset Brush"; ot->description = "Return brush to defaults based on current tool"; ot->idname = "BRUSH_OT_reset"; - + /* api callbacks */ ot->exec = brush_reset_exec; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -353,7 +353,7 @@ static Brush *brush_tool_toggle(Main *bmain, Brush *brush_orig, const int tool, /* store the previously-selected brush */ if (br) br->toggle_brush = brush_orig; - + return br; } else if (brush_orig->toggle_brush) { @@ -502,7 +502,7 @@ static wmKeyMapItem *keymap_brush_select(wmKeyMap *keymap, int paint_mode, keymap_type, KM_PRESS, keymap_modifier, 0); RNA_enum_set(kmi->ptr, "paint_mode", paint_mode); - + switch (paint_mode) { case OB_MODE_SCULPT: RNA_enum_set(kmi->ptr, "sculpt_tool", tool); @@ -914,7 +914,7 @@ static int stencil_reset_transform_exec(bContext *C, wmOperator *op) if (!br) return OPERATOR_CANCELLED; - + if (do_mask) { br->mask_stencil_pos[0] = 256; br->mask_stencil_pos[1] = 256; @@ -1200,7 +1200,7 @@ static void ed_keymap_paint_brush_radial_control(wmKeyMap *keymap, const char *p static void paint_partial_visibility_keys(wmKeyMap *keymap) { wmKeyMapItem *kmi; - + /* Partial visibility */ kmi = WM_keymap_add_item(keymap, "PAINT_OT_hide_show", HKEY, KM_PRESS, KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "action", PARTIALVIS_SHOW); @@ -1246,7 +1246,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) wmKeyMap *keymap; wmKeyMapItem *kmi; int i; - + keymap = WM_keymap_find(keyconf, "Paint Curve", 0, 0); keymap->poll = paint_curve_poll; @@ -1285,7 +1285,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SCULPT_OT_dynamic_topology_toggle", DKEY, KM_PRESS, KM_CTRL, 0); /* Dynamic-topology detail size - * + * * This should be improved further, perhaps by showing a triangle * grid rather than brush alpha */ kmi = WM_keymap_add_item(keymap, "SCULPT_OT_set_detail_size", DKEY, KM_PRESS, KM_SHIFT, 0); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index e6a9fd9adf8..afd24f0fe90 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -125,7 +125,7 @@ typedef struct PaintStroke { float zoom_2d; int pen_flip; - + /* line constraint */ bool constrain_line; float constrained_pos[2]; @@ -711,10 +711,10 @@ PaintStroke *paint_stroke_new(bContext *C, /* initialize here */ ups->overlap_factor = 1.0; ups->stroke_active = true; - + zero_v3(ups->average_stroke_accum); ups->average_stroke_counter = 0; - + /* initialize here to avoid initialization conflict with threaded strokes */ curvemapping_initialize(br->curve); if (p->flags & PAINT_USE_CAVITY_MASK) @@ -904,11 +904,11 @@ static void paint_stroke_sample_average(const PaintStroke *stroke, PaintSample *average) { int i; - + memset(average, 0, sizeof(*average)); BLI_assert(stroke->num_samples > 0); - + for (i = 0; i < stroke->num_samples; i++) { add_v2_v2(average->mouse, stroke->samples[i].mouse); average->pressure += stroke->samples[i].pressure; @@ -1072,17 +1072,17 @@ static void paint_stroke_line_constrain(PaintStroke *stroke, float mouse[2]) if (stroke->constrain_line) { float line[2]; float angle, len, res; - + sub_v2_v2v2(line, mouse, stroke->last_mouse_position); angle = atan2f(line[1], line[0]); len = len_v2(line); - + /* divide angle by PI/4 */ angle = 4.0f * angle / (float)M_PI; - + /* now take residue */ res = angle - floorf(angle); - + /* residue decides how close we are at a certain angle */ if (res <= 0.5f) { angle = floorf(angle) * (float)M_PI_4; @@ -1090,7 +1090,7 @@ static void paint_stroke_line_constrain(PaintStroke *stroke, float mouse[2]) else { angle = (floorf(angle) + 1.0f) * (float)M_PI_4; } - + mouse[0] = stroke->constrained_pos[0] = len * cosf(angle) + stroke->last_mouse_position[0]; mouse[1] = stroke->constrained_pos[1] = len * sinf(angle) + stroke->last_mouse_position[1]; } @@ -1185,12 +1185,12 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event) else if (br->flag & BRUSH_LINE) { if (event->alt) stroke->constrain_line = true; - else + else stroke->constrain_line = false; copy_v2_fl2(mouse, event->mval[0], event->mval[1]); paint_stroke_line_constrain(stroke, mouse); - + if (stroke->stroke_started && (first_modal || (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)))) { if ((br->mtex.brush_angle_mode & MTEX_ANGLE_RAKE) || (br->mask_mtex.brush_angle_mode & MTEX_ANGLE_RAKE)) { copy_v2_v2(stroke->ups->last_rake, stroke->last_mouse_position); diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 70fd57830c0..77c9dcf8ac6 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -222,10 +222,10 @@ void paint_stroke_operator_properties(wmOperatorType *ot) prop = RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); - RNA_def_enum(ot->srna, "mode", stroke_mode_items, BRUSH_STROKE_NORMAL, + RNA_def_enum(ot->srna, "mode", stroke_mode_items, BRUSH_STROKE_NORMAL, "Stroke Mode", "Action taken when a paint stroke is made"); - + } /* 3D Paint */ @@ -436,7 +436,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr CLAMP(x, 0, ar->winx); CLAMP(y, 0, ar->winy); - + if (use_palette) { if (!palette) { palette = BKE_palette_add(CTX_data_main(C), "Palette"); @@ -471,12 +471,12 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr if (imapaint_pick_face(&vc, mval, &faceindex, totpoly)) { Image *image; - - if (use_material) + + if (use_material) image = imapaint_face_image(ob, me, faceindex); else image = imapaint->canvas; - + if (image) { ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL); if (ibuf && ibuf->rect) { @@ -484,16 +484,16 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr float u, v; imapaint_pick_uv(scene, ob, faceindex, mval, uv); sample_success = true; - + u = fmodf(uv[0], 1.0f); v = fmodf(uv[1], 1.0f); - + if (u < 0.0f) u += 1.0f; if (v < 0.0f) v += 1.0f; - + u = u * ibuf->x; v = v * ibuf->y; - + if (ibuf->rect_float) { float rgba_f[4]; if (U.gameflags & USER_DISABLE_MIPMAP) @@ -525,7 +525,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr } } } - + BKE_image_release_ibuf(image, ibuf, NULL); } } @@ -547,7 +547,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr glReadBuffer(GL_BACK); } cp = (unsigned char *)&col; - + if (use_palette) { rgb_uchar_to_float(color->rgb, cp); } diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 4b2eb0fdd30..a496c4cb01d 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2552,7 +2552,7 @@ static float tex_color_alpha_ubyte( } static void do_vpaint_brush_draw_task_cb_ex( - void *__restrict userdata, + void *__restrict userdata, const int n, const ParallelRangeTLS *__restrict UNUSED(tls)) { diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c index 4d70d82d5c6..197b16ffe6e 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c @@ -308,4 +308,4 @@ float ED_wpaint_blend_tool( } } -/** \} */ \ No newline at end of file +/** \} */ diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 605d72e1e20..ca4ad39d14e 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -632,7 +632,7 @@ bool sculpt_brush_test_cube(SculptBrushTest *test, const float co[3], float loca if (local_co[0] <= side && local_co[1] <= side && local_co[2] <= side) { float p = 4.0f; - + test->dist = ((powf(local_co[0], p) + powf(local_co[1], p) + powf(local_co[2], p)) / powf(side, p)); @@ -731,7 +731,7 @@ static float calc_overlap(StrokeCache *cache, const char symm, const char axis, { float mirror[3]; float distsq; - + /* flip_v3_v3(mirror, cache->traced_location, symm); */ flip_v3_v3(mirror, cache->true_location, symm); @@ -1120,7 +1120,7 @@ static float brush_strength( case SCULPT_TOOL_DRAW: case SCULPT_TOOL_LAYER: return alpha * flip * pressure * overlap * feather; - + case SCULPT_TOOL_MASK: overlap = (1 + overlap) / 2; switch ((BrushMaskTool)brush->mask_tool) { @@ -1153,7 +1153,7 @@ static float brush_strength( } else { /* reduce strength for DEEPEN, PEAKS, and CONTRAST */ - return 0.5f * alpha * flip * pressure * overlap * feather; + return 0.5f * alpha * flip * pressure * overlap * feather; } case SCULPT_TOOL_SMOOTH: @@ -1210,7 +1210,7 @@ float tex_strength(SculptSession *ss, const Brush *br, avg = 1; } else if (mtex->brush_map_mode == MTEX_MAP_MODE_3D) { - /* Get strength by feeding the vertex + /* Get strength by feeding the vertex * location directly into a texture */ avg = BKE_brush_sample_tex_3D(scene, br, point, rgba, 0, ss->tex_pool); } @@ -1220,7 +1220,7 @@ float tex_strength(SculptSession *ss, const Brush *br, /* if the active area is being applied for symmetry, flip it * across the symmetry axis and rotate it back to the original - * position in order to project it. This insures that the + * position in order to project it. This insures that the * brush texture will be oriented correctly. */ flip_v3_v3(symm_point, point, cache->mirror_symmetry_pass); @@ -1280,16 +1280,16 @@ bool sculpt_search_sphere_cb(PBVHNode *node, void *data_v) BKE_pbvh_node_get_original_BB(node, bb_min, bb_max); else BKE_pbvh_node_get_BB(node, bb_min, bb_max); - + for (i = 0; i < 3; ++i) { if (bb_min[i] > center[i]) nearest[i] = bb_min[i]; else if (bb_max[i] < center[i]) nearest[i] = bb_max[i]; else - nearest[i] = center[i]; + nearest[i] = center[i]; } - + sub_v3_v3v3(t, center, nearest); return len_squared_v3(t) < data->radius_squared; @@ -1400,7 +1400,7 @@ static void update_sculpt_normal(Sculpt *sd, Object *ob, { const Brush *brush = BKE_paint_brush(&sd->paint); StrokeCache *cache = ob->sculpt->cache; - + if (cache->mirror_symmetry_pass == 0 && cache->radial_symmetry_pass == 0 && (cache->first_time || !(brush->flag & BRUSH_ORIGINAL_NORMAL))) @@ -2042,7 +2042,7 @@ static void do_mask_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) { SculptSession *ss = ob->sculpt; Brush *brush = BKE_paint_brush(&sd->paint); - + switch ((BrushMaskTool)brush->mask_tool) { case BRUSH_MASK_DRAW: do_mask_brush_draw(sd, ob, nodes, totnode); @@ -2189,7 +2189,7 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod mul_v3_v3fl(offset, ss->cache->sculpt_normal_symm, ss->cache->radius); mul_v3_v3(offset, ss->cache->scale); mul_v3_fl(offset, bstrength); - + /* we divide out the squared alpha and multiply by the squared crease to give us the pinch strength */ crease_correction = brush->crease_pinch_factor * brush->crease_pinch_factor; brush_alpha = BKE_brush_alpha_get(scene, brush); @@ -4037,7 +4037,7 @@ static void do_symmetrical_brush_actions( cache->bstrength = brush_strength(sd, cache, feather, ups); cache->symmetry = symm; - /* symm is a bit combination of XYZ - 1 is mirror X; 2 is Y; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */ + /* symm is a bit combination of XYZ - 1 is mirror X; 2 is Y; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */ for (i = 0; i <= symm; ++i) { if (i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5)))) { cache->mirror_symmetry_pass = i; @@ -4172,14 +4172,14 @@ static void sculpt_init_mirror_clipping(Object *ob, SculptSession *ss) (md->mode & eModifierMode_Realtime)) { MirrorModifierData *mmd = (MirrorModifierData *)md; - + if (mmd->flag & MOD_MIR_CLIPPING) { /* check each axis for mirroring */ for (i = 0; i < 3; ++i) { if (mmd->flag & (MOD_MIR_AXIS_X << i)) { /* enable sculpt clipping */ ss->cache->flag |= CLIP_X << i; - + /* update the clip tolerance */ if (mmd->tolerance > ss->cache->clip_tolerance[i]) @@ -4268,7 +4268,7 @@ static void sculpt_update_cache_invariants( Paint *p = &sd->paint; Brush *br; int size = BKE_brush_size_get(scene, brush); - + BLI_strncpy(cache->saved_active_brush_name, brush->id.name + 2, sizeof(cache->saved_active_brush_name)); @@ -4364,7 +4364,7 @@ static void sculpt_update_cache_invariants( #define PIXEL_INPUT_THRESHHOLD 5 if (brush->sculpt_tool == SCULPT_TOOL_ROTATE) cache->dial = BLI_dial_initialize(cache->initial_mouse, PIXEL_INPUT_THRESHHOLD); - + #undef PIXEL_INPUT_THRESHHOLD } @@ -4943,7 +4943,7 @@ static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *UNUSED(st Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; const Brush *brush = BKE_paint_brush(&sd->paint); - + sculpt_stroke_modifiers_check(C, ob, brush); sculpt_update_cache_variants(C, sd, ob, itemptr); sculpt_restore_mesh(sd, ob); @@ -5042,7 +5042,7 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str sculpt_undo_push_end(); BKE_pbvh_update(ss->pbvh, PBVH_UpdateOriginalBB, NULL); - + if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) BKE_pbvh_bmesh_after_stroke(ss->pbvh); @@ -5086,7 +5086,7 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, const wmEvent paint_stroke_data_free(op); return OPERATOR_PASS_THROUGH; } - + if ((retval = op->type->modal(C, op, event)) == OPERATOR_FINISHED) { paint_stroke_data_free(op); return OPERATOR_FINISHED; @@ -5096,7 +5096,7 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, const wmEvent OPERATOR_RETVAL_CHECK(retval); BLI_assert(retval == OPERATOR_RUNNING_MODAL); - + return OPERATOR_RUNNING_MODAL; } @@ -5143,7 +5143,7 @@ static void SCULPT_OT_brush_stroke(wmOperatorType *ot) ot->name = "Sculpt"; ot->idname = "SCULPT_OT_brush_stroke"; ot->description = "Sculpt a stroke into the geometry"; - + /* api callbacks */ ot->invoke = sculpt_brush_stroke_invoke; ot->modal = paint_stroke_modal; @@ -5160,7 +5160,7 @@ static void SCULPT_OT_brush_stroke(wmOperatorType *ot) RNA_def_boolean(ot->srna, "ignore_background_click", 0, "Ignore Background Click", - "Clicks on the background do not start the stroke"); + "Clicks on the background do not start the stroke"); } /**** Reset the copy of the mesh that is being sculpted on (currently just for the layer brush) ****/ @@ -5184,11 +5184,11 @@ static void SCULPT_OT_set_persistent_base(wmOperatorType *ot) ot->name = "Set Persistent Base"; ot->idname = "SCULPT_OT_set_persistent_base"; ot->description = "Reset the copy of the mesh that is being sculpted on"; - + /* api callbacks */ ot->exec = sculpt_set_persistent_base_exec; ot->poll = sculpt_mode_poll; - + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -5290,7 +5290,7 @@ void sculpt_dynamic_topology_enable_ex( /* Enable dynamic topology */ me->flag |= ME_SCULPT_DYNAMIC_TOPOLOGY; - + /* Enable logging for undo/redo */ ss->bm_log = BM_log_create(ss->bm); @@ -5510,12 +5510,12 @@ static void SCULPT_OT_dynamic_topology_toggle(wmOperatorType *ot) ot->name = "Dynamic Topology Toggle"; ot->idname = "SCULPT_OT_dynamic_topology_toggle"; ot->description = "Dynamic topology alters the mesh topology while sculpting"; - + /* api callbacks */ ot->invoke = sculpt_dynamic_topology_toggle_invoke; ot->exec = sculpt_dynamic_topology_toggle_exec; ot->poll = sculpt_mode_poll; - + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -5548,11 +5548,11 @@ static void SCULPT_OT_optimize(wmOperatorType *ot) ot->name = "Optimize"; ot->idname = "SCULPT_OT_optimize"; ot->description = "Recalculate the sculpt BVH to improve performance"; - + /* api callbacks */ ot->exec = sculpt_optimize_exec; ot->poll = sculpt_and_dynamic_topology_poll; - + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -5602,7 +5602,7 @@ static void SCULPT_OT_symmetrize(wmOperatorType *ot) ot->name = "Symmetrize"; ot->idname = "SCULPT_OT_symmetrize"; ot->description = "Symmetrize the topology modifications"; - + /* api callbacks */ ot->exec = sculpt_symmetrize_exec; ot->poll = sculpt_and_dynamic_topology_poll; @@ -5745,7 +5745,7 @@ void ED_object_sculptmode_exit_ex( if (mmd) { multires_force_update(ob); } - + /* Not needed for now. */ #if 0 const int flush_recalc = ed_object_sculptmode_flush_recalc_flag(scene, ob, mmd); @@ -5819,11 +5819,11 @@ static void SCULPT_OT_sculptmode_toggle(wmOperatorType *ot) ot->name = "Sculpt Mode"; ot->idname = "SCULPT_OT_sculptmode_toggle"; ot->description = "Toggle sculpt mode in 3D view"; - + /* api callbacks */ ot->exec = sculpt_mode_toggle_exec; ot->poll = ED_operator_object_active_editable_mesh; - + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index e46760258e1..1c94c1d9198 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -28,7 +28,7 @@ /** \file blender/editors/sculpt_paint/sculpt_intern.h * \ingroup edsculpt */ - + #ifndef __SCULPT_INTERN_H__ #define __SCULPT_INTERN_H__ diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index e90d2b58c0c..cd03c3ec7e2 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -143,7 +143,7 @@ static bool sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoN SculptSession *ss = ob->sculpt; MVert *mvert; int *index; - + if (unode->maxvert) { /* regular mesh restore */ @@ -260,7 +260,7 @@ static bool sculpt_undo_restore_hidden( if (unode->maxvert) { MVert *mvert = ss->mvert; - + for (i = 0; i < unode->totvert; i++) { MVert *v = &mvert[unode->index[i]]; if ((BLI_BITMAP_TEST(unode->vert_hidden, i) != 0) != ((v->flag & ME_HIDE) != 0)) { @@ -272,12 +272,12 @@ static bool sculpt_undo_restore_hidden( } else if (unode->maxgrid && dm->getGridData) { BLI_bitmap **grid_hidden = dm->getGridHidden(dm); - + for (i = 0; i < unode->totgrid; i++) { SWAP(BLI_bitmap *, unode->grid_hidden[i], grid_hidden[unode->grids[i]]); - + } } @@ -291,7 +291,7 @@ static bool sculpt_undo_restore_mask(bContext *C, DerivedMesh *dm, SculptUndoNod MVert *mvert; float *vmask; int *index, i, j; - + if (unode->maxvert) { /* regular mesh restore */ @@ -672,10 +672,10 @@ static void sculpt_undo_alloc_and_store_hidden(PBVH *pbvh, BKE_pbvh_node_get_grids(pbvh, node, &grid_indices, &totgrid, NULL, NULL, NULL); - + unode->grid_hidden = MEM_mapallocN(sizeof(*unode->grid_hidden) * totgrid, "unode->grid_hidden"); - + for (i = 0; i < totgrid; i++) { if (grid_hidden[grid_indices[i]]) unode->grid_hidden[i] = MEM_dupallocN(grid_hidden[grid_indices[i]]); @@ -692,7 +692,7 @@ static SculptUndoNode *sculpt_undo_alloc_node( SculptUndoNode *unode; SculptSession *ss = ob->sculpt; int totvert, allvert, totgrid, maxgrid, gridsize, *grids; - + unode = MEM_callocN(sizeof(SculptUndoNode), "SculptUndoNode"); BLI_strncpy(unode->idname, ob->id.name, sizeof(unode->idname)); unode->type = type; @@ -707,7 +707,7 @@ static SculptUndoNode *sculpt_undo_alloc_node( } else maxgrid = 0; - + /* we will use this while sculpting, is mapalloc slow to access then? */ /* general TODO, fix count_alloc */ @@ -723,7 +723,7 @@ static SculptUndoNode *sculpt_undo_alloc_node( sculpt_undo_alloc_and_store_hidden(ss->pbvh, unode); else unode->vert_hidden = BLI_BITMAP_NEW(allvert, "SculptUndoNode.vert_hidden"); - + break; case SCULPT_UNDO_MASK: unode->mask = MEM_mapallocN(sizeof(float) * allvert, "SculptUndoNode.mask"); @@ -737,7 +737,7 @@ static SculptUndoNode *sculpt_undo_alloc_node( BLI_assert(!"Dynamic topology should've already been handled"); break; } - + BLI_addtail(&usculpt->nodes, unode); if (maxgrid) { @@ -789,7 +789,7 @@ static void sculpt_undo_store_hidden(Object *ob, SculptUndoNode *unode) const int *vert_indices; int allvert; int i; - + BKE_pbvh_node_num_verts(pbvh, node, NULL, &allvert); BKE_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert); for (i = 0; i < allvert; i++) { @@ -928,7 +928,7 @@ SculptUndoNode *sculpt_undo_push_node( } unode = sculpt_undo_alloc_node(ob, node, type); - + BLI_thread_unlock(LOCK_CUSTOM1); /* copy threaded, hopefully this is the performance critical part */ diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index e39750227c0..e93a68b9350 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -137,7 +137,7 @@ typedef struct UvSculptData { /* uvsmooth Paint for fast reference */ Paint *uvsculpt; - + /* tool to use. duplicating here to change if modifier keys are pressed */ char tool; -- cgit v1.2.3