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
diff options
context:
space:
mode:
authorCody Winchester <CodyWinch>2020-02-18 20:12:06 +0300
committerBastien Montagne <b.mont29@gmail.com>2020-02-18 20:14:44 +0300
commit20605c4b515e3e93a1557839669e8c6fc02dcbc9 (patch)
treebdc91cd4533f9cf7881dc723efc216e56d1b61f7 /source/blender/modifiers/intern/MOD_uvwarp.c
parent6cd4363c0c3ee73a0656e84e91ebf9e9c936d6bd (diff)
Modifiers: UVWarp modifier add invert vgroup option
Adds the invert vgroup option to the UVWarp modifier. Adds a flag and char padding to the DNA. Differential Revision: https://developer.blender.org/D6841
Diffstat (limited to 'source/blender/modifiers/intern/MOD_uvwarp.c')
-rw-r--r--source/blender/modifiers/intern/MOD_uvwarp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_uvwarp.c b/source/blender/modifiers/intern/MOD_uvwarp.c
index 2dfb9031c38..973923d1cf4 100644
--- a/source/blender/modifiers/intern/MOD_uvwarp.c
+++ b/source/blender/modifiers/intern/MOD_uvwarp.c
@@ -88,6 +88,7 @@ typedef struct UVWarpData {
int defgrp_index;
float (*warp_mat)[4];
+ bool invert_vgroup;
} UVWarpData;
static void uv_warp_compute(void *__restrict userdata,
@@ -110,7 +111,9 @@ static void uv_warp_compute(void *__restrict userdata,
if (dvert) {
for (l = 0; l < mp->totloop; l++, ml++, mluv++) {
float uv[2];
- const float weight = defvert_find_weight(&dvert[ml->v], defgrp_index);
+ const float weight = data->invert_vgroup ?
+ 1.0f - defvert_find_weight(&dvert[ml->v], defgrp_index) :
+ defvert_find_weight(&dvert[ml->v], defgrp_index);
uv_warp_from_mat4_pair(uv, mluv->uv, warp_mat);
interp_v2_v2v2(mluv->uv, mluv->uv, uv, weight);
@@ -136,6 +139,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
float warp_mat[4][4];
const int axis_u = umd->axis_u;
const int axis_v = umd->axis_v;
+ const bool invert_vgroup = (umd->flag & MOD_UVWARP_INVERT_VGROUP) != 0;
/* make sure there are UV Maps available */
if (!CustomData_has_layer(&mesh->ldata, CD_MLOOPUV)) {
@@ -208,6 +212,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
.dvert = dvert,
.defgrp_index = defgrp_index,
.warp_mat = warp_mat,
+ .invert_vgroup = invert_vgroup,
};
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);