diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-04-30 11:45:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-30 11:59:35 +0300 |
commit | aa4c97faa3666a9417782e598464d0ad2f66dee5 (patch) | |
tree | a18ff2ac7dc48f10c51f78bb8ed6843aff57bb39 /source/blender/makesrna | |
parent | 1721d47106aec81406a2714816b202c2a89a9467 (diff) |
View3D: expose size as a distance in units
also note that size/rotation doesn't work for camera views. see T44511
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index eade210f90d..4f54a6f07dc 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1348,6 +1348,19 @@ static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value) bgpic->blend = 1.0f - value; } +/* radius internally (expose as a distance value) */ +static float rna_BackgroundImage_size_get(PointerRNA *ptr) +{ + BGpic *bgpic = ptr->data; + return bgpic->size * 2.0f; +} + +static void rna_BackgroundImage_size_set(PointerRNA *ptr, float value) +{ + BGpic *bgpic = ptr->data; + bgpic->size = value * 0.5f; +} + static BGpic *rna_BackgroundImage_new(View3D *v3d) { BGpic *bgpic = ED_view3D_background_image_new(v3d); @@ -2108,15 +2121,16 @@ static void rna_def_background_image(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically from the world origin"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "size"); - RNA_def_property_ui_text(prop, "Size", "Scaling factor for the background image"); + RNA_def_property_float_funcs(prop, "rna_BackgroundImage_size_get", "rna_BackgroundImage_size_set", NULL); + RNA_def_property_ui_text(prop, "Size", "Size of the background image (ortho view only)"); RNA_def_property_range(prop, 0.0, FLT_MAX); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER); RNA_def_property_float_sdna(prop, NULL, "rotation"); - RNA_def_property_ui_text(prop, "Rotation", "Rotation for the background image"); + RNA_def_property_ui_text(prop, "Rotation", "Rotation for the background image (ortho view only)"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "use_flip_x", PROP_BOOLEAN, PROP_NONE); |