From 57411d1c5f1e1043643bf7e5dbd98803c8ff7311 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 5 Sep 2011 03:09:49 +0000 Subject: minor edits. - init proximity to 1.0f - min/max proximity dist were not being copied. - minor edits to comments - use ascii chars in a few places. --- .../blender/modifiers/intern/MOD_weightvg_util.c | 28 ++++++++++++---------- .../blender/modifiers/intern/MOD_weightvg_util.h | 11 +++++---- source/blender/modifiers/intern/MOD_weightvgedit.c | 9 ++++--- source/blender/modifiers/intern/MOD_weightvgmix.c | 11 ++++----- .../modifiers/intern/MOD_weightvgproximity.c | 12 ++++++---- 5 files changed, 37 insertions(+), 34 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index 43cc3081199..d688da4ba80 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -27,8 +27,8 @@ */ /* - * XXX I’d like to make modified weights visible in WeightPaint mode, - * but couldn’t figure a way to do this… + * XXX I'd like to make modified weights visible in WeightPaint mode, + * but couldn't figure a way to do this… * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? * Or the WeightPaint mode code itself? */ @@ -61,9 +61,10 @@ * XXX The standard “factor” value is assumed in [0.0, 1.0] range. Else, weird results might appear. */ void weightvg_do_mask(int num, int *indices, float *org_w, float *new_w, Object *ob, - DerivedMesh *dm, float fact, const char *defgrp_name, Tex *texture, + DerivedMesh *dm, float fact, const char defgrp_name[32], Tex *texture, int tex_use_channel, int tex_mapping, Object *tex_map_object, - const char *tex_uvlayer_name) { + const char *tex_uvlayer_name) +{ int ref_didx; MDeformVert *dvert = NULL; int i; @@ -80,9 +81,9 @@ void weightvg_do_mask(int num, int *indices, float *org_w, float *new_w, Object float (*v_co)[3]; /* Use new generic get_texture_coords, but do not modify our DNA struct for it… - * XXX Why use a ModifierData stuff here ? Why not a simple, generic struct for parameters ? - * What e.g. if a modifier wants to use several textures ? - * Why use only v_co, and not MVert (or both) ? + * XXX Why use a ModifierData stuff here ? Why not a simple, generic struct for parameters ? + * What e.g. if a modifier wants to use several textures ? + * Why use only v_co, and not MVert (or both) ? */ t_map.texture = texture; t_map.map_object = tex_map_object; @@ -180,9 +181,10 @@ void weightvg_do_mask(int num, int *indices, float *org_w, float *new_w, Object * If indices is not NULL, it must be a table of same length as weights, mapping to the real * vertex index (in case the weight table does not cover the whole vertices...). */ -void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, int num, int *indices, - float *weights, int do_add, float add_thresh, int do_rem, - float rem_thresh){ +void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, int num, + const int *indices, const float *weights, int do_add, + float add_thresh, int do_rem, float rem_thresh) +{ int i; for (i = 0; i < num; i++) { @@ -195,8 +197,8 @@ void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, int num, int *indice /* Never allow weights out of [0.0, 1.0] range. */ CLAMP(w, 0.0, 1.0); - /* Let’s first check to see if this vert is already in the weight group – if so - * let’s update it, or remove it if needed. + /* Let's first check to see if this vert is already in the weight group – if so + * let's update it, or remove it if needed. */ for (j = 0; j < dv->totweight; j++) { /* If this weight corresponds to the deform group, update the value or, @@ -233,7 +235,7 @@ void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, int num, int *indice } } - /* If the vert wasn’t in the deform group, add it if needed! + /* If the vert wasn't in the deform group, add it if needed! */ if (add2vg && w > add_thresh) { newdw = MEM_callocN(sizeof(MDeformWeight)*(dv->totweight+1), "WeightVGEdit Modifier, deformWeight"); diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h index 1bd40e3879f..b42e9c20035 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.h +++ b/source/blender/modifiers/intern/MOD_weightvg_util.h @@ -44,8 +44,8 @@ struct Object; struct MappingInfoModifierData;*/ /* - * XXX I’d like to make modified weights visible in WeightPaint mode, - * but couldn’t figure a way to do this… + * XXX I'd like to make modified weights visible in WeightPaint mode, + * but couldn't figure a way to do this… * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? * Or the WeightPaint mode code itself? */ @@ -68,7 +68,7 @@ struct MappingInfoModifierData;*/ * XXX The standard “factor” value is assumed in [0.0, 1.0] range. Else, weird results might appear. */ void weightvg_do_mask(int num, int *indices, float *org_w, float *new_w, Object *ob, - struct DerivedMesh *dm, float fact, const char *defgrp_name, Tex *texture, + struct DerivedMesh *dm, float fact, const char defgrp_name[32], Tex *texture, int tex_use_channel, int tex_mapping, Object *tex_map_object, const char *tex_uvlayer_name); @@ -76,7 +76,8 @@ void weightvg_do_mask(int num, int *indices, float *org_w, float *new_w, Object * If indices is not NULL, it must be a table of same length as weights, mapping to the real * vertex index (in case the weight table does not cover the whole vertices...). */ -void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, int num, int *indices, float *weights, - int do_add, float add_thresh, int do_rem, float rem_thresh); +void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, int num, + const int *indices, const float *weights, int do_add, + float add_thresh, int do_rem, float rem_thresh); #endif /* MOD_WEIGHTVG_UTIL_H */ diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index a1057bdbbbb..bcf2195d366 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -27,8 +27,8 @@ */ /* - * XXX I’d like to make modified weights visible in WeightPaint mode, - * but couldn’t figure a way to do this… + * XXX I'd like to make modified weights visible in WeightPaint mode, + * but couldn't figure a way to do this… * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? * Or the WeightPaint mode code itself? */ @@ -102,8 +102,7 @@ static void copyData(ModifierData *md, ModifierData *target) twmd->mask_tex_use_channel = wmd->mask_tex_use_channel; twmd->mask_tex_mapping = wmd->mask_tex_mapping; twmd->mask_tex_map_obj = wmd->mask_tex_map_obj; - BLI_strncpy(twmd->mask_tex_uvlayer_name, wmd->mask_tex_uvlayer_name, - sizeof(twmd->mask_tex_uvlayer_name)); + BLI_strncpy(twmd->mask_tex_uvlayer_name, wmd->mask_tex_uvlayer_name, sizeof(twmd->mask_tex_uvlayer_name)); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) @@ -232,7 +231,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* Create a copy of our dmesh, only if our affected cdata layer is the same as org mesh. */ if (dvert == CustomData_get_layer(&ob_m->vdata, CD_MDEFORMVERT)) { /* XXX Seems to create problems with weightpaint mode??? - * I’m missing something here, I guess… + * I'm missing something here, I guess… */ // DM_set_only_copy(dm, CD_MASK_MDEFORMVERT); /* Only copy defgroup layer. */ ret = CDDM_copy(dm); diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index 8b0e598962e..ba5ae5a2d70 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -27,8 +27,8 @@ */ /* - * XXX I’d like to make modified weights visible in WeightPaint mode, - * but couldn’t figure a way to do this… + * XXX I'd like to make modified weights visible in WeightPaint mode, + * but couldn't figure a way to do this… * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? * Or the WeightPaint mode code itself? */ @@ -61,7 +61,7 @@ static float mix_weight(float weight, float weight2, char mix_mode) { #if 0 /* - * XXX Don’t know why, but the switch version takes many CPU time, + * XXX Don't know why, but the switch version takes many CPU time, * and produces lag in realtime playback… */ switch (mix_mode) @@ -146,8 +146,7 @@ static void copyData(ModifierData *md, ModifierData *target) twmd->mask_tex_use_channel = wmd->mask_tex_use_channel; twmd->mask_tex_mapping = wmd->mask_tex_mapping; twmd->mask_tex_map_obj = wmd->mask_tex_map_obj; - BLI_strncpy(twmd->mask_tex_uvlayer_name, wmd->mask_tex_uvlayer_name, - sizeof(twmd->mask_tex_uvlayer_name)); + BLI_strncpy(twmd->mask_tex_uvlayer_name, wmd->mask_tex_uvlayer_name, sizeof(twmd->mask_tex_uvlayer_name)); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) @@ -279,7 +278,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* Create a copy of our dmesh, only if our affected cdata layer is the same as org mesh. */ if (dvert == CustomData_get_layer(&ob_m->vdata, CD_MDEFORMVERT)) { /* XXX Seems to create problems with weightpaint mode??? - * I’m missing something here, I guess… + * I'm missing something here, I guess… */ // DM_set_only_copy(dm, CD_MASK_MDEFORMVERT); /* Only copy defgroup layer. */ ret = CDDM_copy(dm); diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index c4f0c2b214c..1acb3035d2a 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -27,8 +27,8 @@ */ /* - * XXX I’d like to make modified weights visible in WeightPaint mode, - * but couldn’t figure a way to do this… + * XXX I'd like to make modified weights visible in WeightPaint mode, + * but couldn't figure a way to do this… * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? * Or the WeightPaint mode code itself? */ @@ -234,6 +234,7 @@ static void initData(ModifierData *md) wmd->mask_constant = 1.0f; wmd->mask_tex_use_channel = MOD_WVG_MASK_TEX_USE_INT; /* Use intensity by default. */ wmd->mask_tex_mapping = MOD_DISP_MAP_LOCAL; + wmd->max_dist = 1.0f; /* vert arbitrary distance, but don't use 0 */ } static void copyData(ModifierData *md, ModifierData *target) @@ -252,8 +253,9 @@ static void copyData(ModifierData *md, ModifierData *target) twmd->mask_tex_use_channel = wmd->mask_tex_use_channel; twmd->mask_tex_mapping = wmd->mask_tex_mapping; twmd->mask_tex_map_obj = wmd->mask_tex_map_obj; - BLI_strncpy(twmd->mask_tex_uvlayer_name, wmd->mask_tex_uvlayer_name, - sizeof(twmd->mask_tex_uvlayer_name)); + BLI_strncpy(twmd->mask_tex_uvlayer_name, wmd->mask_tex_uvlayer_name, sizeof(twmd->mask_tex_uvlayer_name)); + twmd->min_dist = wmd->min_dist; + twmd->max_dist = wmd->max_dist; } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) @@ -396,7 +398,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* Create a copy of our dmesh, only if our affected cdata layer is the same as org mesh. */ if (dvert == CustomData_get_layer(&ob_m->vdata, CD_MDEFORMVERT)) { /* XXX Seems to create problems with weightpaint mode??? - * I’m missing something here, I guess… + * I'm missing something here, I guess… */ // DM_set_only_copy(dm, CD_MASK_MDEFORMVERT); /* Only copy defgroup layer. */ ret = CDDM_copy(dm); -- cgit v1.2.3