diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-10-19 16:53:03 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-10-19 16:53:03 +0400 |
commit | a75f11d03678b094d608382c50d0bb299c53ed1c (patch) | |
tree | c7b30eb780bfe1203fd36419a9d58e8b4cba085b /source/blender/makesrna | |
parent | 3a41ab73ff4e480fe5b86c2845f0fb4f9df113d7 (diff) |
Fix #32219: Inconsistent influence of Units Scale on new objects
Made it so meshes, curves, surfaces and metaballs are scaling to a grid cell size,
which makes them behave consistently now.
There're still issues to be resolved still:
- Lattice is not scaled to grid cell size yet, it uses slightly different add
function which makes scaling a bit tricky and hacky. Would prefer to do a
bit bigger refactor here, so it's a TODO for now.
- Cameras, speakers and other helpers are not scaling. They don't have data
on which scale could be applied and perhaps it should be some kind of draw
scale. Also would consider it's a TODO for now.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 13aa5557964..51fb9d413da 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -336,6 +336,15 @@ static void rna_View3D_CursorLocation_set(PointerRNA *ptr, const float *values) copy_v3_v3(cursor, values); } +static float rna_View3D_GridScaleUnit_get(PointerRNA *ptr) +{ + View3D *v3d = (View3D *)(ptr->data); + bScreen *sc = (bScreen *)ptr->id.data; + Scene *scene = (Scene *)sc->scene; + + return ED_view3d_grid_scale(scene, v3d, NULL); +} + static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const int *values) { View3D *v3d = (View3D *)(ptr->data); @@ -1603,7 +1612,12 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_range(prop, 1, 1024); RNA_def_property_int_default(prop, 10); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - + + prop = RNA_def_property(srna, "grid_scale_unit", PROP_FLOAT, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_float_funcs(prop, "rna_View3D_GridScaleUnit_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Grid Scale Unit", "Grid cell size scaled by scene unit system settings"); + prop = RNA_def_property(srna, "show_floor", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_FLOOR); RNA_def_property_ui_text(prop, "Display Grid Floor", "Show the ground plane grid in perspective view"); |