Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Bishop <nicholasbishop@gmail.com>2010-07-27 20:09:02 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2010-07-27 20:09:02 +0400
commit88dcfbaee9be4a08104efc2f4edd20dd8e7957fe (patch)
tree22670033fd0118e29e4293911ac231b34b784321 /source/blender/editors
parent78e5a299900233aa8779f87947edb9f37f9336bf (diff)
== Sculpt ==
Added a brush reset operator so that a user won't need to reload the default blend to get back default brush settings * New brush.reset operator, resets a brush based on the currently-selected tool * Added UI button in the tools panel TODO: * Only resets sculpt brushes right now, other paint modes should be added * Sculpt polish tool exists only as a Brush, not as a tool; I'd suggest we make it a tool so it can be reset to defaults too
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 5a27af9cf5f..00e2ed7dc62 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -154,6 +154,35 @@ void PAINT_OT_vertex_color_set(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+static int brush_reset_exec(bContext *C, wmOperator *op)
+{
+ Paint *paint = paint_get_active(CTX_data_scene(C));
+ Brush *brush = paint_brush(paint);
+ Object *ob = CTX_data_active_object(C);
+
+ if(!ob) return OPERATOR_CANCELLED;
+
+ if(ob->mode & OB_MODE_SCULPT)
+ brush_reset_sculpt(brush);
+ /* TODO: other modes */
+
+ return OPERATOR_FINISHED;
+}
+
+void BRUSH_OT_reset(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Reset Brush";
+ ot->description= "Return brush to defaults based on current tool";
+ ot->idname= "BRUSH_OT_reset";
+
+ /* api callbacks */
+ ot->exec= brush_reset_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
/**************************** registration **********************************/
void ED_operatortypes_paint(void)
@@ -162,7 +191,7 @@ void ED_operatortypes_paint(void)
WM_operatortype_append(BRUSH_OT_add);
WM_operatortype_append(BRUSH_OT_scale_size);
WM_operatortype_append(BRUSH_OT_curve_preset);
-
+ WM_operatortype_append(BRUSH_OT_reset);
/* image */
WM_operatortype_append(PAINT_OT_texture_paint_toggle);
@@ -175,7 +204,6 @@ void ED_operatortypes_paint(void)
WM_operatortype_append(PAINT_OT_project_image);
WM_operatortype_append(PAINT_OT_image_from_view);
-
/* weight */
WM_operatortype_append(PAINT_OT_weight_paint_toggle);
WM_operatortype_append(PAINT_OT_weight_paint_radial_control);