[Bf-blender-cvs] [f095fbc] gooseberry: New option for the particle Add brush: `use_add_stroke` to toggle between stroke and single-add mode.
Lukas Tönne
noreply at git.blender.org
Fri Jan 30 15:17:58 CET 2015
Commit: f095fbc6beee7738f78ef993e1b44d0aafe52556
Author: Lukas Tönne
Date: Fri Jan 30 15:15:35 2015 +0100
Branches: gooseberry
https://developer.blender.org/rBf095fbc6beee7738f78ef993e1b44d0aafe52556
New option for the particle Add brush: `use_add_stroke` to toggle
between stroke and single-add mode.
This was requested especially for use with tablets. With a pen it is
difficult to set a precise point and the tool ends up making multiple
hairs close together all the time. Disabling the stroke option helps
adding individual hairs.
===================================================================
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/editors/physics/particle_edit.c
M source/blender/makesdna/DNA_scene_types.h
M source/blender/makesrna/intern/rna_sculpt_paint.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 18a38c8..ca5a9cf 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -881,7 +881,11 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
col.prop(brush, "count")
col = layout.column()
col.prop(settings, "use_default_interpolate")
- col.prop(brush, "steps", slider=True)
+ row = col.row()
+ row.prop(brush, "use_add_stroke", text="Stroke")
+ sub = row.row()
+ sub.active = brush.use_add_stroke
+ sub.prop(brush, "steps", slider=True)
col.prop(settings, "default_key_count", slider=True)
elif tool == 'LENGTH':
layout.prop(brush, "length_mode", expand=True)
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 5bae6e5..201252f 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -3705,6 +3705,7 @@ typedef struct BrushEdit {
int first;
int lastmouse[2];
float zfac;
+ bool done;
/* optional cached view settings to avoid setting on every mousemove */
PEData data;
@@ -3730,6 +3731,7 @@ static int brush_edit_init(bContext *C, wmOperator *op)
bedit= MEM_callocN(sizeof(BrushEdit), "BrushEdit");
bedit->first= 1;
+ bedit->done = false;
op->customdata= bedit;
bedit->scene= scene;
@@ -3885,13 +3887,16 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
}
case PE_BRUSH_ADD:
{
- if (edit->psys && edit->psys->part->from==PART_FROM_FACE) {
+ bool done = (brush->flag & PE_BRUSH_DATA_ADD_SINGLE) && bedit->done;
+ if (!done && edit->psys && edit->psys->part->from==PART_FROM_FACE) {
data.mval= mval;
added= brush_add(&data, brush->count);
if (pset->flag & PE_KEEP_LENGTHS)
recalc_lengths(edit);
+
+ bedit->done = true;
}
else
added= 0;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index de95f53..26ba31b 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1824,6 +1824,7 @@ typedef enum eGPencil_Source_3D {
/* ParticleBrushData->flag */
#define PE_BRUSH_DATA_PUFF_VOLUME 1
+#define PE_BRUSH_DATA_ADD_SINGLE 2
/* tooksettings->particle edittype */
#define PE_TYPE_PARTICLES 0
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 0a282ee..11fbefb 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -935,6 +935,10 @@ static void rna_def_particle_edit(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Puff Volume",
"Apply puff to unselected end-points (helps maintain hair volume when puffing root)");
+ prop = RNA_def_property(srna, "use_add_stroke", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PE_BRUSH_DATA_ADD_SINGLE);
+ RNA_def_property_ui_text(prop, "Add Stroke", "Add multiple particles per brush stroke");
+
prop = RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "invert");
RNA_def_property_enum_items(prop, length_mode);
More information about the Bf-blender-cvs
mailing list