diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2011-05-12 05:57:47 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2011-05-12 05:57:47 +0400 |
commit | 910220be47729d6effffb7aa33bfe05d4caa5d3d (patch) | |
tree | ecc0d3c6c5073aee112ed5946ec7882ee4bfe236 /source/blender/makesrna/intern/rna_space.c | |
parent | 040f65f6c29a8d5b624d4dd5b3083d8519d4a8c1 (diff) |
== Radial control ==
Patch to make the radial control more generic with RNA. Patch was
reviewed here: http://codereview.appspot.com/4280080/
Prior to this update, the radial control code in trunk had generic
parts of the radial control implemented as an incomplete operator
within WM. Then each different user of the radial control had to
implement a separate operator to actually pass in specific brush data
-- e.g. sculpt's brush size, vpaint's brush size, etc.
This patch removes all the extra operators and makes the WM operator
do everything. It now takes several RNA path strings as its properties
-- the only required property is data_path, which specifies the data
to be modified by the radial control. The other paths affect display
in various ways, e.g. rotation, color, etc.
In addition to decreasing some duplicate paint brush code, these
updates make it pretty easy to enable radial control for other
purposes (and it can be set up entirely though python or keymaps, no
extra C code needed.)
Diffstat (limited to 'source/blender/makesrna/intern/rna_space.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 59824d6a752..5281e152d54 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -508,6 +508,27 @@ static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *C, P return item; } +static void rna_SpaceImageEditor_zoom_get(PointerRNA *ptr, float *values) +{ + SpaceImage *sima= (SpaceImage*)ptr->data; + ScrArea *sa; + ARegion *ar; + + values[0] = values[1] = 1; + + sa = rna_area_from_space(ptr); + if(!sa) return; + + /* find aregion */ + for(ar=sa->regionbase.first; ar; ar=ar->next) { + if(ar->regiontype == RGN_TYPE_WINDOW) + break; + } + if(!ar) return; + + ED_space_image_zoom(sima, ar, &values[0], &values[1]); +} + static void rna_SpaceImageEditor_cursor_location_get(PointerRNA *ptr, float *values) { SpaceImage *sima= (SpaceImage*)ptr->data; @@ -1556,6 +1577,12 @@ static void rna_def_space_image(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "sample_line_hist"); RNA_def_property_struct_type(prop, "Histogram"); RNA_def_property_ui_text(prop, "Line sample", "Sampled colors along line"); + + prop= RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE); + RNA_def_property_array(prop, 2); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_zoom_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Zoom", "Zoom factor"); /* image draw */ prop= RNA_def_property(srna, "show_repeat", PROP_BOOLEAN, PROP_NONE); |