From 29859d0d5e6c0365fc86570fc235120314c6a9a4 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 23 Feb 2017 22:31:21 +0100 Subject: [PATCH 01/13] Fix some more minor issue with updated py doc generation. --- doc/python_api/sphinx_doc_update.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/python_api/sphinx_doc_update.py b/doc/python_api/sphinx_doc_update.py index 884ddeecffb..561e58dec66 100755 --- a/doc/python_api/sphinx_doc_update.py +++ b/doc/python_api/sphinx_doc_update.py @@ -98,6 +98,7 @@ def main(): blenver = blenver_zip = "" api_name = "" + branch = "" is_release = False # I) Update local mirror using rsync. @@ -119,6 +120,7 @@ def main(): " is_release = bpy.app.version_cycle in {'rc', 'release'}\n" " branch = bpy.app.build_branch.split()[0].decode()\n" " f.write('%d\\n' % is_release)\n" + " f.write('%s\\n' % branch)\n" " f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n" " if is_release else '%s\\n' % branch)\n" " f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n" @@ -127,7 +129,7 @@ def main(): "--python-expr", getver_script, "--", getver_file) subprocess.run(get_ver_cmd) with open(getver_file) as f: - is_release, blenver, blenver_zip = f.read().split("\n") + is_release, branch, blenver, blenver_zip = f.read().split("\n") is_release = bool(int(is_release)) os.remove(getver_file) @@ -166,7 +168,7 @@ def main(): with open(os.path.join(args.mirror_dir, "250PythonDoc/index.html"), 'w') as f: f.write("Redirecting...Redirecting..." % api_name) - else: + elif branch == "master": with open(os.path.join(args.mirror_dir, "blender_python_api/index.html"), 'w') as f: f.write("Redirecting...Redirecting..." % api_name) From 4c164487bc15854834577f2867623a83db75ed60 Mon Sep 17 00:00:00 2001 From: Luca Rood Date: Thu, 23 Feb 2017 19:00:03 -0300 Subject: [PATCH 02/13] Add "Gravitation" option to "Force" type force fields This adds an option to force fields of type "Force", which enables the simulation of gravitational behavior (dist^-2 falloff). Patch by @AndreasE Reviewers: #physics, LucaRood, mont29 Reviewed By: #physics, LucaRood, mont29 Tags: #physics Differential Revision: https://developer.blender.org/D2389 --- .../scripts/startup/bl_ui/properties_physics_common.py | 2 ++ source/blender/blenkernel/intern/effect.c | 8 ++++++++ source/blender/makesdna/DNA_object_force.h | 1 + source/blender/makesrna/intern/rna_object_force.c | 7 ++++++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index 277b59d187d..4478c6a4379 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -274,6 +274,8 @@ def basic_force_field_settings_ui(self, context, field): col.prop(field, "use_global_coords", text="Global") elif field.type == 'HARMONIC': col.prop(field, "use_multiple_springs") + if field.type == 'FORCE': + col.prop(field, "use_gravity_falloff", text="Gravitation") split = layout.split() diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index fe8f5ebdca6..4eee24b378f 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -848,6 +848,14 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected break; case PFIELD_FORCE: normalize_v3(force); + if (pd->flag & PFIELD_GRAVITATION){ /* Option: Multiply by 1/distance^2 */ + if (efd->distance < FLT_EPSILON){ + strength = 0.0f; + } + else { + strength *= powf(efd->distance, -2.0f); + } + } mul_v3_fl(force, strength * efd->falloff); break; case PFIELD_VORTEX: diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h index 59acefeffe4..ed14c4b9311 100644 --- a/source/blender/makesdna/DNA_object_force.h +++ b/source/blender/makesdna/DNA_object_force.h @@ -372,6 +372,7 @@ typedef struct SoftBody { #define PFIELD_DO_ROTATION (1<<15) #define PFIELD_GUIDE_PATH_WEIGHT (1<<16) /* apply curve weights */ #define PFIELD_SMOKE_DENSITY (1<<17) /* multiply smoke force by density */ +#define PFIELD_GRAVITATION (1<<18) /* used for (simple) force */ /* pd->falloff */ #define PFIELD_FALL_SPHERE 0 diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 1d89f7535c4..514fca1b011 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -1275,7 +1275,7 @@ static void rna_def_field(BlenderRNA *brna) prop = RNA_def_property(srna, "falloff_power", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_power"); RNA_def_property_range(prop, 0.0f, 10.0f); - RNA_def_property_ui_text(prop, "Falloff Power", "Falloff power (real gravitational falloff = 2)"); + RNA_def_property_ui_text(prop, "Falloff Power", ""); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_NONE); @@ -1394,6 +1394,11 @@ static void rna_def_field(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_SMOKE_DENSITY); RNA_def_property_ui_text(prop, "Apply Density", "Adjust force strength based on smoke density"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); + prop = RNA_def_property(srna, "use_gravity_falloff", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GRAVITATION); + RNA_def_property_ui_text(prop, "Gravity Falloff", "Multiply force by 1/distance²"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); + /* Pointer */ From f49e28bae71b7efa08df0fe6900595046fa31814 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 24 Feb 2017 14:25:11 +0100 Subject: [PATCH 03/13] Cycles: Fix non-zero exit status when rendering animation from CLI and running out of memory --- source/creator/creator_args.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index 77ca055dcea..3c01c0c4476 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -1407,10 +1407,11 @@ static int arg_handle_render_animation(int UNUSED(argc), const char **UNUSED(arg Render *re = RE_NewRender(scene->id.name); ReportList reports; BLI_begin_threaded_malloc(); - BKE_reports_init(&reports, RPT_PRINT); + BKE_reports_init(&reports, RPT_STORE); RE_SetReports(re, &reports); RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, scene->r.sfra, scene->r.efra, scene->r.frame_step); RE_SetReports(re, NULL); + BKE_reports_clear(&reports); BLI_end_threaded_malloc(); } else { From 1e29286c8c98aedcb01ef66378ca10c49f354e50 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 24 Feb 2017 14:33:10 +0100 Subject: [PATCH 04/13] Cycles: Fix compilation warning with CUDA on OSX --- intern/cycles/util/util_static_assert.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/intern/cycles/util/util_static_assert.h b/intern/cycles/util/util_static_assert.h index 033d85e8ec6..e90049254de 100644 --- a/intern/cycles/util/util_static_assert.h +++ b/intern/cycles/util/util_static_assert.h @@ -43,7 +43,9 @@ template <> class StaticAssertFailure {}; # endif /* __COUNTER__ */ # endif /* C++11 or MSVC2015 */ #else /* __KERNEL_GPU__ */ -# define static_assert(statement, message) +# ifndef static_assert +# define static_assert(statement, message) +# endif #endif /* __KERNEL_GPU__ */ /* TODO(sergey): For until C++11 is a bare minimum for us, From 9062c086b481ee9f1307f6e2688d822a1166d805 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 24 Feb 2017 14:56:50 +0100 Subject: [PATCH 05/13] Fix T50676: Crash on closing while frameserver rendering. Can't see any reason to call AUD exit early in WM_exit, that's a low-level module that has no dependency on anything else in Blender, but is dependency of some other parts of Blender, so it should rather be exited late in the process! --- source/blender/windowmanager/intern/wm_init_exit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index c11c398c616..4b2369a1a7c 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -444,8 +444,6 @@ void WM_exit_ext(bContext *C, const bool do_python) { wmWindowManager *wm = C ? CTX_wm_manager(C) : NULL; - BKE_sound_exit(); - /* first wrap up running stuff, we assume only the active WM is running */ /* modal handlers are on window level freed, others too? */ /* note; same code copied in wm_files.c */ @@ -591,6 +589,10 @@ void WM_exit_ext(bContext *C, const bool do_python) BLI_threadapi_exit(); + /* No need to call this early, rather do it late so that other pieces of Blender using sound may exit cleanly, + * see also T50676. */ + BKE_sound_exit(); + BKE_blender_atexit(); if (MEM_get_memory_blocks_in_use() != 0) { From caaf5f0a09d3f05648068161034756c756052b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Fri, 24 Feb 2017 21:19:52 +0100 Subject: [PATCH 06/13] Fix T50757: Alembic, assign imported materials to the object data instead of to the object itself. --- source/blender/alembic/intern/abc_mesh.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index 8bc9c335054..5a57e43326a 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -691,7 +691,7 @@ static void assign_materials(Main *bmain, Object *ob, const std::mapsecond; } - assign_material(ob, assigned_name, it->second, BKE_MAT_ASSIGN_OBJECT); + assign_material(ob, assigned_name, it->second, BKE_MAT_ASSIGN_OBDATA); } } } From 15f1072ee2e1ff4f0f4c30a9d3a514afa6c371f2 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 25 Feb 2017 02:35:53 +0100 Subject: [PATCH 07/13] Fix build error with macOS / clang / c++11. --- intern/cycles/bvh/bvh_build.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp index fcbc50f4f6f..517afc75641 100644 --- a/intern/cycles/bvh/bvh_build.cpp +++ b/intern/cycles/bvh/bvh_build.cpp @@ -905,12 +905,13 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range, * can not control. */ typedef StackAllocator<256, int> LeafStackAllocator; + typedef StackAllocator<256, float2> LeafTimeStackAllocator; typedef StackAllocator<256, BVHReference> LeafReferenceStackAllocator; vector p_type[PRIMITIVE_NUM_TOTAL]; vector p_index[PRIMITIVE_NUM_TOTAL]; vector p_object[PRIMITIVE_NUM_TOTAL]; - vector p_time[PRIMITIVE_NUM_TOTAL]; + vector p_time[PRIMITIVE_NUM_TOTAL]; vector p_ref[PRIMITIVE_NUM_TOTAL]; /* TODO(sergey): In theory we should be able to store references. */ @@ -964,7 +965,7 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range, vector local_prim_type, local_prim_index, local_prim_object; - vector local_prim_time; + vector local_prim_time; local_prim_type.resize(num_new_prims); local_prim_index.resize(num_new_prims); local_prim_object.resize(num_new_prims); From 8c5826f59a37924866ed7dd5bda7fb39c44e8227 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 25 Feb 2017 03:09:02 +0100 Subject: [PATCH 08/13] Fix T50698: Cycles baking artifacts with transparent surfaces. --- intern/cycles/kernel/kernel_bake.h | 3 ++- intern/cycles/kernel/kernel_shader.h | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h index 5bcc57cdcdf..f18d145f7cf 100644 --- a/intern/cycles/kernel/kernel_bake.h +++ b/intern/cycles/kernel/kernel_bake.h @@ -54,7 +54,8 @@ ccl_device_inline void compute_light_pass(KernelGlobals *kg, float rbsdf = path_state_rng_1D(kg, &rng, &state, PRNG_BSDF); shader_eval_surface(kg, sd, &rng, &state, rbsdf, state.flag, SHADER_CONTEXT_MAIN); - /* TODO, disable the closures we won't need */ + /* TODO, disable more closures we don't need besides transparent */ + shader_bsdf_disable_transparency(kg, sd); #ifdef __BRANCHED_PATH__ if(!kernel_data.integrator.branched) { diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index d0826e5e879..59c1331a63c 100644 --- a/intern/cycles/kernel/kernel_shader.h +++ b/intern/cycles/kernel/kernel_shader.h @@ -685,6 +685,18 @@ ccl_device float3 shader_bsdf_transparency(KernelGlobals *kg, ShaderData *sd) return eval; } +ccl_device void shader_bsdf_disable_transparency(KernelGlobals *kg, ShaderData *sd) +{ + for(int i = 0; i < ccl_fetch(sd, num_closure); i++) { + ShaderClosure *sc = ccl_fetch_array(sd, closure, i); + + if(sc->type == CLOSURE_BSDF_TRANSPARENT_ID) { + sc->sample_weight = 0.0f; + sc->weight = make_float3(0.0f, 0.0f, 0.0f); + } + } +} + ccl_device float3 shader_bsdf_alpha(KernelGlobals *kg, ShaderData *sd) { float3 alpha = make_float3(1.0f, 1.0f, 1.0f) - shader_bsdf_transparency(kg, sd); From a0b8a9fe6816f1e704b2edbeccddf1e3285e4520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Sat, 25 Feb 2017 06:18:32 +0100 Subject: [PATCH 09/13] Alembic: addition of a scope timer to perform basic profiling. --- source/blender/alembic/intern/abc_util.cc | 14 ++++++++++++++ source/blender/alembic/intern/abc_util.h | 19 +++++++++++++++++++ source/blender/alembic/intern/alembic_capi.cc | 4 ++++ 3 files changed, 37 insertions(+) diff --git a/source/blender/alembic/intern/abc_util.cc b/source/blender/alembic/intern/abc_util.cc index 08c94f437e6..158ec263df5 100644 --- a/source/blender/alembic/intern/abc_util.cc +++ b/source/blender/alembic/intern/abc_util.cc @@ -37,6 +37,8 @@ extern "C" { #include "DNA_object_types.h" #include "BLI_math.h" + +#include "PIL_time.h" } std::string get_id_name(Object *ob) @@ -523,3 +525,15 @@ AbcObjectReader *create_reader(const Alembic::AbcGeom::IObject &object, ImportSe return reader; } + +/* ********************** */ + +ScopeTimer::ScopeTimer(const char *message) + : m_message(message) + , m_start(PIL_check_seconds_timer()) +{} + +ScopeTimer::~ScopeTimer() +{ + std::fprintf(stderr, "%s: %fs\n", m_message, PIL_check_seconds_timer() - m_start); +} diff --git a/source/blender/alembic/intern/abc_util.h b/source/blender/alembic/intern/abc_util.h index a7ac9df91c7..85ba4d5c9c7 100644 --- a/source/blender/alembic/intern/abc_util.h +++ b/source/blender/alembic/intern/abc_util.h @@ -146,4 +146,23 @@ ABC_INLINE void copy_yup_from_zup(short yup[3], const short zup[3]) yup[2] = -zup[1]; } +/* *************************** */ + +#undef ABC_DEBUG_TIME + +class ScopeTimer { + const char *m_message; + double m_start; + +public: + ScopeTimer(const char *message); + ~ScopeTimer(); +}; + +#ifdef ABC_DEBUG_TIME +# define SCOPE_TIMER(message) ScopeTimer prof(message) +#else +# define SCOPE_TIMER(message) +#endif + #endif /* __ABC_UTIL_H__ */ diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc index d8d017119b1..dc5146a26e0 100644 --- a/source/blender/alembic/intern/alembic_capi.cc +++ b/source/blender/alembic/intern/alembic_capi.cc @@ -542,6 +542,8 @@ ABC_INLINE bool is_mesh_and_strands(const IObject &object) static void import_startjob(void *user_data, short *stop, short *do_update, float *progress) { + SCOPE_TIMER("Alembic import, objects reading and creation"); + ImportJobData *data = static_cast(user_data); data->stop = stop; @@ -677,6 +679,8 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa static void import_endjob(void *user_data) { + SCOPE_TIMER("Alembic import, cleanup"); + ImportJobData *data = static_cast(user_data); std::vector::iterator iter; From 2c4564b044ada4f7f5568735c197afce888d43df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Sat, 25 Feb 2017 07:08:14 +0100 Subject: [PATCH 10/13] Alembic: avoid crashing when reading non-indexed UV params. --- source/blender/alembic/intern/abc_customdata.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/blender/alembic/intern/abc_customdata.cc b/source/blender/alembic/intern/abc_customdata.cc index ebf1b2ba96e..0d11ab79ddd 100644 --- a/source/blender/alembic/intern/abc_customdata.cc +++ b/source/blender/alembic/intern/abc_customdata.cc @@ -327,6 +327,11 @@ static void read_custom_data_ex(const ICompoundProperty &prop, } else if (data_type == CD_MLOOPUV) { IV2fGeomParam uv_param(prop, prop_header.getName()); + + if (!uv_param.isIndexed()) { + return; + } + IV2fGeomParam::Sample sample; uv_param.getIndexed(sample, iss); From 94ca09e01c98b5bb8bfbcc934ad8fdd9e3f2d835 Mon Sep 17 00:00:00 2001 From: raa Date: Sat, 25 Feb 2017 13:18:41 +0300 Subject: [PATCH 11/13] Fix rows with fixed last item (D2524) --- .../editors/interface/interface_layout.c | 58 ++++++++++++++++--- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 9acc8cf8271..aa39870d755 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -189,7 +189,7 @@ static const char *ui_item_name_add_colon(const char *name, char namestr[UI_MAX_ return name; } -static int ui_item_fit(int item, int pos, int all, int available, bool is_last, int alignment) +static int ui_item_fit(int item, int pos, int all, int available, bool is_last, int alignment, float *extra_pixel) { /* available == 0 is unlimited */ if (available == 0) @@ -199,16 +199,22 @@ static int ui_item_fit(int item, int pos, int all, int available, bool is_last, /* contents is bigger than available space */ if (is_last) return available - pos; - else - return (item * available) / all; + else { + float width = *extra_pixel + (item * available) / (float)all; + *extra_pixel = width - (int)width; + return (int)width; + } } else { /* contents is smaller or equal to available space */ if (alignment == UI_LAYOUT_ALIGN_EXPAND) { if (is_last) return available - pos; - else - return (item * available) / all; + else { + float width = *extra_pixel + (item * available) / (float)all; + *extra_pixel = width - (int)width; + return (int)width; + } } else return item; @@ -302,6 +308,26 @@ static void ui_item_position(uiItem *item, int x, int y, int w, int h) } } +static void ui_item_move(uiItem *item, int delta_xmin, int delta_xmax) +{ + if (item->type == ITEM_BUTTON) { + uiButtonItem *bitem = (uiButtonItem *)item; + + bitem->but->rect.xmin += delta_xmin; + bitem->but->rect.xmax += delta_xmax; + + ui_but_update(bitem->but); /* for strlen */ + } + else { + uiLayout *litem = (uiLayout *)item; + + if (delta_xmin > 0) + litem->x += delta_xmin; + else + litem->w += delta_xmax; + } +} + /******************** Special RNA Items *********************/ static int ui_layout_local_dir(uiLayout *layout) @@ -2099,9 +2125,10 @@ static int ui_litem_min_width(int itemw) static void ui_litem_layout_row(uiLayout *litem) { - uiItem *item; + uiItem *item, *last_free_item = NULL; int x, y, w, tot, totw, neww, newtotw, itemw, minw, itemh, offset; int fixedw, freew, fixedx, freex, flag = 0, lastw = 0; + float extra_pixel; /* x = litem->x; */ /* UNUSED */ y = litem->y; @@ -2128,6 +2155,7 @@ static void ui_litem_layout_row(uiLayout *litem) x = 0; flag = 0; newtotw = totw; + extra_pixel = 0.0f; for (item = litem->items.first; item; item = item->next) { if (item->flag & UI_ITEM_FIXED) @@ -2137,7 +2165,7 @@ static void ui_litem_layout_row(uiLayout *litem) minw = ui_litem_min_width(itemw); if (w - lastw > 0) - neww = ui_item_fit(itemw, x, totw, w - lastw, !item->next, litem->alignment); + neww = ui_item_fit(itemw, x, totw, w - lastw, !item->next, litem->alignment, &extra_pixel); else neww = 0; /* no space left, all will need clamping to minimum size */ @@ -2166,6 +2194,7 @@ static void ui_litem_layout_row(uiLayout *litem) freex = 0; fixedx = 0; + extra_pixel = 0.0f; x = litem->x; for (item = litem->items.first; item; item = item->next) { @@ -2177,13 +2206,14 @@ static void ui_litem_layout_row(uiLayout *litem) if (item->type != ITEM_BUTTON && item->flag & UI_ITEM_MIN) { minw = itemw; } - itemw = ui_item_fit(minw, fixedx, fixedw, min_ii(w, fixedw), !item->next, litem->alignment); + itemw = ui_item_fit(minw, fixedx, fixedw, min_ii(w, fixedw), !item->next, litem->alignment, &extra_pixel); fixedx += itemw; } else { /* free size item */ - itemw = ui_item_fit(itemw, freex, freew, w - fixedw, !item->next, litem->alignment); + itemw = ui_item_fit(itemw, freex, freew, w - fixedw, !item->next, litem->alignment, &extra_pixel); freex += itemw; + last_free_item = item; } /* align right/center */ @@ -2205,6 +2235,16 @@ static void ui_litem_layout_row(uiLayout *litem) x += litem->space; } + /* add extra pixel */ + uiItem *last_item = litem->items.last; + extra_pixel = litem->w - (x - litem->x); + if (extra_pixel > 0 && litem->alignment == UI_LAYOUT_ALIGN_EXPAND && + last_free_item && last_item && last_item->flag & UI_ITEM_FIXED) { + ui_item_move(last_free_item, 0, extra_pixel); + for (item = last_free_item->next; item; item = item->next) + ui_item_move(item, extra_pixel, extra_pixel); + } + litem->w = x - litem->x; litem->h = litem->y - y; litem->x = x; From d66d5790e9fa823700994780439615cf0b0621b1 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sat, 25 Feb 2017 11:27:11 +0100 Subject: [PATCH 12/13] Fix (unreported) missing update when adding constraint from RNA. --- source/blender/makesrna/intern/rna_object.c | 6 +++++- source/blender/makesrna/intern/rna_pose.c | 14 +++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 0cffba47f16..b3c166a6810 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1321,8 +1321,12 @@ static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value) static bConstraint *rna_Object_constraints_new(Object *object, int type) { + bConstraint *new_con = BKE_constraint_add_for_object(object, NULL, type); + + ED_object_constraint_tag_update(object, new_con); WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, object); - return BKE_constraint_add_for_object(object, NULL, type); + + return new_con; } static void rna_Object_constraints_remove(Object *object, ReportList *reports, PointerRNA *con_ptr) diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 28ce63a61bd..8d161466d56 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -524,12 +524,15 @@ static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr, PointerRNA va BKE_constraints_active_set(&pchan->constraints, (bConstraint *)value.data); } -static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, int type) +static bConstraint *rna_PoseChannel_constraints_new(ID *id, bPoseChannel *pchan, Main *main, int type) { - /*WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object); */ - /* TODO, pass object also */ - /* TODO, new pose bones don't have updated draw flags */ - return BKE_constraint_add_for_pose(NULL, pchan, NULL, type); + Object *ob = (Object *)id; + bConstraint *new_con = BKE_constraint_add_for_pose(ob, pchan, NULL, type); + + ED_object_constraint_dependency_tag_update(main, ob, new_con); + WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, id); + + return new_con; } static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, ReportList *reports, PointerRNA *con_ptr) @@ -764,6 +767,7 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro /* Constraint collection */ func = RNA_def_function(srna, "new", "rna_PoseChannel_constraints_new"); RNA_def_function_ui_description(func, "Add a constraint to this object"); + RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_SELF_ID); /* ID and Main needed for refresh */ /* return type */ parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint"); RNA_def_function_return(func, parm); From 5c3216e2334863137019b55a44d5b9cfea842c10 Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Sat, 25 Feb 2017 14:58:08 +0100 Subject: [PATCH 13/13] Fix compiling after a0b8a9f --- source/blender/alembic/intern/abc_util.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/alembic/intern/abc_util.cc b/source/blender/alembic/intern/abc_util.cc index 158ec263df5..50fa43a3491 100644 --- a/source/blender/alembic/intern/abc_util.cc +++ b/source/blender/alembic/intern/abc_util.cc @@ -535,5 +535,5 @@ ScopeTimer::ScopeTimer(const char *message) ScopeTimer::~ScopeTimer() { - std::fprintf(stderr, "%s: %fs\n", m_message, PIL_check_seconds_timer() - m_start); + fprintf(stderr, "%s: %fs\n", m_message, PIL_check_seconds_timer() - m_start); }