Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt.c
| Context not available. | |||||
| typedef void (*BrushActionFunc)(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups); | typedef void (*BrushActionFunc)(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups); | ||||
| static void do_tiled(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups, BrushActionFunc action) | |||||
| { | |||||
| SculptSession *ss = ob->sculpt; | |||||
| StrokeCache *cache = ss->cache; | |||||
| float const * bbMin = ob->bb->vec[0]; | |||||
sergeyUnsubmitted Done Inline Actionssergey: const float *bbMin = ob->bb->vec[0]; | |||||
| float const * bbMax = ob->bb->vec[6]; | |||||
| float start[3]; | |||||
| float end[3]; | |||||
| float const * step = sd->tile_offset; | |||||
| int dim; | |||||
| for (dim = 0; dim < 3; ++dim) | |||||
sergeyUnsubmitted Done Inline Actionsfor (dim = 0; dim < 3; ++dim) {sergey: for (dim = 0; dim < 3; ++dim) { | |||||
| { | |||||
| if ((sd->flags & (SCULPT_TILE_X << dim)) && step[dim] > 0) | |||||
sergeyUnsubmitted Done Inline ActionsSame as above, and make it consistent. sergey: Same as above, and make it consistent. | |||||
| { | |||||
| int n = (cache->location[dim] - bbMin[dim]) / step[dim]; | |||||
| start[dim] = cache->location[dim] - n * step[dim]; | |||||
| end[dim] = bbMax[dim]; | |||||
| } | |||||
| else | |||||
| start[dim] = end[dim] = cache->location[dim]; | |||||
| } | |||||
| copy_v3_v3(cache->location, start); | |||||
| do | |||||
| { | |||||
| do | |||||
| { | |||||
| do | |||||
| { | |||||
| action(sd, ob, brush, ups); | |||||
| cache->location[2] += step[2]; | |||||
| } | |||||
| while (cache->location[2] < end[2]); | |||||
sergeyUnsubmitted Done Inline Actions} while (cache->location[2] < end[2]); sergey: } while (cache->location[2] < end[2]); | |||||
| cache->location[2] = start[2]; | |||||
| cache->location[1] += step[1]; | |||||
| } | |||||
| while (cache->location[1] < end[1]); | |||||
| cache->location[1] = start[1]; | |||||
| cache->location[0] += step[0]; | |||||
| } | |||||
| while (cache->location[0] < end[0]); | |||||
| } | |||||
| static void do_radial_symmetry(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups, | static void do_radial_symmetry(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups, | ||||
| BrushActionFunc action, | BrushActionFunc action, | ||||
| const char symm, const int axis, | const char symm, const int axis, | ||||
| Context not available. | |||||
| const float angle = 2 * M_PI * i / sd->radial_symm[axis - 'X']; | const float angle = 2 * M_PI * i / sd->radial_symm[axis - 'X']; | ||||
| ss->cache->radial_symmetry_pass = i; | ss->cache->radial_symmetry_pass = i; | ||||
| calc_brushdata_symm(sd, ss->cache, symm, axis, angle, feather); | calc_brushdata_symm(sd, ss->cache, symm, axis, angle, feather); | ||||
| action(sd, ob, brush, ups); | do_tiled(sd, ob, brush, ups, action); | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| cache->radial_symmetry_pass = 0; | cache->radial_symmetry_pass = 0; | ||||
| calc_brushdata_symm(sd, cache, i, 0, 0, feather); | calc_brushdata_symm(sd, cache, i, 0, 0, feather); | ||||
| action(sd, ob, brush, ups); | do_tiled(sd, ob, brush, ups, action); | ||||
| do_radial_symmetry(sd, ob, brush, ups, action, i, 'X', feather); | do_radial_symmetry(sd, ob, brush, ups, action, i, 'X', feather); | ||||
| do_radial_symmetry(sd, ob, brush, ups, action, i, 'Y', feather); | do_radial_symmetry(sd, ob, brush, ups, action, i, 'Y', feather); | ||||
| Context not available. | |||||
| if (ts->sculpt->constant_detail == 0.0f) | if (ts->sculpt->constant_detail == 0.0f) | ||||
| ts->sculpt->constant_detail = 30.0f; | ts->sculpt->constant_detail = 30.0f; | ||||
| /* Set sane default tiling offsets */ | |||||
| if (!ts->sculpt->tile_offset[0]) ts->sculpt->tile_offset[0] = 1.0f; | |||||
| if (!ts->sculpt->tile_offset[1]) ts->sculpt->tile_offset[1] = 1.0f; | |||||
| if (!ts->sculpt->tile_offset[2]) ts->sculpt->tile_offset[2] = 1.0f; | |||||
| /* Create sculpt mode session data */ | /* Create sculpt mode session data */ | ||||
| if (ob->sculpt) | if (ob->sculpt) | ||||
| BKE_sculptsession_free(ob); | BKE_sculptsession_free(ob); | ||||
| Context not available. | |||||