Commit Graph

102088 Commits

Author SHA1 Message Date
Bastien Montagne 96995b2343 Fix (unreported) bug in liboverride diffing code for collection item insertion.
In case we do not use names, code adding new insert operations in
collections was broken.

Not a proble in practice so far, since this case was not yet in use, but
will be soon with NLA overrides.
2020-11-20 11:41:15 +01:00
Campbell Barton 07db110add Fix T82493: PyDoc generation throws exception on exit
Since add-ons now unregister on exit
(as of fa566157a5)
clearing functions in `bpy.app.handlers` caused an error on exit.

Resolve by restoring handlers before exiting.
2020-11-20 18:59:59 +11:00
Jeroen Bakker 056c9de30d Merge branch 'blender-v2.91-release' 2020-11-20 08:57:58 +01:00
Campbell Barton 93850c74c1 Fix add-object cursor plane failing to update on zoom
Zoom with an orthographic view wasn't refreshing the preview plane.
2020-11-20 17:32:09 +11:00
Campbell Barton 1501c3adad Add Object Tool: support placing objects in orthographic axis views
When an projecting onto a plane that is orthogonal to the views Z axis,
project onto a view aligned axis then map it back to the original plane.
see: ED_view3d_win_to_3d_on_plane_with_fallback

Since the depth can't be properly visualized in 3D, display a 2D so
it's possible to to tell the depth from the cursor motion.
2020-11-20 17:15:18 +11:00
Campbell Barton a8f4affb2e Add Object Tool: use the closest view-aligned axis as a fallback
When using surface orientation and nothing is under the mouse-cursor,
pick the axis that's closest to the view's Z axis.

Now by default default, drawing into empty spaces wont use a plane
orthogonal to the view.
2020-11-20 16:45:06 +11:00
Hans Goudey a1120892b0 UI: Fix panel drag icon added to redo panel
Error in cleanup commit 0d93bd8d63. Currently floating panels
cannot be dragged, so the widget should not be displayed.
2020-11-19 20:43:10 -05:00
Campbell Barton 5b34d11b55 Fix add-object tools cursor distorted drawing on save
Generating the thumbnail left the view matrices set to values
that couldn't be used for cursor drawing.

Backup/restore the matrices for off-screen drawing.
2020-11-20 12:15:04 +11:00
Campbell Barton f0b75cc19d Cleanup: use a struct to backup/restore values for offscreen drawing
Variables to temporarily override values was scattered,
making it harder to follow.
2020-11-20 12:15:04 +11:00
Campbell Barton cf780e0f67 Cleanup: remove unused off-screen drawing struct 2020-11-20 12:14:50 +11:00
Campbell Barton f166fa67b7 Cleanup: rename do_sky argument to draw_background
This was leftover from Blender internal, follow the naming
already used by the draw manager.
2020-11-20 12:14:50 +11:00
Campbell Barton 219c3aa653 Cleanup: remove unused perspective argument to off-screen drawing
Some callers were passing in dummy values, this can be accessed from
`RegionView3D.is_persp` can be used to check this.
2020-11-20 12:14:50 +11:00
Campbell Barton 25266caa45 Cleanup: spelling 2020-11-20 11:39:22 +11:00
Campbell Barton 5f1bb8da96 Cleanup: clang-format 2020-11-20 11:28:58 +11:00
Stefan Werner fdd3032f8f Cycles: Fixed zero sized normals when certain attributes were missing.
The Normal Map node was falling back to (0, 0, 0) when it was missing
the required attributes to calculate a new normal.
(0, 0, 0) is not a valid normal and can lead to NaNs when it is
normalized later in the shader. Instead, we now return sd->N,
the unperturbed surface normal.
2020-11-19 23:15:09 +01:00
Jacques Lucke dca36a8ec9 Fix T82769: remove thread local data from PTCacheMem
The issue was that the same point cache was read by multiple
threads at the same time (the same object was evaluated for
render and for the viewport).
Both threads incremented PTCacheMem->cur which lead to the crash.

The fix is to remove the PTCacheMem->cur and store it on the
stack instead. This way every thread has its own cur.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D9606
2020-11-19 19:09:24 +01:00
Sergey Sharybin 72a199e148 Atomic: Cover with unit tests
Cover all atomic functions with unit tests.

The tests are quite simple, nothing special so far. The goal is to:

- Make sure implementation exists.
- Implementation behaves the same way on all platforms
  (We had issue when MSVC and GCC were behaving differently in the
  past).
- Proper bitness is used for implementation and non-fixed-size
  function implementation.

The tests can be extended further to make sure, for example, that
CAS operations do not cast arguments to a more narrow type for
comparison. Considering it a possible further improvement, as it is
better be done being focused on that specific task.

There is an annoying ifdef around 64bit implementation, which uses
same internal ifdef as the header does. This check is aimed to be
removed, so is easier to simply accept such duplication for now.

The tests seems somewhat duplicate for signed/unsigned variants and
things like this. The reason for that is to keep test code as simple
as possible: attempting to do something smart/tricky in the test code
often causes the test code to be a subject of being covered with its
own unit tests.

Differential Revision: https://developer.blender.org/D9590
2020-11-19 17:19:48 +01:00
Brecht Van Lommel 0d027b4583 Fix RNA not giving error with invalid identifiers for collection properties 2020-11-19 16:29:29 +01:00
Sergey Sharybin a44bb8603e Guarded allocator: Fix lock-free allocator tests
Previously the lock-free tests were actually testing guarded allocator
because the main entry point of tests was switching allocator to the
guarded one.

There seems to be no allocations happening between the initialization
sequence and the fixture's SetUp(), so easiest seems to be just to
switch to lockfree implementation in the fixture's SetUp().

The test are passing locally, so the "should work" has high chance
of actually being truth :)

Differential Revision: https://developer.blender.org/D9584
2020-11-19 16:17:48 +01:00
Sergey Sharybin 39ec64b13d Guarded allocator: Add safety around type change
While it might not cover all possible abuse of API, it does provide
basic checks against most obvious usage mistakes.
2020-11-19 16:17:48 +01:00
Sergey Sharybin 4a8cf9d182 Guarded allocator: Add explicit switch to the lockfree implementation
Previously the only way to use lockfree implementation was to start
executable and never switch to guarded allocator.

Surely, it is not possible to switch implementation once any allocation
did happen, but some tests are desired to test lock-free implementation
of the allocator. Those tests did not operate properly because the main
entry point of tests are forcing guarded allocator to help catching
bugs.

This change makes it possible for those tests to ensure they do operate
on lock-free implementation.

There is no functional changes here, preparing boilerplate for an
upcoming work on the allocator tests themselves.
2020-11-19 16:17:48 +01:00
Brecht Van Lommel 42b2ae5f69 Fix lost node links when linked node group datablock is temporarily missing
Don't refresh the list of sockets, so that when the .blend file is restored the
links remain valid. Also display such nodes in red to indicate an error, same
as when the node type info is missing.
2020-11-19 15:55:05 +01:00
Campbell Barton c5306dd0cd Merge branch 'blender-v2.91-release' 2020-11-20 01:41:17 +11:00
Campbell Barton e01bf7a92e Fix T82540: Smart UV project ignores seams
The seam check was missed in 9296ba8674
which calculates islands from the BMesh.
2020-11-20 01:35:26 +11:00
Julian Eisel ad4b7741db Build-system: Force C linkage for all DNA type headers
Some DNA headers already did this, most did not. Even though many of them would
be included in C++ files and thus compiled as C++. This would be confusing and
developers may think they have to add `extern "C"` too a whole lot of
(indirect) includes to be able to use a C header in C++.

However, this is a misconception.
`extern "C"` does not cause code to be compiled with C rather than C++! It only
causes the linker to not use C++ function name mangling. See
https://stackoverflow.com/a/1041880.
Because extern DNA headers don't have function declarations, using `extern "C"`
actually should not have any effect. On the other hand, adding it causes no
harm and avoids confusion. So let's just have it consistently in C header
files.

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

Reviewed by: Bastien Montagne, Sybren Stüvel
2020-11-19 13:41:50 +01:00
Richard Antalik 1395ba70bf Fix crash when adding strip using RNA API call
Don't allocate StripElem for movieclip, scene and mask strips. This
struct is not handled in seq_dupli function. This caused field to be
uninitialized in COW datablock.

StripElem is not allocated when adding strip with operator and it is
not needed for these strip types.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9600
2020-11-19 13:10:42 +01:00
Richard Antalik abe95fbdff Cleanup: refactor sequencer_edit.c file
Move RNA enums and utility functions closer to operator definition.

No functional changes.
2020-11-19 13:04:17 +01:00
Sybren A. Stüvel af7af488d4 Cleanup: Animation, fix uninitialised variable in Euler filter code
No functional changes.
2020-11-19 13:02:13 +01:00
Sybren A. Stüvel 226feb52ec Cleanup: Animation, refactor Euler filter
Split up the Euler filter function into two more functions. The Euler
filter operator works in two stages (find channels that define the X/Y/Z
Euler rotations, and perform filtering on those channels), and each
stage now has its own function. This makes it clearer which data are
used in which part of the code, and makes future improvements easier.

No functional changes.
2020-11-19 12:57:29 +01:00
Campbell Barton b5e85321dc Docs: document bmesh.utils.vert_collapse_faces join_faces argument 2020-11-19 22:18:47 +11:00
Sybren A. Stüvel fd88246d61 Fix error message prefix in `Quaternion.to_euler()`
Fix copy-paste error of error message prefix, so that the Quaternion
function no longer says it's a Matrix function error.
2020-11-19 11:26:54 +01:00
Sybren A. Stüvel ae64898147 Cleanup: fix bad comment separator
Replace `* /` with `*/` to actually end the comment. As it was, the code
compiled but caused an "`/*` in comment" warning.

No functional changes.
2020-11-19 11:04:30 +01:00
Dalai Felinto 71c6c95aec Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-19 10:43:46 +01:00
Dalai Felinto 256e77c987 Fix T82833: GreasePencil crash when changing to Vertex Color mode
This is actually a user interface issue, introduced on 0688309988.

but->tip is checked for NULL in other parts, and rightly so, since here
it crashes Blender.

On a side note I don't know how to reliably reproduce the original bug
whose fix introduced this issue. That got on the way of seeing whether
this is the correct fix, if it happens outside greasepencil operators.

Maybe it is an operator that is missing a tooltip? Impossible to tell
without more information from said commit. That said since this happened
during the end of bcon3 and we are not in bcon4 I'm going ahead with
this NULL check commit.

Patch reviewed by Philipp Oeser and Sergey Sharybin.
2020-11-19 10:33:08 +01:00
Richard Antalik e5df87b1b9 Cleanup: split sequencer_edit.c file
Move proxy operator functions to own file.

No functional changes.
2020-11-19 09:54:40 +01:00
Richard Antalik 8ec6b34b8e VSE: Move split operator logic to module code
Code was rewritten to work on per-sequence basis returning reference to
created strip.

There should be no functional changes.

Selection logic is left as is for now. I could simplify it, but it
belongs to operator, not split logic.

Reviewed By: sergey

Differential Revision: developer.blender.org/D9592
2020-11-19 05:31:40 +01:00
Nicholas Rishel 9d6d5b9beb Fix T82445: Wintab packets being discarded.
Switched timer to use GetTickCount instead of QueryPerformanceCounter
as Wintab's pkTime seems to (but is not guaranteed to) use the former.
2020-11-18 14:29:51 -08:00
Hans Goudey e9ddb21df3 Cleanup: Grammar: "Allow to" vs gerund missed in last commit 2020-11-18 16:31:26 -05:00
Hans Goudey 8f30a88e63 Cleanup: Grammar: "Allow to" vs gerund
In cases where "Allow" is followed by an infinitive, a noun needs
to directly follow it. But it makes more sense to follow it with a
gerund instead.
2020-11-18 16:14:48 -05:00
Hans Goudey 038828f49a Fix: Sub-panel backdrop sometimes draws when closed
My last cleanup commit for this function missed this case. It likely
happens because the panel's block size doesn't update properly somewhere.
Short of investigating that right now, it makes sense to return early
in this case anyway.
2020-11-18 15:54:41 -05:00
Antonio Vazquez e9607f45d8 GPencil: Automerge last drawn stroke with previous strokes
This option joins any stroke with an end near  the actual stroke. Now it is not limited to the last stroke, any stroke in the same layer for the actual frame can be joined. The join can join two strokes drawing a third stroke.

If the end and the start of the result stroke are very small, the stroke is changed to be cyclic automatically.

There is a limit distance to join the stroke, if the distance is greater than this value, the strokes are not joined. Actually, a constant, threshold distance is used, but we could expose 
as a parameter in the UI in the future.

The tool can be used with freehand drawing or with primitives.

Note: Great part of the patch is just a refactor of the old code to make it accessible and to keep code organized.

Reviewed By: mendio

Maniphest Tasks: T82377

Differential Revision: https://developer.blender.org/D9440
2020-11-18 21:35:06 +01:00
Hans Goudey c126e27cdc Cleanup: Move function to proper section 2020-11-18 15:16:17 -05:00
Hans Goudey 0d93bd8d63 UI Code Quality: Refactor panel drawing function
The existing panel drawing function was a bit convoluted with dependent
conditions in different scopes, redundant and unecessary computations,
and un-helpful naming.

This commit separates the function into two parts, the backdrop and the
widgets. It also improves naming and uses const where possible, and in
general cleans up the code.

There are some slight visual changes, mostly with the placement of the
drag icon, which moves a bit downward to be centered with the triangle
icon. The black rectangle displayed while dragging is also removed.
2020-11-18 15:14:11 -05:00
Julian Eisel ad58999b0d Fix pin icon in Properties not right-aligned after zooming
The logic for separator-spacers (used here for right-alignment) didn't take
region scaling into account. Usually that's not an issue because they are
otherwise only used in headers which can't zoom.
2020-11-18 19:54:35 +01:00
Julian Eisel d6d7965307 Fix pin icon in Properties not right-aligned after zooming
The logic for separator-spacers (used here for right-alignment) didn't take
region scaling into account. Usually that's not an issue because they are
otherwise only used in headers which can't zoom.
2020-11-18 19:49:20 +01:00
Nathan Craddock 56ef6fdb9e Merge branch 'blender-v2.91-release' 2020-11-18 08:19:37 -07:00
Nathan Craddock 9a8f5022b7 Fix: Outliner hierarchy line width variations
During some operators like rotate in grease pencil edit mode the
hierarchy lines in the outliner would draw twice as thick. Set the width
before drawing the lines in the outliner.

Differential Revision: https://developer.blender.org/D9589
2020-11-18 08:17:42 -07:00
Germano Cavalcante 898231fdbc Fix transform redo panel showing only the first custom orientation
The error was introduced in rBf470a02afaea, but the problem is in
`ED_transform_calc_orientation_from_type_ex`
2020-11-18 11:57:08 -03:00
Germano Cavalcante 20f8130d6f Fix T82777: Some transform modes using incorrect default orientation
Some modes were always using `"Global"` orientation as the default.
2020-11-18 11:57:08 -03:00
Howard Trickey 466cd2535b Fix exact boolean coplanar problem due to inexact transform.
This is an addendum to previous boolean fix, where the object
transformation was "cleaned". Now the operand one is too.
This fixes the issue shown in the video in T82301 when you move
a column around the XY plane with the top and bottom faces
supposedly coplanar with a cube. The transformation matrix when
you do that has a tiny offset in the z component.
2020-11-18 09:56:20 -05:00