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:
authorAntony Riakiotakis <kalast@gmail.com>2013-03-30 15:40:09 +0400
committerAntony Riakiotakis <kalast@gmail.com>2013-03-30 15:40:09 +0400
commitae1028df73dc4280b033a6c3230dbb9402b15a2f (patch)
treea26e8041370d56cee12d50b1fb30196273de0ed2
parentcd6d337d410fcef8d9ea9a06ae4f6cffc2942b84 (diff)
Tidy up stroke options and make them sexy, aka the paint option
sculptification commit. We have a drop menu to select the stroke mode now. Jitter controls appear under stroke panel under all modes (As they should! They stroke control options). Also enable jittering for all modes. I really fail to see why not.
-rw-r--r--release/scripts/startup/bl_ui/space_image.py66
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py79
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c12
-rw-r--r--source/blender/makesrna/intern/rna_brush.c15
4 files changed, 92 insertions, 80 deletions
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index f4896cb2648..488f2bddd90 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -697,13 +697,6 @@ class IMAGE_PT_paint(Panel, ImagePaintPanel):
self.prop_unified_strength(row, context, brush, "use_pressure_strength")
row = col.row(align=True)
- if(brush.use_relative_jitter):
- row.prop(brush, "use_relative_jitter", text="", icon='LOCKED')
- row.prop(brush, "jitter", slider=True)
- else:
- row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED')
- row.prop(brush, "jitter_absolute")
- row.prop(brush, "use_pressure_jitter", toggle=True, text="")
col.prop(brush, "blend", text="Blend")
@@ -728,6 +721,19 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel):
brush_texture_settings(col, brush, 0)
+ # use_texture_overlay and texture_overlay_alpha
+ col = layout.column(align=True)
+ col.active = brush.brush_capabilities.has_overlay
+ col.label(text="Overlay:")
+
+ row = col.row()
+ if brush.use_texture_overlay:
+ row.prop(brush, "use_texture_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
+ else:
+ row.prop(brush, "use_texture_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
+ sub = row.row()
+ sub.prop(brush, "texture_overlay_alpha", text="Alpha")
+
class IMAGE_PT_tools_mask_texture(BrushButtonsPanel, Panel):
bl_label = "Texture Mask"
@@ -782,28 +788,48 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel):
col = layout.column()
col.prop(toolsettings, "input_samples")
- col.prop(brush, "use_airbrush")
- row = col.row()
- row.active = brush.use_airbrush
- row.prop(brush, "rate", slider=True)
+ col = layout.column()
+
+ col.label(text="Stroke Method:")
+
+ col.prop(brush, "stroke_method", text="")
+
+ if brush.use_anchor:
+ col.separator()
+ col.prop(brush, "use_edge_to_edge", "Edge To Edge")
+ if brush.use_airbrush:
+ col.separator()
+ col.prop(brush, "rate", text="Rate", slider=True)
+
+ if brush.use_space:
+ col.separator()
+ row = col.row(align=True)
+ row.active = brush.use_space
+ row.prop(brush, "spacing", text="Spacing")
+ row.prop(brush, "use_pressure_spacing", toggle=True, text="")
+
+
+ col = layout.column()
col.separator()
col.prop(brush, "use_smooth_stroke")
- col = layout.column()
- col.active = brush.use_smooth_stroke
- col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
- col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
+ sub = col.column()
+ sub.active = brush.use_smooth_stroke
+ sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
+ sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
col.separator()
- col = layout.column()
- col.prop(brush, "use_space")
row = col.row(align=True)
- row.active = brush.use_space
- row.prop(brush, "spacing", text="Distance", slider=True)
- row.prop(brush, "use_pressure_spacing", toggle=True, text="")
+ if brush.use_relative_jitter:
+ row.prop(brush, "use_relative_jitter", text="", icon='LOCKED')
+ row.prop(brush, "jitter", slider=True)
+ else:
+ row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED')
+ row.prop(brush, "jitter_absolute")
+ row.prop(brush, "use_pressure_jitter", toggle=True, text="")
col.prop(brush, "use_wrap")
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 63c8365dd67..efeb4ff0f1c 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -681,13 +681,6 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
self.prop_unified_strength(row, context, brush, "use_pressure_strength")
row = col.row(align=True)
- if(brush.use_relative_jitter):
- row.prop(brush, "use_relative_jitter", text="", icon='LOCKED')
- row.prop(brush, "jitter", slider=True)
- else:
- row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED')
- row.prop(brush, "jitter_absolute")
- row.prop(brush, "use_pressure_jitter", toggle=True, text="")
col.prop(brush, "blend", text="Blend")
@@ -714,14 +707,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
self.prop_unified_strength(row, context, brush, "use_pressure_strength")
row = col.row(align=True)
- if(brush.use_relative_jitter):
- row.prop(brush, "use_relative_jitter", text="", icon='LOCKED')
- row.prop(brush, "jitter", slider=True)
- else:
- row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED')
- row.prop(brush, "jitter_absolute")
- row.prop(brush, "use_pressure_jitter", toggle=True, text="")
-
+
col.prop(brush, "vertex_tool", text="Blend")
# Vertex Paint Mode #
@@ -830,29 +816,32 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
settings = self.paint_settings(context)
brush = settings.brush
- image_paint = context.image_paint_object
col = layout.column()
+ col.label(text="Stroke Method:")
+
if context.sculpt_object:
- col.label(text="Stroke Method:")
+ col.prop(brush, "sculpt_stroke_method", text="")
+ else:
col.prop(brush, "stroke_method", text="")
- if brush.use_anchor:
- col.separator()
- col.prop(brush, "use_edge_to_edge", "Edge To Edge")
+ if brush.use_anchor:
+ col.separator()
+ col.prop(brush, "use_edge_to_edge", "Edge To Edge")
- if brush.use_airbrush:
- col.separator()
- col.prop(brush, "rate", text="Rate", slider=True)
+ if brush.use_airbrush:
+ col.separator()
+ col.prop(brush, "rate", text="Rate", slider=True)
- if brush.use_space:
- col.separator()
- row = col.row(align=True)
- row.active = brush.use_space
- row.prop(brush, "spacing", text="Spacing")
- row.prop(brush, "use_pressure_spacing", toggle=True, text="")
+ if brush.use_space:
+ col.separator()
+ row = col.row(align=True)
+ row.active = brush.use_space
+ row.prop(brush, "spacing", text="Spacing")
+ row.prop(brush, "use_pressure_spacing", toggle=True, text="")
+ if context.sculpt_object:
if brush.sculpt_capabilities.has_smooth_stroke:
col = layout.column()
col.separator()
@@ -868,40 +857,34 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
col.separator()
row = col.row(align=True)
- if(brush.use_relative_jitter):
+ if brush.use_relative_jitter:
row.prop(brush, "use_relative_jitter", text="", icon='LOCKED')
row.prop(brush, "jitter", slider=True)
else:
row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED')
row.prop(brush, "jitter_absolute")
row.prop(brush, "use_pressure_jitter", toggle=True, text="")
-
else:
- col.prop(brush, "use_airbrush")
-
- row = col.row()
- row.active = brush.use_airbrush and (not brush.use_space) and (not brush.use_anchor)
- row.prop(brush, "rate", slider=True)
-
+ col = layout.column()
col.separator()
col.prop(brush, "use_smooth_stroke")
- col = layout.column()
- col.active = brush.use_smooth_stroke
- col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
- col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
+ sub = col.column()
+ sub.active = brush.use_smooth_stroke
+ sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
+ sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
col.separator()
- col = layout.column()
- col.active = brush.brush_capabilities.has_spacing
- col.prop(brush, "use_space")
-
row = col.row(align=True)
- row.active = brush.use_space
- row.prop(brush, "spacing", text="Spacing")
- row.prop(brush, "use_pressure_spacing", toggle=True, text="")
+ if brush.use_relative_jitter:
+ row.prop(brush, "use_relative_jitter", text="", icon='LOCKED')
+ row.prop(brush, "jitter", slider=True)
+ else:
+ row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED')
+ row.prop(brush, "jitter_absolute")
+ row.prop(brush, "use_pressure_jitter", toggle=True, text="")
class VIEW3D_PT_tools_brush_curve(Panel, View3DPaintPanel):
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 83b144e314e..d5ece4830af 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -278,9 +278,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const wmEve
paint_brush_update(C, brush, mode, stroke, mouse_in, pressure);
- /* TODO: as sculpt and other paint modes are unified, this
- * separation will go away */
- if (paint_supports_jitter(mode)) {
+ {
float delta[2];
float factor = stroke->zoom_2d;
@@ -298,9 +296,6 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const wmEve
add_v2_v2v2(mouse_out, mouse_in, delta);
}
}
- else {
- copy_v2_v2(mouse_out, mouse_in);
- }
/* TODO: can remove the if statement once all modes have this */
if (stroke->get_location)
@@ -525,11 +520,6 @@ bool paint_supports_dynamic_tex_coords(Brush *br, PaintMode mode)
return true;
}
-bool paint_supports_jitter(PaintMode mode)
-{
- return ELEM3(mode, PAINT_SCULPT, PAINT_TEXTURE_PROJECTIVE, PAINT_TEXTURE_2D);
-}
-
#define PAINT_STROKE_MODAL_CANCEL 1
/* called in paint_ops.c, on each regeneration of keymaps */
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index de68c4d19d9..a1e057aed69 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -551,7 +551,7 @@ static void rna_def_brush(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
- static EnumPropertyItem brush_stroke_method_items[] = {
+ static EnumPropertyItem sculpt_stroke_method_items[] = {
{0, "DOTS", 0, "Dots", "Apply paint on each mouse move step"},
{BRUSH_RESTORE_MESH, "DRAG_DOT", 0, "Drag Dot", "Allows a single dot to be carefully positioned"},
{BRUSH_SPACE, "SPACE", 0, "Space", "Limit brush application to the distance specified by spacing"},
@@ -560,6 +560,13 @@ static void rna_def_brush(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
+ static EnumPropertyItem brush_stroke_method_items[] = {
+ {0, "DOTS", 0, "Dots", "Apply paint on each mouse move step"},
+ {BRUSH_SPACE, "SPACE", 0, "Space", "Limit brush application to the distance specified by spacing"},
+ {BRUSH_AIRBRUSH, "AIRBRUSH", 0, "Airbrush", "Keep applying paint effect while holding mouse (spray)"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
static EnumPropertyItem texture_angle_source_items[] = {
{0, "USER", 0, "User", "Rotate the brush texture by given angle"},
{BRUSH_RAKE, "RAKE", 0, "Rake", "Rotate the brush texture to match the stroke direction"},
@@ -628,6 +635,12 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Stroke Method", "");
RNA_def_property_update(prop, 0, "rna_Brush_update");
+ prop = RNA_def_property(srna, "sculpt_stroke_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, sculpt_stroke_method_items);
+ RNA_def_property_ui_text(prop, "Stroke Method", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
prop = RNA_def_property(srna, "texture_angle_source_random", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
RNA_def_property_enum_items(prop, texture_angle_source_items);