Compare commits
4 Commits
main
...
soc-2016-s
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5829a04a17 | ||
![]() |
54f537f5e0 | ||
![]() |
0b9a72a0dc | ||
![]() |
1ea040281f |
BIN
release/datafiles/brushicons/silhouette.png
Normal file
BIN
release/datafiles/brushicons/silhouette.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
Submodule release/datafiles/locale updated: 9628dc1922...a87cfb8a89
Submodule release/scripts/addons updated: 407d0ea752...75fb4e0a91
Submodule release/scripts/addons_contrib updated: 9f29e18707...72c24a1dbf
@@ -140,7 +140,7 @@ void BKE_brush_init(Brush *brush)
|
||||
|
||||
brush_defaults(brush);
|
||||
|
||||
brush->sculpt_tool = SCULPT_TOOL_DRAW; /* sculpting defaults to the draw tool for new brushes */
|
||||
brush->sculpt_tool = SCULPT_TOOL_DRAW; /* sculpting defaults to the draw tool for new brushes */
|
||||
|
||||
/* the default alpha falloff curve */
|
||||
BKE_brush_curve_preset(brush, CURVE_PRESET_SMOOTH);
|
||||
@@ -417,13 +417,14 @@ void BKE_brush_sculpt_reset(Brush *br)
|
||||
br->sub_col[0] = 0.25;
|
||||
br->sub_col[1] = 1;
|
||||
break;
|
||||
case SCULPT_TOOL_SILHOUETTE:
|
||||
case SCULPT_TOOL_INFLATE:
|
||||
br->add_col[0] = 0.750000;
|
||||
br->add_col[1] = 0.750000;
|
||||
br->add_col[2] = 0.750000;
|
||||
br->sub_col[0] = 0.250000;
|
||||
br->sub_col[1] = 0.250000;
|
||||
br->sub_col[2] = 0.250000;
|
||||
br->sub_col[0] = 0.250000;
|
||||
br->sub_col[1] = 0.250000;
|
||||
br->sub_col[2] = 0.250000;
|
||||
break;
|
||||
case SCULPT_TOOL_NUDGE:
|
||||
br->add_col[0] = 0.250000;
|
||||
|
@@ -797,6 +797,11 @@ void BKE_scene_init(Scene *sce)
|
||||
gp_brush->size = 25;
|
||||
gp_brush->strength = 0.5f;
|
||||
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
|
||||
|
||||
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_SILHOUETTE];
|
||||
gp_brush->size = 10;
|
||||
gp_brush->strength = 0.5f;
|
||||
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
|
||||
}
|
||||
|
||||
/* GP Stroke Placement */
|
||||
|
@@ -111,6 +111,7 @@ float dist_squared_to_line_segment_v3(const float p[3], const float l1[3], const
|
||||
float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]);
|
||||
float dist_squared_to_line_v3(const float p[3], const float l1[3], const float l2[3]);
|
||||
float dist_to_line_v3(const float p[3], const float l1[3], const float l2[3]);
|
||||
float dist_squared_to_line_direction_v3v3(const float v1[3], const float v2[3], const float dir[3]);
|
||||
float dist_signed_squared_to_corner_v3v3v3(
|
||||
const float p[3],
|
||||
const float v1[3], const float v2[3], const float v3[3],
|
||||
|
@@ -496,6 +496,16 @@ float dist_to_line_v3(const float p[3], const float l1[3], const float l2[3])
|
||||
return sqrtf(dist_squared_to_line_v3(p, l1, l2));
|
||||
}
|
||||
|
||||
/* distance v1 to line v2-V_dir in 3D */
|
||||
float dist_squared_to_line_direction_v3v3(const float v1[3], const float v2[3], const float dir[3])
|
||||
{
|
||||
float v2v1[3];
|
||||
sub_v3_v3v3(v2v1, v1, v2);
|
||||
float e[3];
|
||||
cross_v3_v3v3(e, v2v1, dir);
|
||||
return len_squared_v3(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if \a p is inside the 2x planes defined by ``(v1, v2, v3)``
|
||||
* where the 3x points define 2x planes.
|
||||
|
@@ -109,7 +109,7 @@ void BLO_update_defaults_startup_blend(Main *bmain)
|
||||
brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
|
||||
|
||||
brush = &gset->brush[GP_EDITBRUSH_TYPE_GRAB];
|
||||
brush->size = 50;
|
||||
brush->size = 50;
|
||||
brush->strength = 0.3f;
|
||||
brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
|
||||
|
||||
@@ -132,6 +132,11 @@ void BLO_update_defaults_startup_blend(Main *bmain)
|
||||
brush->size = 25;
|
||||
brush->strength = 0.5f;
|
||||
brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
|
||||
|
||||
brush = &gset->brush[GP_EDITBRUSH_TYPE_SILHOUETTE];
|
||||
brush->size = 10;
|
||||
brush->strength = 0.5f;
|
||||
brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
|
||||
}
|
||||
|
||||
ts->gpencil_v3d_align = GP_PROJECT_VIEWSPACE;
|
||||
@@ -208,12 +213,19 @@ void BLO_update_defaults_startup_blend(Main *bmain)
|
||||
{
|
||||
Brush *br;
|
||||
|
||||
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Fill");
|
||||
if (!br) {
|
||||
br = BKE_brush_add(bmain, "Fill", OB_MODE_TEXTURE_PAINT);
|
||||
br->imagepaint_tool = PAINT_TOOL_FILL;
|
||||
br->ob_mode = OB_MODE_TEXTURE_PAINT;
|
||||
}
|
||||
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Fill");
|
||||
if (!br) {
|
||||
br = BKE_brush_add(bmain, "Fill", OB_MODE_TEXTURE_PAINT);
|
||||
br->imagepaint_tool = PAINT_TOOL_FILL;
|
||||
br->ob_mode = OB_MODE_TEXTURE_PAINT;
|
||||
}
|
||||
|
||||
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Silhouette");
|
||||
if (!br) {
|
||||
br = BKE_brush_add(bmain, "Silhouette", OB_MODE_SCULPT);
|
||||
br->sculpt_tool = SCULPT_TOOL_SILHOUETTE;
|
||||
br->ob_mode = OB_MODE_SCULPT;
|
||||
}
|
||||
|
||||
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Mask");
|
||||
if (br) {
|
||||
@@ -222,10 +234,10 @@ void BLO_update_defaults_startup_blend(Main *bmain)
|
||||
}
|
||||
|
||||
/* remove polish brush (flatten/contrast does the same) */
|
||||
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Polish");
|
||||
if (br) {
|
||||
BKE_libblock_free(bmain, br);
|
||||
}
|
||||
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Polish");
|
||||
if (br) {
|
||||
BKE_libblock_free(bmain, br);
|
||||
}
|
||||
|
||||
/* remove brush brush (huh?) from some modes (draw brushes do the same) */
|
||||
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Brush");
|
||||
|
@@ -165,6 +165,9 @@ extern char datatoc_twist_png[];
|
||||
extern int datatoc_vertexdraw_png_size;
|
||||
extern char datatoc_vertexdraw_png[];
|
||||
|
||||
//extern int datatoc_silhouette_png_size;
|
||||
//extern char datatoc_silhouette_png[];
|
||||
|
||||
/* Matcap files */
|
||||
|
||||
extern int datatoc_mc01_jpg_size;
|
||||
|
@@ -977,6 +977,7 @@ DEF_ICON(BRUSH_TEXMASK)
|
||||
DEF_ICON(BRUSH_THUMB)
|
||||
DEF_ICON(BRUSH_ROTATE)
|
||||
DEF_ICON(BRUSH_VERTEXDRAW)
|
||||
DEF_ICON(BRUSH_SILHOUETTE)
|
||||
|
||||
/* Matcaps */
|
||||
DEF_ICON(MATCAP_01)
|
||||
|
@@ -598,7 +598,7 @@ static void init_brush_icons(void)
|
||||
INIT_BRUSH_ICON(ICON_BRUSH_SCULPT_DRAW, draw);
|
||||
INIT_BRUSH_ICON(ICON_BRUSH_FILL, fill);
|
||||
INIT_BRUSH_ICON(ICON_BRUSH_FLATTEN, flatten);
|
||||
INIT_BRUSH_ICON(ICON_BRUSH_GRAB, grab);
|
||||
INIT_BRUSH_ICON(ICON_BRUSH_GRAB, grab);
|
||||
INIT_BRUSH_ICON(ICON_BRUSH_INFLATE, inflate);
|
||||
INIT_BRUSH_ICON(ICON_BRUSH_LAYER, layer);
|
||||
INIT_BRUSH_ICON(ICON_BRUSH_LIGHTEN, lighten);
|
||||
@@ -619,6 +619,7 @@ static void init_brush_icons(void)
|
||||
INIT_BRUSH_ICON(ICON_BRUSH_THUMB, thumb);
|
||||
INIT_BRUSH_ICON(ICON_BRUSH_ROTATE, twist);
|
||||
INIT_BRUSH_ICON(ICON_BRUSH_VERTEXDRAW, vertexdraw);
|
||||
//INIT_BRUSH_ICON(ICON_BRUSH_SILHOUETTE, silhouette);
|
||||
|
||||
#undef INIT_BRUSH_ICON
|
||||
}
|
||||
|
@@ -762,7 +762,7 @@ void PAINTCURVE_OT_draw(wmOperatorType *ot)
|
||||
/* identifiers */
|
||||
ot->name = "Draw Curve";
|
||||
ot->description = "Draw curve";
|
||||
ot->idname = "PAINTCURVE_OT_draw";
|
||||
ot->idname = "PAINTCURVE_OT_draw";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = paintcurve_draw_exec;
|
||||
|
@@ -469,9 +469,14 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const float
|
||||
|
||||
ups->last_hit = paint_brush_update(C, brush, mode, stroke, mouse_in, mouse_out, pressure, location);
|
||||
copy_v3_v3(ups->last_location, location);
|
||||
if (!ups->last_hit) {
|
||||
return;
|
||||
}
|
||||
if (brush->sculpt_tool == SCULPT_TOOL_SILHOUETTE) {
|
||||
if (ups->last_hit) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!ups->last_hit) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Add to stroke */
|
||||
RNA_collection_add(op->ptr, "stroke", &itemptr);
|
||||
|
@@ -268,6 +268,9 @@ typedef struct StrokeCache {
|
||||
|
||||
rcti previous_r; /* previous redraw rectangle */
|
||||
rcti current_r; /* current redraw rectangle */
|
||||
|
||||
/* not so good, could be another way */
|
||||
int brush_size;
|
||||
} StrokeCache;
|
||||
|
||||
/************** Access to original unmodified vertex data *************/
|
||||
@@ -653,9 +656,16 @@ void ED_sculpt_redraw_planes_get(float planes[4][4], ARegion *ar,
|
||||
typedef struct SculptBrushTest {
|
||||
float radius_squared;
|
||||
float location[3];
|
||||
float normal[3];
|
||||
float dist;
|
||||
int mirror_symmetry_pass;
|
||||
|
||||
ViewContext* vc;
|
||||
int brush_size;
|
||||
float true_location[3];
|
||||
float prep_foot[3];
|
||||
float radius;
|
||||
|
||||
/* View3d clipping - only set rv3d for clipping */
|
||||
RegionView3D *clip_rv3d;
|
||||
} SculptBrushTest;
|
||||
@@ -663,9 +673,13 @@ typedef struct SculptBrushTest {
|
||||
static void sculpt_brush_test_init(SculptSession *ss, SculptBrushTest *test)
|
||||
{
|
||||
RegionView3D *rv3d = ss->cache->vc->rv3d;
|
||||
test->vc = ss->cache->vc;
|
||||
test->brush_size = ss->cache->brush_size;
|
||||
copy_v3_v3(test->true_location, ss->cache->true_location);
|
||||
|
||||
test->radius_squared = ss->cache->radius_squared;
|
||||
copy_v3_v3(test->location, ss->cache->location);
|
||||
copy_v3_v3(test->normal, ss->cache->view_normal);
|
||||
test->dist = 0.0f; /* just for initialize */
|
||||
|
||||
test->mirror_symmetry_pass = ss->cache->mirror_symmetry_pass;
|
||||
@@ -1157,7 +1171,7 @@ static float brush_strength(const Sculpt *sd, const StrokeCache *cache, const fl
|
||||
float pressure = BKE_brush_use_alpha_pressure(scene, brush) ? cache->pressure : 1;
|
||||
float pen_flip = cache->pen_flip ? -1 : 1;
|
||||
float invert = cache->invert ? -1 : 1;
|
||||
float overlap = ups->overlap_factor;
|
||||
float overlap = ups->overlap_factor;
|
||||
/* spacing is integer percentage of radius, divide by 50 to get
|
||||
* normalized diameter */
|
||||
|
||||
@@ -1182,7 +1196,7 @@ static float brush_strength(const Sculpt *sd, const StrokeCache *cache, const fl
|
||||
case SCULPT_TOOL_CREASE:
|
||||
case SCULPT_TOOL_BLOB:
|
||||
return alpha * flip * pressure * overlap * feather;
|
||||
|
||||
case SCULPT_TOOL_SILHOUETTE:
|
||||
case SCULPT_TOOL_INFLATE:
|
||||
if (flip > 0) {
|
||||
return 0.250f * alpha * flip * pressure * overlap * feather;
|
||||
@@ -1346,6 +1360,12 @@ static bool sculpt_search_sphere_cb(PBVHNode *node, void *data_v)
|
||||
return len_squared_v3(t) < data->radius_squared;
|
||||
}
|
||||
|
||||
/* temporary function to make silhouette brush loop through all the nodes */
|
||||
static bool sculpt_search_silhouette_cb (PBVHNode *UNUSED(node), void *UNUSED(data_v))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Handles clipping against a mirror modifier and SCULPT_LOCK axis flags */
|
||||
static void sculpt_clip(Sculpt *sd, SculptSession *ss, float co[3], const float val[3])
|
||||
{
|
||||
@@ -2214,7 +2234,7 @@ static void do_grab_brush_task_cb_ex(
|
||||
ss, brush, orig_data.co, test.dist, orig_data.no, NULL, vd.mask ? *vd.mask : 0.0f,
|
||||
thread_id);
|
||||
|
||||
mul_v3_v3fl(proxy[vd.i], grab_delta, fade);
|
||||
mul_v3_v3fl(proxy[vd.i], grab_delta, fade);
|
||||
|
||||
if (vd.mvert)
|
||||
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||
@@ -2232,7 +2252,8 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
|
||||
copy_v3_v3(grab_delta, ss->cache->grab_delta_symmetry);
|
||||
|
||||
if (ss->cache->normal_weight > 0.0f) {
|
||||
sculpt_project_v3_normal_align(ss, ss->cache->normal_weight, grab_delta);
|
||||
sculpt_project_v3_normal_align(ss, ss->cache->normal_weight, grab_delta);
|
||||
|
||||
}
|
||||
|
||||
SculptThreadedTaskData data = {
|
||||
@@ -3368,6 +3389,115 @@ static void sculpt_topology_update(Sculpt *sd, Object *ob, Brush *brush, Unified
|
||||
}
|
||||
}
|
||||
|
||||
/* calc the foot of the perpendicular of a point to a line
|
||||
* should move this to the math_ .c */
|
||||
|
||||
static void calc_foot_perp_v3_v3v3v3(float* foot, const float* a, const float* l_dir, const float* p)
|
||||
{
|
||||
float v1[3];
|
||||
|
||||
sub_v3_v3v3(v1, a, p);
|
||||
|
||||
float vp[3];
|
||||
mul_v3_v3fl(vp, l_dir, dot_v3v3(l_dir, v1));
|
||||
add_v3_v3v3(foot, p, vp);
|
||||
}
|
||||
|
||||
/* should move this test to the test section */
|
||||
static bool sculpt_brush_test_silhouette(SculptBrushTest *test, const float co[])
|
||||
{
|
||||
calc_foot_perp_v3_v3v3v3(test->prep_foot, co, test->normal, test->location);
|
||||
test->radius = paint_calc_object_space_radius(test->vc,
|
||||
test->prep_foot,
|
||||
test->brush_size);
|
||||
|
||||
test->radius_squared = test->radius * test->radius;
|
||||
|
||||
float distsq = dist_squared_to_line_direction_v3v3(co, test->location, test->normal);
|
||||
|
||||
if (distsq <= test->radius_squared) {
|
||||
if (sculpt_brush_test_clipping(test, co)) {
|
||||
return 0;
|
||||
}
|
||||
test->dist = sqrtf(distsq);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void do_silhouette_brush_task_cb_ex(
|
||||
void *userdata, void *UNUSED(userdata_chunk), const int n, const int UNUSED(thread_id))
|
||||
{
|
||||
SculptThreadedTaskData *data = userdata;
|
||||
SculptSession *ss = data->ob->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
SculptBrushTest test;
|
||||
float (*proxy)[3];
|
||||
|
||||
float ray_normal[3], ray_start[3], ray_end[3];
|
||||
float imat[4][4];
|
||||
|
||||
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, data->nodes[n])->co;
|
||||
|
||||
sculpt_brush_test_init(ss, &test);
|
||||
|
||||
/* Do ray cast again from the view point. This has been done before in stroke update, but the
|
||||
* ray_normal and ray_end seem to be lost. The location in cache is weird and the view_normal
|
||||
* is not the inverse of ray_normal, therefore not usable */
|
||||
ED_view3d_win_to_segment(test.vc->ar, test.vc->v3d, ss->cache->mouse, ray_start, ray_end, true);
|
||||
|
||||
/* deal with transform */
|
||||
invert_m4_m4(data->ob->imat, data->ob->obmat);
|
||||
copy_m4_m4(imat, data->ob->imat);
|
||||
|
||||
mul_m4_v3(imat, ray_normal);
|
||||
mul_m4_v3(imat, ray_start);
|
||||
mul_m4_v3(imat, ray_end);
|
||||
|
||||
sub_v3_v3v3(ray_normal, ray_end, ray_start);
|
||||
normalize_v3(ray_normal);
|
||||
|
||||
copy_v3_v3(test.normal, ray_normal);
|
||||
copy_v3_v3(test.location, ray_end);
|
||||
|
||||
BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||
{
|
||||
if (sculpt_brush_test_silhouette(&test, vd.co)) {
|
||||
|
||||
float val[3];
|
||||
|
||||
sub_v3_v3v3(val, vd.co, test.prep_foot);
|
||||
|
||||
normalize_v3(val);
|
||||
|
||||
mul_v3_fl(val, test.radius - test.dist);
|
||||
copy_v3_v3(proxy[vd.i], val);
|
||||
|
||||
if (vd.mvert)
|
||||
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||
}
|
||||
}
|
||||
BKE_pbvh_vertex_iter_end;
|
||||
}
|
||||
|
||||
|
||||
static void do_silhouette_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
|
||||
{
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
SculptThreadedTaskData data = {
|
||||
.sd = sd, .ob = ob, .brush = brush, .nodes = nodes,
|
||||
};
|
||||
|
||||
BLI_task_parallel_range_ex(
|
||||
0, totnode, &data, NULL, 0, do_silhouette_brush_task_cb_ex,
|
||||
((sd->flags & SCULPT_USE_OPENMP) && totnode > SCULPT_THREADED_LIMIT), false);
|
||||
|
||||
}
|
||||
|
||||
static void do_brush_action_task_cb(void *userdata, const int n)
|
||||
{
|
||||
SculptThreadedTaskData *data = userdata;
|
||||
@@ -3389,10 +3519,14 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe
|
||||
data.sd = sd;
|
||||
data.radius_squared = ss->cache->radius_squared;
|
||||
data.original = sculpt_tool_needs_original(brush->sculpt_tool) ? true : ss->cache->original;
|
||||
BKE_pbvh_search_gather(ss->pbvh, sculpt_search_sphere_cb, &data, &nodes, &totnode);
|
||||
if (brush->sculpt_tool == SCULPT_TOOL_SILHOUETTE) {
|
||||
BKE_pbvh_search_gather(ss->pbvh, sculpt_search_silhouette_cb, &data, &nodes, &totnode);
|
||||
}
|
||||
else
|
||||
BKE_pbvh_search_gather(ss->pbvh, sculpt_search_sphere_cb, &data, &nodes, &totnode);
|
||||
|
||||
/* Only act if some verts are inside the brush area */
|
||||
if (totnode) {
|
||||
if (totnode) {
|
||||
float location[3];
|
||||
|
||||
SculptThreadedTaskData task_data = {
|
||||
@@ -3464,7 +3598,9 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe
|
||||
break;
|
||||
case SCULPT_TOOL_MASK:
|
||||
do_mask_brush(sd, ob, nodes, totnode);
|
||||
break;
|
||||
break;
|
||||
case SCULPT_TOOL_SILHOUETTE:
|
||||
do_silhouette_brush(sd, ob, nodes, totnode);
|
||||
}
|
||||
|
||||
if (!ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_MASK) &&
|
||||
@@ -3935,6 +4071,8 @@ static const char *sculpt_tool_name(Sculpt *sd)
|
||||
return "Mask Brush";
|
||||
case SCULPT_TOOL_SIMPLIFY:
|
||||
return "Simplify Brush";
|
||||
case SCULPT_TOOL_SILHOUETTE:
|
||||
return "Silhouette Brush";
|
||||
}
|
||||
|
||||
return "Sculpting";
|
||||
@@ -4316,10 +4454,11 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
|
||||
|
||||
/* Truly temporary data that isn't stored in properties */
|
||||
if (cache->first_time) {
|
||||
if (!BKE_brush_use_locked_size(scene, brush)) {
|
||||
if (!BKE_brush_use_locked_size(scene, brush)) {
|
||||
cache->brush_size = BKE_brush_size_get(scene, brush);
|
||||
cache->initial_radius = paint_calc_object_space_radius(cache->vc,
|
||||
cache->true_location,
|
||||
BKE_brush_size_get(scene, brush));
|
||||
cache->brush_size);
|
||||
BKE_brush_unprojected_radius_set(scene, brush, cache->initial_radius);
|
||||
}
|
||||
else {
|
||||
@@ -4465,6 +4604,9 @@ static float sculpt_raycast_init(ViewContext *vc, const float mouse[2], float ra
|
||||
sub_v3_v3v3(ray_normal, ray_end, ray_start);
|
||||
dist = normalize_v3(ray_normal);
|
||||
|
||||
float n_rn[3];
|
||||
normalize_v3_v3(n_rn, ray_normal);
|
||||
|
||||
if ((rv3d->is_persp == false) &&
|
||||
/* if the ray is clipped, don't adjust its start/end */
|
||||
((rv3d->rflag & RV3D_CLIPPING) == 0))
|
||||
@@ -4647,14 +4789,19 @@ static bool over_mesh(bContext *C, struct wmOperator *UNUSED(op), float x, float
|
||||
static bool sculpt_stroke_test_start(bContext *C, struct wmOperator *op,
|
||||
const float mouse[2])
|
||||
{
|
||||
/* Don't start the stroke until mouse goes over the mesh.
|
||||
* note: mouse will only be null when re-executing the saved stroke. */
|
||||
if (!mouse || over_mesh(C, op, mouse[0], mouse[1])) {
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
|
||||
ED_view3d_init_mats_rv3d(ob, CTX_wm_region_view3d(C));
|
||||
/* Don't start the stroke until mouse goes over the mesh. ! Except for silhouette brush !
|
||||
* silhouette brush only starts when mouse is not over the mesh
|
||||
* note: mouse will only be null when re-executing the saved stroke. */
|
||||
if (!mouse || over_mesh(C, op, mouse[0], mouse[1]) ||
|
||||
(!over_mesh(C, op, mouse[0], mouse[1]) &&
|
||||
CTX_data_tool_settings(C)->sculpt->paint.brush->sculpt_tool == SCULPT_TOOL_SILHOUETTE)) {
|
||||
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
|
||||
ED_view3d_init_mats_rv3d(ob, CTX_wm_region_view3d(C));
|
||||
|
||||
sculpt_update_cache_invariants(C, sd, ss, op, mouse);
|
||||
|
||||
|
@@ -254,7 +254,8 @@ typedef enum BrushSculptTool {
|
||||
SCULPT_TOOL_CREASE = 16,
|
||||
SCULPT_TOOL_BLOB = 17,
|
||||
SCULPT_TOOL_CLAY_STRIPS = 18,
|
||||
SCULPT_TOOL_MASK = 19
|
||||
SCULPT_TOOL_MASK = 19,
|
||||
SCULPT_TOOL_SILHOUETTE = 20
|
||||
} BrushSculptTool;
|
||||
|
||||
/** When #BRUSH_ACCUMULATE is used */
|
||||
|
@@ -962,7 +962,7 @@ typedef struct TimeMarker {
|
||||
|
||||
/* Paint Tool Base */
|
||||
typedef struct Paint {
|
||||
struct Brush *brush;
|
||||
struct Brush *brush;
|
||||
struct Palette *palette;
|
||||
struct CurveMapping *cavity_curve; /* cavity curve */
|
||||
|
||||
@@ -1116,9 +1116,10 @@ typedef enum eGP_EditBrush_Types {
|
||||
GP_EDITBRUSH_TYPE_SUBDIVIDE = 7,
|
||||
GP_EDITBRUSH_TYPE_SIMPLIFY = 8,
|
||||
GP_EDITBRUSH_TYPE_CLONE = 9,
|
||||
GP_EDITBRUSH_TYPE_SILHOUETTE= 10,
|
||||
|
||||
/* !!! Update GP_EditBrush_Data brush[###]; below !!! */
|
||||
TOT_GP_EDITBRUSH_TYPES
|
||||
TOT_GP_EDITBRUSH_TYPES,
|
||||
} eGP_EditBrush_Types;
|
||||
|
||||
|
||||
@@ -1147,7 +1148,7 @@ typedef enum eGP_EditBrush_Flag {
|
||||
|
||||
/* GPencil Stroke Sculpting Settings */
|
||||
typedef struct GP_BrushEdit_Settings {
|
||||
GP_EditBrush_Data brush[10]; /* TOT_GP_EDITBRUSH_TYPES */
|
||||
GP_EditBrush_Data brush[11]; /* TOT_GP_EDITBRUSH_TYPES */
|
||||
void *paintcursor; /* runtime */
|
||||
|
||||
int brushtype; /* eGP_EditBrush_Types */
|
||||
|
@@ -70,7 +70,7 @@ EnumPropertyItem rna_enum_brush_sculpt_tool_items[] = {
|
||||
{SCULPT_TOOL_DRAW, "DRAW", ICON_BRUSH_SCULPT_DRAW, "Draw", ""},
|
||||
{SCULPT_TOOL_FILL, "FILL", ICON_BRUSH_FILL, "Fill", ""},
|
||||
{SCULPT_TOOL_FLATTEN, "FLATTEN", ICON_BRUSH_FLATTEN, "Flatten", ""},
|
||||
{SCULPT_TOOL_GRAB, "GRAB", ICON_BRUSH_GRAB, "Grab", ""},
|
||||
{SCULPT_TOOL_GRAB, "GRAB", ICON_BRUSH_GRAB, "Grab", ""},
|
||||
{SCULPT_TOOL_INFLATE, "INFLATE", ICON_BRUSH_INFLATE, "Inflate", ""},
|
||||
{SCULPT_TOOL_LAYER, "LAYER", ICON_BRUSH_LAYER, "Layer", ""},
|
||||
{SCULPT_TOOL_MASK, "MASK", ICON_BRUSH_MASK, "Mask", ""},
|
||||
@@ -81,7 +81,8 @@ EnumPropertyItem rna_enum_brush_sculpt_tool_items[] = {
|
||||
{SCULPT_TOOL_SIMPLIFY, "SIMPLIFY", ICON_BRUSH_SUBTRACT /* icon TODO */, "Simplify", ""},
|
||||
{SCULPT_TOOL_SMOOTH, "SMOOTH", ICON_BRUSH_SMOOTH, "Smooth", ""},
|
||||
{SCULPT_TOOL_SNAKE_HOOK, "SNAKE_HOOK", ICON_BRUSH_SNAKE_HOOK, "Snake Hook", ""},
|
||||
{SCULPT_TOOL_THUMB, "THUMB", ICON_BRUSH_THUMB, "Thumb", ""},
|
||||
{SCULPT_TOOL_THUMB, "THUMB", ICON_BRUSH_THUMB, "Thumb", ""},
|
||||
{SCULPT_TOOL_SILHOUETTE, "SILHOUETTE", ICON_BRUSH_GRAB /*icon TODO*/, "Silhouette", ""},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
|
@@ -63,7 +63,7 @@ static EnumPropertyItem particle_edit_hair_brush_items[] = {
|
||||
EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = {
|
||||
{GP_EDITBRUSH_TYPE_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth stroke points"},
|
||||
{GP_EDITBRUSH_TYPE_THICKNESS, "THICKNESS", 0, "Thickness", "Adjust thickness of strokes"},
|
||||
{GP_EDITBRUSH_TYPE_GRAB, "GRAB", 0, "Grab", "Translate the set of points initially within the brush circle"},
|
||||
{GP_EDITBRUSH_TYPE_GRAB, "GRAB", 0, "Grab", "Translate the set of points initially within the brush circle"},
|
||||
{GP_EDITBRUSH_TYPE_PUSH, "PUSH", 0, "Push", "Move points out of the way, as if combing them"},
|
||||
{GP_EDITBRUSH_TYPE_TWIST, "TWIST", 0, "Twist", "Rotate points around the midpoint of the brush"},
|
||||
{GP_EDITBRUSH_TYPE_PINCH, "PINCH", 0, "Pinch", "Pull points towards the midpoint of the brush"},
|
||||
@@ -71,7 +71,8 @@ EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = {
|
||||
//{GP_EDITBRUSH_TYPE_SUBDIVIDE, "SUBDIVIDE", 0, "Subdivide", "Increase point density for higher resolution strokes when zoomed in"},
|
||||
//{GP_EDITBRUSH_TYPE_SIMPLIFY, "SIMPLIFY", 0, "Simplify", "Reduce density of stroke points"},
|
||||
{GP_EDITBRUSH_TYPE_CLONE, "CLONE", 0, "Clone", "Paste copies of the strokes stored on the clipboard"},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
{GP_EDITBRUSH_TYPE_SILHOUETTE, "SILHOUETTE", 0, "Silhouette", "Silhouette, place holder, could use PUSH instead"},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
EnumPropertyItem rna_enum_symmetrize_direction_items[] = {
|
||||
@@ -418,7 +419,7 @@ static void rna_def_paint(BlenderRNA *brna)
|
||||
RNA_def_struct_ui_text(srna, "Paint", "");
|
||||
|
||||
/* Global Settings */
|
||||
prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
|
||||
prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Brush_mode_poll");
|
||||
RNA_def_property_ui_text(prop, "Brush", "Active Brush");
|
||||
|
Reference in New Issue
Block a user