diff options
-rw-r--r-- | source/blender/makesdna/DNA_modifier_types.h | 44 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 12 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvg_util.c | 28 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvg_util.h | 11 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgedit.c | 9 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgmix.c | 11 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgproximity.c | 12 |
7 files changed, 61 insertions, 66 deletions
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 83b82972cef..d3c3ba2f93b 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -790,16 +790,13 @@ typedef enum { typedef struct WeightVGEditModifierData { ModifierData modifier; - /* XXX Note: I tried to keep everything logically ordered – provided the - * alignment constraints… - */ + /* Note: I tried to keep everything logically ordered - provided the + * alignment constraints... */ char defgrp_name[32]; /* Name of vertex group to edit. */ - /* Flags (MOD_WVG_EDIT_MAP, MOD_WVG_EDIT_CMAP, MOD_WVG_EDIT_REVERSE_WEIGHTS, - * MOD_WVG_EDIT_ADD2VG, MOD_WVG_EDIT_REMFVG, MOD_WVG_EDIT_CLAMP). - */ - int edit_flags; + short edit_flags; /* using MOD_WVG_EDIT_* flags */ + short pad1; float default_weight; /* Weight for vertices not in vgroup. */ /* Mapping stuff. */ @@ -809,7 +806,7 @@ typedef struct WeightVGEditModifierData { float add_threshold, rem_threshold; /* Masking options. */ - float mask_constant; /* The global “influence”, if no vgroup nor tex is used as mask. */ + float mask_constant; /* The global "influence", if no vgroup nor tex is used as mask. */ /* Name of mask vertex group from which to get weight factors. */ char mask_defgrp_name[32]; @@ -817,10 +814,9 @@ typedef struct WeightVGEditModifierData { int mask_tex_use_channel; /* Which channel to use as weightf. */ struct Tex *mask_texture; /* The texture. */ struct Object *mask_tex_map_obj; /* Name of the map object. */ - /* How to map the texture (using MOD_DISP_MAP_xxx constants). */ + /* How to map the texture (using MOD_DISP_MAP_* constants). */ int mask_tex_mapping; char mask_tex_uvlayer_name[32]; /* Name of the UV layer. */ - /* Padding… */ int pad_i1; } WeightVGEditModifierData; @@ -843,21 +839,19 @@ typedef struct WeightVGMixModifierData { ModifierData modifier; /* XXX Note: I tried to keep everything logically ordered – provided the - * alignment constraints… - */ + * alignment constraints... */ char defgrp_name[32]; /* Name of vertex group to modify/weight. */ char defgrp_name2[32]; /* Name of other vertex group to mix in. */ float default_weight; /* Default weight value for first vgroup. */ float default_weight2; /* Default weight value to mix in. */ - char mix_mode; /* How second vgroup’s weights affect first ones */ + char mix_mode; /* How second vgroups weights affect first ones */ char mix_set; /* What vertices to affect. */ - char pad_c1, pad_c2; - int pad_i1; + char pad[6]; /* Masking options. */ - float mask_constant; /* The global “influence”, if no vgroup nor tex is used as mask. */ + float mask_constant; /* The global "influence", if no vgroup nor tex is used as mask. */ /* Name of mask vertex group from which to get weight factors. */ char mask_defgrp_name[32]; @@ -867,12 +861,11 @@ typedef struct WeightVGMixModifierData { struct Object *mask_tex_map_obj; /* Name of the map object. */ int mask_tex_mapping; /* How to map the texture! */ char mask_tex_uvlayer_name[32]; /* Name of the UV layer. */ - /* Padding… */ - int pad_i2; + int pad2; } WeightVGMixModifierData; -/* How second vgroup’s weights affect first ones. */ +/* How second vgroup's weights affect first ones. */ #define MOD_WVG_MIX_SET 1 /* Second weights replace weights. */ #define MOD_WVG_MIX_ADD 2 /* Second weights are added to weights. */ #define MOD_WVG_MIX_SUB 3 /* Second weights are subtracted from weights. */ @@ -891,9 +884,8 @@ typedef struct WeightVGMixModifierData { typedef struct WeightVGProximityModifierData { ModifierData modifier; - /* XXX Note: I tried to keep everything logically ordered – provided the - * alignment constraints… - */ + /* Note: I tried to keep everything logically ordered - provided the + * alignment constraints... */ char defgrp_name[32]; /* Name of vertex group to modify/weight. */ @@ -901,11 +893,11 @@ typedef struct WeightVGProximityModifierData { int proximity_mode; int proximity_flags; - /* Target object from which to calculate vertices’ distances. */ + /* Target object from which to calculate vertices distances. */ struct Object *proximity_ob_target; /* Masking options. */ - float mask_constant; /* The global “influence”, if no vgroup nor tex is used as mask. */ + float mask_constant; /* The global "influence", if no vgroup nor tex is used as mask. */ /* Name of mask vertex group from which to get weight factors. */ char mask_defgrp_name[32]; @@ -918,8 +910,8 @@ typedef struct WeightVGProximityModifierData { float min_dist, max_dist; /* Distances mapping to 0.0/1.0 weights. */ - /* Padding… */ - int pad_i2; + /* Padding... */ + int pad; } WeightVGProximityModifierData; /* Modes of proximity weighting. */ diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index b30c4f84a9e..8dff0e376cb 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -2642,7 +2642,7 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "add_threshold"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_range(prop, -100000.0, 100000.0, 10, 0); - RNA_def_property_ui_text(prop, "Add Threshold", "Lower bound for a vertex’s weight " + RNA_def_property_ui_text(prop, "Add Threshold", "Lower bound for a vertex's weight " "to be added to the vgroup."); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -2650,7 +2650,7 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "rem_threshold"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_range(prop, -100000.0, 100000.0, 10, 0); - RNA_def_property_ui_text(prop, "Rem Threshold", "Upper bound for a vertex’s weight " + RNA_def_property_ui_text(prop, "Rem Threshold", "Upper bound for a vertex's weight " "to be removed from the vgroup."); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -2746,7 +2746,7 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna) {MOD_WVG_PROXIMITY_OBJECT, "OBJECT", 0, "Object Distance", "Use distance between affected and target objects."}, {MOD_WVG_PROXIMITY_GEOMETRY, "GEOMETRY", 0, "Geometry Distance", - "Use distance between affected object’s vertices and target object, or target object’s geometry."}, + "Use distance between affected object's vertices and target object, or target object's geometry."}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem proximity_geometry_items[] = { @@ -2760,7 +2760,7 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna) srna= RNA_def_struct(brna, "WeightVGProximityModifier", "Modifier"); RNA_def_struct_ui_text(srna, "WeightVG Proximity Modifier", - "Set the weights of vertices in a group from a target object’s " + "Set the weights of vertices in a group from a target object's " "distance."); RNA_def_struct_sdna(srna, "WeightVGProximityModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_WEIGHTVG); @@ -2780,12 +2780,12 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "proximity_flags"); RNA_def_property_enum_items(prop, proximity_geometry_items); RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */ - RNA_def_property_ui_text(prop, "Proximity Geometry", "Use shortest distance to target object’s geometry as weight"); + RNA_def_property_ui_text(prop, "Proximity Geometry", "Use shortest distance to target object's geometry as weight"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "proximity_ob_target"); - RNA_def_property_ui_text(prop, "Target Object", "Object to calculate vertices’ distances from."); + RNA_def_property_ui_text(prop, "Target Object", "Object to calculate vertices distances from."); RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); 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); |