diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-03-29 16:36:01 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-03-29 16:36:01 +0300 |
commit | 11130970c6a3ff14cb4dd0caece2137891b43e87 (patch) | |
tree | b21d79b38e4ee28ed9762973e8ea1cc604dcfd1b /source | |
parent | f6ad53804099802ab3f5eafa830f95f8545eb888 (diff) | |
parent | ca5f3dd2200725712a665705fc25e20a208d6295 (diff) |
Merge commit 'origin/master^' into blender2.8
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/BLI_array_utils.h | 12 | ||||
-rw-r--r-- | source/blender/blenlib/intern/array_utils.c | 17 | ||||
-rw-r--r-- | source/blender/collada/AnimationImporter.cpp | 19 | ||||
-rw-r--r-- | source/blender/collada/AnimationImporter.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene_api.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 2 |
6 files changed, 42 insertions, 12 deletions
diff --git a/source/blender/blenlib/BLI_array_utils.h b/source/blender/blenlib/BLI_array_utils.h index a46c87cec40..9a510bcfc3b 100644 --- a/source/blender/blenlib/BLI_array_utils.h +++ b/source/blender/blenlib/BLI_array_utils.h @@ -74,10 +74,18 @@ bool _bli_array_iter_span( bool use_wrap, bool use_delimit_bounds, bool (*test_fn)(const void *arr_item, void *user_data), void *user_data, unsigned int span_step[2], unsigned int *r_span_len); -#define BLI_array_iter_span(arr, arr_len, use_wrap, use_delimit_bounds, test_fn, user_data, \ - span_step, r_span_len) \ +#define BLI_array_iter_span( \ + arr, arr_len, use_wrap, use_delimit_bounds, test_fn, user_data, \ + span_step, r_span_len) \ _bli_array_iter_span( \ arr, arr_len, sizeof(*(arr)), use_wrap, use_delimit_bounds, test_fn, user_data, \ span_step, r_span_len) +bool _bli_array_is_zeroed( + const void *arr, + unsigned int arr_len, size_t arr_stride); +#define BLI_array_is_zeroed(arr, arr_len) \ + _bli_array_is_zeroed( \ + arr, arr_len, sizeof(*(arr))) + #endif /* __BLI_ARRAY_UTILS_H__ */ diff --git a/source/blender/blenlib/intern/array_utils.c b/source/blender/blenlib/intern/array_utils.c index 32f0111babd..7b2d35a763c 100644 --- a/source/blender/blenlib/intern/array_utils.c +++ b/source/blender/blenlib/intern/array_utils.c @@ -308,3 +308,20 @@ bool _bli_array_iter_span( return false; } + +/** + * Simple utility to check memory is zeroed. + */ +bool _bli_array_is_zeroed( + const void *arr_v, + unsigned int arr_len, size_t arr_stride) +{ + const char *arr_step = (const char *)arr_v; + size_t i = arr_stride * arr_len; + while (i--) { + if (*(arr_step++)) { + return false; + } + } + return true; +} diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index ee3fddbf5b7..31dd7d5de46 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -109,7 +109,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) fcu->flag = (FCURVE_VISIBLE | FCURVE_AUTO_HANDLES | FCURVE_SELECTED); // fcu->rna_path = BLI_strdupn(path, strlen(path)); fcu->array_index = 0; - fcu->totvert = curve->getKeyCount(); + //fcu->totvert = curve->getKeyCount(); // create beztriple for each key for (unsigned int j = 0; j < curve->getKeyCount(); j++) { @@ -669,6 +669,13 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list } +float AnimationImporter::convert_to_focal_length(float in_xfov, int fov_type, float aspect, float sensorx) +{ + // NOTE: Needs more testing (As we curretnly have no official test data for this) + float xfov = (fov_type == CAMERA_YFOV) ? (2.0f * atanf(aspect * tanf(DEG2RADF(in_xfov) * 0.5f))) : DEG2RADF(in_xfov); + return fov_to_focallength(xfov, sensorx); +} + /* * Lens animations must be stored in COLLADA by using FOV, * while blender internally uses focal length. @@ -698,13 +705,9 @@ void AnimationImporter::Assign_lens_animations(const COLLADAFW::UniqueId& listid FCurve *fcu = *iter; for (unsigned int i = 0; i < fcu->totvert; i++) { - - double input_fov = fcu->bezt[i].vec[1][1]; - - // NOTE: Needs more testing (As we curretnly have no official test data for this) - double xfov = (fov_type == CAMERA_YFOV) ? (2.0f * atanf(aspect * tanf(DEG2RADF(input_fov) * 0.5f))) : DEG2RADF(input_fov); - - fcu->bezt[i].vec[1][1] = fov_to_focallength(xfov, cam->sensor_x); + fcu->bezt[i].vec[0][1] = convert_to_focal_length(fcu->bezt[i].vec[0][1], fov_type, aspect, cam->sensor_x); + fcu->bezt[i].vec[1][1] = convert_to_focal_length(fcu->bezt[i].vec[1][1], fov_type, aspect, cam->sensor_x); + fcu->bezt[i].vec[2][1] = convert_to_focal_length(fcu->bezt[i].vec[2][1], fov_type, aspect, cam->sensor_x); } BLI_addtail(AnimCurves, fcu); diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index 7dc4131dd69..1f2de2f3162 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -202,6 +202,8 @@ public: // gives a world-space mat, end's mat not included bool calc_joint_parent_mat_rest(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end); + float convert_to_focal_length(float in_xfov, int fov_type, float aspect, float sensorx); + #ifdef ARMATURE_TEST Object *get_joint_object(COLLADAFW::Node *root, COLLADAFW::Node *node, Object *par_job); #endif diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 212578cf3f0..cb3c2078cfe 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -366,7 +366,7 @@ void RNA_api_scene(StructRNA *srna) RNA_def_float(func, "shutter_close", 1.0f, -1.0f, 1.0f, "Shutter close", "", -1.0f, 1.0f); RNA_def_boolean(func, "selected_only" , 0, "Selected only", "Export only selected objects"); RNA_def_boolean(func, "uvs" , 1, "UVs", "Export UVs"); - RNA_def_boolean(func, "normals" , 1, "Normals", "Export cormals"); + RNA_def_boolean(func, "normals" , 1, "Normals", "Export normals"); RNA_def_boolean(func, "vcolors" , 0, "Vertex colors", "Export vertex colors"); RNA_def_boolean(func, "apply_subdiv" , 1, "Subsurfs as meshes", "Export subdivision surfaces as meshes"); RNA_def_boolean(func, "flatten" , 0, "Flatten hierarchy", "Flatten hierarchy"); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 84a4c3786e6..2ed16dd20db 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -385,7 +385,7 @@ static uiBlock *block_create_confirm_quit(struct bContext *C, struct ARegion *ar UI_block_emboss_set(block, UI_EMBOSS); uiLayout *layout = UI_block_layout( - block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, U.pixelsize * 480, U.pixelsize * 110, 0, style); + block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, U.widget_unit * 24, U.widget_unit * 6, 0, style); /* Text and some vertical space */ { |