[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28986] branches/soc-2010-nicolasbishop: * Added a temporary operator to set masks, does nothing yet
Nicholas Bishop
nicholasbishop at gmail.com
Tue May 25 21:13:37 CEST 2010
Revision: 28986
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28986
Author: nicholasbishop
Date: 2010-05-25 21:13:37 +0200 (Tue, 25 May 2010)
Log 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-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py
branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h
branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_ops.c
Added Paths:
-----------
branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c
Modified: branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py 2010-05-25 18:34:49 UTC (rev 28985)
+++ branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py 2010-05-25 19:13:37 UTC (rev 28986)
@@ -486,6 +486,25 @@
return False
+class VIEW3D_PT_tools_masking(PaintPanel):
+ bl_label = "Masking"
+ bl_default_closed = False
+
+ 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(PaintPanel):
bl_label = "Brush"
@@ -1044,6 +1063,7 @@
VIEW3D_PT_tools_latticeedit,
VIEW3D_PT_tools_posemode,
VIEW3D_PT_tools_posemode_options,
+ VIEW3D_PT_tools_masking,
VIEW3D_PT_tools_brush,
VIEW3D_PT_tools_brush_texture,
VIEW3D_PT_tools_brush_tool,
Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h 2010-05-25 18:34:49 UTC (rev 28985)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h 2010-05-25 19:13:37 UTC (rev 28986)
@@ -119,5 +119,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-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c (rev 0)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c 2010-05-25 19:13:37 UTC (rev 28986)
@@ -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_flush_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-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_ops.c 2010-05-25 18:34:49 UTC (rev 28985)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_ops.c 2010-05-25 19:13:37 UTC (rev 28986)
@@ -139,6 +139,9 @@
WM_operatortype_append(PAINT_OT_face_select_linked);
WM_operatortype_append(PAINT_OT_face_select_linked_pick);
WM_operatortype_append(PAINT_OT_face_select_all);
+
+ /* mask */
+ WM_operatortype_append(PAINT_OT_mask_set);
}
static void ed_keymap_paint_brush_switch(wmKeyMap *keymap, const char *path)
More information about the Bf-blender-cvs
mailing list