diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_cursor.c | 4 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_curve.c | 8 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_hide.c | 16 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 46 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_2d.c | 8 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_proj.c | 94 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 22 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_stroke.c | 24 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_utils.c | 24 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 66 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_undo.c | 26 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_uv.c | 2 |
14 files changed, 172 insertions, 172 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 8d941078c5f..848d12bcfaa 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); @@ -1001,7 +1001,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 049d8ff8c0b..af0b828ae39 100644 --- a/source/blender/editors/sculpt_paint/paint_curve.c +++ b/source/blender/editors/sculpt_paint/paint_curve.c @@ -697,17 +697,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); @@ -717,7 +717,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 4dd770d79b9..3d4f6c05ff4 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++) { @@ -323,7 +323,7 @@ static void clip_planes_from_rect(bContext *C, { ViewContext vc; BoundBox bb; - + view3d_operator_needs_opengl(C); ED_view3d_viewcontext_init(C, &vc); ED_view3d_clipping_calc(&bb, clip_planes, vc.ar, vc.obact, rect); @@ -354,7 +354,7 @@ static void get_pbvh_nodes(PBVH *pbvh, case PARTIALVIS_MASKED: break; } - + BKE_pbvh_search_gather(pbvh, cb, clip_planes, nodes, totnode); } @@ -414,7 +414,7 @@ static int hide_show_exec(bContext *C, wmOperator *op) if (nodes) MEM_freeN(nodes); - + /* end undo */ sculpt_undo_push_end(); @@ -425,7 +425,7 @@ static int hide_show_exec(bContext *C, wmOperator *op) } ED_region_tag_redraw(ar); - + return OPERATOR_FINISHED; } @@ -454,7 +454,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"; @@ -474,6 +474,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 9ecdc44cd10..2921faf8a5a 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -169,7 +169,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; @@ -195,7 +195,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"); @@ -204,15 +204,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++) @@ -221,9 +221,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; @@ -232,7 +232,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; } } @@ -312,7 +312,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; } @@ -465,7 +465,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); @@ -483,7 +483,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); @@ -850,7 +850,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; @@ -915,7 +915,7 @@ static int sample_color_exec(bContext *C, wmOperator *op) } WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, brush); - + return OPERATOR_FINISHED; } @@ -1017,7 +1017,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; @@ -1086,7 +1086,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 */ @@ -1096,8 +1096,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; @@ -1106,7 +1106,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) { Object *obedit = CTX_data_edit_object(C); ED_space_image_set(sima, scene, obedit, ima); @@ -1116,7 +1116,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) } } } - + ob->mode |= mode_flag; BKE_paint_init(scene, ePaintTextureProjective, PAINT_CURSOR_TEXTURE_PAINT); @@ -1143,7 +1143,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; @@ -1163,7 +1163,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; @@ -1236,7 +1236,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 c2ce9d83782..a75d6344849 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -582,7 +582,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); @@ -1132,13 +1132,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; @@ -1232,7 +1232,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 45ee1ebac11..0e48596ca1a 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -1055,7 +1055,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; @@ -2117,7 +2117,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. @@ -2128,12 +2128,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) != @@ -2150,20 +2150,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); @@ -2171,9 +2171,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)) @@ -2187,7 +2187,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, @@ -2352,7 +2352,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"); @@ -2976,7 +2976,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; @@ -3487,7 +3487,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)); @@ -3513,7 +3513,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))) @@ -3707,7 +3707,7 @@ static void project_paint_prepare_all_faces( ps->dm_mloopuv[lt->poly] = mloopuv_base; continue; } - + tpage = slot->ima; } } @@ -4399,7 +4399,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; @@ -4608,7 +4608,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 @@ -4686,7 +4686,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; @@ -4919,14 +4919,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) }; @@ -4939,14 +4939,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; } @@ -5085,9 +5085,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; @@ -5319,7 +5319,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); @@ -5519,7 +5519,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," : "", @@ -5540,7 +5540,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) { @@ -5554,16 +5554,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; @@ -5583,7 +5583,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->ldata, CD_MLOOPUV); @@ -5604,7 +5604,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; } @@ -5617,7 +5617,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; } @@ -5654,7 +5654,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; } @@ -5681,32 +5681,32 @@ 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); - + 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); DEG_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; } @@ -5734,7 +5734,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 */ @@ -5819,7 +5819,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); - + DEG_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 f56ef32ba72..3a8ab12b96d 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -88,10 +88,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; } @@ -145,10 +145,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; @@ -286,10 +286,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; } @@ -354,7 +354,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) { @@ -930,7 +930,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; @@ -1201,7 +1201,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); @@ -1247,7 +1247,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; @@ -1286,7 +1286,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 3ded6326c67..b63f9461401 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -126,7 +126,7 @@ typedef struct PaintStroke { float zoom_2d; int pen_flip; - + /* line constraint */ bool constrain_line; float constrained_pos[2]; @@ -735,10 +735,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) @@ -928,11 +928,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; @@ -1096,17 +1096,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; @@ -1114,7 +1114,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]; } @@ -1209,12 +1209,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 594fbbd04d4..80c4d4099a2 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -221,10 +221,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"); @@ -473,12 +473,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_eval, me_eval, faceindex); else image = imapaint->canvas; - + if (image) { ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL); if (ibuf && ibuf->rect) { @@ -486,16 +486,16 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr float u, v; imapaint_pick_uv(me_eval, scene, ob_eval, 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]; bilinear_interpolation_color_wrap(ibuf, NULL, rgba_f, u, v); @@ -521,7 +521,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr } } } - + BKE_image_release_ibuf(image, ibuf, NULL); } } @@ -542,7 +542,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 3e4a2e24920..53b73562322 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2604,7 +2604,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/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index c0674289a5a..5dd7f23864c 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -631,7 +631,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)); @@ -730,7 +730,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); @@ -1119,7 +1119,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) { @@ -1152,7 +1152,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: @@ -1209,7 +1209,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); } @@ -1219,7 +1219,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); @@ -1279,16 +1279,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; @@ -1399,7 +1399,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))) @@ -2041,7 +2041,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); @@ -2192,7 +2192,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); @@ -4040,7 +4040,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; @@ -4175,14 +4175,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]) @@ -4271,7 +4271,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)); @@ -4367,7 +4367,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 } @@ -4949,7 +4949,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); @@ -5048,7 +5048,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); @@ -5092,7 +5092,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; @@ -5102,7 +5102,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; } @@ -5149,7 +5149,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; @@ -5166,7 +5166,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) ****/ @@ -5190,11 +5190,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; } @@ -5298,7 +5298,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); @@ -5522,12 +5522,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; } @@ -5560,11 +5560,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; } @@ -5614,7 +5614,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; @@ -5836,11 +5836,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 bca33ad8014..ff6b5a6f374 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 b819fe8e97d..fbdca27b018 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -144,7 +144,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 */ @@ -261,7 +261,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)) { @@ -273,12 +273,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]]); - + } } @@ -292,7 +292,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 */ @@ -671,10 +671,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]]); @@ -691,7 +691,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; @@ -706,7 +706,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 */ @@ -722,7 +722,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"); @@ -736,7 +736,7 @@ static SculptUndoNode *sculpt_undo_alloc_node( BLI_assert(!"Dynamic topology should've already been handled"); break; } - + BLI_addtail(&usculpt->nodes, unode); if (maxgrid) { @@ -788,7 +788,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++) { @@ -927,7 +927,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 6928610f280..46d704e8f74 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -138,7 +138,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; |