[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42631] branches/vgroup_modifiers: Adding optionnal weight preview in Weight Paint mode ( code inspired by Dynapaint one).
Bastien Montagne
montagne29 at wanadoo.fr
Wed Dec 14 16:56:53 CET 2011
Revision: 42631
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42631
Author: mont29
Date: 2011-12-14 15:56:42 +0000 (Wed, 14 Dec 2011)
Log Message:
-----------
Adding optionnal weight preview in Weight Paint mode (code inspired by Dynapaint one).
Also re-enabled the eModifierTypeFlag_SupportsMapping flag, as it seems to not crash anymore (???).
And finally, done some minor style editing...
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_weightvgmix.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-12-14 14:53:22 UTC (rev 42630)
+++ branches/vgroup_modifiers/release/scripts/startup/bl_ui/properties_data_modifier.py 2011-12-14 15:56:42 UTC (rev 42631)
@@ -814,7 +814,9 @@
col.prop(md, "narrowness", slider=True)
@staticmethod
- def vertex_weight_mask(layout, ob, md):
+ def vertex_weight_common(layout, ob, md):
+ layout.prop(md, "use_weight_preview")
+
layout.label(text="Influence/Mask Options:")
split = layout.split(percentage=0.4)
@@ -875,7 +877,7 @@
# Common mask options
layout.separator()
- self.vertex_weight_mask(layout, ob, md)
+ self.vertex_weight_common(layout, ob, md)
def VERTEX_WEIGHT_MIX(self, layout, ob, md):
split = layout.split()
@@ -900,7 +902,7 @@
# Common mask options
layout.separator()
- self.vertex_weight_mask(layout, ob, md)
+ self.vertex_weight_common(layout, ob, md)
def VERTEX_WEIGHT_PROXIMITY(self, layout, ob, md):
split = layout.split()
@@ -925,7 +927,7 @@
# Common mask options
layout.separator()
- self.vertex_weight_mask(layout, ob, md)
+ self.vertex_weight_common(layout, ob, md)
if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__)
Modified: branches/vgroup_modifiers/source/blender/makesdna/DNA_modifier_types.h
===================================================================
--- branches/vgroup_modifiers/source/blender/makesdna/DNA_modifier_types.h 2011-12-14 14:53:22 UTC (rev 42630)
+++ branches/vgroup_modifiers/source/blender/makesdna/DNA_modifier_types.h 2011-12-14 15:56:42 UTC (rev 42631)
@@ -863,11 +863,13 @@
float default_weight; /* Weight for vertices not in vgroup. */
/* Mapping stuff. */
- struct CurveMapping *cmap_curve; /* The custom mapping curve! */
+ struct CurveMapping *cmap_curve; /* The custom mapping curve! */
/* The add/remove vertices weight thresholds. */
float add_threshold, rem_threshold;
+ /* -----Common Options----- */
+ /* XXX This part must be in sync between all WeightVG modifiers! */
/* Masking options. */
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. */
@@ -875,14 +877,14 @@
/* Texture masking. */
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. */
+ 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_* constants). */
int mask_tex_mapping;
char mask_tex_uvlayer_name[32]; /* Name of the UV map. */
- /* Padding... */
- int pad_i1;
+ /* Misc flags (for now, only Weight Preview in Weight Paint mode...). */
+ int common_flags;
} WeightVGEditModifierData;
/* WeightVGEdit flags. */
@@ -905,15 +907,17 @@
/* XXX Note: I tried to keep everything logically ordered – provided the
* alignment constraints... */
- char defgrp_name_a[32]; /* Name of vertex group to modify/weight. */
+ char defgrp_name_a[32]; /* Name of vertex group to modify/weight. */
char defgrp_name_b[32]; /* Name of other vertex group to mix in. */
- float default_weight_a; /* Default weight value for first vgroup. */
+ float default_weight_a; /* Default weight value for first vgroup. */
float default_weight_b; /* Default weight value to mix in. */
- char mix_mode; /* How second vgroups weights affect first ones */
- char mix_set; /* What vertices to affect. */
+ char mix_mode; /* How second vgroups weights affect first ones */
+ char mix_set; /* What vertices to affect. */
char pad_c1[6];
+ /* -----Common Options----- */
+ /* XXX This part must be in sync between all WeightVG modifiers! */
/* Masking options. */
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. */
@@ -921,13 +925,13 @@
/* Texture masking. */
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. */
+ struct Tex *mask_texture; /* The texture. */
+ 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 map. */
- /* Padding... */
- int pad_i1;
+ /* Misc flags (for now, only Weight Preview in Weight Paint mode...). */
+ int common_flags;
} WeightVGMixModifierData;
/* How second vgroup's weights affect first ones. */
@@ -952,15 +956,24 @@
/* Note: I tried to keep everything logically ordered - provided the
* alignment constraints... */
- char defgrp_name[32]; /* Name of vertex group to modify/weight. */
+ char defgrp_name[32]; /* Name of vertex group to modify/weight. */
/* Proximity modes. */
int proximity_mode;
int proximity_flags;
/* Target object from which to calculate vertices distances. */
- struct Object *proximity_ob_target;
+ struct Object *proximity_ob_target;
+ float min_dist, max_dist; /* Distances mapping to 0.0/1.0 weights. */
+
+ /* Put here to avoid breaking existing struct... */
+ short falloff_type; /* Using MOD_WVG_MAPPING_* defines. */
+
+ char pad_c1[6];
+
+ /* -----Common Options----- */
+ /* XXX This part must be in sync between all WeightVG modifiers! */
/* Masking options. */
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. */
@@ -968,18 +981,13 @@
/* Texture masking. */
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. */
+ struct Tex *mask_texture; /* The texture. */
+ 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 Map. */
- float min_dist, max_dist; /* Distances mapping to 0.0/1.0 weights. */
-
- /* Put here to avoid breaking existing struct... */
- short falloff_type; /* Using MOD_WVG_MAPPING_* defines. */
-
- /* Padding... */
- short pad_s1;
+ /* Misc flags (for now, only Weight Preview in Weight Paint mode...). */
+ int common_flags;
} WeightVGProximityModifierData;
/* Modes of proximity weighting. */
@@ -1019,6 +1027,9 @@
#define MOD_WVG_MASK_TEX_USE_VAL 7
#define MOD_WVG_MASK_TEX_USE_ALPHA 8
+/* Misc flags */
+#define MOD_WVG_CFLAG_WEIGHT_PREVIEW (1 << 0)
+
/* Dynamic paint modifier flags */
#define MOD_DYNAMICPAINT_TYPE_CANVAS (1 << 0)
#define MOD_DYNAMICPAINT_TYPE_BRUSH (1 << 1)
Modified: branches/vgroup_modifiers/source/blender/makesrna/intern/rna_modifier.c
===================================================================
--- branches/vgroup_modifiers/source/blender/makesrna/intern/rna_modifier.c 2011-12-14 14:53:22 UTC (rev 42630)
+++ branches/vgroup_modifiers/source/blender/makesrna/intern/rna_modifier.c 2011-12-14 15:56:42 UTC (rev 42631)
@@ -2568,7 +2568,7 @@
RNA_def_property_update(prop, 0, "rna_Modifier_update");*/
}
-static void rna_def_modifier_weightvg_mask(BlenderRNA *brna, StructRNA *srna)
+static void rna_def_modifier_weightvg_common(BlenderRNA *brna, StructRNA *srna)
{
static EnumPropertyItem weightvg_mask_tex_map_items[] = {
{MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Local", "Use local generated coordinates"},
@@ -2630,6 +2630,12 @@
"coordinates from");
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop= RNA_def_property(srna, "use_weight_preview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "common_flags", MOD_WVG_CFLAG_WEIGHT_PREVIEW);
+ RNA_def_property_ui_text(prop, "Preview Weights", "Preview vertices' weights, "
+ "in Weight Paint mode.");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
@@ -2706,8 +2712,8 @@
"to be removed from the vgroup");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- /* Common masking properties. */
- rna_def_modifier_weightvg_mask(brna, srna);
+ /* Common properties (mainly masking). */
+ rna_def_modifier_weightvg_common(brna, srna);
}
static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
@@ -2776,8 +2782,8 @@
RNA_def_property_ui_text(prop, "Vertex Set", "Which vertices should be affected");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- /* Common masking properties. */
- rna_def_modifier_weightvg_mask(brna, srna);
+ /* Common properties (mainly masking). */
+ rna_def_modifier_weightvg_common(brna, srna);
}
static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
@@ -2863,8 +2869,8 @@
RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to there new values");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- /* Common masking properties. */
- rna_def_modifier_weightvg_mask(brna, srna);
+ /* Common properties (mainly masking). */
+ rna_def_modifier_weightvg_common(brna, srna);
}
static void rna_def_modifier_ocean(BlenderRNA *brna)
Modified: branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.c
===================================================================
--- branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.c 2011-12-14 14:53:22 UTC (rev 42630)
+++ branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.c 2011-12-14 15:56:42 UTC (rev 42631)
@@ -1,36 +1,31 @@
/*
-* $Id$
-*
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list