From 6d1ac79514c34a5efcd3b03c376da624830a36b6 Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Mon, 27 Feb 2017 19:33:57 -0500 Subject: Cleanup: Grey --> Gray --- doc/python_api/rst/bge.texture.rst | 8 ++++---- intern/cycles/util/util_math.h | 2 +- release/scripts/freestyle/modules/freestyle/shaders.py | 4 ++-- source/gameengine/VideoTexture/FilterColor.cpp | 2 +- source/gameengine/VideoTexture/FilterColor.h | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/python_api/rst/bge.texture.rst b/doc/python_api/rst/bge.texture.rst index 49f6c4469a4..3028ee653f8 100644 --- a/doc/python_api/rst/bge.texture.rst +++ b/doc/python_api/rst/bge.texture.rst @@ -681,7 +681,7 @@ Image classes .. attribute:: zbuff - Use depth component of render as grey scale color - suitable for texture source. + Use depth component of render as grayscale color - suitable for texture source. :type: bool @@ -817,7 +817,7 @@ Image classes .. attribute:: zbuff - Use depth component of viewport as grey scale color - suitable for texture source. + Use depth component of viewport as grayscale color - suitable for texture source. :type: bool @@ -1260,8 +1260,8 @@ Filter classes .. class:: FilterGray - Filter for gray scale effect. - Proportions of R, G and B contributions in the output gray scale are 28:151:77. + Filter for grayscale effect. + Proportions of R, G and B contributions in the output grayscale are 28:151:77. .. attribute:: previous diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h index 2b81c8c498a..ae4b3d77f12 100644 --- a/intern/cycles/util/util_math.h +++ b/intern/cycles/util/util_math.h @@ -1329,7 +1329,7 @@ ccl_device_inline float3 safe_divide_even_color(float3 a, float3 b) y = (b.y != 0.0f)? a.y/b.y: 0.0f; z = (b.z != 0.0f)? a.z/b.z: 0.0f; - /* try to get grey even if b is zero */ + /* try to get gray even if b is zero */ if(b.x == 0.0f) { if(b.y == 0.0f) { x = z; diff --git a/release/scripts/freestyle/modules/freestyle/shaders.py b/release/scripts/freestyle/modules/freestyle/shaders.py index 633def38b5b..bce6642220b 100644 --- a/release/scripts/freestyle/modules/freestyle/shaders.py +++ b/release/scripts/freestyle/modules/freestyle/shaders.py @@ -568,7 +568,7 @@ class pyRandomColorShader(StrokeShader): class py2DCurvatureColorShader(StrokeShader): """ - Assigns a color (greyscale) to the stroke based on the curvature. + Assigns a color (grayscale) to the stroke based on the curvature. A higher curvature will yield a brighter color. """ def shade(self, stroke): @@ -584,7 +584,7 @@ class py2DCurvatureColorShader(StrokeShader): class pyTimeColorShader(StrokeShader): """ - Assigns a greyscale value that increases for every vertex. + Assigns a grayscale value that increases for every vertex. The brightness will increase along the stroke. """ def __init__(self, step=0.01): diff --git a/source/gameengine/VideoTexture/FilterColor.cpp b/source/gameengine/VideoTexture/FilterColor.cpp index eed84a8580c..15a7e9e4cd1 100644 --- a/source/gameengine/VideoTexture/FilterColor.cpp +++ b/source/gameengine/VideoTexture/FilterColor.cpp @@ -68,7 +68,7 @@ PyTypeObject FilterGrayType = 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ - "Filter for gray scale effect", /* tp_doc */ + "Filter for grayscale effect", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ diff --git a/source/gameengine/VideoTexture/FilterColor.h b/source/gameengine/VideoTexture/FilterColor.h index 350f7270874..d042863d7e8 100644 --- a/source/gameengine/VideoTexture/FilterColor.h +++ b/source/gameengine/VideoTexture/FilterColor.h @@ -36,7 +36,7 @@ #include "FilterBase.h" -/// pixel filter for gray scale +/// pixel filter for grayscale class FilterGray : public FilterBase { public: @@ -53,7 +53,7 @@ protected: // calculate gray value unsigned int gray = (28 * (VT_B(val)) + 151 * (VT_G(val)) + 77 * (VT_R(val))) >> 8; - // return gray scale value + // return grayscale value VT_R(val) = gray; VT_G(val) = gray; VT_B(val) = gray; -- cgit v1.2.3 From a581b6582297c923747b7cc37a814279dc108614 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 28 Feb 2017 12:39:40 +0100 Subject: Fix T49936: Cycles point density get's it's bounding box from basis shape key --- source/blender/render/intern/source/pointdensity.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index a03ea9cb896..fb047aad897 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -983,11 +983,12 @@ void RE_point_density_minmax( } else { float radius[3] = {pd->radius, pd->radius, pd->radius}; - float *loc, *size; + BoundBox *bb = BKE_object_boundbox_get(object); - if (BKE_object_obdata_texspace_get(pd->object, NULL, &loc, &size, NULL)) { - sub_v3_v3v3(r_min, loc, size); - add_v3_v3v3(r_max, loc, size); + if (bb != NULL) { + BLI_assert((bb->flag & BOUNDBOX_DIRTY) == 0); + copy_v3_v3(r_min, bb->vec[0]); + copy_v3_v3(r_max, bb->vec[6]); /* Adjust texture space to include density points on the boundaries. */ sub_v3_v3(r_min, radius); add_v3_v3(r_max, radius); -- cgit v1.2.3 From efe78d824e549a16d974a9df90ade6b74b6d6a7a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 28 Feb 2017 14:08:33 +0100 Subject: Fix/workaround T48549: Crash baking high-to-low-poly normal map in cycles For now only prevent crash. --- source/blender/editors/object/object_bake_api.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index 6b06e7b0a6c..968081818a2 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -352,12 +352,17 @@ static bool is_noncolor_pass(ScenePassType pass_type) } /* if all is good tag image and return true */ -static bool bake_object_check(Object *ob, ReportList *reports) +static bool bake_object_check(Scene *scene, Object *ob, ReportList *reports) { Image *image; void *lock; int i; + if ((ob->lay & scene->lay) == 0) { + BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not on a scene layer", ob->id.name + 2); + return false; + } + if (ob->type != OB_MESH) { BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not a mesh", ob->id.name + 2); return false; @@ -491,7 +496,7 @@ static bool bake_pass_filter_check(ScenePassType pass_type, const int pass_filte } /* before even getting in the bake function we check for some basic errors */ -static bool bake_objects_check(Main *bmain, Object *ob, ListBase *selected_objects, +static bool bake_objects_check(Main *bmain, Scene *scene, Object *ob, ListBase *selected_objects, ReportList *reports, const bool is_selected_to_active) { CollectionPointerLink *link; @@ -502,7 +507,7 @@ static bool bake_objects_check(Main *bmain, Object *ob, ListBase *selected_objec if (is_selected_to_active) { int tot_objects = 0; - if (!bake_object_check(ob, reports)) + if (!bake_object_check(scene, ob, reports)) return false; for (link = selected_objects->first; link; link = link->next) { @@ -530,7 +535,7 @@ static bool bake_objects_check(Main *bmain, Object *ob, ListBase *selected_objec } for (link = selected_objects->first; link; link = link->next) { - if (!bake_object_check(link->ptr.data, reports)) + if (!bake_object_check(scene, link->ptr.data, reports)) return false; } } @@ -1179,7 +1184,7 @@ static int bake_exec(bContext *C, wmOperator *op) goto finally; } - if (!bake_objects_check(bkr.main, bkr.ob, &bkr.selected_objects, bkr.reports, bkr.is_selected_to_active)) { + if (!bake_objects_check(bkr.main, bkr.scene, bkr.ob, &bkr.selected_objects, bkr.reports, bkr.is_selected_to_active)) { goto finally; } @@ -1237,7 +1242,7 @@ static void bake_startjob(void *bkv, short *UNUSED(stop), short *do_update, floa return; } - if (!bake_objects_check(bkr->main, bkr->ob, &bkr->selected_objects, bkr->reports, bkr->is_selected_to_active)) { + if (!bake_objects_check(bkr->main, bkr->scene, bkr->ob, &bkr->selected_objects, bkr->reports, bkr->is_selected_to_active)) { bkr->result = OPERATOR_CANCELLED; return; } -- cgit v1.2.3 From 87f236cd10d8a0bc03fa775114d51e8a6a82d3fe Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 28 Feb 2017 17:33:06 +0100 Subject: Cycles: Fix division by zero in volume code which was producing -nan --- intern/cycles/kernel/kernel_volume.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/kernel/kernel_volume.h b/intern/cycles/kernel/kernel_volume.h index c7cb29b5af2..10d0d185345 100644 --- a/intern/cycles/kernel/kernel_volume.h +++ b/intern/cycles/kernel/kernel_volume.h @@ -966,7 +966,7 @@ ccl_device VolumeIntegrateResult kernel_volume_decoupled_scatter( mis_weight = 2.0f*power_heuristic(pdf, distance_pdf); } } - if(sample_t < 1e-6f) { + if(sample_t < 1e-6f || pdf == 0.0f) { return VOLUME_PATH_SCATTERED; } -- cgit v1.2.3 From c1012c6c3a271746ee59a0d2ffc76b0d6f976352 Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Tue, 28 Feb 2017 11:59:18 -0500 Subject: Cleanup: update copyright and Blender description --- build_files/cmake/packaging.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build_files/cmake/packaging.cmake b/build_files/cmake/packaging.cmake index c7063ed6772..e8621bc457a 100644 --- a/build_files/cmake/packaging.cmake +++ b/build_files/cmake/packaging.cmake @@ -1,5 +1,7 @@ -set(PROJECT_DESCRIPTION "Blender is a very fast and versatile 3D modeller/renderer.") -set(PROJECT_COPYRIGHT "Copyright (C) 2001-2012 Blender Foundation") +string(TIMESTAMP CURRENT_YEAR "%Y") + +set(PROJECT_DESCRIPTION "Blender is the free and open source 3D creation suite software.") +set(PROJECT_COPYRIGHT "Copyright (C) 2001-${CURRENT_YEAR} Blender Foundation") set(PROJECT_CONTACT "foundation@blender.org") set(PROJECT_VENDOR "Blender Foundation") @@ -135,4 +137,3 @@ unset(MINOR_VERSION) unset(PATCH_VERSION) unset(BUILD_REV) - -- cgit v1.2.3 From 351c9239ed7cd62d2c6830bf815c2c9c59caa1c8 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 1 Mar 2017 12:01:19 +0100 Subject: Cleanup: Use explicit unsigned int in atomics --- intern/atomic/atomic_ops.h | 10 ++++----- intern/atomic/intern/atomic_ops_ext.h | 40 +++++++++++++++++------------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/intern/atomic/atomic_ops.h b/intern/atomic/atomic_ops.h index 1107deddf94..1e9528f9ed9 100644 --- a/intern/atomic/atomic_ops.h +++ b/intern/atomic/atomic_ops.h @@ -101,11 +101,11 @@ ATOMIC_INLINE size_t atomic_fetch_and_add_z(size_t *p, size_t x); ATOMIC_INLINE size_t atomic_fetch_and_sub_z(size_t *p, size_t x); ATOMIC_INLINE size_t atomic_cas_z(size_t *v, size_t old, size_t _new); -ATOMIC_INLINE unsigned atomic_add_and_fetch_u(unsigned *p, unsigned x); -ATOMIC_INLINE unsigned atomic_sub_and_fetch_u(unsigned *p, unsigned x); -ATOMIC_INLINE unsigned atomic_fetch_and_add_u(unsigned *p, unsigned x); -ATOMIC_INLINE unsigned atomic_fetch_and_sub_u(unsigned *p, unsigned x); -ATOMIC_INLINE unsigned atomic_cas_u(unsigned *v, unsigned old, unsigned _new); +ATOMIC_INLINE unsigned int atomic_add_and_fetch_u(unsigned int *p, unsigned int x); +ATOMIC_INLINE unsigned int atomic_sub_and_fetch_u(unsigned int *p, unsigned int x); +ATOMIC_INLINE unsigned int atomic_fetch_and_add_u(unsigned int *p, unsigned int x); +ATOMIC_INLINE unsigned int atomic_fetch_and_sub_u(unsigned int *p, unsigned int x); +ATOMIC_INLINE unsigned int atomic_cas_u(unsigned int *v, unsigned int old, unsigned int _new); /* WARNING! Float 'atomics' are really faked ones, those are actually closer to some kind of spinlock-sync'ed operation, * which means they are only efficient if collisions are highly unlikely (i.e. if probability of two threads diff --git a/intern/atomic/intern/atomic_ops_ext.h b/intern/atomic/intern/atomic_ops_ext.h index 8421aa72192..b72c94563fc 100644 --- a/intern/atomic/intern/atomic_ops_ext.h +++ b/intern/atomic/intern/atomic_ops_ext.h @@ -113,58 +113,58 @@ ATOMIC_INLINE size_t atomic_cas_z(size_t *v, size_t old, size_t _new) /******************************************************************************/ /* unsigned operations. */ -ATOMIC_INLINE unsigned atomic_add_and_fetch_u(unsigned *p, unsigned x) +ATOMIC_INLINE unsigned int atomic_add_and_fetch_u(unsigned int *p, unsigned int x) { - assert(sizeof(unsigned) == LG_SIZEOF_INT); + assert(sizeof(unsigned int) == LG_SIZEOF_INT); #if (LG_SIZEOF_INT == 8) - return (unsigned)atomic_add_and_fetch_uint64((uint64_t *)p, (uint64_t)x); + return (unsigned int)atomic_add_and_fetch_uint64((uint64_t *)p, (uint64_t)x); #elif (LG_SIZEOF_INT == 4) - return (unsigned)atomic_add_and_fetch_uint32((uint32_t *)p, (uint32_t)x); + return (unsigned int)atomic_add_and_fetch_uint32((uint32_t *)p, (uint32_t)x); #endif } -ATOMIC_INLINE unsigned atomic_sub_and_fetch_u(unsigned *p, unsigned x) +ATOMIC_INLINE unsigned int atomic_sub_and_fetch_u(unsigned int *p, unsigned int x) { - assert(sizeof(unsigned) == LG_SIZEOF_INT); + assert(sizeof(unsigned int) == LG_SIZEOF_INT); #if (LG_SIZEOF_INT == 8) - return (unsigned)atomic_add_and_fetch_uint64((uint64_t *)p, (uint64_t)-((int64_t)x)); + return (unsigned int)atomic_add_and_fetch_uint64((uint64_t *)p, (uint64_t)-((int64_t)x)); #elif (LG_SIZEOF_INT == 4) - return (unsigned)atomic_add_and_fetch_uint32((uint32_t *)p, (uint32_t)-((int32_t)x)); + return (unsigned int)atomic_add_and_fetch_uint32((uint32_t *)p, (uint32_t)-((int32_t)x)); #endif } -ATOMIC_INLINE unsigned atomic_fetch_and_add_u(unsigned *p, unsigned x) +ATOMIC_INLINE unsigned int atomic_fetch_and_add_u(unsigned int *p, unsigned int x) { - assert(sizeof(unsigned) == LG_SIZEOF_INT); + assert(sizeof(unsigned int) == LG_SIZEOF_INT); #if (LG_SIZEOF_INT == 8) - return (unsigned)atomic_fetch_and_add_uint64((uint64_t *)p, (uint64_t)x); + return (unsigned int)atomic_fetch_and_add_uint64((uint64_t *)p, (uint64_t)x); #elif (LG_SIZEOF_INT == 4) - return (unsigned)atomic_fetch_and_add_uint32((uint32_t *)p, (uint32_t)x); + return (unsigned int)atomic_fetch_and_add_uint32((uint32_t *)p, (uint32_t)x); #endif } -ATOMIC_INLINE unsigned atomic_fetch_and_sub_u(unsigned *p, unsigned x) +ATOMIC_INLINE unsigned int atomic_fetch_and_sub_u(unsigned int *p, unsigned int x) { - assert(sizeof(unsigned) == LG_SIZEOF_INT); + assert(sizeof(unsigned int) == LG_SIZEOF_INT); #if (LG_SIZEOF_INT == 8) - return (unsigned)atomic_fetch_and_add_uint64((uint64_t *)p, (uint64_t)-((int64_t)x)); + return (unsigned int)atomic_fetch_and_add_uint64((uint64_t *)p, (uint64_t)-((int64_t)x)); #elif (LG_SIZEOF_INT == 4) - return (unsigned)atomic_fetch_and_add_uint32((uint32_t *)p, (uint32_t)-((int32_t)x)); + return (unsigned int)atomic_fetch_and_add_uint32((uint32_t *)p, (uint32_t)-((int32_t)x)); #endif } -ATOMIC_INLINE unsigned atomic_cas_u(unsigned *v, unsigned old, unsigned _new) +ATOMIC_INLINE unsigned int atomic_cas_u(unsigned int *v, unsigned int old, unsigned int _new) { - assert(sizeof(unsigned) == LG_SIZEOF_INT); + assert(sizeof(unsigned int) == LG_SIZEOF_INT); #if (LG_SIZEOF_INT == 8) - return (unsigned)atomic_cas_uint64((uint64_t *)v, (uint64_t)old, (uint64_t)_new); + return (unsigned int)atomic_cas_uint64((uint64_t *)v, (uint64_t)old, (uint64_t)_new); #elif (LG_SIZEOF_INT == 4) - return (unsigned)atomic_cas_uint32((uint32_t *)v, (uint32_t)old, (uint32_t)_new); + return (unsigned int)atomic_cas_uint32((uint32_t *)v, (uint32_t)old, (uint32_t)_new); #endif } -- cgit v1.2.3 From f0cf15b5c68a1332707fe88985d21e238736ab40 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 1 Mar 2017 12:45:51 +0100 Subject: Task scheduler: Remove counter of done tasks This was only used for progress report, and it's wrong because: - Pool might in theory be re-used by different tasks - We should not make any decision based on scheduling stats Proper way is to take care of progress by the task itself. --- source/blender/blenlib/BLI_task.h | 3 --- source/blender/blenlib/intern/task.c | 8 -------- source/blender/render/CMakeLists.txt | 1 + source/blender/render/intern/source/volume_precache.c | 10 ++++++++-- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h index 967e0be6d0a..08b9629610d 100644 --- a/source/blender/blenlib/BLI_task.h +++ b/source/blender/blenlib/BLI_task.h @@ -113,9 +113,6 @@ void *BLI_task_pool_userdata(TaskPool *pool); /* optional mutex to use from run function */ ThreadMutex *BLI_task_pool_user_mutex(TaskPool *pool); -/* number of tasks done, for stats, don't use this to make decisions */ -size_t BLI_task_pool_tasks_done(TaskPool *pool); - /* Parallel for routines */ typedef void (*TaskParallelRangeFunc)(void *userdata, const int iter); typedef void (*TaskParallelRangeFuncEx)(void *userdata, void *userdata_chunk, const int iter, const int thread_id); diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c index fc2d9674c2f..c4761e9f7ef 100644 --- a/source/blender/blenlib/intern/task.c +++ b/source/blender/blenlib/intern/task.c @@ -106,7 +106,6 @@ struct TaskPool { TaskScheduler *scheduler; volatile size_t num; - volatile size_t done; size_t num_threads; size_t currently_running_tasks; ThreadMutex num_mutex; @@ -238,7 +237,6 @@ static void task_pool_num_decrease(TaskPool *pool, size_t done) pool->num -= done; atomic_sub_and_fetch_z(&pool->currently_running_tasks, done); - pool->done += done; if (pool->num == 0) BLI_condition_notify_all(&pool->num_cond); @@ -504,7 +502,6 @@ static TaskPool *task_pool_create_ex(TaskScheduler *scheduler, void *userdata, c pool->scheduler = scheduler; pool->num = 0; - pool->done = 0; pool->num_threads = 0; pool->currently_running_tasks = 0; pool->do_cancel = false; @@ -743,11 +740,6 @@ ThreadMutex *BLI_task_pool_user_mutex(TaskPool *pool) return &pool->user_mutex; } -size_t BLI_task_pool_tasks_done(TaskPool *pool) -{ - return pool->done; -} - /* Parallel range routines */ /** diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index 9e40ab02ee4..569b207c966 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -35,6 +35,7 @@ set(INC ../makesdna ../makesrna ../physics + ../../../intern/atomic ../../../intern/guardedalloc ../../../intern/mikktspace ../../../intern/smoke/extern diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index 5377d0eba00..752a9df0b79 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -60,6 +60,8 @@ #include "volumetric.h" #include "volume_precache.h" +#include "atomic_ops.h" + /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* defined in pipeline.c, is hardcopy of active dynamic allocated Render */ @@ -509,7 +511,8 @@ static void *vol_precache_part_test(void *data) */ typedef struct VolPrecacheState { double lasttime; - int totparts; + unsigned int doneparts; + unsigned int totparts; } VolPrecacheState; static void vol_precache_part(TaskPool * __restrict pool, void *taskdata, int UNUSED(threadid)) @@ -574,13 +577,15 @@ static void vol_precache_part(TaskPool * __restrict pool, void *taskdata, int UN } } + unsigned int doneparts = atomic_add_and_fetch_u(&state->doneparts, 1); + time = PIL_check_seconds_timer(); if (time - state->lasttime > 1.0) { ThreadMutex *mutex = BLI_task_pool_user_mutex(pool); if (BLI_mutex_trylock(mutex)) { char str[64]; - float ratio = (float)BLI_task_pool_tasks_done(pool)/(float)state->totparts; + float ratio = (float)doneparts/(float)state->totparts; BLI_snprintf(str, sizeof(str), IFACE_("Precaching volume: %d%%"), (int)(100.0f * ratio)); re->i.infostr = str; re->stats_draw(re->sdh, &re->i); @@ -631,6 +636,7 @@ static void precache_launch_parts(Render *re, RayObject *tree, ShadeInput *shi, /* setup task scheduler */ memset(&state, 0, sizeof(state)); + state.doneparts = 0; state.totparts = parts[0]*parts[1]*parts[2]; state.lasttime = PIL_check_seconds_timer(); -- cgit v1.2.3 From 32c5f3d77224d86aaf5adb5b7b7542c92a616406 Mon Sep 17 00:00:00 2001 From: raa Date: Wed, 1 Mar 2017 16:11:21 +0300 Subject: Fix text and icon positioning issues --- source/blender/editors/interface/interface_widgets.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index b3736a71e74..6e871b8ec92 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -873,15 +873,15 @@ static void widget_draw_icon( if (icon && icon != ICON_BLANK1) { float ofs = 1.0f / aspect; - if (but->drawflag & UI_BUT_ICON_LEFT) { + if (but->drawflag & UI_BUT_ICON_LEFT || ui_block_is_pie_menu(but->block)) { if (but->block->flag & UI_BLOCK_LOOP) { if (but->type == UI_BTYPE_SEARCH_MENU) xs = rect->xmin + 4.0f * ofs; else - xs = rect->xmin + ofs; + xs = rect->xmin + 2.0f * ofs; } else { - xs = rect->xmin + 4.0f * ofs; + xs = rect->xmin + 2.0f * ofs; } ys = (rect->ymin + rect->ymax - height) / 2.0f; } @@ -1554,11 +1554,11 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB /* Icons on the left with optional text label on the right */ else if (but->flag & UI_HAS_ICON || show_menu_icon) { const BIFIconID icon = (but->flag & UI_HAS_ICON) ? but->icon + but->iconadd : ICON_NONE; - const float icon_size = ICON_SIZE_FROM_BUTRECT(rect); + const float icon_size = ICON_DEFAULT_WIDTH; /* menu item - add some more padding so menus don't feel cramped. it must * be part of the button so that this area is still clickable */ - if (ui_block_is_menu(but->block)) + if (ui_block_is_menu(but->block) && !ui_block_is_pie_menu(but->block)) rect->xmin += 0.3f * U.widget_unit; widget_draw_icon(but, icon, alpha, rect, show_menu_icon); -- cgit v1.2.3 From 714e85b5344db7d9c9c7ac0a91cd0bb574c35353 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 2 Mar 2017 00:16:36 +1100 Subject: Cleanup: code-style, duplicate header --- source/blender/blenkernel/intern/appdir.c | 1 - source/blender/blenkernel/intern/tracking_stabilize.c | 7 ++++--- source/blender/editors/animation/anim_channels_defines.c | 3 ++- source/blender/editors/armature/armature_naming.c | 2 +- source/blender/editors/gpencil/gpencil_edit.c | 1 - source/blender/editors/render/render_opengl.c | 2 +- source/blender/editors/space_clip/tracking_ops.c | 6 ++++-- source/blender/editors/space_sequencer/sequencer_draw.c | 3 ++- source/blender/editors/space_view3d/drawvolume.c | 4 ++-- source/blender/makesrna/intern/rna_define.c | 3 ++- source/blender/makesrna/intern/rna_smoke.c | 4 ++-- source/blender/modifiers/intern/MOD_dynamicpaint.c | 2 +- source/blender/nodes/shader/nodes/node_shader_fresnel.c | 5 +++-- source/blender/nodes/shader/nodes/node_shader_layer_weight.c | 2 +- source/blender/nodes/shader/nodes/node_shader_tex_brick.c | 2 +- 15 files changed, 26 insertions(+), 21 deletions(-) diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c index 9236a1b5853..f2f0a92d8b3 100644 --- a/source/blender/blenkernel/intern/appdir.c +++ b/source/blender/blenkernel/intern/appdir.c @@ -755,7 +755,6 @@ static void where_is_temp(char *fullname, char *basename, const size_t maxlen, c void BKE_tempdir_init(char *userdir) { where_is_temp(btempdir_session, btempdir_base, FILE_MAX, userdir); -; } /** diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c b/source/blender/blenkernel/intern/tracking_stabilize.c index 36b24fbb2dc..722fc89a75f 100644 --- a/source/blender/blenkernel/intern/tracking_stabilize.c +++ b/source/blender/blenkernel/intern/tracking_stabilize.c @@ -1167,7 +1167,8 @@ static void stabilization_calculate_data(StabContext *ctx, if (ctx->stab->flag & TRACKING_STABILIZE_SCALE) { *r_scale = expf(scale_step * scaleinf); /* Averaged in log scale */ - } else { + } + else { *r_scale = 1.0f; } @@ -1180,8 +1181,8 @@ static void stabilization_calculate_data(StabContext *ctx, */ get_animated_target_pos(ctx, framenr, target_pos); sub_v2_v2(r_translation, target_pos); - *r_angle -= get_animated_target_rot(ctx,framenr); - target_scale = get_animated_target_scale(ctx,framenr); + *r_angle -= get_animated_target_rot(ctx, framenr); + target_scale = get_animated_target_scale(ctx, framenr); if (target_scale != 0.0f) { *r_scale /= target_scale; /* target_scale is an expected/intended reference zoom value */ diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 57302c18a88..4d4f8c1298a 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -3856,7 +3856,8 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float if (ac->sl) { if ((ac->spacetype == SPACE_IPO) && (acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE) || - acf->has_setting(ac, ale, ACHANNEL_SETTING_ALWAYS_VISIBLE))) { + acf->has_setting(ac, ale, ACHANNEL_SETTING_ALWAYS_VISIBLE))) + { /* for F-Curves, draw color-preview of curve behind checkbox */ if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) { FCurve *fcu = (FCurve *)ale->data; diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c index fa192ed6f36..c928508237d 100644 --- a/source/blender/editors/armature/armature_naming.c +++ b/source/blender/editors/armature/armature_naming.c @@ -362,7 +362,7 @@ static int armature_flip_names_exec(bContext *C, wmOperator *UNUSED(op)) arm = ob->data; - ListBase bones_names= {NULL}; + ListBase bones_names = {NULL}; CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) { diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index e118e490f25..fa9acc36a2b 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -74,7 +74,6 @@ #include "ED_object.h" #include "ED_screen.h" #include "ED_view3d.h" -#include "ED_screen.h" #include "ED_space_api.h" #include "gpencil_intern.h" diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 55c07140216..24e8af1c6ec 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -315,7 +315,7 @@ static void screen_opengl_render_doit(OGLRender *oglrender, RenderResult *rr) RE_render_result_rect_from_ibuf(rr, &scene->r, out, oglrender->view_id); IMB_freeImBuf(out); } - else if (gpd){ + else if (gpd) { /* If there are no strips, Grease Pencil still needs a buffer to draw on */ ImBuf *out = IMB_allocImBuf(oglrender->sizex, oglrender->sizey, 32, IB_rect); RE_render_result_rect_from_ibuf(rr, &scene->r, out, oglrender->view_id); diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index d28cbe5fb1d..169eb76399b 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1534,7 +1534,8 @@ static int join_tracks_exec(bContext *C, wmOperator *op) update_stabilization = true; if ((act_track->flag & TRACK_USE_2D_STAB) == 0) { act_track->flag |= TRACK_USE_2D_STAB; - } else { + } + else { stab->tot_track--; } BLI_assert(0 <= stab->tot_track); @@ -1543,7 +1544,8 @@ static int join_tracks_exec(bContext *C, wmOperator *op) update_stabilization = true; if ((act_track->flag & TRACK_USE_2D_STAB_ROT) == 0) { act_track->flag |= TRACK_USE_2D_STAB_ROT; - } else { + } + else { stab->tot_rot_track--; } BLI_assert(0 <= stab->tot_rot_track); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index e1768e4aedc..70a6e6d83cb 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -545,7 +545,8 @@ static void draw_seq_text(View2D *v2d, SpaceSeq *sseq, Sequence *seq, float x1, if ((sseq->flag & SEQ_ALL_WAVEFORMS) || (seq->flag & SEQ_AUDIO_DRAW_WAVEFORM)) { str[0] = 0; str_len = 0; - } else if (seq->sound) { + } + else if (seq->sound) { str_len = BLI_snprintf(str, sizeof(str), "%s: %s | %d", name, seq->sound->name, seq->len); } diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 27ecbf83db5..182dc214f8e 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -774,8 +774,8 @@ void draw_smoke_velocity(SmokeDomainSettings *domain, float viewnormal[3]) float min[3] = { domain->p0[0] - domain->cell_size[0] * domain->adapt_res, - domain->p0[1] - domain->cell_size[1] * domain->adapt_res, - domain->p0[2] - domain->cell_size[2] * domain->adapt_res, + domain->p0[1] - domain->cell_size[1] * domain->adapt_res, + domain->p0[2] - domain->cell_size[2] * domain->adapt_res, }; int num_points_v[3] = { diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index dc97d39052b..1d232d2df39 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -3157,8 +3157,9 @@ int rna_parameter_size(PropertyRNA *parm) StringPropertyRNA *sparm = (StringPropertyRNA *)parm; return sizeof(char) * sparm->maxlength; } - else + else { return sizeof(char *); + } case PROP_POINTER: { #ifdef RNA_RUNTIME diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 6db370fc152..c12937bd2bf 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -832,14 +832,14 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) {FLUID_FIELD_COLOR_R, "COLOR_R", 0, "Red", "Red component of the color field"}, {FLUID_FIELD_COLOR_G, "COLOR_G", 0, "Green", "Green component of the color field"}, {FLUID_FIELD_COLOR_B, "COLOR_B", 0, "Blue", "Blue component of the color field"}, - {FLUID_FIELD_DENSITY, "DENSITY", 0, "Density", "Quantity of soot in the fluid"}, + {FLUID_FIELD_DENSITY, "DENSITY", 0, "Density", "Quantity of soot in the fluid"}, {FLUID_FIELD_FLAME, "FLAME", 0, "Flame", "Flame field"}, {FLUID_FIELD_FUEL, "FUEL", 0, "Fuel", "Fuel field"}, {FLUID_FIELD_HEAT, "HEAT", 0, "Heat", "Temperature of the fluid"}, {FLUID_FIELD_VELOCITY_X, "VELOCITY_X", 0, "X Velocity", "X component of the velocity field"}, {FLUID_FIELD_VELOCITY_Y, "VELOCITY_Y", 0, "Y Velocity", "Y component of the velocity field"}, {FLUID_FIELD_VELOCITY_Z, "VELOCITY_Z", 0, "Z Velocity", "Z component of the velocity field"}, - {0, NULL, 0, NULL, NULL} + {0, NULL, 0, NULL, NULL} }; prop = RNA_def_property(srna, "coba_field", PROP_ENUM, PROP_NONE); diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c index 05068b9b597..bb75d655802 100644 --- a/source/blender/modifiers/intern/MOD_dynamicpaint.c +++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c @@ -116,7 +116,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, static bool is_brush_cb(Object *UNUSED(ob), ModifierData *pmd) { - return ((DynamicPaintModifierData*)pmd)->brush != NULL; + return ((DynamicPaintModifierData *)pmd)->brush != NULL; } static void updateDepgraph(ModifierData *md, DagForest *forest, diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.c b/source/blender/nodes/shader/nodes/node_shader_fresnel.c index d5e11795fc0..5a9e33a4053 100644 --- a/source/blender/nodes/shader/nodes/node_shader_fresnel.c +++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.c @@ -64,10 +64,11 @@ static void node_shader_exec_fresnel(void *data, int UNUSED(thread), bNode *UNUS copy_v3_v3(n, shi->vn); } - if(shi->use_world_space_shading) + if (shi->use_world_space_shading) { mul_mat3_m4_v3((float (*)[4])RE_render_current_get_matrix(RE_VIEW_MATRIX), n); + } - out[0]->vec[0] = RE_fresnel_dielectric(shi->view, n, shi->flippednor ? 1/eta : eta); + out[0]->vec[0] = RE_fresnel_dielectric(shi->view, n, shi->flippednor ? 1 / eta : eta); } /* node type definition */ diff --git a/source/blender/nodes/shader/nodes/node_shader_layer_weight.c b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c index 90e2625b961..a0b2408a7bb 100644 --- a/source/blender/nodes/shader/nodes/node_shader_layer_weight.c +++ b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c @@ -69,7 +69,7 @@ static void node_shader_exec_layer_weight(void *data, int UNUSED(thread), bNode if (shi->use_world_space_shading) mul_mat3_m4_v3((float (*)[4])RE_render_current_get_matrix(RE_VIEW_MATRIX), n); - out[0]->vec[0] = RE_fresnel_dielectric(shi->view, n, shi->flippednor ? eta : 1/eta); + out[0]->vec[0] = RE_fresnel_dielectric(shi->view, n, shi->flippednor ? eta : 1 / eta); float facing = fabs(dot_v3v3(shi->view, n)); if (blend != 0.5) { diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_brick.c b/source/blender/nodes/shader/nodes/node_shader_tex_brick.c index 0be47c4f751..1dfebc45d60 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_brick.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_brick.c @@ -64,7 +64,7 @@ static void node_shader_init_tex_brick(bNodeTree *UNUSED(ntree), bNode *node) for (bNodeSocket *sock = node->inputs.first; sock; sock = sock->next) { if (STREQ(sock->name, "Mortar Smooth")) { - ((bNodeSocketValueFloat*)sock->default_value)->value = 0.1f; + ((bNodeSocketValueFloat *)sock->default_value)->value = 0.1f; } } } -- cgit v1.2.3