[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39930] branches/vgroup_modifiers: VGroup Modifiers: added mapping options to proximity and edit.
Bastien Montagne
montagne29 at wanadoo.fr
Mon Sep 5 18:16:01 CEST 2011
Revision: 39930
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39930
Author: mont29
Date: 2011-09-05 16:16:00 +0000 (Mon, 05 Sep 2011)
Log Message:
-----------
VGroup Modifiers: added mapping options to proximity and edit.
*Added Smooth/Sharp/Root/etc. mappings to WeightVGEdit modifier, in addition to custom curve one.
*Added Smooth/Sharp/Root/etc. mappings to WeightVGProximity modifier, without the custom curve one!
*Factorized the common mapping code into MOD_weightvg_util.
Modified Paths:
--------------
branches/vgroup_modifiers/release/scripts/startup/bl_ui/properties_data_modifier.py
branches/vgroup_modifiers/source/blender/makesdna/DNA_modifier_types.h
branches/vgroup_modifiers/source/blender/makesrna/intern/rna_modifier.c
branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.c
branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.h
branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgedit.c
branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgproximity.c
Modified: branches/vgroup_modifiers/release/scripts/startup/bl_ui/properties_data_modifier.py
===================================================================
--- branches/vgroup_modifiers/release/scripts/startup/bl_ui/properties_data_modifier.py 2011-09-05 16:04:15 UTC (rev 39929)
+++ branches/vgroup_modifiers/release/scripts/startup/bl_ui/properties_data_modifier.py 2011-09-05 16:16:00 UTC (rev 39930)
@@ -779,32 +779,11 @@
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_curve")
- if md.use_map_curve:
+ layout.prop(md, "mapping_mode")
+ if md.mapping_mode == 'CURVE':
col = layout.column()
col.template_curve_mapping(md, "map_curve")
-# 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")
-
row = layout.row()
row.prop(md, "use_add")
row.prop(md, "use_remove")
@@ -864,6 +843,8 @@
row.prop(md, "min_dist")
row.prop(md, "max_dist")
+ layout.prop(md, "mapping_mode")
+
# Common mask options…
layout.separator()
self.weight_vg_mask(layout, ob, md)
Modified: branches/vgroup_modifiers/source/blender/makesdna/DNA_modifier_types.h
===================================================================
--- branches/vgroup_modifiers/source/blender/makesdna/DNA_modifier_types.h 2011-09-05 16:04:15 UTC (rev 39929)
+++ branches/vgroup_modifiers/source/blender/makesdna/DNA_modifier_types.h 2011-09-05 16:16:00 UTC (rev 39930)
@@ -795,8 +795,8 @@
char defgrp_name[32]; /* Name of vertex group to edit. */
- short edit_flags; /* using MOD_WVG_EDIT_* flags */
- short pad1;
+ short edit_flags; /* Using MOD_WVG_EDIT_* flags. */
+ short mapping_mode; /* Using MOD_WVG_MAPPING_* defines. */
float default_weight; /* Weight for vertices not in vgroup. */
/* Mapping stuff. */
@@ -817,6 +817,7 @@
/* 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;
@@ -825,7 +826,7 @@
/* Use parametric mapping. */
//#define MOD_WVG_EDIT_MAP (1 << 0)
/* Use curve mapping. */
-#define MOD_WVG_EDIT_CMAP (1 << 1)
+//#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)
/* Add vertices with higher weight than threshold to vgroup. */
@@ -848,7 +849,7 @@
char mix_mode; /* How second vgroups weights affect first ones */
char mix_set; /* What vertices to affect. */
- char pad[6];
+ char pad_c1[6];
/* Masking options. */
float mask_constant; /* The global "influence", if no vgroup nor tex is used as mask. */
@@ -861,8 +862,9 @@
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 pad2;
+ int pad_i1;
} WeightVGMixModifierData;
/* How second vgroup's weights affect first ones. */
@@ -910,8 +912,11 @@
float min_dist, max_dist; /* Distances mapping to 0.0/1.0 weights. */
+ /* Put here to avoid breaking existing struct... */
+ short mapping_mode; /* Using MOD_WVG_MAPPING_* defines. */
+
/* Padding... */
- int pad;
+ short pad_s1;
} WeightVGProximityModifierData;
/* Modes of proximity weighting. */
@@ -929,6 +934,18 @@
#define MOD_WVG_PROXIMITY_GEOM_FACES (1 << 2)
/* Defines common to all WeightVG modifiers. */
+/* Mapping modes. */
+#define MOD_WVG_MAPPING_NONE 0
+#define MOD_WVG_MAPPING_CURVE 1
+#define MOD_WVG_MAPPING_SHARP 2 /* PROP_SHARP */
+#define MOD_WVG_MAPPING_SMOOTH 3 /* PROP_SMOOTH */
+#define MOD_WVG_MAPPING_ROOT 4 /* PROP_ROOT */
+/* PROP_LIN not used (same as NONE, here...). */
+/* PROP_CONST not used. */
+#define MOD_WVG_MAPPING_SPHERE 7 /* PROP_SPHERE */
+#define MOD_WVG_MAPPING_RANDOM 8 /* PROP_RANDOM */
+#define MOD_WVG_MAPPING_STEP 9 /* Median Step. */
+
/* Tex channel to be used as mask. */
#define MOD_WVG_MASK_TEX_USE_INT 1
#define MOD_WVG_MASK_TEX_USE_RED 2
Modified: branches/vgroup_modifiers/source/blender/makesrna/intern/rna_modifier.c
===================================================================
--- branches/vgroup_modifiers/source/blender/makesrna/intern/rna_modifier.c 2011-09-05 16:04:15 UTC (rev 39929)
+++ branches/vgroup_modifiers/source/blender/makesrna/intern/rna_modifier.c 2011-09-05 16:16:00 UTC (rev 39930)
@@ -2552,6 +2552,17 @@
static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
{
+ static EnumPropertyItem weightvg_edit_mapping_mode_items[] = {
+ {MOD_WVG_MAPPING_NONE, "LINEAR", ICON_LINCURVE, "Linear", ""},
+ {MOD_WVG_MAPPING_CURVE, "CURVE", ICON_RNDCURVE, "Custom Curve", ""},
+ {MOD_WVG_MAPPING_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
+ {MOD_WVG_MAPPING_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
+ {MOD_WVG_MAPPING_ROOT, "ROOT", ICON_ROOTCURVE, "Root", ""},
+ {MOD_WVG_MAPPING_SPHERE, "ICON_SPHERECURVE", ICON_SPHERECURVE, "Sphere", ""},
+ {MOD_WVG_MAPPING_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", ""},
+ {MOD_WVG_MAPPING_STEP, "STEP", ICON_NOCURVE, "Median Step", ""}, /* Would need a better icon... */
+ {0, NULL, 0, NULL, NULL}};
+
StructRNA *srna;
PropertyRNA *prop;
@@ -2567,21 +2578,11 @@
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_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.");
+ prop= RNA_def_property(srna, "mapping_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, weightvg_edit_mapping_mode_items);
+ RNA_def_property_ui_text(prop, "Mapping Mode", "How weights are mapped to there new values.");
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);
RNA_def_property_ui_text(prop, "Group Add", "Add vertices with weight over threshold "
@@ -2594,11 +2595,6 @@
"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, "default_weight", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 1.0f);
RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 0);
@@ -2606,34 +2602,6 @@
"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_curve", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "cmap_curve");
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list