diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-09-09 15:32:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-09-09 16:17:03 +0300 |
commit | f5e0dfe59c7e748907f955f848264751ed0967f0 (patch) | |
tree | a4bf4369b1076ffd7f449061f04d2813ce715a15 /source/blender/blenkernel/intern/screen.c | |
parent | e164afe9b5f98fe1ddb2ce063e1df9e9926cacfd (diff) |
DNA: initial DNA defaults support
This provides an API to access structs
with their members set to default values:
- DNA_struct_default_get(name)
- DNA_struct_default_alloc(name)
Currently this is only used for scene & view shading initialization,
eventually it can be used for RNA defaults and initializing
DNA struct members on file reading.
Diffstat (limited to 'source/blender/blenkernel/intern/screen.c')
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 9f049b61b5a..1835fb2a523 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -36,6 +36,7 @@ #include "DNA_space_types.h" #include "DNA_view3d_types.h" #include "DNA_workspace_types.h" +#include "DNA_defaults.h" #include "BLI_math_vector.h" #include "BLI_listbase.h" @@ -852,24 +853,8 @@ void BKE_screen_view3d_scene_sync(bScreen *sc, Scene *scene) void BKE_screen_view3d_shading_init(View3DShading *shading) { - memset(shading, 0, sizeof(*shading)); - - shading->type = OB_SOLID; - shading->prev_type = OB_SOLID; - shading->flag = V3D_SHADING_SPECULAR_HIGHLIGHT | V3D_SHADING_XRAY_WIREFRAME | - V3D_SHADING_SCENE_LIGHTS_RENDER | V3D_SHADING_SCENE_WORLD_RENDER; - shading->light = V3D_LIGHTING_STUDIO; - shading->shadow_intensity = 0.5f; - shading->xray_alpha = 0.5f; - shading->xray_alpha_wire = 0.0f; - shading->cavity_valley_factor = 1.0f; - shading->cavity_ridge_factor = 1.0f; - shading->cavity_type = V3D_SHADING_CAVITY_CURVATURE; - shading->curvature_ridge_factor = 1.0f; - shading->curvature_valley_factor = 1.0f; - copy_v3_fl(shading->single_color, 0.8f); - copy_v3_fl(shading->background_color, 0.05f); - shading->studiolight_intensity = 1.0f; + const View3DShading *shading_default = DNA_struct_default_get(View3DShading); + memcpy(shading, shading_default, sizeof(*shading)); } /* magic zoom calculation, no idea what |