Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-10-11 11:14:16 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-10-11 11:14:16 +0300
commitdc95c79971d48dae9418e0047f14c01e6dcab13c (patch)
treef6da183a7e7b3d0adf691c5b270ccab4f8801e35 /source
parentef1918d3128b1f56d69c189a838b648dc88de4c9 (diff)
parent4782000fd5b2a1ae3041884f64ab192dbcb853c0 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c133
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c2
-rw-r--r--source/blender/editors/space_file/file_ops.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c2
-rw-r--r--source/blender/windowmanager/intern/wm_files_link.c2
6 files changed, 39 insertions, 106 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index befb635cfc4..2d2d5fa33c9 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -1025,7 +1025,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
ViewContext vc;
view3d_set_viewcontext(C, &vc);
- if (vc.rv3d->rflag & RV3D_NAVIGATING) {
+ if (vc.rv3d && (vc.rv3d->rflag & RV3D_NAVIGATING)) {
return;
}
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 3fa1eda5d1e..7a0c6999623 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -310,78 +310,29 @@ static uint vpaint_blend(
return color_blend;
}
-
-/* whats _dl mean? */
-static float calc_vp_strength_col_dl(
+static void tex_color_alpha(
VPaint *vp, const ViewContext *vc, const float co[3],
- const float mval[2], const float brush_size_pressure, float rgba[4])
+ float r_rgba[4])
{
- float co_ss[2]; /* screenspace */
-
- if (ED_view3d_project_float_object(
- vc->ar,
- co, co_ss,
- V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
- {
- const float dist_sq = len_squared_v2v2(mval, co_ss);
-
- if (dist_sq <= SQUARE(brush_size_pressure)) {
- Brush *brush = BKE_paint_brush(&vp->paint);
- const float dist = sqrtf(dist_sq);
- float factor;
-
- if (brush->mtex.tex && rgba) {
- if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) {
- BKE_brush_sample_tex_3D(vc->scene, brush, co, rgba, 0, NULL);
- }
- else {
- const float co_ss_3d[3] = {co_ss[0], co_ss[1], 0.0f}; /* we need a 3rd empty value */
- BKE_brush_sample_tex_3D(vc->scene, brush, co_ss_3d, rgba, 0, NULL);
- }
- factor = rgba[3];
- }
- else {
- factor = 1.0f;
- }
- return factor * BKE_brush_curve_strength_clamped(brush, dist, brush_size_pressure);
- }
+ const Brush *brush = BKE_paint_brush(&vp->paint);
+ BLI_assert(brush->mtex.tex != NULL);
+ if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) {
+ BKE_brush_sample_tex_3D(vc->scene, brush, co, r_rgba, 0, NULL);
}
- if (rgba)
- zero_v4(rgba);
- return 0.0f;
-}
-
-static float calc_vp_alpha_col_dl(
- VPaint *vp, const ViewContext *vc,
- float vpimat[3][3], const DMCoNo *v_co_no,
- const float mval[2],
- const float brush_size_pressure, const float brush_alpha_pressure, float rgba[4])
-{
- float strength = calc_vp_strength_col_dl(vp, vc, v_co_no->co, mval, brush_size_pressure, rgba);
-
- if (strength > 0.0f) {
- float alpha = brush_alpha_pressure * strength;
-
- if ((vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0) {
- float dvec[3];
-
- /* transpose ! */
- dvec[2] = dot_v3v3(vpimat[2], v_co_no->no);
- if (dvec[2] > 0.0f) {
- dvec[0] = dot_v3v3(vpimat[0], v_co_no->no);
- dvec[1] = dot_v3v3(vpimat[1], v_co_no->no);
-
- alpha *= dvec[2] / len_v3(dvec);
- }
- else {
- return 0.0f;
- }
+ else {
+ float co_ss[2]; /* screenspace */
+ if (ED_view3d_project_float_object(
+ vc->ar,
+ co, co_ss,
+ V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
+ {
+ const float co_ss_3d[3] = {co_ss[0], co_ss[1], 0.0f}; /* we need a 3rd empty value */
+ BKE_brush_sample_tex_3D(vc->scene, brush, co_ss_3d, r_rgba, 0, NULL);
+ }
+ else {
+ zero_v4(r_rgba);
}
-
- return alpha;
}
-
- return 0.0f;
}
/* vpaint has 'vpaint_blend' */
@@ -1195,8 +1146,6 @@ struct WPaintData {
struct WeightPaintGroupData active, mirror;
- float wpimat[3][3];
-
/* variables for auto normalize */
const bool *vgroup_validmap; /* stores if vgroups tie to deforming bones or not */
const bool *lock_flags;
@@ -1338,8 +1287,6 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
VPaint *vp = CTX_data_tool_settings(C)->wpaint;
EvaluationContext eval_ctx;
- float mat[4][4], imat[4][4];
-
if (ED_wpaint_ensure_data(C, op->reports, WPAINT_ENSURE_MIRROR, &vgroup_index) == false) {
return false;
}
@@ -1443,11 +1390,6 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
wpd->precomputed_weight = MEM_mallocN(sizeof(float) * me->totvert, __func__);
}
- /* imat for normals */
- mul_m4_m4m4(mat, wpd->vc.rv3d->viewmat, ob->obmat);
- invert_m4_m4(imat, mat);
- copy_m3_m4(wpd->wpimat, imat);
-
/* If not previously created, create vertex/weight paint mode session data */
vertex_paint_init_session(&eval_ctx, scene, ob);
vwpaint_update_cache_invariants(C, vp, ss, op, mouse);
@@ -2361,8 +2303,6 @@ struct VPaintData {
struct VertProjHandle *vp_handle;
struct DMCoNo *vertexcosnos;
- float vpimat[3][3];
-
/* modify 'me->mcol' directly, since the derived mesh is drawing from this
* array, otherwise we need to refresh the modifier stack */
bool use_fast_update;
@@ -2373,7 +2313,7 @@ struct VPaintData {
bool is_texbrush;
- /* Special storage for smear brush, avoid feedback loop - update each step and swap. */
+ /* Special storage for smear brush, avoid feedback loop - update each step. */
struct {
uint *color_prev;
uint *color_curr;
@@ -2390,7 +2330,6 @@ static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const f
struct VPaintData *vpd;
Object *ob = CTX_data_active_object(C);
Mesh *me;
- float mat[4][4], imat[4][4];
SculptSession *ss = ob->sculpt;
EvaluationContext eval_ctx;
@@ -2446,11 +2385,6 @@ static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const f
ob->sculpt->building_vp_handle = false;
}
- /* some old cruft to sort out later */
- mul_m4_m4m4(mat, vpd->vc.rv3d->viewmat, ob->obmat);
- invert_m4_m4(imat, mat);
- copy_m3_m4(vpd->vpimat, imat);
-
/* If not previously created, create vertex/weight paint mode session data */
vertex_paint_init_session(&eval_ctx, scene, ob);
vwpaint_update_cache_invariants(C, vp, ss, op, mouse);
@@ -2512,23 +2446,17 @@ static void do_vpaint_brush_calc_average_color_cb_ex(
BKE_pbvh_vertex_iter_end;
}
-static void handle_texture_brush(
- SculptThreadedTaskData *data, PBVHVertexIter vd, float size_pressure, float alpha_pressure,
- float *r_alpha, uint *r_color)
+static float tex_color_alpha_ubyte(
+ SculptThreadedTaskData *data, const float v_co[3],
+ uint *r_color)
{
- SculptSession *ss = data->ob->sculpt;
- CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh);
- const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
-
float rgba[4];
float rgba_br[3];
-
- *r_alpha = calc_vp_alpha_col_dl(
- data->vp, &data->vpd->vc, data->vpd->vpimat,
- &data->vpd->vertexcosnos[v_index], ss->cache->mouse, size_pressure, alpha_pressure, rgba);
+ tex_color_alpha(data->vp, &data->vpd->vc, v_co, rgba);
rgb_uchar_to_float(rgba_br, (const uchar *)&data->vpd->paintcol);
mul_v3_v3(rgba_br, rgba);
rgb_float_to_uchar((uchar *)r_color, rgba_br);
+ return rgba[3];
}
static void do_vpaint_brush_draw_task_cb_ex(
@@ -2586,9 +2514,10 @@ static void do_vpaint_brush_draw_task_cb_ex(
/* If we're painting with a texture, sample the texture color and alpha. */
float tex_alpha = 1.0;
if (data->vpd->is_texbrush) {
- handle_texture_brush(
- data, vd, brush_size_pressure, brush_alpha_pressure,
- &tex_alpha, &color_final);
+ /* Note: we may want to paint alpha as vertex color alpha. */
+ tex_alpha = tex_color_alpha_ubyte(
+ data, data->vpd->vertexcosnos[v_index].co,
+ &color_final);
}
/* For each poly owning this vert, paint each loop belonging to this vert. */
for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) {
@@ -3032,7 +2961,7 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
if (vp->paint.brush->vertexpaint_tool == PAINT_BLEND_SMEAR) {
- SWAP(uint *, vpd->smear.color_curr, vpd->smear.color_prev);
+ memcpy(vpd->smear.color_prev, vpd->smear.color_curr, sizeof(uint) * ((Mesh *)ob->data)->totloop);
}
/* calculate pivot for rotation around seletion if needed */
@@ -3058,6 +2987,10 @@ static void vpaint_stroke_done(const bContext *C, struct PaintStroke *stroke)
ViewContext *vc = &vpd->vc;
Object *ob = vc->obact;
+ if (vpd->is_texbrush) {
+ ED_vpaint_proj_handle_free(vpd->vp_handle);
+ }
+
if (vpd->mlooptag)
MEM_freeN(vpd->mlooptag);
if (vpd->smear.color_prev)
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index fb5192b8072..dff536f91f2 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -941,7 +941,7 @@ static void calc_area_center(
/* Intentionally set 'sd' to NULL since we share logic with vertex paint. */
SculptThreadedTaskData data = {
- .sd = NULL, .ob = ob, .nodes = nodes, .totnode = totnode,
+ .sd = NULL, .ob = ob, .brush = brush, .nodes = nodes, .totnode = totnode,
.has_bm_orco = has_bm_orco, .area_cos = area_cos, .area_nos = NULL, .count = count,
};
BLI_mutex_init(&data.mutex);
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index ab1bcbaa8b5..22c1214d928 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -2203,7 +2203,7 @@ static int file_rename_poll(bContext *C)
poll = false;
}
else {
- char dir[FILE_MAX];
+ char dir[FILE_MAX_LIBEXTRA];
if (filelist_islibrary(sfile->files, dir, NULL)) {
poll = false;
}
@@ -2235,7 +2235,7 @@ static int file_delete_poll(bContext *C)
SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile && sfile->params) {
- char dir[FILE_MAX];
+ char dir[FILE_MAX_LIBEXTRA];
int numfiles = filelist_files_ensure(sfile->files);
int i;
int num_selected = 0;
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 407f4306fec..a1549f39b7c 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -1232,7 +1232,7 @@ static int sequencer_snap_invoke(bContext *C, wmOperator *op, const wmEvent *UNU
void SEQUENCER_OT_snap(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Snap Strips";
+ ot->name = "Snap Strips to Frame";
ot->idname = "SEQUENCER_OT_snap";
ot->description = "Frame where selected strips will be snapped";
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index af0d2be8097..dbf0ff90ada 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -319,7 +319,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
SceneLayer *sl = CTX_data_scene_layer(C);
PropertyRNA *prop;
WMLinkAppendData *lapp_data;
- char path[FILE_MAX_LIBEXTRA], root[FILE_MAXDIR], libname[FILE_MAX], relname[FILE_MAX];
+ char path[FILE_MAX_LIBEXTRA], root[FILE_MAXDIR], libname[FILE_MAX_LIBEXTRA], relname[FILE_MAX];
char *group, *name;
int totfiles = 0;
short flag;