4 years agoFix T53476: File Browser: Selection Issue with 'fill' option.
Bastien Montagne [Tue, 5 Dec 2017 21:34:49 +0000 (22:34 +0100)]
Fix T53476: File Browser: Selection Issue with 'fill' option.

Fill-selection would only go upward in list of items to find an already
selected one and fill-select all items in-between. Now, in case upward
search fails, it will also intent to go downward, effectiviely allowing
to 'fill-select' from bottom to top.

Note that top-to-bottom keeps priority (i.e. if a top-to-bottom
fill-selection is possible, it will always happen, even if a
bottom-to-top one is also possible).

4 years agoFix T53430: Cut at the strip end fails w/ endstill
Campbell Barton [Tue, 5 Dec 2017 17:52:38 +0000 (04:52 +1100)]
Fix T53430: Cut at the strip end fails w/ endstill

4 years agoCMake: avoid checking each MSVC minor revision
Campbell Barton [Tue, 5 Dec 2017 16:38:44 +0000 (03:38 +1100)]
CMake: avoid checking each MSVC minor revision

4 years agoFix MSVS2017 compiler version
Antonioya [Tue, 5 Dec 2017 16:15:30 +0000 (17:15 +0100)]
Fix MSVS2017 compiler version

After last update to Visual Studio 2017 15.5.0 the compiler version changed

4 years agoTypes are to have explicit forward declaration
Sergey Sharybin [Tue, 5 Dec 2017 15:54:39 +0000 (16:54 +0100)]
Types are to have explicit forward declaration

4 years agoFix T53469: Make sure that edges are drawn in the backbuff whenever you are looking...
Germano [Tue, 5 Dec 2017 13:13:53 +0000 (11:13 -0200)]
Fix T53469: Make sure that edges are drawn in the backbuff whenever you are looking for the nearest edge

Caused by rB9f5bf19

4 years agoFix for typo in previous commit
Joshua Leung [Tue, 5 Dec 2017 12:14:20 +0000 (01:14 +1300)]
Fix for typo in previous commit

4 years agoSimplify UI-names for B-Bone Ease In/Out settings
Joshua Leung [Tue, 5 Dec 2017 11:58:10 +0000 (00:58 +1300)]
Simplify UI-names for B-Bone Ease In/Out settings

For more consistency with the other settings, and increased readability
when the UI is cramped (and it isn't possible to see the whole names).

4 years agoVersion patching fixes for F-Curves (as required for fixes for T48988 and T52009)
Joshua Leung [Tue, 5 Dec 2017 11:54:39 +0000 (00:54 +1300)]
Version patching fixes for F-Curves (as required for fixes for T48988 and T52009)

* For the T48988 fix (i.e. separate Ease In/Out properties for Bendy Bones
  in Edit vs Pose modes), old animation data needed to be patched to use
  the new property names. This is needed to partially fix some of the
  issues in T53356 (though the Rigify code itself still needs to be patched).

* For the T52009 fix, old files needed to have the frame_start and frame_end
  properties on the FModifier (base-class) updated to match that of the
  FMod_Stepped type-specific class. This wasn't done in the earlier commit
  since it wasn't worth going through all animation data just for the sake
  of updating these relatively-rare settings, but since we're doing it anyway
  now, it makes sense to include this here.

4 years agoAdded BKE_fcurves_main_cb(), a wrapper around BKE_animdata_main_cb to make it easier...
Joshua Leung [Tue, 5 Dec 2017 04:16:05 +0000 (17:16 +1300)]
Added BKE_fcurves_main_cb(), a wrapper around BKE_animdata_main_cb to make it easier to apply fixes to all F-Curves in a file

4 years agoCleanup/Style Tweaks to fit rest of code
Joshua Leung [Tue, 5 Dec 2017 04:14:55 +0000 (17:14 +1300)]
Cleanup/Style Tweaks to fit rest of code

4 years agoFix T53463: Rotation numerical input shows instable behaviour.
Bastien Montagne [Mon, 4 Dec 2017 17:40:33 +0000 (18:40 +0100)]
Fix T53463: Rotation numerical input shows instable behaviour.

Inverting a number in radians when user is in degrees gives rather
unexpected results. ;)

4 years agoDepsgraph: Cleanup, indentation
Sergey Sharybin [Mon, 4 Dec 2017 14:50:06 +0000 (15:50 +0100)]
Depsgraph: Cleanup, indentation

4 years agoBetter bevel profile at extreme values of profile.
Howard Trickey [Mon, 4 Dec 2017 14:30:40 +0000 (09:30 -0500)]
Better bevel profile at extreme values of profile.

Patch from Richard Erhardt, with some additions & modifications.
Changes bevel profile shape parameter so that can get arbitrarily
near square profile as parameter -> 1.
Adds code to make profile=0 case work, at least for cube corners,
so changed hard min of profile parameter to 0 from 0.15.

4 years agoRNA: Use const qualifier for an utility function
Sergey Sharybin [Mon, 4 Dec 2017 14:26:43 +0000 (15:26 +0100)]
RNA: Use const qualifier for an utility function

4 years agoDepsgraph: Add parameters nodes for bone custom properties
Sergey Sharybin [Mon, 4 Dec 2017 13:50:14 +0000 (14:50 +0100)]
Depsgraph: Add parameters nodes for bone custom properties

Currently shouldn't make any difference, but this is something what needs to be
done to sanitize drivers relations )with the idea to re-use some generic code
to get operations for driver variables.

4 years agoEdit Mesh Selection: Draw the backbuff of edge selection only when requested
Germano [Mon, 4 Dec 2017 14:05:06 +0000 (12:05 -0200)]
Edit Mesh Selection: Draw the backbuff of edge selection only when requested

And make sure the width is 1

4 years agoDepsgraph: Cleanup, move RNA key constructor to it's file
Sergey Sharybin [Mon, 4 Dec 2017 11:59:44 +0000 (12:59 +0100)]
Depsgraph: Cleanup, move RNA key constructor to it's file

4 years agoDepsgraph: Cleanup, don't use bracers in relations names
Sergey Sharybin [Mon, 4 Dec 2017 11:48:16 +0000 (12:48 +0100)]
Depsgraph: Cleanup, don't use bracers in relations names

Those don't bring any information.

4 years agoDepsgraph: Cleanup, node from RNA pointer search
Sergey Sharybin [Mon, 4 Dec 2017 11:45:42 +0000 (12:45 +0100)]
Depsgraph: Cleanup, node from RNA pointer search

4 years agoDepsgraph: Remove unused property based update tags
Sergey Sharybin [Mon, 4 Dec 2017 11:34:25 +0000 (12:34 +0100)]
Depsgraph: Remove unused property based update tags

Those are unused, and not clear whether we will ever support this.

Seems to be better having more like "component" tags, would be less magic
involved to guess what exactly is to be tagged.

4 years agoCleanup: link/append: get rid of booleans in func parameters.
Bastien Montagne [Mon, 4 Dec 2017 12:09:13 +0000 (13:09 +0100)]
Cleanup: link/append: get rid of booleans in func parameters.

One or two are OK, but more make it rather unreadable, and future work
is likely to require more toggle specific behavior here. So switched to
bitflags, switching from short to int and using 16 upper bits for
'internal' ones defined in BLO_readfile.h, combined with 'public' ones
from user interaction, defined in DNA_space_types.h

4 years agoCleanup: wrap long function args in seqeffects
Campbell Barton [Mon, 4 Dec 2017 05:49:30 +0000 (16:49 +1100)]
Cleanup: wrap long function args in seqeffects

4 years agoCleanup: style
Campbell Barton [Mon, 4 Dec 2017 05:37:31 +0000 (16:37 +1100)]
Cleanup: style

4 years agoBLI_ghash: Description of GHash, GSet
Campbell Barton [Sat, 2 Dec 2017 16:35:45 +0000 (03:35 +1100)]
BLI_ghash: Description of GHash, GSet

Also some re-indenting.

4 years agoFix Cycles standalone crash when saving output, after recent refactoring.
Brecht Van Lommel [Sat, 2 Dec 2017 04:44:32 +0000 (05:44 +0100)]
Fix Cycles standalone crash when saving output, after recent refactoring.

4 years agoRemoving OMP: legacy ccgsubsurf.
Bastien Montagne [Thu, 30 Nov 2017 14:55:15 +0000 (15:55 +0100)]
Removing OMP: legacy ccgsubsurf.

Performances gain is rather low this time, about 5% on average (in whole
affected functions).

4 years agoTransform: Use single flag with more meaningful name to prevent snapping to a depende...
Sergey Sharybin [Thu, 30 Nov 2017 14:03:48 +0000 (15:03 +0100)]
Transform: Use single flag with more meaningful name to prevent snapping to a dependent object

The idea of this flag was to prevent snapping onto an object which depends on
currently modifying ones. Using single flag makes more sense here, and also
makes it possible to replace some ob->recalc based magic with depsgraph query
to set those flags.

4 years agoTransform: Remove some legacy code about snapping in particle edit mode
Sergey Sharybin [Thu, 30 Nov 2017 13:52:34 +0000 (14:52 +0100)]
Transform: Remove some legacy code about snapping in particle edit mode

It looks stupid to first force some flag being set and then have workaround
to ignore that flag in snapping code. Let's just not set the flag in the first

The only useful situation where such snapping was usable is to move roots of
disconnected hair, which still works just fine. However, there might be some
other hidden corner case where this workaround was needed.

4 years agoDepsgraph: More full explanation for previous commit
Sergey Sharybin [Thu, 30 Nov 2017 10:57:21 +0000 (11:57 +0100)]
Depsgraph: More full explanation for previous commit

4 years agoDepsgraph: Fix DEG_id_type_tag comment
Dalai Felinto [Thu, 30 Nov 2017 10:53:11 +0000 (08:53 -0200)]
Depsgraph: Fix DEG_id_type_tag comment

4 years agoHaiku OS Support
Campbell Barton [Thu, 30 Nov 2017 06:56:01 +0000 (17:56 +1100)]
Haiku OS Support

D2860 by @miqlas

Even though Haiku is a niche OS, only minor changes are needed.

4 years agoCycles: Improve denoising speed on GPUs with small tile sizes
Lukas Stockner [Fri, 10 Nov 2017 03:34:14 +0000 (04:34 +0100)]
Cycles: Improve denoising speed on GPUs with small tile sizes

Previously, the NLM kernels would be launched once per offset with one thread per pixel.
However, with the smaller tile sizes that are now feasible, there wasn't enough work to fully occupy GPUs which results in a significant slowdown.

Therefore, the kernels are now launched in a single call that handles all offsets at once.
This has two downsides: Memory accesses to accumulating buffers are now atomic, and more importantly, the temporary memory now has to be allocated for every shift at once, increasing the required memory.
On the other hand, of course, the smaller tiles significantly reduce the size of the memory.

The main bottleneck right now is the construction of the transformation - there is nothing to be parallelized there, one thread per pixel is the maximum.
I tried to parallelize the SVD implementation by storing the matrix in shared memory and launching one block per pixel, but that wasn't really going anywhere.

To make the new code somewhat readable, the handling of rectangular regions was cleaned up a bit and commented, it should be easier to understand what's going on now.
Also, some variables have been renamed to make the difference between buffer width and stride more apparent, in addition to some general style cleanup.

4 years agoFix T53410: 3D Text always recalculated
Campbell Barton [Thu, 30 Nov 2017 06:08:37 +0000 (17:08 +1100)]
Fix T53410: 3D Text always recalculated

4 years agoSelect similar for bones by group index
Campbell Barton [Thu, 30 Nov 2017 03:33:58 +0000 (14:33 +1100)]
Select similar for bones by group index

D2931 by @col-one

4 years agoFix T53420: Vertex Groups: The "-" button gets a hidden function
Bastien Montagne [Wed, 29 Nov 2017 19:19:07 +0000 (20:19 +0100)]
Fix T53420: Vertex Groups: The "-" button gets a hidden function

Guess 'remove all unlocked' is new-ish feature...

To be backported to 2.79a (I think).

4 years agoFix T53116: default texture coordinates for volume materials are blank.
José Luis Oliveira Cunha [Wed, 29 Nov 2017 18:18:04 +0000 (19:18 +0100)]
Fix T53116: default texture coordinates for volume materials are blank.

Differential Revision:

4 years agoCycles: add object level holdout property.
Brecht Van Lommel [Sat, 18 Nov 2017 05:06:27 +0000 (06:06 +0100)]
Cycles: add object level holdout property.

This works the same as the holdout shader and Z mask layer. Combined with
overrides in 2.8 this is intended to replace the Z mask layer bits.

4 years agoCycles: improve triangle intersection performance.
Maxym Dmytrychenko [Wed, 29 Nov 2017 01:02:17 +0000 (02:02 +0100)]
Cycles: improve triangle intersection performance.

Reduces render time by about 1-2% in benchmark scenes.

Differential Revision:

4 years agoSequencer: add many more color blend modes, and a new color mix strip.
Maikon Araujo [Mon, 27 Nov 2017 22:33:08 +0000 (23:33 +0100)]
Sequencer: add many more color blend modes, and a new color mix strip.

Differential Revision:

4 years agoFix paint float color blending bugs with alpha 1.0 and vivid light.
Brecht Van Lommel [Wed, 29 Nov 2017 01:13:37 +0000 (02:13 +0100)]
Fix paint float color blending bugs with alpha 1.0 and vivid light.

For some blend modes there would be no effect with factor 1.0, even if factor
0.999 would give a very different image. Now the result should have no

Differential Revision:

4 years agoDepsgraph: Cleanup, use explicit NULL pointer checks
Sergey Sharybin [Wed, 29 Nov 2017 16:55:28 +0000 (17:55 +0100)]
Depsgraph: Cleanup, use explicit NULL pointer checks

4 years agoCleanup: De-duplicate code in object update routines
Sergey Sharybin [Wed, 29 Nov 2017 15:26:16 +0000 (16:26 +0100)]
Cleanup: De-duplicate code in object update routines

4 years agoCleanup: Split depsgraph uber transform function callback
Sergey Sharybin [Wed, 29 Nov 2017 15:22:59 +0000 (16:22 +0100)]
Cleanup: Split depsgraph uber transform function callback

4 years agoCleanup: Remove unused argument
Sergey Sharybin [Wed, 29 Nov 2017 15:14:39 +0000 (16:14 +0100)]
Cleanup: Remove unused argument

4 years agoCleanup: Make object_handle_update easier to follow
Sergey Sharybin [Wed, 29 Nov 2017 15:12:39 +0000 (16:12 +0100)]
Cleanup: Make object_handle_update easier to follow

4 years agoCleanup: Remove unused function
Sergey Sharybin [Wed, 29 Nov 2017 14:59:51 +0000 (15:59 +0100)]
Cleanup: Remove unused function

4 years agoTransform: Avoid use of ob->recalc in snapping code
Sergey Sharybin [Wed, 29 Nov 2017 14:29:39 +0000 (15:29 +0100)]
Transform: Avoid use of ob->recalc in snapping code

Do a direct update of object transform instead, without involving
manual trickery of recalc flag.

Shouldn't be functional changes as far as artists are concerned,
but will allow us to get rid of recalc flags in 2.8.

Thanks Bastien for review!

4 years agoDepsgraph: Fix assert failure
Sergey Sharybin [Wed, 29 Nov 2017 13:58:37 +0000 (14:58 +0100)]
Depsgraph: Fix assert failure

4 years agoCleanup: rename bpy_util -> bpy_capi_utils
Campbell Barton [Wed, 29 Nov 2017 10:11:29 +0000 (21:11 +1100)]
Cleanup: rename bpy_util -> bpy_capi_utils

This is for internal CAPI use only, avoid confusion w/ bpy.utils module.

4 years agoCleanup: Python imports
Campbell Barton [Wed, 29 Nov 2017 07:00:41 +0000 (18:00 +1100)]
Cleanup: Python imports

Split over lines to diff more easily.

4 years agoPyAPI: add function to check any mathutils type
Campbell Barton [Wed, 29 Nov 2017 05:09:46 +0000 (16:09 +1100)]
PyAPI: add function to check any mathutils type

Also add CheckExact versions of type checking macros.

4 years agoRNA: sync API changes from 2.8
Campbell Barton [Wed, 29 Nov 2017 03:09:49 +0000 (14:09 +1100)]
RNA: sync API changes from 2.8

4 years agoRNA: Allow structs to define tags for their properties
Julian Eisel [Wed, 29 Nov 2017 02:52:06 +0000 (13:52 +1100)]
RNA: Allow structs to define tags for their properties

Adds support for defining a number of tags as part of the rna-struct
definition, which its properties can set similar to property-flags.
BPY supports setting these tags when defining custom properties too.

* To define tags for a struct (which its properties can use then), define the tags in an `EnumPropertyItem` array, and assign them to the struct using `RNA_def_struct_property_tags(...)`.
* To set tags for an RNA-property in C, use the new `RNA_def_property_tags(...)`.
* To set tags for an RNA-property in Python, use the newly added tags parameter. E.g. `bpy.props.FloatProperty(name="Some Float", tags={'SOME_TAG', 'ANOTHER_TAG'})`.

4 years agoPyAPI: PyC_Err_PrintWithFunc utility function
Campbell Barton [Wed, 29 Nov 2017 02:41:10 +0000 (13:41 +1100)]
PyAPI: PyC_Err_PrintWithFunc utility function

Move function error printing utility into py_capi_utils.

4 years agoCleanup (remove commented OMP directive).
Bastien Montagne [Tue, 28 Nov 2017 15:31:11 +0000 (16:31 +0100)]
Cleanup (remove commented OMP directive).

4 years agoRemoving OMP: BKE's tracking_stabilize.
Bastien Montagne [Tue, 28 Nov 2017 11:38:10 +0000 (12:38 +0100)]
Removing OMP: BKE's tracking_stabilize.

Again, 2 times quicker with BLI than with OMP (from about 5ms to 2.5ms
per frame for the parallelized loop, on a rather small video...).

4 years agomakesdna/makesrna: silence output by default
Campbell Barton [Tue, 28 Nov 2017 09:27:40 +0000 (20:27 +1100)]
makesdna/makesrna: silence output by default

No need to print status for basic & reliable operations,
build systems can output operations they run if needed,
or debug output changed in the source if developers are debugging.

Nice for ninja, so any printed text hints at a problem to fix.

4 years agoFix T53145: bevel tool does not start with amount at zero.
Brecht Van Lommel [Mon, 27 Nov 2017 15:55:27 +0000 (16:55 +0100)]
Fix T53145: bevel tool does not start with amount at zero.

4 years agoCleanup: indentation
Sergey Sharybin [Mon, 27 Nov 2017 15:22:09 +0000 (16:22 +0100)]
Cleanup: indentation

4 years agoRemove workaround for loopcut and DM stability
Sergey Sharybin [Mon, 27 Nov 2017 14:39:32 +0000 (15:39 +0100)]
Remove workaround for loopcut and DM stability

Neither me nor Campbell could redo the issue, lets get rid of this workaround
and fix it properly if still needed.

4 years agoDepsgraph: Make sure unexpected configuration does not happen
Sergey Sharybin [Mon, 27 Nov 2017 13:51:49 +0000 (14:51 +0100)]
Depsgraph: Make sure unexpected configuration does not happen

4 years agoSequencer: Fix missing FX compositor when starting rendering from frame with DoF...
Sergey Sharybin [Mon, 27 Nov 2017 13:24:16 +0000 (14:24 +0100)]
Sequencer: Fix missing FX compositor when starting rendering from frame with DoF disabled

4 years agoSequencer: Add option to render OpenGL preview with DoF
Sergey Sharybin [Fri, 24 Nov 2017 11:19:26 +0000 (12:19 +0100)]
Sequencer: Add option to render OpenGL preview with DoF

The title says it all actually, controlled with DoF check box next to textured
solid check box.

Thanks Campbell for review!

4 years agoRefactor view3d offscreen drawing to avoid having multiple boolean arguments
Sergey Sharybin [Fri, 24 Nov 2017 10:43:16 +0000 (11:43 +0100)]
Refactor view3d offscreen drawing to avoid having multiple boolean arguments

This is fully unreadable to have lots of boolean arguments scattered across the
whole argument list. What does `false, true, true` mean in terms of behavior?

Replace those with bitfield which has advantage of having more human readable

4 years agoTracking: Cleanup. make code friendly for multi-column editing
Sergey Sharybin [Mon, 27 Nov 2017 07:50:01 +0000 (08:50 +0100)]
Tracking: Cleanup. make code friendly for multi-column editing

4 years agoCleanup: incorrect comment
Campbell Barton [Mon, 27 Nov 2017 04:15:56 +0000 (15:15 +1100)]
Cleanup: incorrect comment

4 years agoCleanup: ImageEditor's mask drawing code was re-implementing `BKE_maskrasterize_buffer`!
Bastien Montagne [Sun, 26 Nov 2017 18:18:12 +0000 (19:18 +0100)]
Cleanup: ImageEditor's mask drawing code was re-implementing `BKE_maskrasterize_buffer`!

So this deduplicates and simplifies code, yeah.

Also, as an odd bonus, new code seems slighly quicker than previous one
(about 5 to 10% quicker).

4 years agoRemoving OMP: BKE's mask_rasterize.c
Bastien Montagne [Sun, 26 Nov 2017 18:06:26 +0000 (19:06 +0100)]
Removing OMP: BKE's mask_rasterize.c

Once again nothing much to say here, except that whole mask rendering
process from VSE is about 25% quicker now. ;)

4 years agoRemoving OMP: autotrack BKE code.
Bastien Montagne [Sun, 26 Nov 2017 16:25:41 +0000 (17:25 +0100)]
Removing OMP: autotrack BKE code.

Pretty straightforward this time, we already have a single struct
pointer containing all needed data (or nearly).

And we gain about 10-15% speed on tracking! :)

4 years agoRemoving OMP: bmesh_operators.c
Bastien Montagne [Sun, 26 Nov 2017 14:51:50 +0000 (15:51 +0100)]
Removing OMP: bmesh_operators.c

Two more 'not really useful' cases (OMP only shows some noticeable
speedup with above 1M elements, and since this is quick operation anyway
compared to even ather basic operators, gain is in the 1% area of total
processing time in best case).

So not worth parallelizing here, we'll gain much more on tackling heavy
operations. ;)

And BMesh is free from OMP now!

4 years agoRemoving OMP: bmesh_interp.c
Bastien Montagne [Sun, 26 Nov 2017 12:06:39 +0000 (13:06 +0100)]
Removing OMP: bmesh_interp.c

Performances tests on this one are quite surprising actually...
Parallelized loop itself is at least 10 times quicker with new BLI_task
code than it was with OMP. And subdividing e.g. a heavy mesh with 3
levels of multires (whole process) takes 8 seconds with new code, while
10 seconds with OMP one. And cherry on top, BLI_task code only uses
about 50% of CPU load, while OMP one was at nearly 100%!

In fact, I suspect OMP code was not properly declaring outside vars,
generating a lot of uneeded locks.

Also, raised the minimum level of subdiv to enable parallelization,
tests here showed that we only start to get significant gain with subdiv
levels of 4, below single threaded one is quicker.

4 years agoRemoving OMP: nuke last usages in bmesh_mesh.c
Bastien Montagne [Sun, 26 Nov 2017 10:36:50 +0000 (11:36 +0100)]
Removing OMP: nuke last usages in bmesh_mesh.c

Those three ones were actually giving no significant benefits, in fact
even slowing things down in one case compared to no parallelization at
all (in `BM_mesh_elem_table_ensure()`).

Point being, once more, parallelizing *very* small tasks (like index or
flag setting, etc.) is nearly never worth it.

Also note that we could not easlily use per-item parallel looping in
those three cases, since they are heavily relying on valid
loop-generated index (or are doing non-threadable things like allocation
from a mempool)...

4 years agoFix T53349: AO bounces not working correct with OpenCL.
Mathieu Menuet [Sun, 26 Nov 2017 14:50:36 +0000 (15:50 +0100)]
Fix T53349: AO bounces not working correct with OpenCL.

4 years agoCleanup: rename edge -> edges
Campbell Barton [Sun, 26 Nov 2017 09:13:18 +0000 (20:13 +1100)]
Cleanup: rename edge -> edges

4 years agoMinor improvement to last commit
Campbell Barton [Sun, 26 Nov 2017 07:34:21 +0000 (18:34 +1100)]
Minor improvement to last commit

Don't operate on multiple boundaries at once,
instead keep collapsing from the first selected boundary.

4 years agoBMesh: improve edge rotate when edges share faces
Campbell Barton [Sun, 26 Nov 2017 06:48:00 +0000 (17:48 +1100)]
BMesh: improve edge rotate when edges share faces

Previously outcome depended on order of edges,
now the longest boundary edges are rotated first,
then the faces connected edges.

This gives more predictable results, allowing regions containing
a vertex fan to be rotated onto the next vertex.

4 years agoCleanup: move edge-rotate into own file
Campbell Barton [Sun, 26 Nov 2017 02:40:26 +0000 (13:40 +1100)]
Cleanup: move edge-rotate into own file

4 years agoFix T53393: Change from 'd' key to 'draw' panel button causes pencil to be activated...
Joshua Leung [Sun, 26 Nov 2017 00:05:33 +0000 (13:05 +1300)]
Fix T53393: Change from 'd' key to 'draw' panel button causes pencil to be activated immediately instead of upon LMB

4 years agoFix for Fix (c): broken atomic lock in own bmesh code.
Bastien Montagne [Sat, 25 Nov 2017 22:14:54 +0000 (23:14 +0100)]
Fix for Fix (c): broken atomic lock in own bmesh code.

That was a nasty one, Debug build would never have any issue (even tried
with 64 threads!), but Release build would deadlock nearly immediately,
even with only 2 threads!

What happened here (I think) is that gcc optimizer would generate a
specific path endlessly looping when initial value of virtual_lock was
FLT_MAX, by-passing re-assignment from v_no[0] and the atomic cas
completely. Which would have been correct, should v_no[0] not have been
shared (and modified) by multiple threads. ;)

Idea of that (broken) for loop was to avoid completely calling the
atomic cas as long as v_no[0] was locked by some other thread, but...
Guess the avoided/missing memory barrier was the root of the issue here.

Lesson of the evening: Remember kids, do not trust your compiler to
understand all possible threading-related side effects, and be explicit
rather than elegant when using atomic ops!

Side-effect lesson: do check both release and debug builds when messing
with said atomic ops...

4 years agoFix broken atomic_cas lock in own recent commit in bmesh.
Bastien Montagne [Sat, 25 Nov 2017 19:28:12 +0000 (20:28 +0100)]
Fix broken atomic_cas lock in own recent commit in bmesh.

Using atomic cas correctly is really hairy... ;)

In this case, the returned value from cas needs to validate *two*
conditions, it must not be FLT_MAX (which is our 'locked' value and
would mean another thread has already locked it), but it also must be
equal to previously stored value...

This means we need two steps per loop here, hence using a 'for' loop
instead of a 'while' one now.

Note that collisions are (as expected) very rare, less than 1 for 10k
typically, so did not catch the issue initially (also because I was
mostly working with release build to check on performances...).

4 years agoDepsgraph: Cleanup, indentation
Sergey Sharybin [Fri, 24 Nov 2017 14:45:41 +0000 (15:45 +0100)]
Depsgraph: Cleanup, indentation

4 years agoDepsgraph: Allow finding operations after construction is done
Sergey Sharybin [Fri, 24 Nov 2017 14:37:51 +0000 (15:37 +0100)]
Depsgraph: Allow finding operations after construction is done

4 years agoDepsgraph: Deduplicate operation node finding logic
Sergey Sharybin [Fri, 24 Nov 2017 14:35:42 +0000 (15:35 +0100)]
Depsgraph: Deduplicate operation node finding logic

4 years agoDepsgraph: Use proper return type for find_node method
Sergey Sharybin [Fri, 24 Nov 2017 14:34:53 +0000 (15:34 +0100)]
Depsgraph: Use proper return type for find_node method

4 years agoDepsgraph: Use get_ prefix for function which expect operation to exists
Sergey Sharybin [Fri, 24 Nov 2017 14:32:29 +0000 (15:32 +0100)]
Depsgraph: Use get_ prefix for function which expect operation to exists

4 years agoDepsgraph: Make has_ prefixed function to return boolean
Sergey Sharybin [Fri, 24 Nov 2017 14:26:54 +0000 (15:26 +0100)]
Depsgraph: Make has_ prefixed function to return boolean

4 years agoDepsgraph: Introduce explicit method which finds operation or returns NULL
Sergey Sharybin [Fri, 24 Nov 2017 14:24:33 +0000 (15:24 +0100)]
Depsgraph: Introduce explicit method which finds operation or returns NULL

4 years agoDepsgraph: Make more clear what find_operation() is doing for component
Sergey Sharybin [Fri, 24 Nov 2017 14:21:50 +0000 (15:21 +0100)]
Depsgraph: Make more clear what find_operation() is doing for component

4 years agoCleanup leftover timing debug prints from own recent commits.
Bastien Montagne [Fri, 24 Nov 2017 09:43:29 +0000 (10:43 +0100)]
Cleanup leftover timing debug prints from own recent commits.

Sorry about that...

4 years agoCleanup: -Wnonnull-compare GCC warning
Campbell Barton [Fri, 24 Nov 2017 03:28:35 +0000 (14:28 +1100)]
Cleanup: -Wnonnull-compare GCC warning

4 years agoMinor cleanup for own recent commits.
Bastien Montagne [Thu, 23 Nov 2017 21:43:11 +0000 (22:43 +0100)]
Minor cleanup for own recent commits.

4 years agoGetting rid of OMP: first usage of new parallel BMesh items iteration instead.
Bastien Montagne [Thu, 23 Nov 2017 20:21:32 +0000 (21:21 +0100)]
Getting rid of OMP: first usage of new parallel BMesh items iteration instead.

`BM_mesh_normals_update` was converted from OMP to new parallel iterator code,
basic test with heavily subdivided cube (24.5k faces) gives:
    - old OMP code: average 10ms per run.
    - new BLI_task code: average 6ms per run.

So new code seems to be easily 40% quicker, in addition to getting rid of OMP. ;)

Reviewers: sergey, campbellbarton

Differential Revision:

4 years agoBMesh: add limited support for parallelization over some basic iterators.
Bastien Montagne [Thu, 23 Nov 2017 20:19:54 +0000 (21:19 +0100)]
BMesh: add limited support for parallelization over some basic iterators.

This merely uses new memloop/task looper over vertex/edge/face mempools.

Quite obviously, only BM_VERTS/EDGES/FACES_OF_MESH iterators are

4 years agoatomic_ops: add `atomic_cas_float` helper.
Bastien Montagne [Thu, 23 Nov 2017 20:17:16 +0000 (21:17 +0100)]
atomic_ops: add `atomic_cas_float` helper.

4 years agoAdd a new parallel looper for MemPool items to BLI_task.
Bastien Montagne [Thu, 23 Nov 2017 20:14:43 +0000 (21:14 +0100)]
Add a new parallel looper for MemPool items to BLI_task.

It merely uses the new thread-safe iterators system of mempool, quite
straight forward.

Note that to avoid possible confusion with two void pointers as
parameters of the callback, a dummy opaque struct pointer is used
instead for the second parameter (pointer generated by iteration over
mempool), callback functions must explicitely convert it to expected
real type.

Also added a basic gtest for this new feature.

4 years agoAdd ability to use more than one mempool iterator simultaneously.
Bastien Montagne [Thu, 23 Nov 2017 20:12:00 +0000 (21:12 +0100)]
Add ability to use more than one mempool iterator simultaneously.

This will allow threaded tasks to 'consume' all mempool items in
parallel tasks, each one working on a whole chunk at once (to reduce
concurrency managing overhead).

4 years agoatomic_ops: Copy/adapt static assert macro from BLI_utildefines, and use it.
Bastien Montagne [Thu, 23 Nov 2017 19:18:21 +0000 (20:18 +0100)]
atomic_ops: Copy/adapt static assert macro from BLI_utildefines, and use it.

Checking for type sizes is much nicer with a static assert!

4 years agoAdd non-gcc variant of static assert macro.
Bastien Montagne [Thu, 23 Nov 2017 19:15:15 +0000 (20:15 +0100)]
Add non-gcc variant of static assert macro.

Adapted from

Note that this macro just discards error message, so error when building
is much less nice than with gcc's _Static_assert... But error log will
point to right place in code, so should still be OK.

4 years agoFix T53145: bevel tool fails when used a second time.
Brecht Van Lommel [Thu, 23 Nov 2017 19:14:31 +0000 (20:14 +0100)]
Fix T53145: bevel tool fails when used a second time.

Pixel size was not initial early enough. For first time this was not a problem
because the bevel amount starts at 0 then, and after the mouse moves the pixel
size is initialized. For the second time the bevel amount starts at a non-zero
value, and it failed then.