interface + naming improvements to vertex wright modifier
authorCampbell Barton <ideasman42@gmail.com>
Wed, 7 Sep 2011 07:46:26 +0000 (07:46 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 7 Sep 2011 07:46:26 +0000 (07:46 +0000)
- WeightVG -> Vertex Weight
- mapping_mode -> falloff_type
- nicer layout for VertexWeightModifiers add/remove options

doc/python_api/rst/info_tips_and_tricks.rst
release/scripts/startup/bl_ui/properties_data_modifier.py
source/blender/editors/include/UI_icons.h
source/blender/makesdna/DNA_modifier_types.h
source/blender/makesrna/intern/rna_modifier.c
source/blender/modifiers/intern/MOD_weightvg_util.c
source/blender/modifiers/intern/MOD_weightvgedit.c
source/blender/modifiers/intern/MOD_weightvgmix.c
source/blender/modifiers/intern/MOD_weightvgproximity.c

index f4e68a4..3ce2cfd 100644 (file)
@@ -100,6 +100,22 @@ While this is not best practice - for testing you can extend the search path, th
 Don't Use Blender!
 ==================
 
+While developing your own scripts blenders interface can get in the way, manually reloading, running the scripts, opening file import etc is just overhead.
+
+For scripts that are not interactive it can end up being easier not to use blender at all and run blender from a terminal, without opening a window and execute the script on the command line.
+
+.. code-block::
+
+   blender --backgruond --python myscript.py
+
+
+You might want to run this with a blend file too.
+
+.. code-block::
+
+   blender myscene.blend --backgruond --python myscript.py
+
+
 
 Use External Tools
 ==================
index 8e7f50c..058e816 100644 (file)
@@ -768,7 +768,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
                 elif md.mask_tex_mapping == 'UV' and ob.type == 'MESH':
                     layout.prop_search(md, "mask_tex_uv_layer", ob.data, "uv_textures")
 
-    def WEIGHT_VGEDIT(self, layout, ob, md):
+    def VERTEX_WEIGHT_EDIT(self, layout, ob, md):
         if ob.type == 'MESH':
             split = layout.split()
             col = split.column()
@@ -779,25 +779,28 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
             col.label(text="Default Weight:")
             col.prop(md, "default_weight", text="")
 
-            layout.prop(md, "mapping_mode")
-            if md.mapping_mode == 'CURVE':
+            layout.prop(md, "falloff_type")
+            if md.falloff_type == 'CURVE':
                 col = layout.column()
                 col.template_curve_mapping(md, "map_curve")
 
-            row = layout.row()
-            row.prop(md, "use_add")
-            row.prop(md, "use_remove")
-            row = layout.row()
-            if md.use_add:
-                row.prop(md, "add_threshold")
-            if md.use_remove:
-                row.prop(md, "remove_threshold")
+            split = layout.split(percentage=0.4)
+            split.prop(md, "use_add")
+            row = split.row()
+            row.active = md.use_add
+            row.prop(md, "add_threshold")
+
+            split = layout.split(percentage=0.4)
+            split.prop(md, "use_remove")
+            row = split.row()
+            row.active = md.use_remove
+            row.prop(md, "remove_threshold")
 
             # Common mask options…
             layout.separator()
             self.weight_vg_mask(layout, ob, md)
 
-    def WEIGHT_VGMIX(self, layout, ob, md):
+    def VERTEX_WEIGHT_MIX(self, layout, ob, md):
         if ob.type == 'MESH':
             split = layout.split()
             col = split.column()
@@ -822,7 +825,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
             layout.separator()
             self.weight_vg_mask(layout, ob, md)
 
-    def WEIGHT_VGPROXIMITY(self, layout, ob, md):
+    def VERTEX_WEIGHT_PROXIMITY(self, layout, ob, md):
         if ob.type == 'MESH':
             split = layout.split()
             col = split.column()
@@ -843,7 +846,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
             row.prop(md, "min_dist")
             row.prop(md, "max_dist")
 
-            layout.prop(md, "mapping_mode")
+            layout.prop(md, "falloff_type")
 
             # Common mask options…
             layout.separator()
index d6ef426..f8d0b81 100644 (file)
@@ -589,7 +589,7 @@ DEF_ICON(MOD_MULTIRES)
 DEF_ICON(MOD_SMOKE)
 DEF_ICON(MOD_SOLIDIFY)
 DEF_ICON(MOD_SCREW)
-DEF_ICON(MOD_WEIGHTVG)
+DEF_ICON(MOD_VERTEX_WEIGHT)
 #ifndef DEF_ICON_BLANK_SKIP
        DEF_ICON(BLANK161)
        DEF_ICON(BLANK162)
index c4eef98..32a78cb 100644 (file)
@@ -796,7 +796,7 @@ typedef struct WeightVGEditModifierData {
        char    defgrp_name[32];      /* Name of vertex group to edit. */
 
        short   edit_flags;     /* Using MOD_WVG_EDIT_* flags. */
-       short   mapping_mode;   /* Using MOD_WVG_MAPPING_* defines. */
+       short   falloff_type;   /* Using MOD_WVG_MAPPING_* defines. */
        float   default_weight; /* Weight for vertices not in vgroup. */
 
        /* Mapping stuff. */
@@ -913,7 +913,7 @@ typedef struct WeightVGProximityModifierData {
        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. */
+       short   falloff_type;              /* Using MOD_WVG_MAPPING_* defines. */
 
        /* Padding... */
        short pad_s1;
index 76e3435..2e8e852 100644 (file)
@@ -69,9 +69,9 @@ EnumPropertyItem modifier_type_items[] ={
        {eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""},
        {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""},
        {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""},
-       {eModifierType_WeightVGEdit, "WEIGHT_VGEDIT", ICON_MOD_WEIGHTVG, "WeightVG Edit", ""},
-       {eModifierType_WeightVGMix, "WEIGHT_VGMIX", ICON_MOD_WEIGHTVG, "WeightVG Mix", ""},
-       {eModifierType_WeightVGProximity, "WEIGHT_VGPROXIMITY", ICON_MOD_WEIGHTVG, "WeightVG Proximity", ""},
+       {eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""},
+       {eModifierType_WeightVGMix, "VERTEX_WEIGHT_MIX", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Mix", ""},
+       {eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Proximity", ""},
        {0, "", 0, "Deform", ""},
        {eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""},
        {eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""},
@@ -188,11 +188,11 @@ static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr)
                case eModifierType_Warp:
                        return &RNA_WarpModifier;
                case eModifierType_WeightVGEdit:
-                       return &RNA_WeightVGEditModifier;
+                       return &RNA_VertexWeightEditModifier;
                case eModifierType_WeightVGMix:
-                       return &RNA_WeightVGMixModifier;
+                       return &RNA_VertexWeightMixModifier;
                case eModifierType_WeightVGProximity:
-                       return &RNA_WeightVGProximityModifier;
+                       return &RNA_VertexWeightProximityModifier;
                default:
                        return &RNA_Modifier;
        }
@@ -2552,7 +2552,7 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *brna, StructRNA *srna)
 
 static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
 {
-       static EnumPropertyItem weightvg_edit_mapping_mode_items[] = {
+       static EnumPropertyItem weightvg_edit_falloff_type_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", ""},
@@ -2566,11 +2566,11 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
-       srna= RNA_def_struct(brna, "WeightVGEditModifier", "Modifier");
+       srna= RNA_def_struct(brna, "VertexWeightEditModifier", "Modifier");
        RNA_def_struct_ui_text(srna, "WeightVG Edit Modifier",
                               "Edit the weights of vertices in a group.");
        RNA_def_struct_sdna(srna, "WeightVGEditModifierData");
-       RNA_def_struct_ui_icon(srna, ICON_MOD_WEIGHTVG);
+       RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
 
        prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
@@ -2578,9 +2578,9 @@ 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, "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.");
+       prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, weightvg_edit_falloff_type_items);
+       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");
 
        prop= RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE);
@@ -2650,11 +2650,11 @@ static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
-       srna= RNA_def_struct(brna, "WeightVGMixModifier", "Modifier");
+       srna= RNA_def_struct(brna, "VertexWeightMixModifier", "Modifier");
        RNA_def_struct_ui_text(srna, "WeightVG Mix Modifier",
                               "Mix the weights of two vertex groups.");
        RNA_def_struct_sdna(srna, "WeightVGMixModifierData");
-       RNA_def_struct_ui_icon(srna, ICON_MOD_WEIGHTVG);
+       RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
 
        prop= RNA_def_property(srna, "vertex_group_a", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "defgrp_name_a");
@@ -2712,7 +2712,7 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
                {MOD_WVG_PROXIMITY_GEOM_FACES, "FACE", ICON_FACESEL, "Face", ""},
                {0, NULL, 0, NULL, NULL}};
 
-       static EnumPropertyItem weightvg_proximity_mapping_mode_items[] = {
+       static EnumPropertyItem weightvg_proximity_falloff_type_items[] = {
                {MOD_WVG_MAPPING_NONE, "LINEAR", ICON_LINCURVE, "Linear", ""},
                /* No curve mapping here! */
                {MOD_WVG_MAPPING_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
@@ -2726,12 +2726,12 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
-       srna= RNA_def_struct(brna, "WeightVGProximityModifier", "Modifier");
+       srna= RNA_def_struct(brna, "VertexWeightProximityModifier", "Modifier");
        RNA_def_struct_ui_text(srna, "WeightVG Proximity Modifier",
                               "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);
+       RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
 
        prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
@@ -2769,9 +2769,9 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Highest Dist", "Distance mapping to weight 1.0.");
        RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-       prop= RNA_def_property(srna, "mapping_mode", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_items(prop, weightvg_proximity_mapping_mode_items);
-       RNA_def_property_ui_text(prop, "Mapping Mode", "How weights are mapped to there new values.");
+       prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, weightvg_proximity_falloff_type_items);
+       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. */
index 52c851c..51465cc 100644 (file)
  * vertex index (in case the weight tables do not cover the whole vertices...).
  * cmap might be NULL, in which case curve mapping mode will return unmodified data.
  */
-void weightvg_do_map(int num, float *new_w, short mode, CurveMapping *cmap)
+void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cmap)
 {
        int i;
 
        /* Return immediately, if we have nothing to do! */
        /* Also security checks... */
-       if(((mode == MOD_WVG_MAPPING_CURVE) && (cmap == NULL))
-          || !ELEM7(mode, MOD_WVG_MAPPING_CURVE, MOD_WVG_MAPPING_SHARP, MOD_WVG_MAPPING_SMOOTH,
-                          MOD_WVG_MAPPING_ROOT, MOD_WVG_MAPPING_SPHERE, MOD_WVG_MAPPING_RANDOM,
-                          MOD_WVG_MAPPING_STEP))
+       if(((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == NULL))
+               || !ELEM7(falloff_type, MOD_WVG_MAPPING_CURVE, MOD_WVG_MAPPING_SHARP, MOD_WVG_MAPPING_SMOOTH,
+                         MOD_WVG_MAPPING_ROOT, MOD_WVG_MAPPING_SPHERE, MOD_WVG_MAPPING_RANDOM,
+                         MOD_WVG_MAPPING_STEP))
                return;
 
        /* Map each weight (vertex) to its new value, accordingly to the chosen mode. */
@@ -81,7 +81,7 @@ void weightvg_do_map(int num, float *new_w, short mode, CurveMapping *cmap)
 
                /* Code borrowed from the warp modifier. */
                /* Closely matches PROP_SMOOTH and similar. */
-               switch(mode) {
+               switch(falloff_type) {
                case MOD_WVG_MAPPING_CURVE:
                        fac = curvemapping_evaluateF(cmap, 0, fac);
                        break;
index 7a7f69c..0b6b69b 100644 (file)
@@ -62,7 +62,7 @@ static void initData(ModifierData *md)
 {
        WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md;
        wmd->edit_flags             = 0;
-       wmd->mapping_mode           = MOD_WVG_MAPPING_NONE;
+       wmd->falloff_type           = MOD_WVG_MAPPING_NONE;
        wmd->default_weight         = 0.0f;
 
        wmd->cmap_curve             = curvemapping_add(1, 0.0, 0.0, 1.0, 1.0);
@@ -90,7 +90,7 @@ static void copyData(ModifierData *md, ModifierData *target)
        BLI_strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name));
 
        twmd->edit_flags             = wmd->edit_flags;
-       twmd->mapping_mode           = wmd->mapping_mode;
+       twmd->falloff_type           = wmd->falloff_type;
        twmd->default_weight         = wmd->default_weight;
 
        twmd->cmap_curve             = curvemapping_copy(wmd->cmap_curve);
@@ -268,8 +268,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
        }
 
        /* Do mapping. */
-       if (wmd->mapping_mode != MOD_WVG_MAPPING_NONE) {
-               weightvg_do_map(numVerts, new_w, wmd->mapping_mode, wmd->cmap_curve);
+       if (wmd->falloff_type != MOD_WVG_MAPPING_NONE) {
+               weightvg_do_map(numVerts, new_w, wmd->falloff_type, wmd->cmap_curve);
        }
 
        /* Do masking. */
@@ -298,7 +298,7 @@ static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
 
 
 ModifierTypeInfo modifierType_WeightVGEdit = {
-       /* name */              "WeightVGEdit",
+       /* name */              "VertexWeightEdit",
        /* structName */        "WeightVGEditModifierData",
        /* structSize */        sizeof(WeightVGEditModifierData),
        /* type */              eModifierTypeType_Nonconstructive,
index 9785764..8bfc56f 100644 (file)
@@ -438,7 +438,7 @@ static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
 
 
 ModifierTypeInfo modifierType_WeightVGMix = {
-       /* name */              "WeightVGMix",
+       /* name */              "VertexWeightMix",
        /* structName */        "WeightVGMixModifierData",
        /* structSize */        sizeof(WeightVGMixModifierData),
        /* type */              eModifierTypeType_Nonconstructive,
index 55f0102..ffb783f 100644 (file)
@@ -220,7 +220,7 @@ static void initData(ModifierData *md)
        wmd->proximity_mode       = MOD_WVG_PROXIMITY_OBJECT;
        wmd->proximity_flags      = MOD_WVG_PROXIMITY_GEOM_VERTS;
 
-       wmd->mapping_mode         = MOD_WVG_MAPPING_NONE;
+       wmd->falloff_type         = MOD_WVG_MAPPING_NONE;
 
        wmd->mask_constant        = 1.0f;
        wmd->mask_tex_use_channel = MOD_WVG_MASK_TEX_USE_INT; /* Use intensity by default. */
@@ -238,7 +238,7 @@ static void copyData(ModifierData *md, ModifierData *target)
        twmd->proximity_flags        = wmd->proximity_flags;
        twmd->proximity_ob_target    = wmd->proximity_ob_target;
 
-       twmd->mapping_mode           = wmd->mapping_mode;
+       twmd->falloff_type           = wmd->falloff_type;
 
        twmd->mask_constant          = wmd->mask_constant;
        BLI_strncpy(twmd->mask_defgrp_name, wmd->mask_defgrp_name, sizeof(twmd->mask_defgrp_name));
@@ -498,7 +498,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
                         wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
 
        /* Map distances to weights. */
-       do_map(org_w, numIdx, wmd->min_dist, wmd->max_dist, wmd->mapping_mode);
+       do_map(org_w, numIdx, wmd->min_dist, wmd->max_dist, wmd->falloff_type);
 
        /* Update vgroup. Note we never add nor remove vertices from vgroup here. */
        weightvg_update_vg(dvert, defgrp_idx, numIdx, indices, org_w, 0, 0.0f, 0, 0.0f);
@@ -522,7 +522,7 @@ static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
 
 
 ModifierTypeInfo modifierType_WeightVGProximity = {
-       /* name */              "WeightVGProximity",
+       /* name */              "VertexWeightProximity",
        /* structName */        "WeightVGProximityModifierData",
        /* structSize */        sizeof(WeightVGProximityModifierData),
        /* type */              eModifierTypeType_Nonconstructive,