diff options
author | Matt Ebb <matt@mke3.net> | 2009-12-28 04:27:05 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2009-12-28 04:27:05 +0300 |
commit | 78aa9242066a7b4e7723c01a7a538ef8d033ae4b (patch) | |
tree | 3de1dda38588dd22b213b66dd7fd1730cef91fcb /source/blender/makesrna | |
parent | be55097353069b56a2726ebfe87bb2dd0a4b46a6 (diff) |
Change to the way brush/tool selection works, as discussed a while ago
Now, there are preset brushes made for each tool type (eg. for sculpt mode, Grab,
Draw, Inflate, etc), and the recommended method for changing sculpt tools is to
change between Brushes. The shortcut keys for changing between tools have
now been changed to change between named brushes - the G key in sculpt
mode now changes to any brush named 'Grab'.
The advantages of this are:
* Changing between brushes remembers the strength/size/texture etc settings for
each brush. This means that for example, you can draw with a strong textured
Clay brush, but then switch quickly to a weaker, untextured Smooth brush,
without having to re-do your settings each time.
* You can now add your own custom shortcut keys to your own custom brushes -
just add a keymap entry similar to the existing ones, that references your own
custom brush names.
To bring over these new default brushes to an existing B.blend setup, just
append them in from the new B.blend in svn.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 39 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 1 |
2 files changed, 40 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 13c3b15549b..4d17da668b2 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -29,6 +29,7 @@ #include "rna_internal.h" +#include "DNA_ID.h" #include "DNA_scene_types.h" #include "BKE_paint.h" @@ -159,6 +160,38 @@ static void rna_Paint_active_brush_index_range(PointerRNA *ptr, int *min, int *m *max= MAX2(p->brush_count-1, 0); } +static void rna_Paint_active_brush_name_get(PointerRNA *ptr, char *value) +{ + Paint *p= ptr->data; + Brush *br = paint_brush(p); + + BLI_strncpy(value, br->id.name+2, sizeof(br->id.name-2)); +} + + +static int rna_Paint_active_brush_name_length(PointerRNA *ptr) +{ + Paint *p= ptr->data; + Brush *br = paint_brush(p); + return strlen(br->id.name+2); +} + +static void rna_Paint_active_brush_name_set(PointerRNA *ptr, const char *value) +{ + Paint *p= ptr->data; + Brush *br; + int i; + + for(i = 0; i < p->brush_count; ++i) { + br = p->brushes[i]; + + if (strcmp(br->id.name+2, value)==0) { + paint_brush_set(p, br); + return; + } + } +} + #else static void rna_def_paint(BlenderRNA *brna) @@ -182,6 +215,12 @@ static void rna_def_paint(BlenderRNA *brna) RNA_def_property_int_funcs(prop, NULL, "rna_Paint_active_brush_index_set", "rna_Paint_active_brush_index_range"); RNA_def_property_range(prop, 0, INT_MAX); RNA_def_property_update(prop, NC_BRUSH|NA_EDITED, NULL); + + prop= RNA_def_property(srna, "active_brush_name", PROP_STRING, PROP_NONE); + RNA_def_property_string_funcs(prop, "rna_Paint_active_brush_name_get", "rna_Paint_active_brush_name_length", "rna_Paint_active_brush_name_set"); + RNA_def_property_string_maxlength(prop, sizeof(((ID*)NULL)->name)-2); + RNA_def_property_ui_text(prop, "Active Brush Name", ""); + RNA_def_property_update(prop, NC_BRUSH|NA_EDITED, NULL); /* Fake property to get active brush directly, rather than integer index */ prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 67383074497..9c4cc64fbb7 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -353,6 +353,7 @@ void RNA_api_ui_layout(StructRNA *srna) parm= RNA_def_string(func, "active_property", "", 0, "", "Identifier of property in data, for the active element."); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Number of rows to display.", 0, INT_MAX); + parm= RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Maximum number of rows to display.", 0, INT_MAX); parm= RNA_def_enum(func, "type", list_type_items, 0, "Type", "Type of list to use."); func= RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs"); |