[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38130] branches/soc-2011-onion: Vertex Weights Export Tool

Antony Riakiotakis kalast at gmail.com
Tue Jul 5 23:23:06 CEST 2011


Revision: 38130
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38130
Author:   psy-fi
Date:     2011-07-05 21:23:05 +0000 (Tue, 05 Jul 2011)
Log Message:
-----------
Vertex Weights Export Tool
=====================
This tool will allow you to export the vertex groups as masks/layers on an image. The image format chosen is EXR for now as it supports both floats(as weights are, though precision may not be too important here) and layers, allowing you to save all your vgroups in one image.

-dummy exec function and operator
-GUI under vertex paint toolshelf -> weight tools(Save as Layered Image)

Modified Paths:
--------------
    branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c

Modified: branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2011-07-05 20:15:29 UTC (rev 38129)
+++ branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2011-07-05 21:23:05 UTC (rev 38130)
@@ -1129,6 +1129,7 @@
         col.operator("object.vertex_group_invert", text="Invert")
         col.operator("object.vertex_group_clean", text="Clean")
         col.operator("object.vertex_group_levels", text="Levels")
+        col.operator("paint.weight_layers_image_from_view", text="Save As Layered Image")
 
 
 class VIEW3D_PT_tools_weightpaint_options(View3DPanel, bpy.types.Panel):

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c	2011-07-05 20:15:29 UTC (rev 38129)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c	2011-07-05 21:23:05 UTC (rev 38130)
@@ -5595,3 +5595,25 @@
 
 	RNA_def_string_file_name(ot->srna, "filepath", "", FILE_MAX, "File Path", "Name of the file");
 }
+
+static int weight_layers_image_from_view_exec(bContext *C, wmOperator *op)
+{
+	return OPERATOR_FINISHED;
+}
+
+void PAINT_OT_weight_layers_image_from_view(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name= "Weight layers image from View";
+	ot->idname= "PAINT_OT_weight_layers_image_from_view";
+	ot->description= "Make an openEXR image containing luminance layers for each vertex group of the active object from the current 3D view";
+
+	/* api callbacks */
+	ot->exec= weight_layers_image_from_view_exec;
+	ot->poll= ED_operator_region_view3d_active;
+
+	/* flags */
+	ot->flag= OPTYPE_REGISTER;
+
+//	RNA_def_string_file_name(ot->srna, "filepath", "", FILE_MAX, "File Path", "Name of the file");
+}

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h	2011-07-05 20:15:29 UTC (rev 38129)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h	2011-07-05 21:23:05 UTC (rev 38130)
@@ -137,8 +137,8 @@
 void PAINT_OT_texture_paint_toggle(struct wmOperatorType *ot);
 void PAINT_OT_project_image(struct wmOperatorType *ot);
 void PAINT_OT_image_from_view(struct wmOperatorType *ot);
+void PAINT_OT_weight_layers_image_from_view(struct wmOperatorType *ot);
 
-
 /* paint_utils.c */
 void projectf(struct bglMats *mats, const float v[3], float p[2]);
 float paint_calc_object_space_radius(struct ViewContext *vc, float center[3], float pixel_radius);

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c	2011-07-05 20:15:29 UTC (rev 38129)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c	2011-07-05 21:23:05 UTC (rev 38130)
@@ -392,6 +392,7 @@
 	WM_operatortype_append(PAINT_OT_weight_from_bones);
 	WM_operatortype_append(PAINT_OT_weight_sample);
 	WM_operatortype_append(PAINT_OT_weight_sample_group);
+	WM_operatortype_append(PAINT_OT_weight_layers_image_from_view);
 
 	/* vertex */
 	WM_operatortype_append(PAINT_OT_vertex_paint_toggle);




More information about the Bf-blender-cvs mailing list