blender.git
6 weeks agoCleanup/msvc: Remove math.h from creator_signals.c
Lazydodo [Thu, 1 Aug 2019 03:36:52 +0000 (21:36 -0600)]
Cleanup/msvc: Remove math.h from creator_signals.c

Was never needed, looks like it was copy/pasted from creator.c

spotted by @campbellbarton

6 weeks agoCleanup: Remove FMA3 Disable for msvc
Lazydodo [Thu, 1 Aug 2019 02:18:44 +0000 (20:18 -0600)]
Cleanup: Remove FMA3 Disable for msvc

We no longer build with or support msvc2013, so this hack can be removed.

Reviewed By: brecht

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

6 weeks agoCleanup: remove unused member
mano-wii [Thu, 1 Aug 2019 01:46:41 +0000 (22:46 -0300)]
Cleanup: remove unused member

6 weeks agoCleanup: move defaults into U_default struct
Campbell Barton [Thu, 1 Aug 2019 00:03:20 +0000 (10:03 +1000)]
Cleanup: move defaults into U_default struct

6 weeks agoCleanup: remove unused compute-id from preferences
Campbell Barton [Wed, 31 Jul 2019 23:08:43 +0000 (09:08 +1000)]
Cleanup: remove unused compute-id from preferences

6 weeks agoCleanup: use braces, unused variable, unused enum
Campbell Barton [Wed, 31 Jul 2019 23:03:50 +0000 (09:03 +1000)]
Cleanup: use braces, unused variable, unused enum

6 weeks agoFix T67951: Bone selection is broken on some Intel GPUs
mano-wii [Wed, 31 Jul 2019 19:35:06 +0000 (16:35 -0300)]
Fix T67951: Bone selection is broken on some Intel GPUs

The problem is that the `glDrawArraysInstancedBaseInstance` is ignoring the last parameter.
The solution is to indicate that `GLEW_ARB_base_instance` is not supported in these cases.

Reviewers: fclem, brecht, jbakker

Reviewed By: fclem, brecht

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

6 weeks agoFix several undefined-behaviour-sanitizer warnings
Lukas Stockner [Wed, 31 Jul 2019 19:13:29 +0000 (12:13 -0700)]
Fix several undefined-behaviour-sanitizer warnings

Reviewers: brecht

Reviewed By: brecht

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

6 weeks agoUI: Correct Spacing for Short Unit Names
Harley Acheson [Wed, 31 Jul 2019 19:14:29 +0000 (12:14 -0700)]
UI: Correct Spacing for Short Unit Names

This adds a space between a value and its short unit name except for foot, inch, degree, arcminute, arcsecond

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

Reviewed by Brecht Van Lommel

6 weeks agoAdd operator for removing unused material slots
Lukas Stockner [Wed, 31 Jul 2019 19:04:52 +0000 (12:04 -0700)]
Add operator for removing unused material slots

Reviewers: campbellbarton, brecht

Reviewed By: brecht

Subscribers: brecht

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

6 weeks agoMerge per-shader SVM nodes in the main update thread to avoid locking and resizing...
Lukas Stockner [Wed, 31 Jul 2019 06:29:18 +0000 (23:29 -0700)]
Merge per-shader SVM nodes in the main update thread to avoid locking and resizing overhead

In a test file containing 1300 copies of the same shader, this reduces shader update time from 3.1 sec to 0.05 sec.

Thanks to @swerner for noticing this issue.

Reviewers: brecht, sergey, swerner

Subscribers: swerner

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

6 weeks agoFix T66785: Blender Menu As Text When Main Menu Collapsed
Harley Acheson [Wed, 31 Jul 2019 18:37:06 +0000 (11:37 -0700)]
Fix T66785: Blender Menu As Text When Main Menu Collapsed

This makes the blender logo menu appear as text if 'Show Menus' is off

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

Reviewed by Brecht Van Lommel

6 weeks agoClarify in FloatProperty generated docs: single precision floats.
Howard Trickey [Wed, 31 Jul 2019 17:58:09 +0000 (13:58 -0400)]
Clarify in FloatProperty generated docs: single precision floats.

At least one script writer was upset that this was not specified,
as it is different from "floating point" in Python.
Also, docstring for hard and soft min and max for FloatProperty
was wrong, using sys.float_info.min and sys.float_info.max.

6 weeks agoRevert "UI: remove checks for other popovers when switching menu"
Sebastian Parborg [Wed, 31 Jul 2019 17:10:44 +0000 (19:10 +0200)]
Revert "UI: remove checks for other popovers when switching menu"

This reverts commit 77616571292ab1eeb9805797bfdd4525cc306923.

This commit broke overlapping popovers. For example in the color
management tab it would be impossible to select and of the popover
alternatives as it would switch to the menu button under the cursor.

6 weeks agoFix build error after recent cleanup
Brecht Van Lommel [Wed, 31 Jul 2019 16:57:39 +0000 (18:57 +0200)]
Fix build error after recent cleanup

6 weeks agoCleanup: typo in parameter name in function declarations.
Bastien Montagne [Wed, 31 Jul 2019 16:47:26 +0000 (18:47 +0200)]
Cleanup: typo in parameter name in function declarations.

6 weeks agoFix: test object_modifier_array is passing when it shouldn't.
Habib Gahbiche [Wed, 31 Jul 2019 16:29:58 +0000 (18:29 +0200)]
Fix: test object_modifier_array is passing when it shouldn't.

From D5253.

6 weeks agoFix negative boolean
Sergey Sharybin [Wed, 31 Jul 2019 16:20:18 +0000 (18:20 +0200)]
Fix negative boolean

Was a nice looking invention, but is obviously wrong.

Is likely no function changes, since -false is like -0
which is 0 and which false. And -true is like -<non-zero> which
is non-zero as well.

Spotted by Sybren, thanks!

6 weeks agoFix T65837: "Zoom Axis" is not working on the node editor
Sebastian Parborg [Wed, 31 Jul 2019 16:16:37 +0000 (18:16 +0200)]
Fix T65837: "Zoom Axis" is not working on the node editor

We would not take into account the user "Zoom Axis" setting in certain
2D space viewports.  In addition to this, the "Scale Zoom" didn't work
consistently in these spaces either.

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D5132

6 weeks agoFix T63921: Unable to use confirm on release for keyboard shortcuts
Sebastian Parborg [Wed, 31 Jul 2019 15:59:03 +0000 (17:59 +0200)]
Fix T63921: Unable to use confirm on release for keyboard shortcuts

The first issue was that we were still working around a Xorg bug that
has been solved since a very long time:

https://bugs.freedesktop.org/show_bug.cgi?id=22515

The second issue was that the global "confirm on release for mouse
clicks" was used for keyboard shortcuts as well.

6 weeks agoCleanup: remove unused boost code
Brecht Van Lommel [Wed, 31 Jul 2019 15:41:00 +0000 (17:41 +0200)]
Cleanup: remove unused boost code

6 weeks agoFix T67999: calling obj.data.materials.clear() crashes Blender
Sybren A. Stüvel [Wed, 31 Jul 2019 15:18:04 +0000 (17:18 +0200)]
Fix T67999: calling obj.data.materials.clear() crashes Blender

The `BKE_material_clear_id()` didn't call `test_all_objects_materials()`,
which caused the object and mesh material slot count to go out of sync.

6 weeks agoRefactor access to dependency graph
Sergey Sharybin [Thu, 25 Jul 2019 14:36:22 +0000 (16:36 +0200)]
Refactor access to dependency graph

This change ensures that operators which needs access to evaluated data
first makes sure there is a dependency graph.

Other accesses to the dependency graph made it more explicit about
whether they just need a valid dependency graph pointer or whether they
expect the graph to be already evaluated.

This replaces OPTYPE_USE_EVAL_DATA which is now removed.

Some general rules about usage of accessors:

- Drawing is expected to happen from a fully evaluated dependency graph.
  There is now a function to access it, which will in the future control
  that dependency graph is actually evaluated.

  This check is not yet done because there are some things to be taken
  care about first: for example, post-update hooks might leave scene in
  a state where something is still tagged for update.

- All operators which needs to access evaluated state must use
  CTX_data_ensure_evaluated_depsgraph().

  This function replaces OPTYPE_USE_EVAL_DATA.

  The call is generally to be done in the very beginning of the
  operator, prior other logic (unless this is some comprehensive
  operator which might or might not need access to an evaluated state).

  This call is never to be used from a loop.

  If some utility function requires evaluated state of dependency graph
  the graph is to be passed as an explicit argument. This way it is
  clear that no evaluation happens in a loop or something like this.

- All cases which needs to know dependency graph pointer, but which
  doesn't want to actually evaluate it can use old-style function
  CTX_data_depsgraph_pointer(), assuming that underlying code will
  ensure dependency graph is evaluated prior to accessing it.

- The new functions are replacing OPTYPE_USE_EVAL_DATA, so now it is
  explicit and local about where dependency graph is being ensured.

This commit also contains some fixes of wrong usage of evaluation
functions on original objects. Ideally should be split out, but in
reality with all the APIs being renamed is quite tricky.

Fixes T67454: Blender crash on rapid undo and select

Speculation here is that sometimes undo and selection operators are
sometimes handled in the same event loop iteration, which leaves
non-evaluated dependency graph.

Fixes T67973: Crash on Fix Deforms operator
Fixes T67902: Crash when undo a loop cut

Reviewers: brecht

Reviewed By: brecht

Subscribers: lichtwerk

Maniphest Tasks: T67454

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

6 weeks agoFix: build error with MSVC
Lazydodo [Wed, 31 Jul 2019 14:44:58 +0000 (08:44 -0600)]
Fix: build error with MSVC

Reviewed By: Brecht

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

6 weeks agoDepsgraph: Fix wrong check for need-to-be-evaluated
Sergey Sharybin [Wed, 31 Jul 2019 14:39:33 +0000 (16:39 +0200)]
Depsgraph: Fix wrong check for need-to-be-evaluated

Was missing since 1693a5efe91.

6 weeks agoFix T67883: Time Remapping doesn't work
Sergey Sharybin [Wed, 31 Jul 2019 14:38:04 +0000 (16:38 +0200)]
Fix T67883: Time Remapping doesn't work

Was caused by 1693a5efe91.

6 weeks agoFix T67597: Texture painting: Texture slots that correspond to nodes inside node_grou...
mano-wii [Wed, 31 Jul 2019 14:37:03 +0000 (11:37 -0300)]
Fix T67597: Texture painting: Texture slots that correspond to nodes inside node_groups don't remain active

Unlike `fill_texpaint_slots_recursive`, `rna_Material_active_paint_texture_index_update` did not search for texture nodes that are inside node groups.

Reviewers: sergey, psy-fi, zeddb, brecht

Subscribers: brecht

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

6 weeks agoFix T67808: Bright/Contrast node wrong for negative contrast
Philipp Oeser [Wed, 31 Jul 2019 10:22:42 +0000 (12:22 +0200)]
Fix T67808: Bright/Contrast node wrong for negative contrast

strange nobody noticed since 2012...

thx @jenkm for spotting

Reviewers: brecht

Subscribers: jenkm

Maniphest Tasks: T67808

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

6 weeks agoFix T67573: Missing offset in marker names on current frame
Alessio Monti di Sopra [Wed, 31 Jul 2019 14:15:07 +0000 (16:15 +0200)]
Fix T67573: Missing offset in marker names on current frame

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

6 weeks agoHave CMake be more strict when optional x11 libraries are missing but enabled
Sebastian Parborg [Wed, 31 Jul 2019 14:15:38 +0000 (16:15 +0200)]
Have CMake be more strict when optional x11 libraries are missing but enabled

Previously cmake would silently disable features that depended on
certain x11 libraries if they were not found. Now we instead error out
and inform the user that these are missing but optional.

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D5380

6 weeks agoFix T68001: Rotating vertices on the UV map by a fixed number immediately crashes...
Bastien Montagne [Wed, 31 Jul 2019 14:12:33 +0000 (16:12 +0200)]
Fix T68001: Rotating vertices on the UV map by a fixed number immediately crashes Blender.

Spaghetti Transform code can use same code for different kind of data.
The 'stepped rotation' process is actually only useful/doable in a few
cases (when we do have some real place to store rotation value, and we
are using Eulers).

6 weeks agoCleanup: Remove unused function
Sergey Sharybin [Wed, 31 Jul 2019 13:41:35 +0000 (15:41 +0200)]
Cleanup: Remove unused function

6 weeks agoFix T66031: Text Material Change broken.
Bastien Montagne [Wed, 31 Jul 2019 13:36:36 +0000 (15:36 +0200)]
Fix T66031: Text Material Change broken.

font_to_curve code was not handling properly the case where it has nop
object to check for mat indices validity. Check should just not happen
then, not reset mat indices of chars to default 0 value.

6 weeks agoFix Visual Studio compatibility in writeffmpeg.c
Sybren A. Stüvel [Wed, 31 Jul 2019 13:26:25 +0000 (15:26 +0200)]
Fix Visual Studio compatibility in writeffmpeg.c

This fixes an incompatibility with Visual Studio 2019 introduced in
631d5026c7bb34320c5d9b60afa5bc44b40fc5e4. It is likely caused by using
`#  ifdef` inside the use of the `ELEM()` macro.

6 weeks agoAnimation: Remove depsgraph argument from a lot of API
Sergey Sharybin [Wed, 31 Jul 2019 12:56:17 +0000 (14:56 +0200)]
Animation: Remove depsgraph argument from a lot of API

Use explicit boolean flag to indicate whether flush to original data
is needed or not. Makes it possible to avoid confusion on whether an
evaluated or any depsgraph can be passed to the API.

Allows to remove depsgraph from bAnimContext as well.

Reviewers: brecht

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

6 weeks agoAnimation: Remove depsgraph argument from direct keyframing
Sergey Sharybin [Wed, 31 Jul 2019 10:22:43 +0000 (12:22 +0200)]
Animation: Remove depsgraph argument from direct keyframing

It was used to access evaluated object and pose and was done prior
to implementation of flushing values back to original data for an
active dependency graph.

Removing the argument allows to simplify API and solve issues with
accessing missing dependency graph on redo.

6 weeks agoFix: Cycles reporting incorrect number of samples in viewport render
Jeroen Bakker [Wed, 31 Jul 2019 12:32:37 +0000 (14:32 +0200)]
Fix: Cycles reporting incorrect number of samples in viewport render

During viewport rendering where the viewport samples are set to 0 the UI
showed 16777216 as number of samples. We should not show the number of
samples when the number of viewport samples are set to 0.

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

6 weeks agoSpelling fixes in comments and descriptions, patch by luzpaz
Brecht Van Lommel [Wed, 31 Jul 2019 12:25:09 +0000 (14:25 +0200)]
Spelling fixes in comments and descriptions, patch by luzpaz

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

6 weeks agoFix error in user preferences commit
Campbell Barton [Wed, 31 Jul 2019 12:24:19 +0000 (22:24 +1000)]
Fix error in user preferences commit

Add include & initialize variable.

6 weeks agoFix T67652: editing UV vertex location does not work with multiple objects
Brecht Van Lommel [Wed, 31 Jul 2019 11:23:17 +0000 (13:23 +0200)]
Fix T67652: editing UV vertex location does not work with multiple objects

Patch contributed by matc.

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

6 weeks agoCleanup: remove BLO_update_defaults_userpref_blend
Campbell Barton [Wed, 31 Jul 2019 11:46:13 +0000 (21:46 +1000)]
Cleanup: remove BLO_update_defaults_userpref_blend

Merge into BKE_blendfile_userdef_from_defaults

6 weeks agoPreferences: don't store preferences in the startup
Campbell Barton [Tue, 30 Jul 2019 01:04:02 +0000 (11:04 +1000)]
Preferences: don't store preferences in the startup

Simplify preferences by removing the ability to load them from
either the startup.blend or userpref.blend.

Also simplifies updating default preferences by moving
them to a struct definition.

6 weeks agoUI: tweak naming in snapping popover to be "Snap with" and "Snap to"
EitanSomething [Wed, 31 Jul 2019 10:36:19 +0000 (12:36 +0200)]
UI: tweak naming in snapping popover to be "Snap with" and "Snap to"

To replace "Target" and "Snapping", this should be more clear.

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

6 weeks agoSculpt/Paint: Brush curve presets
Pablo Dobarro [Wed, 31 Jul 2019 10:58:50 +0000 (12:58 +0200)]
Sculpt/Paint: Brush curve presets

This patch introduces the same presets that are used for proportional editing in the brush falloff menu. The user can select any of these presets or use the regular custom falloff curve. The presets are hardcoded formulas, so the falloff curve is not used when they are active.

This change improves the general feeling of the brushes and it is more convenient and simpler to use. The CUSTOM curve option should now be used in the case that an unusual deformation is needed, in other cases, the hardcoded curve presets should be the default.

The smooth curve presets is a must in the grab brush, as it fixes the deformation issue with the current custom curve setting. The user may try to adjust the deformation by tweaking the curve, but it is nearly impossible to replicate this desired behavior.

{F7636217}

Other brushes that are included in the sculpt branch also rely on this as they need specific hardcoded falloffs to produce the desired effect.

Reviewers: brecht, billreynish

Reviewed By: brecht

Subscribers: JulienKaspar

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

6 weeks agoFIx T66019: Text cutoffs for descriptions in keyframe insertion (keyingsets).
Bastien Montagne [Wed, 31 Jul 2019 10:29:36 +0000 (12:29 +0200)]
FIx T66019: Text cutoffs for descriptions in keyframe insertion (keyingsets).

6 weeks agoAdded BKE_mesh_clear_geometry() function
Sybren A. Stüvel [Tue, 30 Jul 2019 16:38:31 +0000 (18:38 +0200)]
Added BKE_mesh_clear_geometry() function

This function makes it possible to clear/remove/nuke all the geometry in
a mesh, allowing functions like `Mesh.from_python()` to construct a new
mesh in its place. Without this function, code like in T67627 have to
allocate a new Mesh datablock, fill that, and swap out the old Mesh for
the new one. This introduces issues when exporting, as the new mesh
could be seen by an exporter as unrelated to the old one.

Shape keys are not freed by this function. Freeing those would require
tagging the depsgraph for relations update, which is an expensive
operation. They should be removed explicitly if necessary.

Material slots are also not cleared by this function, in the same way
that they are not cleared when manually removing all geometry from a
mesh.

The `BKE_mesh_clear_geometry()` function is available in Python as
`mesh.clear_geometry()`.

Reviewed by: mont29, brecht

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

6 weeks agoCleanup: Use explicit forward declaration
Sergey Sharybin [Wed, 31 Jul 2019 09:55:25 +0000 (11:55 +0200)]
Cleanup: Use explicit forward declaration

6 weeks agoUI: remove checks for other popovers when switching menu
Campbell Barton [Wed, 31 Jul 2019 08:51:32 +0000 (18:51 +1000)]
UI: remove checks for other popovers when switching menu

I'm unable to redo the original report,
Revert fix for T43247..

6 weeks agoUI: simplify check for active menu button
Campbell Barton [Wed, 31 Jul 2019 08:45:07 +0000 (18:45 +1000)]
UI: simplify check for active menu button

Dragging to select another popup now checks the menus active button.

6 weeks agoParticle: Cleanup, remove unused depsgraph argument
Sergey Sharybin [Wed, 31 Jul 2019 09:50:42 +0000 (11:50 +0200)]
Particle: Cleanup, remove unused depsgraph argument

6 weeks agoCleanup: Remove unused functions
Sergey Sharybin [Wed, 31 Jul 2019 09:46:32 +0000 (11:46 +0200)]
Cleanup: Remove unused functions

6 weeks agoFFmpeg: Added support for writing Opus audio.
Sybren A. Stüvel [Wed, 31 Jul 2019 09:21:24 +0000 (11:21 +0200)]
FFmpeg: Added support for writing Opus audio.

This audio format is often used in conjunction with VP9 video in a WebM
container. Opus was created with the intention to replace Vorbis and
Speex ([source](https://en.wikipedia.org/wiki/Opus_(audio_format))).

Reviewed By: brecht

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

6 weeks agoFFmpeg: Added writing of WebM containers
Sybren A. Stüvel [Wed, 31 Jul 2019 09:20:21 +0000 (11:20 +0200)]
FFmpeg: Added writing of WebM containers

This commit adds support for the WebM container. Previously we only
supported the WebM/VP9 video codec, but still required that it was
stored in a Matroska, MP4, or other compatible container format.

Reviewed By: brecht

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

6 weeks agoFFmpeg: Added support for writing alpha values in WebM/VP9 video
Sybren A. Stüvel [Wed, 31 Jul 2019 09:18:55 +0000 (11:18 +0200)]
FFmpeg: Added support for writing alpha values in WebM/VP9 video

The VP9 video codec supports writing alpha values; now this is available
in Blender too.

Reviewed By: brecht

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

6 weeks agoCleanup: Simplification of `BKE_ffmpeg_alpha_channel_is_supported()`
Sybren A. Stüvel [Wed, 31 Jul 2019 09:15:14 +0000 (11:15 +0200)]
Cleanup: Simplification of `BKE_ffmpeg_alpha_channel_is_supported()`

Simplified `BKE_ffmpeg_alpha_channel_is_supported()` to use `ELEM()`
instead of a row consecutive `if`-statements.

No functional changes.

Reviewed By: brecht

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

6 weeks agoDRW manager: select engine: create generic draw_select_id_mesh
mano-wii [Tue, 30 Jul 2019 21:26:35 +0000 (18:26 -0300)]
DRW manager: select engine: create generic draw_select_id_mesh

6 weeks agoCleanup: Rearrange Select Engine into multiple files
mano-wii [Tue, 30 Jul 2019 20:55:20 +0000 (17:55 -0300)]
Cleanup: Rearrange Select Engine into multiple files

6 weeks agocleanup: Fix typo in last commit
Lazydodo [Tue, 30 Jul 2019 20:50:53 +0000 (14:50 -0600)]
cleanup: Fix typo in last commit

Accidentally took the C flags as a base.

6 weeks agoCMake/Windows: Enable JMC on compilers that support it.
Lazydodo [Tue, 30 Jul 2019 20:40:05 +0000 (14:40 -0600)]
CMake/Windows: Enable JMC on compilers that support it.

JMC [1] enables more productive debugging of C++ code in visual studio
this change enables it on debug builds for builds with visual studio 15.8
or higher.

[1] https://devblogs.microsoft.com/cppblog/announcing-jmc-stepping-in-visual-studio/

6 weeks agoDRW manager: select engine: remove redundant calls
mano-wii [Tue, 30 Jul 2019 19:32:08 +0000 (16:32 -0300)]
DRW manager: select engine: remove redundant calls

6 weeks agoCmake/windows: Fix vcpkg bypassing our libs folder.
Lazydodo [Tue, 30 Jul 2019 17:13:33 +0000 (11:13 -0600)]
Cmake/windows: Fix vcpkg bypassing our libs folder.

Occasionally we get reports of people that build blender and end up
with either build errors or end up with builds that do not run on
other systems. The root cause is when you install vpckg and integrate
it into the build system it puts the search path for its includes and
libraries before anything else.

previously we told people to either uninstall vcpkg or remove the
conflicting packages, which was not great.

this change opts out of the use of vcpkg for blender only, so people
can keep using it for other work without issues.

6 weeks agoFix T67939: GPencil Noise modifier step is ignored in render
Antonio Vazquez [Tue, 30 Jul 2019 17:42:43 +0000 (19:42 +0200)]
Fix T67939: GPencil Noise modifier step is ignored in render

The value of the step was calculated using a variable that was removed when the render frame change.

Now, the step is calculated using the modulus of the current frame and recalculate noise only if the remainder that results from performing integer division is equal to 0.

To calculate current frame, the first used frame is calculated to adjust real frame range.

This approach is more stable in viewport and render.

6 weeks agoFix snap package to work with 2.80 version number
Brecht Van Lommel [Tue, 30 Jul 2019 11:56:08 +0000 (13:56 +0200)]
Fix snap package to work with 2.80 version number

Without this it rounds to 2.8.

6 weeks agoFix T65691: GPencil Drawing long strokes turn invisible
Antonioya [Sat, 20 Jul 2019 21:01:19 +0000 (23:01 +0200)]
Fix T65691: GPencil Drawing long strokes turn invisible

There was a fixed limit to the number of points available in a buffer stroke.

Now, the array is expanded as needed using a predefined number of points for each expansion, instead to add one by one. This is done to reduce the number of times the memory allocation is required.

As part of the fix, some variables have been renamed to reflect better their use.

6 weeks agoAlembic export: fix exporting of loop normals
Sybren A. Stüvel [Tue, 30 Jul 2019 15:05:37 +0000 (17:05 +0200)]
Alembic export: fix exporting of loop normals

When the mesh is using custom normals, those should always be exported,
regardless of the `ME_SMOOTH` flag on the invidivual polys.

Also replaced the loop normal writing with the same logic as we use for
reading (less pointer arithmetic, more normal counting).

6 weeks agoAlembic import: load face-varying normals
Sybren A. Stüvel [Fri, 5 Jul 2019 10:36:30 +0000 (12:36 +0200)]
Alembic import: load face-varying normals

Loop normals are called 'Face-varying normals' in Alembic. Before this
commit, the existence of such normals was used to enable smooth shading.
This is incorrect, as the normals could encode flat faces just as well.

This commit adds the loading of these normals as custom loop normals. It
then also enables Auto-Smoothing on the mesh (which is a bit of a
misnomer and indicates to Blender that the custom normals should be
used).

Fixes the glitching described in T65959.

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

6 weeks agoCleanup: Alembic: renamed 'smooth_normals' to 'export_loop_normals'
Sybren A. Stüvel [Wed, 10 Jul 2019 08:35:39 +0000 (10:35 +0200)]
Cleanup: Alembic: renamed 'smooth_normals' to 'export_loop_normals'

The name now indicates what happens when the variable is set to true.

No functional changes.

6 weeks agoAlembic: changed 'void *user_data' to 'Mesh *mesh'
Sybren A. Stüvel [Thu, 4 Jul 2019 10:04:39 +0000 (12:04 +0200)]
Alembic: changed 'void *user_data' to 'Mesh *mesh'

The only thing that is stored in this pointer is a `Mesh*`, and casting
it from/to `void*` is unnecessary and confusing. Maybe the entire
CDStreamConfig class could/should be removed at some point.

No functional changes.

6 weeks agoAlembic: transformed chain-of-ifs into switch statement
Sybren A. Stüvel [Thu, 4 Jul 2019 09:53:17 +0000 (11:53 +0200)]
Alembic: transformed chain-of-ifs into switch statement

By having a switch statement that lists all the values of the enum, it is
clear which cases we're not handling, and it also allows for warnings in
the future when the enum expands.

No functional changes.

6 weeks agoAlembic: use `r_` prefix for return variables
Sybren A. Stüvel [Thu, 4 Jul 2019 09:51:13 +0000 (11:51 +0200)]
Alembic: use `r_` prefix for return variables

No functional changes.

6 weeks agoAlembic: removal of always-zero parameter
Sybren A. Stüvel [Thu, 4 Jul 2019 09:50:08 +0000 (11:50 +0200)]
Alembic: removal of always-zero parameter

The `poly_start` parameter was always 0, so adding it to a poly index
from Alembic is a no-op.

No functional changes.

6 weeks agoFix T65717: Alembic (camera - also mesh) import scale issue
Sybren A. Stüvel [Thu, 18 Jul 2019 13:39:50 +0000 (15:39 +0200)]
Fix T65717: Alembic (camera - also mesh) import scale issue

The w-component of the translation column of the scaled matrix wasn't
set to 1.0, which, apart from being incorrect, caused drawing problems.

Reviewed By: brecht

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

6 weeks agoFix T67904: GPencil clone brush doesn't copy the right color and layer
Antonio Vazquez [Tue, 30 Jul 2019 14:51:18 +0000 (16:51 +0200)]
Fix T67904: GPencil clone brush doesn't copy the right color and layer

When using the clone brush, the first time the brush worked, but the next time no. The reasons were two:

1) The strokes were copied to the active layer, but if there were more than one layer, the stroke must be copied to the original layer.

2) The materials were not assigned properly and the materials were set as the first slot in the list always.

Now, the original layer name is used to try to find the same layer in destination. If the layer is missing, the active layer is used.

For materials, the bug in the hash lookup is fixed and the material is assigned to the right slot.

7 weeks agoFix T67460: Vertex painting: Sampling color opens empty options window in viewport
Sebastian Parborg [Tue, 30 Jul 2019 14:00:41 +0000 (16:00 +0200)]
Fix T67460: Vertex painting: Sampling color opens empty options window in viewport

The issue was that the redo panel area would call with region type HUD (not WINDOW).
Now we make sure that the redo panel always polls the operator in the original area type context.

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D5361

7 weeks agoMake 3d projpaint iteration lockless.
Bastien Montagne [Tue, 30 Jul 2019 13:39:11 +0000 (15:39 +0200)]
Make 3d projpaint iteration lockless.

While speedup is hard to detect (highly fluctuent), it seems to be
around 5% on average on my 8 threads machine...

It also remove usage of a 'global' thread lock, which is always good.

Note that I also tried to use proper foreach threaded iterator construct
(see D5372), but that proved to be relatively slower (presumably due to
the very high dissymmetry between tasks, usually during a paint stroke
only a few chunks will require most of the computing effort, overhead of
threaded foreach management is then noticeable).

This concludes (for now) the work on
T51133 Bad performance with texture painting depending on multi-thread settings.

7 weeks agoFix T67370 Normal Tools(Alt +N), copy and paste not work
Sebastian Parborg [Tue, 30 Jul 2019 13:37:27 +0000 (15:37 +0200)]
Fix T67370 Normal Tools(Alt +N), copy and paste not work

The copy operator requried at least a vert AND a face to be selected.
It should only require that a vert OR a face is selected.

7 weeks agoBLI_task: Cleanup: rename some structs to make them more generic.
Bastien Montagne [Tue, 30 Jul 2019 12:56:47 +0000 (14:56 +0200)]
BLI_task: Cleanup: rename some structs to make them more generic.

TLS and Settings can be used by other types of parallel 'for loops', so
removing 'Range' from their names.

No functional changes expected here.

7 weeks agoBLI_task: tweak default chunk size for `BLI_task_parallel_range()`.
Bastien Montagne [Tue, 30 Jul 2019 12:36:59 +0000 (14:36 +0200)]
BLI_task: tweak default chunk size for `BLI_task_parallel_range()`.

Previously we were setting it to 1 (aka no 'chunking'), to follow
previous behavior. However, this is far from optimal, especially with
CPUs that can have tens of threads nowadays.

Now taking an heuristic approach (inspired from the one already existing
for `BLI_task_parallel_listbase()`, which tries to guesstimate best
chunk sizes based on several factors (amount of threads/parallel tasks,
total number of items, ...).

Think this is a reasonable base ground, more optimization here would of
course be possible.

Note that code that was already explicitely settings some value here
won't be affected at all by that change.

7 weeks agoFix T66629: Library override - fails when armature and mesh are in separate collections.
Bastien Montagne [Tue, 30 Jul 2019 11:04:00 +0000 (13:04 +0200)]
Fix T66629: Library override - fails when armature and mesh are in separate collections.

Some ugly very low-level collection code was using the generic
LIB_TAG_DOIT tag... should never happen, that one is for rather
high-level code to use, core process shall use own tags.

7 weeks agoFix T67067: Wrong rotation input values when using shortcuts on keyboard like rx720.
Bastien Montagne [Tue, 30 Jul 2019 11:00:48 +0000 (13:00 +0200)]
Fix T67067: Wrong rotation input values when using shortcuts on keyboard like rx720.

This allows to type in numinput 720 and indeed get a rotation of 720°, not 0°...

This patch basically applies 'big rotations' in steps < 180°, such that
compatible rotation works as expected. This implies resetting current
rotation to initial one first, otherwise we'd end up applying much more
turns than expected when that code is called more than once.

It also makes things somewhat slower for big rotations (millions of degrees),
Hence we clamp to 1000 turns max.

And since that's a case that cannot happen with regular tool/widget-driven rotation,
it's only enabled when numinput is used for now.

Review task: https://developer.blender.org/D5289

7 weeks agoFix crash clicking in the 3D view on startup
Campbell Barton [Tue, 30 Jul 2019 11:40:42 +0000 (21:40 +1000)]
Fix crash clicking in the 3D view on startup

Setting the 3D view cursor on startup could crash because the
viewport hasn't been assigned to the region.

7 weeks agoTracking: Fix wrong usage of draw buffers
Sergey Sharybin [Tue, 30 Jul 2019 11:00:22 +0000 (13:00 +0200)]
Tracking: Fix wrong usage of draw buffers

Curve drawing was attempting to draw reprojection error curve when it was
not visible.

Worst thing is that the imm was not informed about vertices, so the code
was causing an assert in debug mode. Probably, it is also what have caused
random crashes after recent changes.

7 weeks agoFix T67274: Graph Editor Normalization broken by Keyframe that uses Easing or Dynamic...
Sebastian Parborg [Tue, 30 Jul 2019 10:24:11 +0000 (12:24 +0200)]
Fix T67274: Graph Editor Normalization broken by Keyframe that uses Easing or Dynamic interpolation

We didn't include and of the newer interpolation types in the
normalization function.
Besides taking into account these newer types, we now also only evaluate
the curves when needed. If the values between the control points won't
exceed the control point values, we only use the start/end values for
our normalization

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D5365

7 weeks agoParticle: Fix incorrect access to evaluated mesh
Sergey Sharybin [Tue, 30 Jul 2019 09:55:41 +0000 (11:55 +0200)]
Particle: Fix incorrect access to evaluated mesh

Mesh can not be requested from original object, and it can not be
copied into evaluated modifier because there is no such a thing yet.

It can not be done this way now, because getting evaluated object
will force it to re-calculate, which kind of defeats idea of this
code to preserve un-baked particles.

7 weeks ago3D View: Move selection API to a Selection engine.
mano-wii [Tue, 30 Jul 2019 09:46:59 +0000 (06:46 -0300)]
3D View: Move selection API to a Selection engine.

This commit moves the API of selecting faces, vertices and edges to a DRW manager engine.

Reviewers: campbellbarton, fclem

Subscribers: jbakker, brecht

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

7 weeks agoFix T67906: empty menus for hooks if non-hook modifiers are present
Philipp Oeser [Tue, 30 Jul 2019 09:22:57 +0000 (11:22 +0200)]
Fix T67906: empty menus for hooks if non-hook modifiers are present

7 weeks agoPy node shader wrapper: Add clamping to official min/max values.
Bastien Montagne [Tue, 30 Jul 2019 09:17:01 +0000 (11:17 +0200)]
Py node shader wrapper: Add clamping to official min/max values.

Taking values from relevant node definition C file...

Related to T67889.

7 weeks agoTracking: Fix crash happening after removing object
Sergey Sharybin [Tue, 30 Jul 2019 09:11:54 +0000 (11:11 +0200)]
Tracking: Fix crash happening after removing object

7 weeks agoFix T66591: GPencil layer visibility control via driver doesn't work
Sergey Sharybin [Tue, 30 Jul 2019 08:27:13 +0000 (10:27 +0200)]
Fix T66591: GPencil layer visibility control via driver doesn't work

7 weeks agoFix T67882: buttons are interrupt drag actions
Campbell Barton [Tue, 30 Jul 2019 07:38:18 +0000 (17:38 +1000)]
Fix T67882: buttons are interrupt drag actions

7 weeks agoFix edit-mode interfering with brush swap color
Campbell Barton [Tue, 30 Jul 2019 05:37:45 +0000 (15:37 +1000)]
Fix edit-mode interfering with brush swap color

D5353 by @robert-wallis

7 weeks agoUI: add use_button option to popovers
Campbell Barton [Tue, 30 Jul 2019 00:57:47 +0000 (10:57 +1000)]
UI: add use_button option to popovers

This is useful when popovers are launched from operators
instead of as button popover types.
Where the connection between the button and the popover is useful to keep.

7 weeks agoCleanup: de-duplicate file reading code
Campbell Barton [Tue, 30 Jul 2019 00:43:07 +0000 (10:43 +1000)]
Cleanup: de-duplicate file reading code

Also remove goto's.

7 weeks agoCleanup: check is_startup parameters instead of the path
Campbell Barton [Tue, 30 Jul 2019 00:38:06 +0000 (10:38 +1000)]
Cleanup: check is_startup parameters instead of the path

7 weeks agoCleanup: replace unused return defines with bool
Campbell Barton [Tue, 30 Jul 2019 00:26:03 +0000 (10:26 +1000)]
Cleanup: replace unused return defines with bool

7 weeks agoGPencil: Remove Annotations panel from non-preview Sequencer areas
Antonioya [Mon, 29 Jul 2019 20:43:09 +0000 (22:43 +0200)]
GPencil: Remove Annotations panel from non-preview Sequencer areas

Fix by: Peter Fog (@tintwotin)

I did some small changes to original differential code.

Differential Revision: http://developer.blender.org/D5306

7 weeks agoDoxygen: update version number to 2.81
Brecht Van Lommel [Mon, 29 Jul 2019 14:54:08 +0000 (16:54 +0200)]
Doxygen: update version number to 2.81

7 weeks agoFix T67874: Show gizmo incorrectly uses Cmd-` on macOS
Campbell Barton [Mon, 29 Jul 2019 15:53:45 +0000 (01:53 +1000)]
Fix T67874: Show gizmo incorrectly uses Cmd-` on macOS

7 weeks agoCleanup: GPencil replace cfra_eval by cfra or CFRA
Antonioya [Mon, 29 Jul 2019 15:07:24 +0000 (17:07 +0200)]
Cleanup: GPencil replace cfra_eval by cfra or CFRA

Don't need these variable because this code was part of using depsgraph frame number, but now using scene framenumber only add noise to the code.

7 weeks agoFix T67849: Offset after "Hook to Selected Object"
Philipp Oeser [Mon, 29 Jul 2019 14:35:49 +0000 (00:35 +1000)]
Fix T67849: Offset after "Hook to Selected Object"