blender.git
2 years agoCycles: better path termination for transparency.
Brecht Van Lommel [Tue, 20 Feb 2018 13:22:40 +0000 (14:22 +0100)]
Cycles: better path termination for transparency.

We now continue transparent paths after diffuse/glossy/transmission/volume
bounces are exceeded. This avoids unexpected boundaries in volumes with
transparent boundaries. It is also required for MIS to work correctly with
transparent surfaces, as we also continue through these in shadow rays.

The main visible changes is that volumes will now be lit by the background
even at volume bounces 0, same as surfaces.

Fixes T53914 and T54103.

2 years agoCycles: make principled BSDF node wider in the node editor by default.
Brecht Van Lommel [Mon, 19 Feb 2018 22:47:42 +0000 (23:47 +0100)]
Cycles: make principled BSDF node wider in the node editor by default.

2 years agoCode cleanup: fix incorrect socket names in hair and particle info nodes.
Brecht Van Lommel [Wed, 21 Feb 2018 12:18:40 +0000 (13:18 +0100)]
Code cleanup: fix incorrect socket names in hair and particle info nodes.

2 years agoFix incorrect OSL raytype bits and add some comments.
Brecht Van Lommel [Tue, 20 Feb 2018 13:36:50 +0000 (14:36 +0100)]
Fix incorrect OSL raytype bits and add some comments.

2 years agoFix T54105: random walk SSS missing in branched indirect paths.
Brecht Van Lommel [Mon, 19 Feb 2018 23:15:14 +0000 (00:15 +0100)]
Fix T54105: random walk SSS missing in branched indirect paths.

Unify the path and branched path indirect SSS code. No performance impact
found on CUDA, for AMD split kernel the extra code was already there.

2 years agoFix T54107: bevel shader + normal map gives wrong result.
Brecht Van Lommel [Tue, 20 Feb 2018 19:24:40 +0000 (20:24 +0100)]
Fix T54107: bevel shader + normal map gives wrong result.

2 years agoCleanup: Don't perform borderselect on channels that aren't visible
Joshua Leung [Wed, 21 Feb 2018 11:59:15 +0000 (00:59 +1300)]
Cleanup: Don't perform borderselect on channels that aren't visible

2 years agoFix: Return back to conventional way of averaging points for keyframe de-dup
Joshua Leung [Wed, 21 Feb 2018 11:44:03 +0000 (00:44 +1300)]
Fix: Return back to conventional way of averaging points for keyframe de-dup

The other approach was causing too much error in some cases (e.g. favouring
the lower-valued keyframes). This fix should make the resulting curves less
bumpy/jagged.

2 years agoFix: Forgot to recalculate handles after deleting keyframes
Joshua Leung [Wed, 21 Feb 2018 10:21:56 +0000 (23:21 +1300)]
Fix: Forgot to recalculate handles after deleting keyframes

2 years agoFix: Don't average keyframe values if FCurve can only have int/discrete values
Joshua Leung [Wed, 21 Feb 2018 09:37:48 +0000 (22:37 +1300)]
Fix: Don't average keyframe values if FCurve can only have int/discrete values

This is to prevent problems with integer/enum properties getting invalid
values set.

2 years agoCleanup: Delete debugging code and the old version of the automerge code
Joshua Leung [Wed, 21 Feb 2018 06:15:41 +0000 (19:15 +1300)]
Cleanup: Delete debugging code and the old version of the automerge code

2 years agoTweak/Fix for T54106 - Moving multiple selected keyframes on top of an unselected...
Joshua Leung [Wed, 21 Feb 2018 06:14:33 +0000 (19:14 +1300)]
Tweak/Fix for T54106 - Moving multiple selected keyframes on top of an unselected one would not merge the keys

This commit removes an earlier attempt at optimising the lookups
for duplicates of a particular tRetainedKeyframe once we'd already
deleted all the selected copies. The problem was that now, instead
of getting rid of the unselected keys (i.e. the basic function here),
we were only getting rid of the selected duplicates.

With this fix, unselected keyframes will now get removed (as expected)
again. However, we currently don't take their values into account
when merging keyframes, since it is assumed that we don't care so much
about their values when overriding.

2 years agoMinor Optimisation: Terminate early if we've passed the insertion point for tRetained...
Joshua Leung [Wed, 21 Feb 2018 05:59:15 +0000 (18:59 +1300)]
Minor Optimisation: Terminate early if we've passed the insertion point for tRetainedKeyframes

2 years agoFeature Request T54106: When scaling keyframes, merge (by-averaging) selected keys
Joshua Leung [Wed, 21 Feb 2018 04:53:54 +0000 (17:53 +1300)]
Feature Request T54106: When scaling keyframes, merge (by-averaging) selected keys
that end up on the same frame

Currently, when scaling keyframes in the Dopesheet, if multiple
selected keyframes end up on the same frame post-scaling, they
would not get removed by the "Automerge" setting that normally
removes duplicates on the same frame.

This commit changes the behaviour so that when multiple selected
keyframes end up on the same frame, instead of keeping all these
around on the same frame (e.g. resulting in a column of keyframes
on different values), we will instead merge them into a single
keyframe (by averaging the values). This should result in a
smoother F-Curve with fewer "stair-steps" that need to be carefully
cleaned out afterwards.

Requested by @hjalti

2 years agobezt_add_to_cfra_elem() - Use same keyframe equality test as in other places
Joshua Leung [Thu, 15 Feb 2018 04:40:19 +0000 (17:40 +1300)]
bezt_add_to_cfra_elem() - Use same keyframe equality test as in other places

This shouldn't affect anything currently, as this function doesn't appear
to get used anywhere.

2 years agoFix T54065: NLA-Strip Control Curves would get disabled when name-based-filtering...
Joshua Leung [Thu, 15 Feb 2018 03:39:46 +0000 (16:39 +1300)]
Fix T54065: NLA-Strip Control Curves would get disabled when name-based-filtering is enabled

This bug took a while to track down. In the test file with this report,
the Nla-Strip Control Curve for strip time would get disabled if you
changed the NLA Editor to a second Graph Editor instance.

It turns out that because this second Graph Editor would have the
"filter fcurves by name" option enabled, this would trigger a lookup
of the referenced property's name (in order to test whether it matched
the filtering criteria). However, since that filtering code was written
before the introduction of these curves, it still assumed that the names
for these Control Curves should be handled the same as for standard FCurves.
Unfortunately, that doesn't work, as the property lookups fail if the standard
method is used - when the lookups fail, the F-Curves get tagged as being
invalid/disabled (and need to be reset using the "Revive Disabled FCurves"
operator).

Note: The changes in this patch look complicated, as I've had to shuffle
a bit of code around so that the name-filtering check can have access to
the additional info it needs. In the process, I've also removed the earlier
(hacky) approach where the control curves were getting added to a temp
buffer to get changed from normal FCurves to special ANIMTYPE_NLACURVES.

2 years agoFix more missing ID remapping in animation editor callbacks
Joshua Leung [Thu, 15 Feb 2018 02:45:08 +0000 (15:45 +1300)]
Fix more missing ID remapping in animation editor callbacks

Applying the same fixes as introduced in 98d797b67c07e85889768bf8ecde292e9e6f70e9
this time, for the Graph and NLA editors

2 years agoDepsgraph: Fix fake dependency cycle with chained IK solvers with tip excluded
Sergey Sharybin [Wed, 21 Feb 2018 11:04:28 +0000 (12:04 +0100)]
Depsgraph: Fix fake dependency cycle with chained IK solvers with tip excluded

Not sure why we need a relation from solver to a tip local transform, this
will be handled via parent relation.

Fixes remaining dependency cycles reported in T54083.

2 years agoDepsgraph: Fix dependency when constraint influence drives some other constraint
Sergey Sharybin [Wed, 21 Feb 2018 10:13:25 +0000 (11:13 +0100)]
Depsgraph: Fix dependency when constraint influence drives some other constraint

It is not possible to address transform at particular position of constraint
stack, and when constraint is being addressed is usually from driver variable.

This fixes some of dependency cycles reported in T54083.

2 years agoDepsgraph: Split debug flags
Sergey Sharybin [Wed, 21 Feb 2018 09:44:36 +0000 (10:44 +0100)]
Depsgraph: Split debug flags

Now it's possible to have debug messages for following things:

- Graph construction
- Graph evaluation
- Graph tagging

2 years agoDepsgraph: Fix crash using --debug-depsgraph and --debug-depsgraph-no-threads
Sergey Sharybin [Wed, 21 Feb 2018 09:42:22 +0000 (10:42 +0100)]
Depsgraph: Fix crash using --debug-depsgraph and --debug-depsgraph-no-threads

Was accessing past the array boundaries.

Should be safe for 2.79a.

2 years agoDepsgraph: Report overall number of cycles detected
Sergey Sharybin [Tue, 20 Feb 2018 16:16:41 +0000 (17:16 +0100)]
Depsgraph: Report overall number of cycles detected

Handy to quickly see if a fix fixed any of the cycles in a real rig,
or whether it's introduced new ones.

2 years agoVSE: skip non image/movie w/ proxy dir storage
Campbell Barton [Wed, 21 Feb 2018 07:13:40 +0000 (18:13 +1100)]
VSE: skip non image/movie w/ proxy dir storage

This would use uninitialized filename variable,
looked into supporting this however generating proxies currently only
works for movies.

2 years agoCleanup: split normals: use different varnames for angle and its cosine.
Bastien Montagne [Tue, 20 Feb 2018 12:03:10 +0000 (13:03 +0100)]
Cleanup: split normals: use different varnames for angle and its cosine.

Using same name for two different things is not the best idea ever...

2 years agoFix T54069: Vertex groups for hair length is wrong in some cases
Sergey Sharybin [Tue, 20 Feb 2018 09:47:01 +0000 (10:47 +0100)]
Fix T54069: Vertex groups for hair length is wrong in some cases

This is a regression in rB4f1c0a1 which only allowed cutting haior at the
second segment only, while there is nothing wrong with cutting hair at the
first segmewnt.

2 years agoFix T54096: Subdivision Surface + Boolean Modifiers + Transform = crash
Sergey Sharybin [Mon, 19 Feb 2018 15:16:56 +0000 (16:16 +0100)]
Fix T54096: Subdivision Surface + Boolean Modifiers + Transform = crash

Don't use dm->get*Array for DM you don't own. This call can allocate temporary
CD layer, which is not thread safe at all.

Also removed hard-coded logic around CDDM check. new functions will do same
logic, but are mode DM-type-=independent.

2 years agoFix T53032: Image sequence works bad with Displace modifier
Sergey Sharybin [Mon, 19 Feb 2018 13:33:48 +0000 (14:33 +0100)]
Fix T53032: Image sequence works bad with Displace modifier

We shouldn't mix image pool acuisition with and without user provided,
the fact that internally image.c uses last frame from Image datablock
confuses the logic.

2 years agoCleanup: rename SequenceEditor instance to 'ed'
Campbell Barton [Mon, 19 Feb 2018 11:32:41 +0000 (22:32 +1100)]
Cleanup: rename SequenceEditor instance to 'ed'

Name 'sequencer' & 'sequence' are too similar.

2 years agoCleanup: remove BMeshToMeshParams.calc_tessface
Campbell Barton [Mon, 19 Feb 2018 06:41:37 +0000 (17:41 +1100)]
Cleanup: remove BMeshToMeshParams.calc_tessface

This wasn't used, tessface is being phased out.
Caller can run explicitly if needed.

2 years agoFix T54098: Crash existing /w dyntopo sculpt
Campbell Barton [Mon, 19 Feb 2018 06:27:01 +0000 (17:27 +1100)]
Fix T54098: Crash existing /w dyntopo sculpt

Optionally don't remap indices for objects.

Checking all objects parent's would reference a freed pointer
while freeing all objects.

In the case of dynamic topology there is no use in keeping track
of hook/vertex-parent indices.

Also disable this when creating meshes for undo storage
since adding an undo step shouldn't be modifying other objects.

2 years agoCleanup: sync vertex-paint and sculpt from 2.8
Campbell Barton [Mon, 19 Feb 2018 01:20:18 +0000 (12:20 +1100)]
Cleanup: sync vertex-paint and sculpt from 2.8

Sync API changes from 2.8 to master.

2 years agoFix T54089: missing GLSL material draw update when changing object pass index.
Brecht Van Lommel [Sun, 18 Feb 2018 18:28:14 +0000 (19:28 +0100)]
Fix T54089: missing GLSL material draw update when changing object pass index.

2 years agoCleanup: group BLI_ghash_utils.c API in BLU_ghash.h
Campbell Barton [Sun, 18 Feb 2018 11:10:56 +0000 (22:10 +1100)]
Cleanup: group BLI_ghash_utils.c API in BLU_ghash.h

2 years agoCleanup: split GHash helpers from implementation
Campbell Barton [Sun, 18 Feb 2018 10:44:56 +0000 (21:44 +1100)]
Cleanup: split GHash helpers from implementation

2 years agoCleanup: add 2d suffix to BLI files
Campbell Barton [Sun, 18 Feb 2018 10:27:33 +0000 (21:27 +1100)]
Cleanup: add 2d suffix to BLI files

Some of these API's can have 3D versions, explicitly name them 2D.

2 years agoCycles: tweak CUDA messages and avoid build errors with existing sm_2x configs.
Brecht Van Lommel [Tue, 6 Feb 2018 14:19:25 +0000 (15:19 +0100)]
Cycles: tweak CUDA messages and avoid build errors with existing sm_2x configs.

2 years agoCode cleanup: remove some more unused code after recent CUDA changes.
Brecht Van Lommel [Sat, 17 Feb 2018 23:51:46 +0000 (00:51 +0100)]
Code cleanup: remove some more unused code after recent CUDA changes.

2 years agoCycles: Remove Fermi texture code.
Thomas Dinges [Sat, 17 Feb 2018 21:56:58 +0000 (22:56 +0100)]
Cycles: Remove Fermi texture code.

This should be the last Fermi removal commit, unless I missed something.
It's been a pleasure Fermi!

2 years agoCycles: Remove fermi related defines from the code.
Thomas Dinges [Sat, 17 Feb 2018 21:19:54 +0000 (22:19 +0100)]
Cycles: Remove fermi related defines from the code.

Did not touch Texture related defines, that comes next.

2 years agoCycles: Remove Fermi support from CMake and update runtime checks in device_cuda...
Thomas Dinges [Sat, 17 Feb 2018 15:15:07 +0000 (16:15 +0100)]
Cycles: Remove Fermi support from CMake and update runtime checks in device_cuda.cpp.

Fermi code in Cycles kernel and texture system are coming next.

2 years agoBuildbot: Disable Cycles CUDA support on 32bit, and stop building sm_2x.
Thomas Dinges [Sat, 17 Feb 2018 14:49:37 +0000 (15:49 +0100)]
Buildbot: Disable Cycles CUDA support on 32bit, and stop building sm_2x.

2 years agofix:T50079 collada matrix and blender matrix are transposed. This was not regarded...
Gaia Clary [Fri, 16 Feb 2018 15:58:20 +0000 (16:58 +0100)]
fix:T50079 collada matrix and blender matrix are transposed. This was not regarded by the animation importer, so it was creating very odd results

2 years agofix: limit precision also for animation matrixes if the limit option is set (gives...
Gaia Clary [Fri, 16 Feb 2018 15:53:16 +0000 (16:53 +0100)]
fix: limit precision also for animation matrixes if the limit option is set (gives nicer output for inspection)

2 years agoFix rotation issues due to matrix to quaternion ambiguities
Gaia Clary [Fri, 16 Feb 2018 11:37:36 +0000 (12:37 +0100)]
Fix rotation issues due to matrix to quaternion ambiguities

Reviewers: mont29

Reviewed By: mont29

Subscribers: mont29

Differential Revision: https://developer.blender.org/D3066

2 years agoCode cleanup: deduplicate code for running Python scripts outside Blender.
Brecht Van Lommel [Fri, 16 Feb 2018 00:22:34 +0000 (01:22 +0100)]
Code cleanup: deduplicate code for running Python scripts outside Blender.

2 years agoTests: add OpenGL UI drawing tests.
Brecht Van Lommel [Wed, 14 Feb 2018 19:33:33 +0000 (20:33 +0100)]
Tests: add OpenGL UI drawing tests.

This reuses the Cycles regression test code to also work for OpenGL UI drawing.
We launch Blender with a bunch of .blend files, take a screenshot and compare
it with a reference screenshot, and generate a HMTL report showing the failed
tests and their differences.

For Cycles we keep small reference renders to compare to in svn, but for OpenGL
developers currently have to generate the references manually. How to use:

* WITH_OPENGL_DRAW_TESTS=ON in CMake
* BLENDER_TEST_UPDATE=1 ctest -R opengl_draw
* .. make code changes ..
* ctest -R opengl_draw
* open build_dir/tests/opengl_draw/report.html

Differential Revision: https://developer.blender.org/D3064

2 years agoTests: split off render report test code from Cycles tests.
Brecht Van Lommel [Wed, 14 Feb 2018 16:33:06 +0000 (17:33 +0100)]
Tests: split off render report test code from Cycles tests.

This renames test environment variables from CYCLESTEST_* to BLENDER_TEST_*.

Differential Revision: https://developer.blender.org/D3064

2 years agoFix bplayer (c)
Bastien Montagne [Fri, 16 Feb 2018 09:42:43 +0000 (10:42 +0100)]
Fix bplayer (c)

2 years agoFix part II of T53977: Severe problem with multiple instances of a library (save...
Bastien Montagne [Fri, 16 Feb 2018 09:31:03 +0000 (10:31 +0100)]
Fix part II of T53977: Severe problem with multiple instances of a library (save and reload).

Once 'losing lib' issue is fixed (in previous commit), we have new issue
that this could lead to several copies of the same linked data-block in
.blend file. Which is not good. At all.

So had to add a GHash-based check in libraries reading code to ensure we
only load a same ID from a same lib once.

2 years agoFix part I of T53977: Severe problem with multiple instances of a library (save and...
Bastien Montagne [Tue, 13 Feb 2018 19:58:40 +0000 (20:58 +0100)]
Fix part I of T53977: Severe problem with multiple instances of a library (save and reload).

The issue was that when a same lib was found several times in loaded
.blend, we'd only keep the first occurence. But since Blender expects
next data-blocks to belong to last found library, we could actually
be adding data-blocks assigned to copies of the duplicated lib to
another, totally unrelated lib.

Those data-blocks were then obviously not found when actually loading
libs content, and lost.

Note that this only fix one part of the issue, current code can
generate several copies of same linked data-block now, will fix in
another commit.

2 years agoCode cleanup: simplify switch statement, ensure we catch missing enums.
Brecht Van Lommel [Thu, 15 Feb 2018 17:13:07 +0000 (18:13 +0100)]
Code cleanup: simplify switch statement, ensure we catch missing enums.

2 years agoFix T54073: crash and uninitialized memory in Cycles displacement hashing.
Brecht Van Lommel [Thu, 15 Feb 2018 14:28:34 +0000 (15:28 +0100)]
Fix T54073: crash and uninitialized memory in Cycles displacement hashing.

2 years agoFix crash reading deg_point_cache_transform.blend test, saved with 2.8.
Brecht Van Lommel [Thu, 15 Feb 2018 15:25:37 +0000 (16:25 +0100)]
Fix crash reading deg_point_cache_transform.blend test, saved with 2.8.

In general 2.8 files may not be readable in master, but might as well fix
this case so all the lib/tests can be opened still.

2 years agoCleanup: Remove debug-only code
Sergey Sharybin [Thu, 15 Feb 2018 16:57:44 +0000 (17:57 +0100)]
Cleanup: Remove debug-only code

2 years agoFix T54076: MCE in Graph mode - clip.graph_select_border does not work by header...
Sergey Sharybin [Thu, 15 Feb 2018 15:56:49 +0000 (16:56 +0100)]
Fix T54076: MCE in Graph mode - clip.graph_select_border does not work by header menu

While the script should be using INVOKE_PREVIEW for operators in clip view,
window manager was lacking some switch statements.

Thanks Brecht fore review!

2 years agoCleanup: rename BLI_thread.h API
Campbell Barton [Thu, 15 Feb 2018 14:13:46 +0000 (01:13 +1100)]
Cleanup: rename BLI_thread.h API

- Use BLI_threadpool_ prefix for (deprecated)
  thread/listbase API.
- Use BLI_thread as prefix for other functions.

See P614 to apply instead of manually resolving conflicts.

2 years agoCleanup: use '_len' instead of '_size' w/ BLI API
Campbell Barton [Thu, 15 Feb 2018 12:36:11 +0000 (23:36 +1100)]
Cleanup: use '_len' instead of '_size' w/ BLI API

- When returning the number of items in a collection use BLI_*_len()
- Keep _size() for size in bytes.
- Keep _count() for data structures that don't store length
  (hint this isn't a simple getter).

See P611 to apply instead of manually resolving conflicts.

2 years agoCleanup: Style, braces with macros
Sergey Sharybin [Thu, 15 Feb 2018 11:41:35 +0000 (12:41 +0100)]
Cleanup: Style, braces with macros

See https://wiki.blender.org/index.php/Dev:Doc/Code_Style#Braces_with_Macros

2 years agoCleanup: Remove BLI_ prefix from listbase macro
Sergey Sharybin [Thu, 15 Feb 2018 11:38:21 +0000 (12:38 +0100)]
Cleanup: Remove BLI_ prefix from listbase macro

This is kind of doesn't matter where macro itself is defined.

We should stick to the following:

- If some macro is actually more an inline function, follow regular
  function name conventions.
- If macro is a macro, type it in capitals. Use module prefix if that
  helps readability or it if helps avoiding accidents.

2 years agoSimple hair children: Make twist affected by texture
Sergey Sharybin [Thu, 15 Feb 2018 10:22:44 +0000 (11:22 +0100)]
Simple hair children: Make twist affected by texture

This completes twist feature, which is now possible to also control by
texture. Since textures can not easily contain negative values as well,
same trick with 0.5 neutral as vertex groups is used.

All in all, this twist features allows to do following things.

Original hair:

{F2287535}

Hair with scientifically calculated twist value of 0.5:

{F2287540}

And we can also twist braids in opposite directions dependent on left/right
side:

{F2287548}

2 years agoFix T54078: Adding subsurf prior to particle system breaks simple children vgroups...
Sergey Sharybin [Thu, 15 Feb 2018 09:27:39 +0000 (10:27 +0100)]
Fix T54078: Adding subsurf prior to particle system breaks simple children vgroups and textures

cpa->num points to a face index on BASE mesh, but get_child_modifier_parameters()
expects index on a FINAL dm. So wrong index was used here.

2 years agoSimple hair children: Make twist affected by vertex group
Sergey Sharybin [Wed, 14 Feb 2018 15:46:29 +0000 (16:46 +0100)]
Simple hair children: Make twist affected by vertex group

The idea is to give a control over direction of twist, and maybe amount of
twist as well. More concrete example: make braids on left and right side of
character head to be twisting opposite directions.

Now, tricky part: we need some negative values to flip direction, but weights
can not be negative. So we use same trick as displacement map and tangent normal
maps, where 0.5 is neutral, values below 0.5 are considered negative and values
above 0.5 are considered positive.

2 years agoSimple hair children: Initial implementation of twist control
Sergey Sharybin [Wed, 14 Feb 2018 13:33:53 +0000 (14:33 +0100)]
Simple hair children: Initial implementation of twist control

It allows to have children hair to be twisted around parent curve, which is
quite an essential feature when creating hair braids.

There are currently two controls:

- Number of turns around parent children.
- Influence curve, which allows to modify "twistness" along the strand.

2 years agoBlenlib: Assert when attempting to rotate point around vector and store result in...
Sergey Sharybin [Wed, 14 Feb 2018 13:29:37 +0000 (14:29 +0100)]
Blenlib: Assert when attempting to rotate point around vector and store result in the point

This isn't supported since there are subsequent reads to all point coordinates
after modification started.

Probably we need to create a temp copy of point, but that's like extra CPU
ticks.

2 years agoParticles: Wrap insane amount of arguments to child modifier evaluation
Sergey Sharybin [Wed, 14 Feb 2018 11:33:34 +0000 (12:33 +0100)]
Particles: Wrap insane amount of arguments to child modifier evaluation

Use single structure. It seems we will need to pass more information soon,
so better to do it via the structure.

2 years agoFix T54075: Align Objects fails w/ empty mesh
Campbell Barton [Thu, 15 Feb 2018 00:33:47 +0000 (11:33 +1100)]
Fix T54075: Align Objects fails w/ empty mesh

2 years agoCleanup: style
Campbell Barton [Thu, 15 Feb 2018 00:13:54 +0000 (11:13 +1100)]
Cleanup: style

2 years agoFix T54072: Crash splitting edges
Campbell Barton [Wed, 14 Feb 2018 23:48:12 +0000 (10:48 +1100)]
Fix T54072: Crash splitting edges

2 years agoCycles: restore Particle Info Index for now, keep it next to Random.
Brecht Van Lommel [Wed, 14 Feb 2018 16:02:28 +0000 (17:02 +0100)]
Cycles: restore Particle Info Index for now, keep it next to Random.

It seems to be useful still in cases where the particle are distributed in
a particular order or pattern, to colorize them along with that. This isn't
really well defined, but might as well avoid breaking backwards compatibility
for now.

2 years agoCycles: change Index output of Hair and Particle Info to Random, in 0..1 range.
Brecht Van Lommel [Wed, 14 Feb 2018 13:32:38 +0000 (14:32 +0100)]
Cycles: change Index output of Hair and Particle Info to Random, in 0..1 range.

These are used for randomization, so it's convenient if the index is already
hashed and consistent with the Object Info node.

2 years agoParticles: Avoid multiple function declarations in multiple places
Sergey Sharybin [Wed, 14 Feb 2018 10:52:58 +0000 (11:52 +0100)]
Particles: Avoid multiple function declarations in multiple places

This makes it really hard to spot errors when function signature changes.

2 years agoParticles: Cleanup, remove trailign whitespace
Sergey Sharybin [Wed, 14 Feb 2018 10:46:33 +0000 (11:46 +0100)]
Particles: Cleanup, remove trailign whitespace

2 years agoHair child: Use clamp function to clamp curve evaluation
Sergey Sharybin [Wed, 14 Feb 2018 10:36:46 +0000 (11:36 +0100)]
Hair child: Use clamp function to clamp curve evaluation

Avoids redundant calls to the curve evaluation.

2 years agoMath utils: Add clamping functions
Sergey Sharybin [Wed, 14 Feb 2018 10:21:27 +0000 (11:21 +0100)]
Math utils: Add clamping functions

2 years agoCMake: Expose Cycles devices support as CMake option
Sergey Sharybin [Wed, 14 Feb 2018 09:31:04 +0000 (10:31 +0100)]
CMake: Expose Cycles devices support as CMake option

Handy to disable GPU based devices when it's needed to run Valgrind.

2 years agoCMake: Fix cimpilation error when CUDA dynload is disabled but toolkit is not installed
Sergey Sharybin [Wed, 14 Feb 2018 09:20:26 +0000 (10:20 +0100)]
CMake: Fix cimpilation error when CUDA dynload is disabled but toolkit is not installed

2 years agoCleanup: use prefix for tests
Campbell Barton [Wed, 14 Feb 2018 05:02:21 +0000 (16:02 +1100)]
Cleanup: use prefix for tests

Allows for running all `bmesh_*` or `object_*` tests.

2 years agoAdd ED_object_editmode_exit_ex
Campbell Barton [Tue, 13 Feb 2018 13:38:13 +0000 (00:38 +1100)]
Add ED_object_editmode_exit_ex

Allow exiting editmode from non-active scene.

2 years agoCycles: Implement index output for hair node
Sergey Sharybin [Tue, 13 Feb 2018 13:20:47 +0000 (14:20 +0100)]
Cycles: Implement index output for hair node

This is like the only way to add variety to hair which is created
using simple children. Used here for the hair.

Maybe not ideal, but the time will show.

2 years ago(Nodes) Display image name if any in the Cycles Image and Environment Texture node...
Ines Almeida [Mon, 12 Feb 2018 23:58:26 +0000 (00:58 +0100)]
(Nodes) Display image name if any in the Cycles Image and Environment Texture node title

2 years agoFix random walk SSS issues with different base and subsurface color.
Brecht Van Lommel [Mon, 12 Feb 2018 20:08:59 +0000 (21:08 +0100)]
Fix random walk SSS issues with different base and subsurface color.

Burley SSS uses a bit of strange thing where the albedo and closure weight are
different, which makes the subsurface color act a bit like a subsurface radius
indirectly by the way the Burley SSS profile works.

This can't work for random walk SSS though, and it's not clear to me that this
is actually a good idea since it's really the subsurface radius that is supposed
to control this. For now I'll leave Burley SSS working the same to not break
backwards compatibility.

2 years agoFix part of T53080: don't use current scene world for icon previews.
Brecht Van Lommel [Mon, 12 Feb 2018 19:08:50 +0000 (20:08 +0100)]
Fix part of T53080: don't use current scene world for icon previews.

This can be very slow if it contains a big texture, and it's not
necessarily setup in a useful way anyway, and materials can be used
in multiple scenes.

2 years agoBuildbot: Remove usage of deprecated chroot
Sergey Sharybin [Mon, 12 Feb 2018 16:55:38 +0000 (17:55 +0100)]
Buildbot: Remove usage of deprecated chroot

2 years agoAdd boolean regression test.
Howard Trickey [Mon, 12 Feb 2018 12:23:23 +0000 (07:23 -0500)]
Add boolean regression test.

2 years agoError in last commit, disable cycles when not enabled
Campbell Barton [Mon, 12 Feb 2018 06:56:14 +0000 (17:56 +1100)]
Error in last commit, disable cycles when not enabled

Would only disable when loading old preferences.

2 years agoDisable cycles when WITH_CYCLES=OFF
Campbell Barton [Mon, 12 Feb 2018 06:37:39 +0000 (17:37 +1100)]
Disable cycles when WITH_CYCLES=OFF

2 years agoBKE_addon: new/free/ensure functions
Campbell Barton [Mon, 12 Feb 2018 06:24:18 +0000 (17:24 +1100)]
BKE_addon: new/free/ensure functions

2 years agoCycles: add random walk subsurface scattering to Principled BSDF.
Brecht Van Lommel [Thu, 8 Feb 2018 15:19:04 +0000 (16:19 +0100)]
Cycles: add random walk subsurface scattering to Principled BSDF.

Differential Revision: https://developer.blender.org/D3054

2 years agoCycles: random walk subsurface scattering.
Brecht Van Lommel [Sun, 21 Jan 2018 13:04:22 +0000 (14:04 +0100)]
Cycles: random walk subsurface scattering.

It is basically brute force volume scattering within the mesh, but part
of the SSS code for faster performance. The main difference with actual
volume scattering is that we assume the boundaries are diffuse and that
all lighting is coming through this boundary from outside the volume.

This gives much more accurate results for thin features and low density.
Some challenges remain however:

* Significantly more noisy than BSSRDF. Adding Dwivedi sampling may help
  here, but it's unclear still how much it helps in real world cases.
* Due to this being a volumetric method, geometry like eyes or mouth can
  darken the skin on the outside. We may be able to reduce this effect,
  or users can compensate for it by reducing the scattering radius in
  such areas.
* Sharp corners are quite bright. This matches actual volume rendering
  and results in some other renderers, but maybe not so much real world
  objects.

Differential Revision: https://developer.blender.org/D3054

2 years agoFix (unreported) error on freeing timers which customdata pointer shall not be freed.
Bastien Montagne [Fri, 9 Feb 2018 16:19:11 +0000 (17:19 +0100)]
Fix (unreported) error on freeing timers which customdata pointer shall not be freed.

Looks like there was no way to avoid that so far, since
WM_event_add_timer_notifier can set mere int-in-pointer there, this can
cause issues. So added mere flags system to wmTimer to allow
controlling this.

2 years agoFix (unreported) crash when duplicating a FileBrowser window in preview draw mode.
Bastien Montagne [Fri, 9 Feb 2018 15:13:13 +0000 (16:13 +0100)]
Fix (unreported) crash when duplicating a FileBrowser window in preview draw mode.

We did not clear preview or smoothscroll timers pointers in copy code...

2 years agoDoc: attempt to document RNA's FunctionFlag.
Bastien Montagne [Fri, 9 Feb 2018 11:04:29 +0000 (12:04 +0100)]
Doc: attempt to document RNA's FunctionFlag.

Tired of searching through code to find which is what, and how to use it
in the C callback, everytime I need anot-so-common option...

2 years agoPaint Dirt: remove operator call from Python
Sybren A. Stüvel [Fri, 9 Feb 2018 11:52:46 +0000 (12:52 +0100)]
Paint Dirt: remove operator call from Python

Instead of calling an operator I just call `collection.new()`. Moving the
code into a separate function also simplifies it. In its new form there is
also no undefined behaviour when me.vertex_colors is non-empty but without
active layer.

2 years agoPaint Dirt: some small fixes
Sybren A. Stüvel [Thu, 8 Feb 2018 11:33:46 +0000 (12:33 +0100)]
Paint Dirt: some small fixes

- normalize → average the vector: the vector isn't normalized here, because
  it doesn't necessarily becomes unit length. Instead, the sum is converted
  to an average vector.
- angle is the acos()…: the dot product between the vertex normal and the
  average direction of the connected vertices is computed, and not the
  opposite.
- The initial `con` list was discarded immediately and replaced by a new
  list.
- File didn't end with a newline.

2 years agoFix crash with font on curve
Sergey Sharybin [Fri, 9 Feb 2018 09:13:42 +0000 (10:13 +0100)]
Fix crash with font on curve

Was a mistake from recent texspace changes.

Reported by Pablo here in the studio!

2 years agoCMake: include missing headers
Campbell Barton [Fri, 9 Feb 2018 02:48:34 +0000 (13:48 +1100)]
CMake: include missing headers

2 years agoFix T53958: Sequencer zoom 1:1 fails
Campbell Barton [Fri, 9 Feb 2018 02:39:47 +0000 (13:39 +1100)]
Fix T53958: Sequencer zoom 1:1 fails

2 years agoFix T53347: Vertex paint crash
Campbell Barton [Fri, 9 Feb 2018 00:58:19 +0000 (11:58 +1100)]
Fix T53347: Vertex paint crash

Vertex paint was still using sculpt mode brush (which can be NULL).

2 years agoFix for missing "Use Freestyle" toggle in the Cycles "Layer" options panel.
Tamito Kajiyama [Thu, 8 Feb 2018 17:46:20 +0000 (02:46 +0900)]
Fix for missing "Use Freestyle" toggle in the Cycles "Layer" options panel.

Reviewed By: Brecht Van Lommel (brecht), Dalai Felinto (dfelinto)

Differential Revision: https://developer.blender.org/D3048

2 years agoCycles: unify OSL BSSRDF closure into a single bssrdf() closure with method.
Brecht Van Lommel [Thu, 8 Feb 2018 15:14:04 +0000 (16:14 +0100)]
Cycles: unify OSL BSSRDF closure into a single bssrdf() closure with method.

This is similar to the upstream unified microfacet() closure, and makes it
easier to extend in the future.