2 years agoCTests: Initial work to cover Cycles nodes with OpenGL tests
Sergey Sharybin [Fri, 10 Feb 2017 13:52:54 +0000 (14:52 +0100)]
CTests: Initial work to cover Cycles nodes with OpenGL tests

Works similar to regular Cycles tests, just does OpenGL render to
get output image.

Seems to work fine with the only funny effect: Blender window will
pop up for each of the tests. This is current limitation of our
OpenGL context. Might be changed in the future.

2 years agoCleanup: Trailing whitespace
Sergey Sharybin [Fri, 10 Feb 2017 13:08:12 +0000 (14:08 +0100)]
Cleanup: Trailing whitespace

2 years agoCycles: Cleanup, move EdgeMap to blender_util
Sergey Sharybin [Fri, 10 Feb 2017 12:33:02 +0000 (13:33 +0100)]
Cycles: Cleanup, move EdgeMap to blender_util

it's better place for such an utility structure. Still not fully ideal tho.

2 years agoCycles: Make an utility class for edge map
Sergey Sharybin [Fri, 10 Feb 2017 12:31:59 +0000 (13:31 +0100)]
Cycles: Make an utility class for edge map

Simplifies some logic.

2 years agoCycles: Fix pointiness attribute giving wrong results with autosplit
Sergey Sharybin [Fri, 10 Feb 2017 12:23:40 +0000 (13:23 +0100)]
Cycles: Fix pointiness attribute giving wrong results with autosplit

Basically made the algorithm to handle vertices with the same coordinate
as a single vertex.

2 years agoCycles: Cleanup: Use less indentation by inverting condition
Sergey Sharybin [Fri, 10 Feb 2017 09:10:06 +0000 (10:10 +0100)]
Cycles: Cleanup: Use less indentation by inverting condition

2 years agoCycles: Calculate all vertex attribute after faces generation
Sergey Sharybin [Fri, 10 Feb 2017 09:06:58 +0000 (10:06 +0100)]
Cycles: Calculate all vertex attribute after faces generation

This way the calculation is not spread over multiple places.

2 years agoCycles: Cleanup: use vector instead of bare malloc
Sergey Sharybin [Fri, 10 Feb 2017 09:05:41 +0000 (10:05 +0100)]
Cycles: Cleanup: use vector instead of bare malloc

This way memory is more "manageable" and easier to follow.

2 years agoAlembic: fixed mistake in bounding box computation
Sybren A. Stüvel [Fri, 10 Feb 2017 10:52:14 +0000 (11:52 +0100)]
Alembic: fixed mistake in bounding box computation

By performing the Z-up to Y-up conversion, the change in sign of the
Z-coordinate swaps "minimum" and "maximum".

2 years agoDo not overide text
Aaron Carlisle [Thu, 9 Feb 2017 21:25:04 +0000 (16:25 -0500)]
Do not overide text

2 years agoFix T50629 -- Add remove doubles to the cleanup menu
Aaron Carlisle [Thu, 9 Feb 2017 21:18:33 +0000 (16:18 -0500)]
Fix T50629 -- Add remove doubles to the cleanup menu

Also move it up in the verticies menu

2 years agoCleanup: Remove commented code
Aaron Carlisle [Thu, 9 Feb 2017 14:26:12 +0000 (09:26 -0500)]
Cleanup: Remove commented code

Code has been commented from before 2010 and relates to old Background image code.

2 years agoUse a smaller cross icon for clearing search box contents
Joshua Leung [Thu, 9 Feb 2017 06:08:58 +0000 (19:08 +1300)]
Use a smaller cross icon for clearing search box contents

2 years agoMore tweaks to Normalisation options in Graph Editor
Joshua Leung [Thu, 9 Feb 2017 05:59:51 +0000 (18:59 +1300)]
More tweaks to Normalisation options in Graph Editor

* Added a new dedicated icon for normalize
* Only use an icon for "Auto"

2 years agoGraph Editor: Replace Normalise/Auto checkboxes with toggle buttons
Joshua Leung [Thu, 9 Feb 2017 04:04:21 +0000 (17:04 +1300)]
Graph Editor: Replace Normalise/Auto checkboxes with toggle buttons

These take less space, fit in better with rest of the UI, and make their relationship clearer

2 years agoFix: GPencil delete operators did not respect color locking
Joshua Leung [Sat, 28 Jan 2017 11:05:41 +0000 (00:05 +1300)]
Fix: GPencil delete operators did not respect color locking

2 years agoCycles: Fix regression with transparent shadows in volume
Sergey Sharybin [Mon, 30 Jan 2017 13:40:37 +0000 (14:40 +0100)]
Cycles: Fix regression with transparent shadows in volume

2 years agoCycles: Solve speed regression by casting opaque ray first
Sergey Sharybin [Mon, 30 Jan 2017 13:11:58 +0000 (14:11 +0100)]
Cycles: Solve speed regression by casting opaque ray first

2 years agoCycles: Fix compilation error on OpenCL
Sergey Sharybin [Mon, 30 Jan 2017 11:33:58 +0000 (12:33 +0100)]
Cycles: Fix compilation error on OpenCL

2 years agoCycles: Split shadow functions to avoid some duplicated calculations
Sergey Sharybin [Mon, 30 Jan 2017 11:08:20 +0000 (12:08 +0100)]
Cycles: Split shadow functions to avoid some duplicated calculations

2 years agoCycles: Store shadow intersections in the kernel globals
Sergey Sharybin [Wed, 21 Sep 2016 15:46:25 +0000 (17:46 +0200)]
Cycles: Store shadow intersections in the kernel globals

Seems CUDA failed to de-duplicate the array across multiple inlined
versions of the shadow_blocked(). Helped it a bit with that now.

Gives about 100MB memory improvement on a scenes after previous
commit and brings up memory "regression" to only 100MB comparing to
the master branch now.

2 years agoCycles: Speedup transparent shadows on CUDA
Sergey Sharybin [Wed, 8 Feb 2017 12:05:05 +0000 (13:05 +0100)]
Cycles: Speedup transparent shadows on CUDA

This commit enables record-all behavior of transparent shadows

Render times difference goes as following:

               GTX 1080 render time
BMW                  -0.5%
Fishy Cat            -0.0%
Pabellon Barcelona   -11.6%
Classroom            +1.2%
Koro                 -58.6%

Kernel will now use some extra VRAM memory to store the intersection
array (200MB on my configuration). This we can optimize out with some
further commits.

2 years agoCycles: Implement record-all transparent shadow function for GPU
Sergey Sharybin [Wed, 21 Sep 2016 15:34:15 +0000 (17:34 +0200)]
Cycles: Implement record-all transparent shadow function for GPU

The idea is to record all possible transparent intersections when
shooting transparent ray on GPU (similar to what we were doing  on
CPU already).

This avoids need of doing whole ray-to-scene intersections queries
for each intersection and speeds up a lot cases like transparent
hair in the cost of extra memory.

This commit is a base ground for now and this feature is kept
disabled for until some further tweaks.

2 years agoCycles: Use an utility function to sort intersections array
Sergey Sharybin [Wed, 21 Sep 2016 10:53:38 +0000 (12:53 +0200)]
Cycles: Use an utility function to sort intersections array

2 years agoCycles: Make GPU version of shadow_blocked() closer to CPU
Sergey Sharybin [Wed, 21 Sep 2016 10:39:14 +0000 (12:39 +0200)]
Cycles: Make GPU version of shadow_blocked() closer to CPU

Now we break the traversal cycle and then perform volume attenuation
and check with zero throughput. Not sure it makes any measurable sense
at this moment, but in the future it might help de-duplicating some
extra logic here.

2 years agoCycles: De-duplicate transparent shadows attenuation
Sergey Sharybin [Wed, 21 Sep 2016 10:30:52 +0000 (12:30 +0200)]
Cycles: De-duplicate transparent shadows attenuation

Fair amount of code was duplicated for CPU and GPU, now we are
using inlined function to avoid such duplication.

2 years agoFix T49249: Alembic export with multiple hair systems crash blender
Sybren A. Stüvel [Wed, 8 Feb 2017 10:47:16 +0000 (11:47 +0100)]
Fix T49249: Alembic export with multiple hair systems crash blender

Removed unnecessary call to DM_update_tessface_data(). This call is
already performed by DM_ensure_tessface(dm). The call being performed
twice caused a failing BLI_assert().

Reviewed by: Kévin Dietrich

2 years agoAlembic export: avoid infinite loops trying to find parent objects.
Sybren A. Stüvel [Wed, 8 Feb 2017 10:50:21 +0000 (11:50 +0100)]
Alembic export: avoid infinite loops trying to find parent objects.

Also added some assertions for debugging purposes

Reviewed by: Kévin Dietrich

2 years agoAlembic export: only create transform writer if the object should be exported
Sybren A. Stüvel [Wed, 8 Feb 2017 10:48:59 +0000 (11:48 +0100)]
Alembic export: only create transform writer if the object should be exported

Reviewed by: Kévin Dietrich

2 years agoAlembic: #undef'ed the correct macro
Sybren A. Stüvel [Tue, 7 Feb 2017 13:53:09 +0000 (14:53 +0100)]
Alembic: #undef'ed the correct macro

TEST_RET is not defined anywhere in Blender's sources, and LAYER_CMP
is no longer used after this function ends.

2 years agoAlembic: Use getXForm() in check, because it's used in rest of the function too
Sybren A. Stüvel [Tue, 7 Feb 2017 11:20:42 +0000 (12:20 +0100)]
Alembic: Use getXForm() in check, because it's used in rest of the function too

This makes the code within the function consistent.

2 years agoAlembic: Renamed copy_zup_yup to copy_yup_from_zup (and same for zup_from_yup)
Sybren A. Stüvel [Fri, 3 Feb 2017 14:54:59 +0000 (15:54 +0100)]
Alembic: Renamed copy_zup_yup to copy_yup_from_zup (and same for zup_from_yup)

With the new names the arguments (yup, zup) are in the same order as
they appear in the function name. The old names used copy_src_dst(dst,
src), which I found very confusing. Furthermore, now it is clear from
where to where the copy is made.

This makes the function names a little bit longer, though. If that is
a real issue, we can just name them zup_from_yup(zup, yup).

Reviewed by: Kévin Dietrich

2 years agoCleanup: Use const qualifier in some of color management code
Sergey Sharybin [Tue, 7 Feb 2017 16:49:35 +0000 (17:49 +0100)]
Cleanup: Use const qualifier in some of color management code

2 years agoSequencer: Some extra speedup in color space conversion
Sergey Sharybin [Tue, 7 Feb 2017 16:45:28 +0000 (17:45 +0100)]
Sequencer: Some extra speedup in color space conversion

Use the new utility from coloranagement which multi-threads byte to
float conversion.

Gives extra 10% speedup from quick tests.

2 years agoColor management: Add utility function to convert byte to float with processor applied
Sergey Sharybin [Tue, 7 Feb 2017 16:45:02 +0000 (17:45 +0100)]
Color management: Add utility function to convert byte to float with processor applied

2 years agoSequencer: Speedup conversion to sequencer space
Sergey Sharybin [Tue, 7 Feb 2017 16:30:51 +0000 (17:30 +0100)]
Sequencer: Speedup conversion to sequencer space

Speedup is mainly gained by multi-threading. Gives about 3x
fps gain on an edit shot file.

There is still some room for improvements, will happen in one
of the upcoming commits.

2 years agoColor management: Implement threaded byte buffer conversion
Sergey Sharybin [Tue, 7 Feb 2017 15:59:17 +0000 (16:59 +0100)]
Color management: Implement threaded byte buffer conversion

The title says it all actually: now we can convert byte buffer
directly, without need of temporary float buffer.

2 years agoParam `is_cached` not being used in` bvhtree_from_mesh_edges_setup_data`
Germano Cavalcante [Tue, 7 Feb 2017 14:03:10 +0000 (11:03 -0300)]
Param `is_cached` not being used in` bvhtree_from_mesh_edges_setup_data`

This could cause bugs in the memory release

2 years agoFix missing hair after rendering with different viewport/render settings
Sergey Sharybin [Tue, 7 Feb 2017 13:21:29 +0000 (14:21 +0100)]
Fix missing hair after rendering with different viewport/render settings

Derived mesh for particles did not include tessellated faces when it
was expected to. Now added explicit function to copy CDDM with tess
faces without need to re-tessellate the result.

2 years agoFix T49253: Cycles blackbody is wrong on AVX2 CPU on Windows
Sergey Sharybin [Tue, 7 Feb 2017 12:05:19 +0000 (13:05 +0100)]
Fix T49253: Cycles blackbody is wrong on AVX2 CPU on Windows

Seems to be bug in optimizer, but managed to reshuffle in a way
which should also give some speedup.

2 years agoPIL_time_utildefines: also show total time in TIMEIT_AVERAGED.
Bastien Montagne [Tue, 7 Feb 2017 09:14:46 +0000 (10:14 +0100)]
PIL_time_utildefines: also show total time in TIMEIT_AVERAGED.

2 years agoFix (unreported) Object previews being written even for skipped objects.
Bastien Montagne [Mon, 6 Feb 2017 19:58:18 +0000 (20:58 +0100)]
Fix (unreported) Object previews being written even for skipped objects.

2 years agoCleanup writefile code a bit.
Bastien Montagne [Mon, 6 Feb 2017 19:42:00 +0000 (20:42 +0100)]
Cleanup writefile code a bit.

Modernize some of it a bit, saves quite some lines of blabla (using
shile instead of for loops... tsssts...).

2 years agoCMake: Remove MOTO library dependency when it is not needed
Jorge Bernal [Mon, 6 Feb 2017 18:29:42 +0000 (19:29 +0100)]
CMake: Remove MOTO library dependency when it is not needed

It is not necessary to add MOTO library dependency when we use
WITH_IK_SOLVER (now it uses Eigen) or we use WITH_MOD_BOOLEAN (it was
used by bsp intern library some time ago but it is not present in the
code anymore).

Reviewers: mont29, sergey

Subscribers: mont29, sergey

Differential Revision:

2 years agoSpecify the correct size of the BVHTree of edges
Germano Cavalcante [Mon, 6 Feb 2017 17:59:31 +0000 (14:59 -0300)]
Specify the correct size of the BVHTree of edges

~edge_num~ edges_num_active
Not always all the edges enter in the build

2 years agoStandardization and style for BKE_bvhutils
Germano Cavalcante [Mon, 6 Feb 2017 17:11:06 +0000 (14:11 -0300)]
Standardization and style for BKE_bvhutils

Add `bvhtree_from_mesh_edges_ex` and callbacks to nearest_to_ray (Similar to the other functions of this code)

2 years agoFix 'public' global 'g_atexit' var in Blender.
Bastien Montagne [Mon, 6 Feb 2017 16:42:30 +0000 (17:42 +0100)]
Fix 'public' global 'g_atexit' var in Blender.

No reason to not make this private to this file, and it gave conflict
when using bpy as module and loading it in a GLib application (which
also has a g_atexit var).

2 years agoFix compilation error after recent change
Sergey Sharybin [Mon, 6 Feb 2017 14:29:13 +0000 (15:29 +0100)]
Fix compilation error after recent change

2 years agoAdd shortcuts for unsigned int, short, long and char
Sergey Sharybin [Mon, 6 Feb 2017 14:04:13 +0000 (15:04 +0100)]
Add shortcuts for unsigned int, short, long and char

Feel free to use those in the new code.

And stay away from simple "unsigned".

2 years agoUse hash instead of linear lookup in armature deform
Sergey Sharybin [Mon, 6 Feb 2017 10:12:35 +0000 (11:12 +0100)]
Use hash instead of linear lookup in armature deform

This avoids calling linear lookup 100s of time when dealing with
real-life character.

Still some tweaks possible.

2 years agoMulti-thread displace modifier
Sergey Sharybin [Mon, 6 Feb 2017 13:21:29 +0000 (14:21 +0100)]
Multi-thread displace modifier

The title says it all actually. Use BLI task to loop over vertices
and distort their locations. Gives 2x FPS increase in a file with
just time-dependent displace modifier on my desktop.

2 years agoDisplace modifier: Use special version of texture sampling
Sergey Sharybin [Mon, 6 Feb 2017 11:33:37 +0000 (12:33 +0100)]
Displace modifier: Use special version of texture sampling

This version will give less spin locks and now well-tested by render engines.

This should reduce amount of threading overhead when having multiple objects
with displace modifier enabled.

In the future this will also help us threading the modifier.

There are more modifiers which could benefit from this, but let's first
investigate the new behavior with one of them.

2 years agoAdd special texture sampling function which takes image pool argument
Sergey Sharybin [Mon, 6 Feb 2017 11:23:03 +0000 (12:23 +0100)]
Add special texture sampling function which takes image pool argument

Using image pool will reduce number of thread locks when acquiring image.
Useful when it's needed to sample texture fewzillion times a second.

2 years agoFix memory leak when building without audaspace
Sergey Sharybin [Mon, 6 Feb 2017 10:18:20 +0000 (11:18 +0100)]
Fix memory leak when building without audaspace

2 years agoC++ conformance fixes (MSVC /permissive-)
Phil Christensen [Mon, 6 Feb 2017 09:44:25 +0000 (10:44 +0100)]
C++ conformance fixes (MSVC /permissive-)

We (the Microsoft C++ team) use the Blender project as part of our "Real world code" tests.
I noticed a place in WIN32 specific code (dvpapi.cpp:85) where a string literal is losing
its const-ness when being passed to BLI_dynlib_open().  This is not permitted when using the
/permissive- conformance compiler switch (see our blog

My suggested fix is to add const and propagate it where needed.  Another possible fix would be
to explicitly cast away the const.

Reviewers: mont29, sergey, LazyDodo

Subscribers: Blendify, sergey, mont29, LazyDodo

Tags: #platform:_windows

Differential Revision:

2 years agofix T50602: Avoid crash when executing `transform_snap_context_project_view3d_mixed...
Germano Cavalcante [Mon, 6 Feb 2017 04:01:39 +0000 (01:01 -0300)]
fix T50602: Avoid crash when executing `transform_snap_context_project_view3d_mixed` with `dist_px` NULL

2 years agoCleaning of the last commit: lack of attention with the debug of time X(
Germano Cavalcante [Sat, 4 Feb 2017 22:06:41 +0000 (19:06 -0300)]
Cleaning of the last commit: lack of attention with the debug of time X(

This was a stupid mistake

2 years agoOptimize BVHTree creation of vertices that have BLI_bitmap test
Germano Cavalcante [Sat, 4 Feb 2017 22:01:29 +0000 (19:01 -0300)]
Optimize BVHTree creation of vertices that have BLI_bitmap test

Instead of reference the vertex first and test the bitmap afterwards. Test the bitmap first and reference the vertex after.

In a mesh with 31146 vertices and the entire bitmap disabled, the loop time is 243% faster
With all bitmap enabled, the time becomes 463473% faster!!!

One possible reason for this huge difference in peformance is that maybe the compiler is not putting the function "BM_vert_at_index" inline (I dont know if buildbot do this, but it's good to investigate).

2 years agofix T50592: Scene.raycast not working
Germano Cavalcante [Sat, 4 Feb 2017 21:17:15 +0000 (18:17 -0300)]
fix T50592: Scene.raycast not working

Ray_start and ray_normal values were being ignored

2 years agoFix (unreported) crash in new snap code.
Bastien Montagne [Sat, 4 Feb 2017 20:51:27 +0000 (21:51 +0100)]
Fix (unreported) crash in new snap code.

Looks like `object_map` and `mem_arena` may be NULL sometimes...

Also, cleaned up function pointers declaration of Nearest2dUserData,
those were warning out in gcc. Please, *always* use typdef defined
prototypes for function pointers, it is sooooo much cleaner and clearer
that way. And easy to convert from compatible functions too.

2 years agoFix T50590: BI lamp doesn't hold a texture in this case.
Bastien Montagne [Sat, 4 Feb 2017 20:29:51 +0000 (21:29 +0100)]
Fix T50590: BI lamp doesn't hold a texture in this case.

BKE_lamp_free was somehow missing the refactor of datablocks handling
(which, among other things, completely separated ID refcounting and
linking management from ID freeing itself).

Either forgot during development, or lost during merge...

2 years agoSnap System: Use callbaks to differentiate how referenced vertives of DerivedMeshs...
Germano Cavalcante [Fri, 3 Feb 2017 23:08:57 +0000 (20:08 -0300)]
Snap System: Use callbaks to differentiate how referenced vertives of DerivedMeshs and Bmeshs

Before it was informed the type of object in the `userdata`, and a same function ran between the types to obtain the coordinates of the vertices

2 years agoRemove flag: `SNAP_OBJECT_USE_CACHE` from snap_context
Germano Cavalcante [Fri, 3 Feb 2017 22:03:31 +0000 (19:03 -0300)]
Remove flag: `SNAP_OBJECT_USE_CACHE` from snap_context

Since the cache is created in one way or another, this flag is not really making a difference
More details here: D2496

2 years agofix T46892: snap to closest point now works with Individual Origins
Germano Cavalcante [Fri, 3 Feb 2017 16:15:44 +0000 (13:15 -0300)]
fix T46892: snap to closest point now works with Individual Origins

The code looks for the closest element between its centers. In the case of islands, the center of each vertex is the center of the island.
The solution here is to skip the search for islands when the operation is translation

2 years agoForgotten in committee ddf99214dc06
Germano Cavalcante [Fri, 3 Feb 2017 15:57:02 +0000 (12:57 -0300)]
Forgotten in committee ddf99214dc06
In obect mode, the rotation matrix need to be restored to the initial value if a snap point is not found

2 years agoBuildbot: Re-enable cuda support for OSX
Sergey Sharybin [Fri, 3 Feb 2017 15:09:53 +0000 (16:09 +0100)]
Buildbot: Re-enable cuda support for OSX

2 years agoFix T50125: Shortcut keys missing in menus for Clear Location, Rotation, and Scale.
Bastien Montagne [Fri, 3 Feb 2017 15:10:00 +0000 (16:10 +0100)]
Fix T50125: Shortcut keys missing in menus for Clear Location, Rotation, and Scale.

Menu entries and shortcuts did not have exact same behavior, now they do
(using shortcuts' behavior).

2 years agoFix T49860: Copying vgroups between objects sharing the same obdata was not possible.
Bastien Montagne [Fri, 3 Feb 2017 14:47:44 +0000 (15:47 +0100)]
Fix T49860: Copying vgroups between objects sharing the same obdata was not possible.

Pretty straight forward actually, just do not bother about obdata part
of vgroups in that case, only copy object part of it.

And let's curse once again those stuff spread accross several types of

2 years agoDepsgraph: Add some extra debug prints on eval
Sergey Sharybin [Fri, 3 Feb 2017 13:05:59 +0000 (14:05 +0100)]
Depsgraph: Add some extra debug prints on eval

2 years agoTests: Use proper order for EXPECT_EQ()
Sergey Sharybin [Fri, 3 Feb 2017 11:03:59 +0000 (12:03 +0100)]
Tests: Use proper order for EXPECT_EQ()

2 years agoTests: Use EXPECT_FALSE() instead of EXPECT_EQ(foo, false)
Sergey Sharybin [Fri, 3 Feb 2017 10:52:47 +0000 (11:52 +0100)]
Tests: Use EXPECT_FALSE() instead of EXPECT_EQ(foo, false)

2 years agoTests: Use EXPECT_TRUE() instead of EXPECT_EQ(foo, true)
Sergey Sharybin [Fri, 3 Feb 2017 10:51:01 +0000 (11:51 +0100)]
Tests: Use EXPECT_TRUE() instead of EXPECT_EQ(foo, true)

2 years agoCycles: Cleanup, order of arguments to EXPECT_EQ
Sergey Sharybin [Fri, 3 Feb 2017 10:35:34 +0000 (11:35 +0100)]
Cycles: Cleanup, order of arguments to EXPECT_EQ

The order was wrong from the semantic point of view, caused
by some legacy workarounds in Libmv. Didn't realize it's was
not how things were expected to be used.

2 years agoExplode modifier: Don't tessellate DM if we are not going to apply modifier
Sergey Sharybin [Fri, 3 Feb 2017 10:03:47 +0000 (11:03 +0100)]
Explode modifier: Don't tessellate DM if we are not going to apply modifier

2 years agofix T49494: snap_align_rotation should use a local pivot to make the transformation
Germano Cavalcante [Fri, 3 Feb 2017 05:27:57 +0000 (02:27 -0300)]
fix T49494: snap_align_rotation should use a local pivot to make the transformation

The problem was simple, just transform the global coordinates of t->tsnap.snapTarget to local coordinates.
(Some comments were added to the code)

2 years agoFix T50084: Adding torus re-orders UV layers.
Bastien Montagne [Thu, 2 Feb 2017 20:37:53 +0000 (21:37 +0100)]
Fix T50084: Adding torus re-orders UV layers.

Issue was indeed in join operation, mesh in which we join all others
could be re-added to final data after others, leading to undesired
re-ordering of CD layers, and existing vertices etc. being shifted away
from their original indices, etc.

All kind of more or less bad and undesired changes, fixed by always
re-inserting destination mesh first.

Also cleaned up a bit that code, it was doing some rather
non-recommanded things (like allocating zero-sized mem, doing own
coocking to remove a data-block from main, etc.).

2 years don't use backticks
Sybren A. Stüvel [Thu, 2 Feb 2017 15:04:49 +0000 (16:04 +0100)] don't use backticks

The script complained that it could not find the executable "--build-all".

2 years agoFix T50524: Basis shapekey editing while rendering bug.
Bastien Montagne [Thu, 2 Feb 2017 16:00:52 +0000 (17:00 +0100)]
Fix T50524: Basis shapekey editing while rendering bug.

Root of the issue was BM_mesh_bm_to_me() breaking application of basis
offset to 'child' shapekeys, when called more than once from same BMesh.

2 years agoFix T50497: prop_search not correctly drew in UI (D2473)
raa [Thu, 2 Feb 2017 14:30:50 +0000 (17:30 +0300)]
Fix T50497: prop_search not correctly drew in UI (D2473)

2 years agoFix T50535: Cycles render segfault when Explode modifier before hair particle modifie...
Sergey Sharybin [Thu, 2 Feb 2017 13:32:05 +0000 (14:32 +0100)]
Fix T50535: Cycles render segfault when Explode modifier before hair particle modifier + UV material

Tricky issue caused by CDDM_copy() coying MFACE array but not MTFACE which
confused logic later on.

Now we don't copy ANY tessellation unless it is requested to.

Thanks Bastien for help and review!

2 years agoRevert the change of a default in a recent commit
Aaron Carlisle [Thu, 2 Feb 2017 04:46:53 +0000 (23:46 -0500)]
Revert the change of a default in a recent commit

This was my own mistake

2 years agoFix incorrect spot lamp blend in python GPU uniform export.
Michael Stahre [Thu, 2 Feb 2017 02:59:11 +0000 (03:59 +0100)]
Fix incorrect spot lamp blend in python GPU uniform export.

Reviewed By: brecht

Differential Revision:

2 years agoFix missing uniform type for python GPU uniform export.
Michael Stahre [Thu, 2 Feb 2017 02:59:21 +0000 (03:59 +0100)]
Fix missing uniform type for python GPU uniform export.

Reviewed By: brecht

Differential Revision:

2 years agoUI: Add missing colon
Aaron [Wed, 1 Feb 2017 19:56:11 +0000 (14:56 -0500)]
UI: Add missing colon

2 years agoFix T50570: pressing pgup or pgdn in any scrollable area irreversably alters scrollin...
Bastien Montagne [Wed, 1 Feb 2017 11:52:26 +0000 (12:52 +0100)]
Fix T50570: pressing pgup or pgdn in any scrollable area irreversably alters scrolling speed.

'page' prop of scroll up/down operators would get stuck once set once by
pageup/down keys... Now only take this prop into account if explicitely
set, not when its value is inherited from previous run.

2 years agoCycles tests: Allow python auto-exec
Sergey Sharybin [Wed, 1 Feb 2017 09:13:40 +0000 (10:13 +0100)]
Cycles tests: Allow python auto-exec

2 years agoCycles: Fix rng_state initialization when using resumable rendering
Lukas Stockner [Wed, 1 Feb 2017 04:43:17 +0000 (05:43 +0100)]
Cycles: Fix rng_state initialization when using resumable rendering

2 years agoSnap System: BVH: Ignore calculations, in parent nodes, used only in perspective...
Germano Cavalcante [Wed, 1 Feb 2017 00:43:44 +0000 (21:43 -0300)]
Snap System: BVH: Ignore calculations, in parent nodes, used only in perspective view

Strangely this change does not affect the performance very much.
Suzanne subdividide 6x (ortho view):
After :0.00013920

But it makes it easier to read the code

2 years agoSnap System: Invert the test order of the elements to snap (useful for ruler)
Germano Cavalcante [Tue, 31 Jan 2017 20:10:34 +0000 (17:10 -0300)]
Snap System: Invert the test order of the elements to snap (useful for ruler)

When the function that tests snap on multiple elements starts from the face and ends at the vertex, the transition between elements becomes much smoother.

2 years agoFix T50331: New Dependency Graph - "frame" python driver expression not working
Sergey Sharybin [Tue, 31 Jan 2017 11:17:42 +0000 (12:17 +0100)]
Fix T50331: New Dependency Graph - "frame" python driver expression not working

2 years agoCycles: Fix spelling in comment
Sergey Sharybin [Tue, 31 Jan 2017 11:08:19 +0000 (12:08 +0100)]
Cycles: Fix spelling in comment

2 years agoFix variable shadow and avoid calculating same value twice
Sergey Sharybin [Tue, 31 Jan 2017 10:55:29 +0000 (11:55 +0100)]
Fix variable shadow and avoid calculating same value twice

2 years agoSilence unused var warnings after rBac58a7fa
Dalai Felinto [Tue, 31 Jan 2017 10:00:18 +0000 (11:00 +0100)]
Silence unused var warnings after rBac58a7fa

2 years agoCleanup: use 'cb_flag', not 'cd_flag' for library_query callbacks.
Bastien Montagne [Tue, 31 Jan 2017 09:41:25 +0000 (10:41 +0100)]
Cleanup: use 'cb_flag', not 'cd_flag' for library_query callbacks.

`cd_flag` tends to be used for CustomData flags in mesh area, while for
library_query those are rather callback flags...

2 years agoCleanup: Rename callback flags from library_query to `IDWALK_CB_...`
Bastien Montagne [Tue, 31 Jan 2017 08:47:59 +0000 (09:47 +0100)]
Cleanup: Rename callback flags from library_query to `IDWALK_CB_...`

Better to have clear way to tell whether flag is parameter for
BKE_library_foreach_ID_link(), parameter for its callback function, or
return value from this callback function.

2 years agoFix compilation error: too few arguments to function call.
Kévin Dietrich [Tue, 31 Jan 2017 05:59:11 +0000 (06:59 +0100)]
Fix compilation error: too few arguments to function call.

D2492 by @tomjpsun.

2 years agoFix bug not reported: Ruler/Protractor: Snap to vertices and edges was not considerin...
Germano Cavalcante [Tue, 31 Jan 2017 02:49:09 +0000 (23:49 -0300)]
Fix bug not reported: Ruler/Protractor: Snap to vertices and edges was not considering the depth variation

Taking advantage of the area, the depth is decreased 0.01 BU to each loop to give priority to elements in order: Vertice > Edge > Face. This increases the threshold and improves the snap to multiple elements

2 years agoSnap System: Return depth by snapping to edges and vertices, because the Ruler only...
Germano Cavalcante [Tue, 31 Jan 2017 01:49:44 +0000 (22:49 -0300)]
Snap System: Return depth by snapping to edges and vertices, because the Ruler only works right this way

The Ruler snaps to the element with the lowest depth.

2 years agoUse the same solution to test the pixel distance to the AABB, with BoundBox
Germano Cavalcante [Tue, 31 Jan 2017 01:27:38 +0000 (22:27 -0300)]
Use the same solution to test the pixel distance to the AABB, with BoundBox

The previous solution took arbitrary values to determine if the mouse was near or not to the Bound Box (it simply scaled the Bound Box).

Now the same function that detected the distance from the BVHTree nodes to the mouse is used in the Bound Box

2 years agoFreestyle: Use of the Fill Range by Selection operator in the mesh edit mode.
Tamito Kajiyama [Tue, 31 Jan 2017 00:04:05 +0000 (09:04 +0900)]
Freestyle: Use of the Fill Range by Selection operator in the mesh edit mode.

This revision extends the functionality of the "Fill Range by Selection" button in
the "Distance from Camera/Object" modifiers so that only selected mesh vertices
in the edit mode are taken into account  (instead of considering all vertices when
in the object mode) to compute the min & max distances from the reference.
This will give users much finer control on the range values.