diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2011-08-17 17:07:51 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2011-08-17 17:07:51 +0400 |
commit | 58af2c36aca4e2092e699dead2bd2ea2347b5622 (patch) | |
tree | 9804df8b949ba390f36cdfe7804c7aa3ca003fc5 | |
parent | 236a94268eac9d5154cd0de45569e59f24952451 (diff) |
vgroup_modifiers: Removed (commented out, for now) addtionnal mapping/clamping options in WeightVGEdit mod, leaving the only curve mapping stuff.
Also, updated all three modifiers with new foreachTexLink walking func.
-rw-r--r-- | release/scripts/startup/bl_ui/properties_data_modifier.py | 36 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_modifier_types.h | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 98 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgedit.c | 52 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgmix.c | 6 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgproximity.c | 6 |
6 files changed, 115 insertions, 95 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 30600d5534c..6370cc8942a 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -779,31 +779,31 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col.label(text="Default Weight:") col.prop(md, "default_weight", text="") - layout.prop(md, "use_map") - if md.use_map: - split = layout.split() - col = split.column() - col.label("Input:") - col.label("Output:") - col = split.column() - col.prop(md, "map_input_low", text="Min") - col.prop(md, "map_output_low", text="Min") - col = split.column() - col.prop(md, "map_input_high", text="Max") - col.prop(md, "map_output_high", text="Max") +# layout.prop(md, "use_map") +# if md.use_map: +# split = layout.split() +# col = split.column() +# col.label("Input:") +# col.label("Output:") +# col = split.column() +# col.prop(md, "map_input_low", text="Min") +# col.prop(md, "map_output_low", text="Min") +# col = split.column() +# col.prop(md, "map_input_high", text="Max") +# col.prop(md, "map_output_high", text="Max") layout.prop(md, "use_map_curve") if md.use_map_curve: col = layout.column() col.template_curve_mapping(md, "map_curve") - layout.prop(md, "use_reverse") +# layout.prop(md, "use_reverse") - layout.prop(md, "use_clamp") - if md.use_clamp: - row = layout.row() - row.prop(md, "clamp_weight_min") - row.prop(md, "clamp_weight_max") +# layout.prop(md, "use_clamp") +# if md.use_clamp: +# row = layout.row() +# row.prop(md, "clamp_weight_min") +# row.prop(md, "clamp_weight_max") row = layout.row() row.prop(md, "use_add") diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 9411d3370ba..61db9230b66 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -803,15 +803,15 @@ typedef struct WeightVGEditModifierData { float default_weight; /* Weight for vertices not in vgroup. */ /* Mapping stuff. */ - float map_org_min, map_org_max; - float map_new_min, map_new_max; + float map_org_min, map_org_max; /* Deprecated, keeping for file compatibility for now... */ + float map_new_min, map_new_max; /* Deprecated, keeping for file compatibility for now... */ struct CurveMapping *cmap_curve; /* The custom mapping curve! */ /* The add/remove vertices weight thresholds. */ float add_threshold, rem_threshold; /* Clamping options. */ - float clamp_weight_min, clamp_weight_max; + float clamp_weight_min, clamp_weight_max; /* Deprecated, keeping for file compatibility for now... */ /* Masking options. */ float mask_constant; /* The global “influence”, if no vgroup nor tex is used as mask. */ @@ -832,17 +832,17 @@ typedef struct WeightVGEditModifierData { /* WeightVGEdit flags. */ /* Use parametric mapping. */ -#define MOD_WVG_EDIT_MAP (1 << 0) +//#define MOD_WVG_EDIT_MAP (1 << 0) /* Use curve mapping. */ #define MOD_WVG_EDIT_CMAP (1 << 1) /* Reverse weights (in the [0.0, 1.0] standard range). */ -#define MOD_WVG_EDIT_REVERSE_WEIGHTS (1 << 2) +//#define MOD_WVG_EDIT_REVERSE_WEIGHTS (1 << 2) /* Add vertices with higher weight than threshold to vgroup. */ #define MOD_WVG_EDIT_ADD2VG (1 << 3) /* Remove vertices with lower weight than threshold from vgroup. */ #define MOD_WVG_EDIT_REMFVG (1 << 4) /* Clamp weights. */ -#define MOD_WVG_EDIT_CLAMP (1 << 5) +//#define MOD_WVG_EDIT_CLAMP (1 << 5) typedef struct WeightVGMixModifierData { ModifierData modifier; diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 6294f149b68..533baf98915 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -2565,20 +2565,20 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGModifier_vgroup_set"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop= RNA_def_property(srna, "use_map", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_MAP); - RNA_def_property_ui_text(prop, "Map", "Map vertex group weights."); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); +/* prop= RNA_def_property(srna, "use_map", PROP_BOOLEAN, PROP_NONE);*/ +/* RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_MAP);*/ +/* RNA_def_property_ui_text(prop, "Map", "Map vertex group weights.");*/ +/* RNA_def_property_update(prop, 0, "rna_Modifier_update");*/ prop= RNA_def_property(srna, "use_map_curve", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_CMAP); RNA_def_property_ui_text(prop, "Curve Map", "Map vertex group weights with a curve."); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop= RNA_def_property(srna, "use_reverse", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_REVERSE_WEIGHTS); - RNA_def_property_ui_text(prop, "Reverse", "Reverse vertex group weights."); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); +/* prop= RNA_def_property(srna, "use_reverse", PROP_BOOLEAN, PROP_NONE);*/ +/* RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_REVERSE_WEIGHTS);*/ +/* RNA_def_property_ui_text(prop, "Reverse", "Reverse vertex group weights.");*/ +/* RNA_def_property_update(prop, 0, "rna_Modifier_update");*/ prop= RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_ADD2VG); @@ -2592,10 +2592,10 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna) "from vgroup."); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop= RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_CLAMP); - RNA_def_property_ui_text(prop, "Clamp", "Clamp vertex group weights."); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); +/* prop= RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);*/ +/* RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_CLAMP);*/ +/* RNA_def_property_ui_text(prop, "Clamp", "Clamp vertex group weights.");*/ +/* RNA_def_property_update(prop, 0, "rna_Modifier_update");*/ prop= RNA_def_property(srna, "default_weight", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); @@ -2604,33 +2604,33 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna) "it is not in the vgroup."); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop= RNA_def_property(srna, "map_input_low", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "map_org_min"); - 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, "Input Low Weight", "Low input mapping value."); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); - - prop= RNA_def_property(srna, "map_input_high", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "map_org_max"); - 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, "Input High Weight", "High input mapping value."); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); - - prop= RNA_def_property(srna, "map_output_low", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "map_new_min"); - 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, "Output Low Weight", "Low output mapping value."); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); - - prop= RNA_def_property(srna, "map_output_high", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "map_new_max"); - 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, "Output High Weight", "High output mapping value."); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); +/* prop= RNA_def_property(srna, "map_input_low", PROP_FLOAT, PROP_NONE);*/ +/* RNA_def_property_float_sdna(prop, NULL, "map_org_min");*/ +/* 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, "Input Low Weight", "Low input mapping value.");*/ +/* RNA_def_property_update(prop, 0, "rna_Modifier_update");*/ + +/* prop= RNA_def_property(srna, "map_input_high", PROP_FLOAT, PROP_NONE);*/ +/* RNA_def_property_float_sdna(prop, NULL, "map_org_max");*/ +/* 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, "Input High Weight", "High input mapping value.");*/ +/* RNA_def_property_update(prop, 0, "rna_Modifier_update");*/ + +/* prop= RNA_def_property(srna, "map_output_low", PROP_FLOAT, PROP_NONE);*/ +/* RNA_def_property_float_sdna(prop, NULL, "map_new_min");*/ +/* 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, "Output Low Weight", "Low output mapping value.");*/ +/* RNA_def_property_update(prop, 0, "rna_Modifier_update");*/ + +/* prop= RNA_def_property(srna, "map_output_high", PROP_FLOAT, PROP_NONE);*/ +/* RNA_def_property_float_sdna(prop, NULL, "map_new_max");*/ +/* 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, "Output High Weight", "High output mapping value.");*/ +/* RNA_def_property_update(prop, 0, "rna_Modifier_update");*/ prop= RNA_def_property(srna, "map_curve", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "cmap_curve"); @@ -2653,17 +2653,17 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna) "to be removed from the vgroup."); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop= RNA_def_property(srna, "clamp_weight_min", PROP_FLOAT, PROP_NONE); - 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, "Min Weight", "Lowest weight a vertex can get."); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); +/* prop= RNA_def_property(srna, "clamp_weight_min", PROP_FLOAT, PROP_NONE);*/ +/* 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, "Min Weight", "Lowest weight a vertex can get.");*/ +/* RNA_def_property_update(prop, 0, "rna_Modifier_update");*/ - prop= RNA_def_property(srna, "clamp_weight_max", PROP_FLOAT, PROP_NONE); - 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, "Max Weight", "Highest weight a vertex can get."); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); +/* prop= RNA_def_property(srna, "clamp_weight_max", PROP_FLOAT, PROP_NONE);*/ +/* 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, "Max Weight", "Highest weight a vertex can get.");*/ +/* RNA_def_property_update(prop, 0, "rna_Modifier_update");*/ /* Common masking properties. */ rna_def_modifier_weightvg_mask(brna, srna); diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index 57c93cdfddf..a8d51cee092 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -61,18 +61,18 @@ static void initData(ModifierData *md) { WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md; - wmd->edit_flags = MOD_WVG_EDIT_CLAMP; + wmd->edit_flags = 0; wmd->default_weight = 0.0f; - wmd->map_org_min = 0.0f; - wmd->map_org_max = 1.0f; - wmd->map_new_min = 0.0f; - wmd->map_new_max = 1.0f; +/* wmd->map_org_min = 0.0f;*/ +/* wmd->map_org_max = 1.0f;*/ +/* wmd->map_new_min = 0.0f;*/ +/* wmd->map_new_max = 1.0f;*/ wmd->cmap_curve = curvemapping_add(1, 0.0, 0.0, 1.0, 1.0); curvemapping_initialize(wmd->cmap_curve); - wmd->clamp_weight_min = 0.0f; - wmd->clamp_weight_max = 1.0f; +/* wmd->clamp_weight_min = 0.0f;*/ +/* wmd->clamp_weight_max = 1.0f;*/ wmd->add_threshold = 0.01f; wmd->rem_threshold = 0.01f; @@ -98,14 +98,14 @@ static void copyData(ModifierData *md, ModifierData *target) twmd->edit_flags = wmd->edit_flags; twmd->default_weight = wmd->default_weight; - twmd->map_org_min = wmd->map_org_min; - twmd->map_org_max = wmd->map_org_max; - twmd->map_new_min = wmd->map_new_min; - twmd->map_new_max = wmd->map_new_max; +/* twmd->map_org_min = wmd->map_org_min;*/ +/* twmd->map_org_max = wmd->map_org_max;*/ +/* twmd->map_new_min = wmd->map_new_min;*/ +/* twmd->map_new_max = wmd->map_new_max;*/ twmd->cmap_curve = curvemapping_copy(wmd->cmap_curve); - twmd->clamp_weight_min = wmd->clamp_weight_min; - twmd->clamp_weight_max = wmd->clamp_weight_max; +/* twmd->clamp_weight_min = wmd->clamp_weight_min;*/ +/* twmd->clamp_weight_max = wmd->clamp_weight_max;*/ twmd->add_threshold = wmd->add_threshold; twmd->rem_threshold = wmd->rem_threshold; @@ -161,6 +161,11 @@ static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *u foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); } +static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void *userData) +{ + walk(userData, ob, md, "mask_texture"); +} + static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UNUSED(scene), Object *UNUSED(ob), DagNode *obNode) { @@ -203,12 +208,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der char rel_ret = 0; /* Boolean, whether we have to release ret dm or not, when not using it! */ float *mapf = NULL; /* Cache for mapping factors. */ /* Flags. */ - char do_map = wmd->edit_flags & MOD_WVG_EDIT_MAP; +/* char do_map = wmd->edit_flags & MOD_WVG_EDIT_MAP;*/ char do_cmap = wmd->edit_flags & MOD_WVG_EDIT_CMAP; - char do_rev = wmd->edit_flags & MOD_WVG_EDIT_REVERSE_WEIGHTS; +/* char do_rev = wmd->edit_flags & MOD_WVG_EDIT_REVERSE_WEIGHTS;*/ char do_add = wmd->edit_flags & MOD_WVG_EDIT_ADD2VG; char do_rem = wmd->edit_flags & MOD_WVG_EDIT_REMFVG; - char do_clamp = wmd->edit_flags & MOD_WVG_EDIT_CLAMP; +/* char do_clamp = wmd->edit_flags & MOD_WVG_EDIT_CLAMP;*/ /* Get number of verts. */ numVerts = dm->getNumVerts(dm); @@ -281,6 +286,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der } } /* Do mapping. */ +#if 0 if (do_map) { /* This mapping is a simple func: a*in + b. * with a = (out_min - out_max)/(in_min - in_max) @@ -299,10 +305,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der } new_w[i] = (mapf[0] * new_w[i]) + mapf[1]; } +#endif if (do_cmap) new_w[i] = curvemapping_evaluateF(wmd->cmap_curve, 0, new_w[i]); - if (do_rev) - new_w[i] = (-1.0 * new_w[i]) + 1.0; +/* if (do_rev)*/ +/* new_w[i] = (-1.0 * new_w[i]) + 1.0;*/ } /* Do masking. */ @@ -311,10 +318,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name); /* Do clamping. */ - if (do_clamp) { - for (i = 0; i < numVerts; i++) - CLAMP(org_w[i], wmd->clamp_weight_min, wmd->clamp_weight_max); - } +/* if (do_clamp) {*/ +/* for (i = 0; i < numVerts; i++)*/ +/* CLAMP(org_w[i], wmd->clamp_weight_min, wmd->clamp_weight_max);*/ +/* }*/ /* Update/add/remove from vgroup. */ weightvg_update_vg(dvert, defgrp_idx, numVerts, NULL, org_w, do_add, wmd->add_threshold, @@ -365,5 +372,6 @@ ModifierTypeInfo modifierType_WeightVGEdit = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ foreachTexLink, }; diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index 29e00040bf6..8b0e598962e 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -191,6 +191,11 @@ static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *u foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); } +static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void *userData) +{ + walk(userData, ob, md, "mask_texture"); +} + static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UNUSED(scene), Object *UNUSED(ob), DagNode *obNode) { @@ -457,5 +462,6 @@ ModifierTypeInfo modifierType_WeightVGMix = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ foreachTexLink, }; diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 7272878b5b5..c4f0c2b214c 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -298,6 +298,11 @@ static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *u foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); } +static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void *userData) +{ + walk(userData, ob, md, "mask_texture"); +} + static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UNUSED(scene), Object *UNUSED(ob), DagNode *obNode) { @@ -550,5 +555,6 @@ ModifierTypeInfo modifierType_WeightVGProximity = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ foreachTexLink, }; |