[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37119] branches/soc-2011-onion: Revision: 28986

Jason Wilkins Jason.A.Wilkins at gmail.com
Fri Jun 3 14:34:49 CEST 2011


Revision: 37119
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37119
Author:   jwilkins
Date:     2011-06-03 12:34:48 +0000 (Fri, 03 Jun 2011)
Log Message:
-----------
Revision: 28986
Author: nicholasbishop
Date: 2:13:37 PM, Tuesday, May 25, 2010
Message:
* Added a temporary operator to set masks, does nothing yet
* Added a temporary UI for the temporary operator for testing

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

Added Paths:
-----------
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c

Property Changed:
----------------
    branches/soc-2011-onion/


Property changes on: branches/soc-2011-onion
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28682,29263,29350
/trunk/blender:36833-37054
   + /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-28986,29263,29350
/trunk/blender:36833-37054

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-06-03 11:57:03 UTC (rev 37118)
+++ branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2011-06-03 12:34:48 UTC (rev 37119)
@@ -702,6 +702,26 @@
             #row.prop(brush, "use_pressure_jitter", toggle=True, text="")
 
 
+class VIEW3D_PT_tools_masking(PaintPanel, bpy.types.Panel):
+    bl_label = "Masking"
+    bl_default_closed = False
+
+    @classmethod
+    def poll(self, context):
+        settings = self.paint_settings(context)
+        return (settings)
+
+    def draw(self, context):
+        layout = self.layout
+
+        settings = self.paint_settings(context)
+
+        row = layout.row(align=True)
+        row.operator("paint.mask_set", text="Clear").mode = 'CLEAR'
+        row.operator("paint.mask_set", text="Full").mode = 'FULL'
+        row.operator("paint.mask_set", text="Random").mode = 'RANDOM'
+
+
 class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
     bl_label = "Texture"
     bl_options = {'DEFAULT_CLOSED'}

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/CMakeLists.txt
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/CMakeLists.txt	2011-06-03 11:57:03 UTC (rev 37118)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/CMakeLists.txt	2011-06-03 12:34:48 UTC (rev 37119)
@@ -44,6 +44,7 @@
 	paint_undo.c
 	paint_utils.c
 	paint_vertex.c
+	paint_mask.c
 	sculpt.c
 	sculpt_undo.c
 

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-06-03 11:57:03 UTC (rev 37118)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h	2011-06-03 12:34:48 UTC (rev 37119)
@@ -139,5 +139,14 @@
 void undo_paint_push_count_alloc(int type, int size);
 void undo_paint_push_end(int type);
 
+/* paint_mask.c */
+/* For now this is just temporary stuff to test masking */
+typedef enum {
+	MASKING_CLEAR,
+	MASKING_FULL,
+	MASKING_RANDOM,
+} MaskSetMode;
+void PAINT_OT_mask_set(struct wmOperatorType *ot);
+
 #endif /* ED_PAINT_INTERN_H */
 

Added: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c	                        (rev 0)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c	2011-06-03 12:34:48 UTC (rev 37119)
@@ -0,0 +1,66 @@
+#include "DNA_mesh_types.h"
+#include "DNA_object_types.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "BKE_context.h"
+#include "BKE_customdata.h"
+#include "BKE_depsgraph.h"
+#include "BKE_mesh.h"
+
+#include "paint_intern.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+static int paint_mask_set_exec(bContext *C, wmOperator *op)
+{
+	MaskSetMode mode = RNA_enum_get(op->ptr, "mode");
+	Object *ob;
+	Mesh *me;
+
+	ob = CTX_data_active_object(C);
+
+	if((me = get_mesh(ob))) {
+		printf("paint mask set %d\n", mode);
+
+		DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+	}
+
+	return OPERATOR_FINISHED;
+}
+
+static int mask_poll(bContext *C)
+{
+	return 1; // TODO
+}
+
+/* Temporary operator to test masking; simply fills up a mask for the
+   entire object, setting each point to either 0, 1, or a random value
+*/
+void PAINT_OT_mask_set(wmOperatorType *ot)
+{
+	static EnumPropertyItem mask_items[] = {
+		{MASKING_CLEAR, "CLEAR", 0, "Clear", ""},
+		{MASKING_FULL, "FULL", 0, "Full", ""},
+		{MASKING_RANDOM, "RANDOM", 0, "Random", ""},
+		{0, NULL, 0, NULL, NULL}};
+
+	/* identifiers */
+	ot->name= "Set Mask";
+	ot->idname= "PAINT_OT_mask_set";
+	
+	/* api callbacks */
+	ot->exec= paint_mask_set_exec;
+	ot->poll= mask_poll;
+	
+	/* flags */
+	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+	/* properties */
+	RNA_def_enum(ot->srna, "mode", mask_items, MASKING_CLEAR, "Mode", "");
+}

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-06-03 11:57:03 UTC (rev 37118)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c	2011-06-03 12:34:48 UTC (rev 37119)
@@ -385,9 +385,11 @@
 	WM_operatortype_append(PAINT_OT_face_select_inverse);
 	WM_operatortype_append(PAINT_OT_face_select_hide);
 	WM_operatortype_append(PAINT_OT_face_select_reveal);
+
+	/* mask */
+	WM_operatortype_append(PAINT_OT_mask_set);
 }
 
-
 static void ed_keymap_paint_brush_switch(wmKeyMap *keymap, const char *mode)
 {
 	wmKeyMapItem *kmi;




More information about the Bf-blender-cvs mailing list