[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38695] branches/vgroup_modifiers: Adding WeightVG modifiers code.

Bastien Montagne montagne29 at wanadoo.fr
Mon Jul 25 17:27:01 CEST 2011


Revision: 38695
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38695
Author:   mont29
Date:     2011-07-25 15:27:01 +0000 (Mon, 25 Jul 2011)
Log Message:
-----------
Adding WeightVG modifiers code. Still some points to tweak, though.
NOTE?\194?\160: Haven?\226?\128?\153t yet tested build with scons, will do asap (unless someone else does :) ).

Modified Paths:
--------------
    branches/vgroup_modifiers/release/datafiles/blenderbuttons
    branches/vgroup_modifiers/release/scripts/startup/bl_ui/properties_data_modifier.py
    branches/vgroup_modifiers/source/blender/blenloader/intern/readfile.c
    branches/vgroup_modifiers/source/blender/blenloader/intern/writefile.c
    branches/vgroup_modifiers/source/blender/editors/datafiles/blenderbuttons.c
    branches/vgroup_modifiers/source/blender/editors/include/UI_icons.h
    branches/vgroup_modifiers/source/blender/editors/space_outliner/outliner.c
    branches/vgroup_modifiers/source/blender/makesdna/DNA_modifier_types.h
    branches/vgroup_modifiers/source/blender/makesrna/RNA_access.h
    branches/vgroup_modifiers/source/blender/makesrna/intern/rna_modifier.c
    branches/vgroup_modifiers/source/blender/modifiers/CMakeLists.txt
    branches/vgroup_modifiers/source/blender/modifiers/MOD_modifiertypes.h
    branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_util.c

Added Paths:
-----------
    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/datafiles/blenderbuttons
===================================================================
(Binary files differ)

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-07-25 14:54:29 UTC (rev 38694)
+++ branches/vgroup_modifiers/release/scripts/startup/bl_ui/properties_data_modifier.py	2011-07-25 15:27:01 UTC (rev 38695)
@@ -735,5 +735,134 @@
         col.prop(md, "width", slider=True)
         col.prop(md, "narrowness", slider=True)
 
+    @staticmethod
+    def weight_vg_mask(layout, ob, md):
+        layout.label(text="Influence/Mask Options:")
+        split = layout.split()
+        col1 = split.column()
+        col2 = split.column()
+
+        col1.label(text="Global Influence:")
+        col2.prop(md, "mask_constant", text="")
+
+        if not md.mask_texture:
+            col1.label(text="Vertex Group Mask:")
+            col2.prop_search(md, "mask_vertex_group", ob, "vertex_groups", text="")
+
+        if not md.mask_vertex_group:
+            col1.label(text="Texture Mask:")
+            col2.template_ID(md, "mask_texture", new="texture.new")
+            if md.mask_texture:
+                split = layout.split()
+                col = split.column()
+                col.label(text="Texture Coordinates:")
+                col.prop(md, "mask_tex_mapping", text="")
+                col = split.column()
+                col.label(text="Use Channel:")
+                col.prop(md, "mask_tex_use_channel", text="")
+
+                if md.mask_tex_mapping == 'OBJECT':
+                    layout.prop(md, "mask_tex_map_obj", text="Object")
+                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):
+        if ob.type == 'MESH':
+            split = layout.split()
+            col = split.column()
+            col.label(text="Vertex Group:")
+            col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+
+            col = split.column()
+            col.label(text="Default Weight:")
+            col.prop(md, "default_weight", text="")
+
+            layout.prop(md, "flag_map")
+            if md.flag_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, "flag_curve_map")
+            if md.flag_curve_map:
+                row = layout.row()
+                row.template_curve_mapping(md, "cmap_curve")
+
+            layout.prop(md, "flag_reverse")
+
+            layout.prop(md, "flag_clamp")
+            if md.flag_clamp:
+                row = layout.row()
+                row.prop(md, "clamp_min_weight")
+                row.prop(md, "clamp_max_weight")
+
+            row = layout.row()
+            row.prop(md, "flag_add2vg")
+            row.prop(md, "flag_remfvg")
+            row = layout.row()
+            if md.flag_add2vg:
+                row.prop(md, "add_threshold")
+            if md.flag_remfvg:
+                row.prop(md, "rem_threshold")
+
+            # Common mask options…
+            layout.separator()
+            self.weight_vg_mask(layout, ob, md)
+
+    def WEIGHT_VGMIX(self, layout, ob, md):
+        if ob.type == 'MESH':
+            split = layout.split()
+            col = split.column()
+            col.label(text="Vertex Group 1:")
+            col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+            col.label(text="Default Weight 1:")
+            col.prop(md, "default_weight", text="")
+
+            col.label(text="Mix Mode:")
+            col.prop(md, "mix_mode", text="")
+
+            col = split.column()
+            col.label(text="Vertex Group 2:")
+            col.prop_search(md, "vertex_group2", ob, "vertex_groups", text="")
+            col.label(text="Default Weight 2:")
+            col.prop(md, "default_weight2", text="")
+
+            col.label(text="Mix Set:")
+            col.prop(md, "mix_set", text="")
+
+            # Common mask options…
+            layout.separator()
+            self.weight_vg_mask(layout, ob, md)
+
+    def WEIGHT_VGPROXIMITY(self, layout, ob, md):
+        if ob.type == 'MESH':
+            split = layout.split()
+            col = split.column()
+            col.label(text="Vertex Group:")
+            col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+
+            col = split.column()
+            col.label(text="Target Object:")
+            col.prop(md, "ob_target", text="")
+
+            row = layout.row()
+            row.prop(md, "proximity_mode", expand=True)
+            if md.proximity_mode == 'OBJ2VERTDIST':
+                row = layout.row()
+                row.prop(md, "obj2vert_verts")
+                row.prop(md, "obj2vert_edges")
+                row.prop(md, "obj2vert_faces")
+
+            # Common mask options…
+            layout.separator()
+            self.weight_vg_mask(layout, ob, md)
+
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)

Modified: branches/vgroup_modifiers/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/vgroup_modifiers/source/blender/blenloader/intern/readfile.c	2011-07-25 14:54:29 UTC (rev 38694)
+++ branches/vgroup_modifiers/source/blender/blenloader/intern/readfile.c	2011-07-25 15:27:01 UTC (rev 38695)
@@ -4154,6 +4154,13 @@
 			if(tmd->curfalloff)
 				direct_link_curvemapping(fd, tmd->curfalloff);
 		}
+		else if (md->type==eModifierType_WeightVGEdit) {
+			WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md;
+
+			wmd->cmap_curve = newdataadr(fd, wmd->cmap_curve);
+			if(wmd->cmap_curve)
+				direct_link_curvemapping(fd, wmd->cmap_curve);
+		}
 	}
 }
 
@@ -11707,7 +11714,22 @@
 	/* put compatibility code here until next subversion bump */
 
 	{
-	
+		Object *ob;
+		ModifierData *md;
+
+		/* WeightVGEdit modifier: CurveMapping pointer… */
+		for(ob = main->object.first; ob; ob = ob->id.next) {
+			for(md = ob->modifiers.first; md; md = md->next) {
+				if(md->type == eModifierType_WeightVGEdit) {
+					WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md;
+					if (wmd->cmap_curve == NULL) {
+						wmd->cmap_curve = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
+						curvemapping_initialize(wmd->cmap_curve);
+					}
+				}
+			}
+		}
+
 	}
 	
 	/* WATCH IT!!!: pointers from libdata have not been converted yet here! */

Modified: branches/vgroup_modifiers/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/vgroup_modifiers/source/blender/blenloader/intern/writefile.c	2011-07-25 14:54:29 UTC (rev 38694)
+++ branches/vgroup_modifiers/source/blender/blenloader/intern/writefile.c	2011-07-25 15:27:01 UTC (rev 38695)
@@ -1294,6 +1294,12 @@
 				write_curvemapping(wd, tmd->curfalloff);
 			}
 		}
+		else if (md->type==eModifierType_WeightVGEdit) {
+			WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md;
+
+			if (wmd->cmap_curve)
+				write_curvemapping(wd, wmd->cmap_curve);
+		}
 	}
 }
 

Modified: branches/vgroup_modifiers/source/blender/editors/datafiles/blenderbuttons.c
===================================================================
--- branches/vgroup_modifiers/source/blender/editors/datafiles/blenderbuttons.c	2011-07-25 14:54:29 UTC (rev 38694)
+++ branches/vgroup_modifiers/source/blender/editors/datafiles/blenderbuttons.c	2011-07-25 15:27:01 UTC (rev 38695)
@@ -3,6580 +3,6602 @@
  */
 /* DataToC output of file <blenderbuttons> */
 
-int datatoc_blenderbuttons_size= 210335;
+int datatoc_blenderbuttons_size= 211021;
 char datatoc_blenderbuttons[]= {
-137, 80, 78, 71, 13, 10, 26, 10,  0,  0,  0, 13, 73, 72, 68, 82,  0,  0,  2, 90,  0,  0,  2,128,  8,  6,  0,  0,  0, 68,254,
-214,163,  0,  0, 10, 79,105, 67, 67, 80, 80,104,111,116,111,115,104,111,112, 32, 73, 67, 67, 32,112,114,111,102,105,108,101,  0,
-  0,120,218,157, 83,103, 84, 83,233, 22, 61,247,222,244, 66, 75,136,128,148, 75,111, 82, 21,  8, 32, 82, 66,139,128, 20,145, 38,
- 42, 33,  9, 16, 74,136, 33,161,217, 21, 81,193, 17, 69, 69,  4, 27,200,160,136,  3,142,142,128,140, 21, 81, 44, 12,138, 10,216,
-  7,228, 33,162,142,131,163,136,138,202,251,225,123,163,107,214,188,247,230,205,254,181,215, 62,231,172,243,157,179,207,  7,192,
-  8, 12,150, 72, 51, 81, 53,128, 12,169, 66, 30, 17,224,131,199,196,198,225,228, 46, 64,129, 10, 36,112,  0, 16,  8,179,100, 33,
-115,253, 35,  1,  0,248,126, 60, 60, 43, 34,192,  7,190,  0,  1,120,211, 11,  8,  0,192, 77,155,192, 48, 28,135,255, 15,234, 66,
-153, 92,  1,128,132,  1,192,116,145, 56, 75,  8,128, 20,  0, 64,122,142, 66,166,  0, 64, 70,  1,128,157,152, 38, 83,  0,160,  4,
-  0, 96,203, 99, 98,227,  0, 80, 45,  0, 96, 39,127,230,211,  0,128,157,248,153,123,  1,  0, 91,148, 33, 21,  1,160,145,  0, 32,
- 19,101,136, 68,  0,104, 59,  0,172,207, 86,138, 69,  0, 88, 48,  0, 20,102, 75,196, 57,  0,216, 45,  0, 48, 73, 87,102, 72,  0,
-176,183,  0,192,206, 16, 11,178,  0,  8, 12,  0, 48, 81,136,133, 41,  0,  4,123,  0, 96,200, 35, 35,120,  0,132,153,  0, 20, 70,
-242, 87, 60,241, 43,174, 16,231, 42,  0,  0,120,153,178, 60,185, 36, 57, 69,129, 91,  8, 45,113,  7, 87, 87, 46, 30, 40,206, 73,
- 23, 43, 20, 54, 97,  2, 97,154, 64, 46,194,121,153, 25, 50,129, 52, 15,224,243,204,  0,  0,160,145, 21, 17,224,131,243,253,120,
-206, 14,174,206,206, 54,142,182, 14, 95, 45,234,191,  6,255, 34, 98, 98,227,254,229,207,171,112, 64,  0,  0,225,116,126,209,254,
- 44, 47,179, 26,128, 59,  6,128,109,254,162, 37,238,  4,104, 94, 11,160,117,247,139,102,178, 15, 64,181,  0,160,233,218, 87,243,
-112,248,126, 60, 60, 69,161,144,185,217,217,229,228,228,216, 74,196, 66, 91, 97,202, 87,125,254,103,194, 95,192, 87,253,108,249,

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list