[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30312] branches/soc-2010-jwilkins/source/ blender/editors/sculpt_paint: * bug fix: [ and ] didn't resize unified size
Jason Wilkins
Jason.A.Wilkins at gmail.com
Wed Jul 14 12:54:42 CEST 2010
Revision: 30312
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30312
Author: jwilkins
Date: 2010-07-14 12:54:42 +0200 (Wed, 14 Jul 2010)
Log Message:
-----------
* bug fix: [ and ] didn't resize unified size
* quieted some warnings
Modified Paths:
--------------
branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_ops.c
branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c
Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_ops.c 2010-07-14 10:46:12 UTC (rev 30311)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_ops.c 2010-07-14 10:54:42 UTC (rev 30312)
@@ -46,7 +46,6 @@
{
/*int type = RNA_enum_get(op->ptr, "type");*/
Paint *paint = paint_get_active(CTX_data_scene(C));
- Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
Brush *br = paint_brush(paint);
if (br)
@@ -59,13 +58,6 @@
return OPERATOR_FINISHED;
}
-static EnumPropertyItem brush_type_items[] = {
- {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt", ""},
- {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
- {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
- {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
- {0, NULL, 0, NULL, NULL}};
-
void BRUSH_OT_add(wmOperatorType *ot)
{
/* identifiers */
@@ -78,10 +70,44 @@
/* flags */
ot->flag= OPTYPE_UNDO;
+}
- RNA_def_enum(ot->srna, "type", brush_type_items, OB_MODE_VERTEX_PAINT, "Type", "Which paint mode to create the brush for.");
+
+static int brush_scale_size_exec(bContext *C, wmOperator *op)
+{
+ /*int type = RNA_enum_get(op->ptr, "type");*/
+ Paint *paint = paint_get_active(CTX_data_scene(C));
+ Brush *br = paint_brush(paint);
+ float factor = RNA_float_get(op->ptr, "scalar");
+
+ if (br) {
+ if (U.sculpt_paint_settings & SCULPT_PAINT_USE_UNIFIED_SIZE) {
+ U.sculpt_paint_unified_size *= factor;
+ }
+ else {
+ br->size *= factor;
+ }
+ }
+
+ return OPERATOR_FINISHED;
}
+void BRUSH_OT_scale_size(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Scale Brush Size";
+ ot->description= "Change brush size by a scalar";
+ ot->idname= "BRUSH_OT_scale_size";
+
+ /* api callbacks */
+ ot->exec= brush_scale_size_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_UNDO;
+
+ RNA_def_float(ot->srna, "scalar", 1, 0, 2, "Factor", "Factor to scale brush size by", 0, 2);
+}
+
static int vertex_color_set_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
@@ -113,6 +139,7 @@
{
/* brush */
WM_operatortype_append(BRUSH_OT_add);
+ WM_operatortype_append(BRUSH_OT_scale_size);
WM_operatortype_append(BRUSH_OT_curve_preset);
@@ -187,16 +214,14 @@
static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *path)
{
wmKeyMapItem *kmi;
-
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_scale_int", LEFTBRACKETKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_float_set(kmi->ptr, "value", 0.9);
-
- kmi= WM_keymap_add_item(keymap, "WM_OT_context_scale_int", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", path);
- RNA_float_set(kmi->ptr, "value", 10.0/9.0); // 1.1111....
-}
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_scale_size", LEFTBRACKETKEY, KM_PRESS, 0, 0);
+ RNA_float_set(kmi->ptr, "scalar", 0.9);
+
+ kmi= WM_keymap_add_item(keymap, "BRUSH_OT_scale_size", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
+ RNA_float_set(kmi->ptr, "scalar", 10.0/9.0); // 1.1111....
+}
+
void ED_keymap_paint(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c 2010-07-14 10:46:12 UTC (rev 30311)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c 2010-07-14 10:54:42 UTC (rev 30312)
@@ -3480,7 +3480,6 @@
Object *ob= CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
- Brush *brush = paint_brush(&sd->paint);
(void)unused;
@@ -3492,7 +3491,7 @@
/* Finished */
if(ss->cache) {
sculpt_stroke_modifiers_check(C, ss);
-
+
/* Alt-Smooth */
if (ss->cache->alt_smooth) {
Paint *p= &sd->paint;
More information about the Bf-blender-cvs
mailing list