Commit Graph

81793 Commits

Author SHA1 Message Date
Howard Trickey 1709bc5164 Add performance timing to mesh_boolean.cc.
You can uncomment the PERFDEBUG define to get timings.
2020-11-26 18:29:11 -05:00
Pablo Dobarro 64b58888fb Sculpt: Refactor transform code to allow incremental updates
This adds support for incremental updates in the sculpt transform
code. Now tools can define if they need the displacement applied
for the original coordinates or incrementally.

This is needed for features like elastic transform or cloth deformation
target in the transform tool.

No functional changes.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9547
2020-11-27 00:18:41 +01:00
Hans Goudey 26eb8d6aa0 UI: Use decorators in volume modifiers
This is consistent with the UI for other modifier types.
2020-11-26 12:56:12 -05:00
Antonio Vazquez 226b028523 GPencil: Cleanup - Remove unused old shaders
These fill shaders were used with the old draw engine.
2020-11-26 17:44:43 +01:00
Germano Cavalcante 9add12ff05 Transform: Improve event detection for AutoConstrain
The event "value" is not really required since this operation works as a toogle.

This change cleans and simplifies the code.
2020-11-26 13:42:56 -03:00
Bastien Montagne dd0e2da00e Cleanup unintentional change in rB8a2270efc52a
Note that the whole thing need to be redone/properly fixed, but this is
a bit more complicated so for now fix in  rB8a2270efc52a is 'good
enough'.
2020-11-26 17:30:20 +01:00
Philipp Oeser 841ae18605 Fix T83055: setting rna pointer properties can create bogus custom properties
This was reported in the form of the eyedropper of the 'Parent' property
creating a custom property 'parent' if self was picked.

Problem arises when certain checks for setting rna pointer properties
failed (for example: the PROP_ID_SELF_CHECK check) and then a different
code path was entered (which was only meant for IDProperties).

Problem was introduced in rBa7b3047cefcb.

To solve, now first enter the branch for rna-based pointer properties,
then perform the sanity-checks (and if these fail: dont enter the other
unrelated codepath but instead do nothing)

Maniphest Tasks: T83055

Differential Revision: https://developer.blender.org/D9652
2020-11-26 17:18:48 +01:00
Philipp Oeser 4b248c1658 Fix T82729: Crash in rna_EffectorWeight_path when object has fluid and
dynamic paint modifiers

Looks like prior to the introduction of mantaflow, the former
SmokeModifierData always had a domain initialized (even if its type was
set to None). Since mataflow, the FluidModifierData type needs to be set
to MOD_FLUID_TYPE_DOMAIN (otherwise domain is invalid)

Maniphest Tasks: T82729

Differential Revision: https://developer.blender.org/D9644
2020-11-26 16:57:02 +01:00
Bastien Montagne 87030d8be5 Fix T83046: Material change not updating in the link of an override.
Code was actually not applying any override operation over linked data.

Reasonn behind that was that if library file is saved with latest
override applied then this is not needed, since data saved for the
override in the lib file is already up to date.

But this is actually fully breaking in case someone update the lib file
of the lib file, without re-saving the libfile itself.

So now we alwaya apply overrides also on linked data.

Note that this will not fix the case where a resync is needed.
2020-11-26 16:43:31 +01:00
Hans Goudey 4705fafa7e UI: Fix incorrect offset for panel label when zooming in
The panel title text intersected any buttons in the header because
the label offset retrieved from the layout code was not scaled by
the block's zoom level. Error in rB0d93bd8d63980.
2020-11-26 10:29:03 -05:00
Germano Cavalcante 44f5d99cbf Fix T83020: Transform: AutoConstraint being confirmed without releasing the MMB
The transform modifiers are confirmed by releasing any button.

Thus, the operation can be falsely confirmed if the button that launched
the operation is released after the modifier has been activated.

Previously the events that confirmed the modifiers were hardcoded.

An option to fix this would be to add custom confirmation keyitens for
specific modifiers. But this can be a bit confusing and would make the
modal keymap even bigger.

So the solution here is to skip the button that launched the operation
when confirming the modifier.
2020-11-26 11:42:28 -03:00
Joseph Brandenburg 849debe36c Fix T80970: Copy Rotation constraint incorrect under shear
Orthogonalize the constraint target's matrix before decomposing it into
Euler angles. This removes sheer, and is actually a requirement for
correct decomposition.

It's conceivable that someone has used the incorrect behaviour in a rig.
As the shear caused unpredictable flipping of the constrained object,
this is unlikely.

Reviewed By: angavrilov, sybren

Differential Revision: https://developer.blender.org/D8915
2020-11-26 13:12:13 +01:00
Bastien Montagne 8a2270efc5 Fix T81265: Animation is not evaluated when collection is included into view layer.
Just tag objects in un-excluded viewlayer for animation update.
2020-11-26 11:08:51 +01:00
Bastien Montagne 774d18804f Fix T82452: Outliner: Cyclic "Original ID" panel in Data API.
I cannot think of any case where we'd want to show this pointer in UI
anyway, so just tag it with `PROP_HIDDEN`.
2020-11-26 10:46:35 +01:00
Erik Abrahamsson f7223d5f72 UI: Allow theming the alternate row color in the sequencer
Previously, the alternate row color in the Video Sequence Editor was
just a shaded version of the editor's background color. This makes it
theme-able just like in the file browser and outliner, although the
default color is very slightly different.

Differential Revision: https://developer.blender.org/D9634
2020-11-25 16:37:33 -05:00
Pablo Dobarro 05c4efc9b1 Fix Edit Face Set operator not being cancelled when the cursor is not over the mesh
If the cursor is not over the mesh, the operator was still using the
last Face Set ID updated by the drawing cursor code when the cursor was
over the mesh.

This now cancels the operator instead of modifying a Face Set that will
look random to the user.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9545
2020-11-25 22:22:12 +01:00
Pablo Dobarro 8b9b3d98e0 Rename use paint symmetry to use mesh symmetry in quadriflow
The original name was chosen because symmetry was a property of
the Paint struct. Now symmetry is a property of meshes, which
also makes the name of the property easier to understand.

Reviewed By: sergey, dbystedt

Differential Revision: https://developer.blender.org/D9618
2020-11-25 22:21:02 +01:00
Bastien Montagne 41a73909de Cleanup: Typo in `print_default_info` function name. 2020-11-25 20:45:47 +01:00
Alexander Gavrilov 02a0f6b04a Fluid Particles: fix viscoelastic spring threading crash again after D7394.
Since D6133 fluid particle code uses thread local storage to collect
springs created during a time step before adding them to the actual
spring array.

Prior to the switch to TBB there was a single finalize callback which
was called on the main thread, so it could use psys_sph_flush_springs
and insert the new entries into the final buffer. However in D7394 it
was replaced with a reduce callback, which is supposed to be thread
safe and have no side effects. This means that the only thing it can
safely do is copy entries to the other temporary buffer.

In addition, careful checking reveals that the 'classical' solver
doesn't actually add springs, so reduce isn't needed there.

Differential Revision: https://developer.blender.org/D9632
2020-11-25 22:31:47 +03:00
Germano Cavalcante 8330e19cb2 RNA Armature: Improve the description of AxisRollFromMatrix
The roll value may not be as expected when a matrix is not orthogonal
or has a negative determinant.

This can lead to confusion as seen in T82930.

Therefore, make it clear that this is a limitation and that a value for
the roll is somewhat indeterminable in these cases.

This fixes T82930
2020-11-25 13:55:05 -03:00
Antonio Vazquez f67f895770 GPencil: Disable vertex color when use holdout
If the material has the holdout enabled, the value of the vertex color must not be used.
2020-11-25 16:01:30 +01:00
Robert Guetzkow 436fd5663e Fix T82988: Div by zero with curve deform modifier
In `calc_curve_deform` a factor is calculated without checking if
the divisior is zero or close to zero. This patch adds the missing
checks and sets the factor to zero if the division shouldn't be
computed.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9645
2020-11-25 15:18:18 +01:00
Jacques Lucke 1c86d32fa7 Nodes: deduplicate ping pong math operation
The formula did not change. The only side effect of this change should be
that the compositor node now does not divide by zero in some cases.
2020-11-25 12:24:44 +01:00
Bastien Montagne 9e77fc533c Cleanup: remove useless cast. 2020-11-25 11:19:28 +01:00
Sergey Sharybin b1533f8fa4 Tracking: Cleanup, de-duplicate implementation of marker lookup
The logic was duplicated.

Should be no functional changes. The modified function is expected
to give same exact results for all inputs.

On the "caching last-used track" topic. The code was using last_marker
to allow faster lookup of marker closest to the frame. With this
change it is still the case since the BKE_tracking_marker_get() does
cache last used marker.
2020-11-25 09:37:24 +01:00
Jacques Lucke e922dd7d8a Viewport: cannot select object by clicking on its instances
Selecting an object by clicking on its instances only worked,
when the object itself is visible. However, it is possible to hide
the object and still keep the instances visible.

The solution is to give every object the correct `select_id` in the
depsgraph object iterator right before rendering.

Reviewers: fclem, brecht

Differential Revision: https://developer.blender.org/D9640
2020-11-24 17:32:56 +01:00
Sybren A. Stüvel 256a9d983d Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-24 16:05:58 +01:00
Jeroen Bakker 278011e44d Fix T80748: Render Emissive Colors in Compositor Backdrop
This change will use the image engine to draw the backdrop of the compositor. With this patch the alpha blending will be done in Linear Scene Reference space and shows pure emissive colors.

See differential for an example image.

**Technical changes**

As only the backdrop drawing is done using the draw manager there are some technical changes.
1. The overlay buffer is partly drawn outside the draw manager. When drawing the backdrop image the overlay buffer needs to be masked to simulate premultiplied alpha under.
2. The backdrop of the node editor is done in region pixel space. A `DRWView` is constructed with this space.
3. UDIM textures uses world position to generate the UV coordinates. This has been implemented more strict by the `IMAGE_DRAW_FLAG_USE_WORLD_POS`. When the flag isn't used the local coordinates are used to generate the UV coordinates what is image space.
4. The draw manager now checks the actual `eSpaceType` of the space data to use different code paths. In the future the movie clip editor will be added.

NOTE: The preview images in nodes are drawn in display space and cannot show pure emissive colors. As preview images are used on more locations it is best to fix this in a separate patch.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D9451
2020-11-24 13:22:17 +01:00
Sergey Sharybin 82cc21d5e4 Fix T77261: Multires creates spikes when subdividing ngons
The spikes were caused by non-initialized tangent matrix used during
smoothing process. The reason tangent matrix was not initialized was
because wrong usage of API: n-gons should pass corner of 0 to the
matrix construction function.

Corrected usage of the API and added assert() to help catching such
kind of non-initialized issues easier.
2020-11-24 12:40:42 +01:00
Sybren A. Stüvel 31bf8307af Graph Editor: fix keyframe not activating in certain cases
When clicking on an already-selected keyframe, mark it as active if the
click caused the previously-active keyframe to become deselected.

When clicking on a key in the graph editor, it is selected and all other
keys are deselected. If that key was already selected before the click,
it would not become the active keyframe. This is now fixed.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D9639
2020-11-24 12:27:43 +01:00
Jeroen Bakker bb5c4de009 Fix T82962: Crash changing lattice resolution with Vertex Group
Regression introduced by {rB042143440d76}. The deform group lookup was
performed on the wrong object. Before the lookup was performed on
the lattice object. This patch changes this back.

Reviewed By: Bastien Montagne

Differential Revision: https://developer.blender.org/D9638
2020-11-24 11:46:38 +01:00
Sybren A. Stüvel aca8eadb63 Animation: Remove debug prints
Remove accidentally-commited debug prints.

No functional changes.

Reviewed by: sergey

Differential Revision: https://developer.blender.org/D9637
2020-11-24 11:13:43 +01:00
Dalai Felinto e74f61b49a Fix Python API docs for the render API
The API doc for free_blender_memory() was used in
get_preview_pixel_size()

Issue introduced in 5494683651.
2020-11-24 10:42:28 +01:00
Nathan Craddock 037ce662e5 Outliner: Switch properties tabs only on icon click
According to feedback the outliner to properties editor tab switching
was annoying when it always changed tabs on selection, especially for
selecting individual objects. This limits the tab switching behavior to
only when the icons in the outliner are selected.
2020-11-23 22:21:02 -07:00
Yevgeny Makarov df31ecf0c3 UI: Add Trackpad Smooth Scrolling for Popovers
Adds smooth scrolling with the trackpad for popovers. Also fixes the position of the scroll arrows on high-DPI.

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

Reviewed by Brecht Van Lommel
2020-11-23 17:22:20 -08:00
Yevgeny Makarov b6a50b5dcb UI: Block Safety Not Scaled Correctly
Layout block safety sizes were not scaled correctly with interface scale.

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

Reviewed by Brecht Van Lommel
2020-11-23 16:56:01 -08:00
Howard Trickey 246c11634f Speedups for new boolean. Better hash function for verts.
The existing hash function didn't work well with Set's method of
masking to the lower bits, because many verts have zeros in the
lower bits.
Also, replaced VectorSet with Set for Vert deduping.
2020-11-23 19:30:40 -05:00
Christoph Lendenfeld 1f09dcc121 Cleanup: Animation, split `graph_edit.c` into separate files
Split some of the code of `graph_edit.c` into:
* `graph_view.c`: preview range, view all, view selected etc.
* `graph_slider_ops.c`: the decimate modal operator code.

The latter file will be extended later with more slider-based operators.

Maniphest Tasks: T81785

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9312
2020-11-23 15:26:54 +01:00
Sergey Sharybin 152754a477 Tracking: Cleanup, typos and spelling in DNA comments 2020-11-23 15:25:55 +01:00
Sybren A. Stüvel e4ca1fc4ea Animation: New Euler filter implementation
This new discontinuity filter performs actions on the entire Euler
rotation, rather than only on the individual X/Y/Z channels. This makes
it fix a wider range of discontinuities, for example those in T52744.

The filter now runs twice on the selected channels, in this order:
- New: Convert X+Y+Z rotation to matrix, then back to Euler angles.
- Old: Add/remove factors of 360° to minimize jumps.

The messaging is streamlined; it now reports how many channels were
filtered, and only warns (instead of errors) when there was an actual
problem with the selected channels (like selecting three or more
channels, but without X/Y/Z triplet).

A new kernel function `BKE_fcurve_keyframe_move_value_with_handles()` is
introduced, to make it possible to move a keyframe's value and move its
handles at the same time.

Manifest Task: T52744

Reviewed By: looch

Differential Revision: https://developer.blender.org/D9602
2020-11-23 12:48:04 +01:00
Bastien Montagne 64513df8b6 Fix T82849: Assert When Unlinking "Edit Source" Text Data-block.
Simplify and sanitize handling of usercounts for Text IDs generated
trhough `BKE_text_load_ex`.
2020-11-23 11:56:40 +01:00
Sergey Sharybin 401612b8e1 Tracking: Cover markers access with basic tests
Just a beginning of tests coverage, related on the planned upcoming
development.
2020-11-23 09:23:19 +01:00
Sergey Sharybin 1e0ff6b723 Tracking: Cleanup, make units explicit in new track creation 2020-11-23 09:23:19 +01:00
Sergey Sharybin 6d314c940e Tracking: Cleanup, clarify comments in tracking settings
Make unit more explicit.

Ideally would be "embedded" into the field name itself, but this will be
more involved change.
2020-11-23 09:23:19 +01:00
Sergey Sharybin 2ee5bc33ea Tracking: Refactor, move track allocation to helper function
The caller is still responsible for allocating list of markers,
but the track allocation and initialization can now be reused.

Currently no functional changes, preparing for an upcoming
development.
2020-11-23 09:23:19 +01:00
Julian Eisel 7bab87c119 Fix T82918: File menu "Save Copy" shows "Save As" in File Browser
Use a dynamic name/description based on the set properties. This makes it more
clear what's going on and avoids confusion, as explained in the report.
2020-11-22 19:21:30 +01:00
Hans Goudey 4c01fbb564 Cleanup: Use const arguments in curve bevel
This makes it clear that only the final "r_data" is being changed.
Also rename a variable to be less vague.
2020-11-22 12:11:15 -05:00
Hans Goudey b11d409ac4 Cleanup: Improve readability of curve displist building
Just a few minor improvements: declare variables where they are
initialized, decrease scope, expand some variable names, and use
LISTBASE_FOREACH.
2020-11-22 11:47:37 -05:00
Hans Goudey 1cc3a0e2cf Cleanup: Reduce indentation
Having up to nine levels of indentation make this function hard to
follow. Instead of indenting the rest of the loop for a simple special
case, just continue.
2020-11-22 11:25:10 -05:00
Alexander Gavrilov 0f3ca3f4bc Fix unclear tooltip for the Affect Transform option of constraints. 2020-11-22 13:33:27 +03:00
Howard Trickey d25e116889 Previous commit forgot to guard some things with #ifdef WITH_GMP. 2020-11-21 22:44:35 -05:00
Howard Trickey df8cc5662b Improve speed of Constrained Delaunay Triangulation with exact arith.
By using floating point filters, the speed improves by a factor of 2 to 10.
This will help speed up some cases of the Exact Boolean modifier.
Changed the interface of mpq2::isect_seg_seg to not return mu, as it was
not needed and not calculating it saved 15% time.
2020-11-21 11:55:14 -05:00
Antonio Vazquez 38fe962d95 Merge branch 'blender-v2.91-release' 2020-11-21 14:18:12 +01:00
Antonio Vazquez 6c6a5a72c2 GPencil: Fix unreported assert when use select Box in single point strokes
The assert was when use segment selection mode.
2020-11-21 14:17:26 +01:00
Hans Goudey 0eb096f406 Cleanup: Declare variables where initialized
Reduce variable scope, and in a few cases, use bool instead of int.
2020-11-20 21:54:52 -05:00
Pablo Dobarro c850ce93a4 Fix wireframe opacity creating artifacts on sculpt overlay edges
When lowering the wireframe opacity with sculpt overlays enabled, the
wireframe overlay was creating white artifacts along the edges.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D9607
2020-11-20 18:02:07 +01:00
Hans Goudey cec22ba8db Cleanup: Use LISTBASE_FOREACH macro 2020-11-20 11:00:51 -05:00
Nathan Craddock 2afdb4ba87 Outliner: Object state filter invert toggle
This adds an invert toggle for the outliner object state filters.
There are some cases where we want a filter for invertable states (Selected,
Unselected) and having a single toggle to invert the filter reduces the
number of separate filter types needed. This removes the "Hidden" filter
which can now be replicated with an inverted "Visible" filter.

Differential Revision: https://developer.blender.org/D9598
2020-11-20 08:47:51 -07:00
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
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
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
Brecht Van Lommel 0d027b4583 Fix RNA not giving error with invalid identifiers for collection properties 2020-11-19 16:29:29 +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
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
Sebastián Barschkis 957f14a689 Merge branch 'blender-v2.91-release' 2020-11-18 15:39:43 +01:00
Sebastián Barschkis 4edaa796d3 Fluid: Revert changes from T82488
Scaling of forces needs more work. Before making changes to them it would be nice to have a setup, that works physically correct across multiple modifiers (cloth, rigid bodies, fluid).

This will be a to do for 2.92.
2020-11-18 15:38:00 +01:00
Jeroen Bakker f132d74c7d Merge branch 'blender-v2.91-release' 2020-11-18 14:26:01 +01:00
Jeroen Bakker 549a1cac88 Fix T82810: UV Editor, Crash with switching between single image and UDIM tile
Active tile could be NULL when it was on the second tile before
switching back and forth between the Image/UDIM.

In the future we might also check that the active_tile_index is always
valid.
2020-11-18 13:12:19 +01:00
Pablo Dobarro 4b55abc335 Fix T82586: Sculpt normals not updating with EEVEE enabled
The root cause of this bug is that the function that updates the PBVH
normals is drw_sculpt_generate_calls. As now both the overlays and
mesh can be drawn without using pbvh drawing, the normals were not
updating. This patch forces a normals updates also in the no PBVH
drawing code path of the overlays. This was affecting both shading and
sculpt surface sampling in both flat and smooth shading modes.

Having the sculpt normals being updated by the drawing code is a wrong
design which also causes other issues like:

    Brushes that sample the surface and do multiple stroke steps between

redraws will sample invalid normals, creating artifacts during the
stroke clearly visible in some brushes.

    Brushes that do not need to sample the surface update the normals on

each redraw. This affects performance a lot as in some cases, updating the
normals takes more time than doing the brush deformation. If flat shading
is being used, this is only necessary to do once after the stroke ends.

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D9535
2020-11-18 12:20:57 +01:00
Campbell Barton d2cddb1fda Merge branch 'blender-v2.91-release' 2020-11-18 16:43:01 +11:00
Campbell Barton dfa2b0e1c9 Fix T82800: Changing settings from a pie menu doesn't add undo steps
Pie menu had inconsistent behavior for dragging & releasing the key
compared to clicking on the button.

This was caused by the `onfree` argument being set to true,
preventing the button from running callbacks such as setting
up undo data & auto-keyframe

This argument should only be used when freeing the button,
set this to false as is done for regular menus.
2020-11-18 16:40:48 +11:00
Campbell Barton 8b8328fbfc Merge branch 'blender-v2.91-release' 2020-11-18 15:13:26 +11:00
Campbell Barton 0688309988 Fix undo UI text containing shortcuts & newlines
- Shortcuts were being shown in the undo history.
- Multi-line tool-tips now only use the first line.
2020-11-18 15:10:51 +11:00
Nathan Craddock 80a701c4e6 Merge branch 'blender-v2.91-release' 2020-11-17 19:55:49 -07:00
Nathan Craddock a352baccc3 Fix grease pencil draw mode icon color in outliner
ICON_GREASEPENCIL was defined as an object data icon when it was used as
a mode icon. This caused it to draw green in the outliner.
2020-11-17 19:51:14 -07:00
Nathan Craddock a3833abe2c Fix wrong grease pencil datablock icon in file browser
The datablock shown in the file browser was the draw mode icon rather
than the datablock icon.
2020-11-17 19:49:28 -07:00
Campbell Barton bbdfeb751e Cleanup: remove break after return statements 2020-11-18 13:36:30 +11:00
Campbell Barton 88512646c0 Cleanup: clarify precedence of operations 2020-11-18 13:36:26 +11:00
Campbell Barton d13edeaed4 Cleanup: 'false' use as NULL pointer 2020-11-18 13:19:53 +11:00
Campbell Barton eb2c26bd38 Fix use of operator flag as boolean
Error in cb9de95d61
2020-11-18 13:13:52 +11:00
Campbell Barton 2485ee997b Cleanup: use descriptive argument name for uv parametrizer 2020-11-18 12:59:39 +11:00
Campbell Barton ec6e88d4b2 Cleanup: simplify array usage for Python box packing API 2020-11-18 12:50:44 +11:00
Campbell Barton 75a4872c90 Cleanup: declare original function storage variables static
Also minor comment formatting changes.
2020-11-18 12:44:08 +11:00
Pablo Dobarro 3e325c35f8 Merge branch 'blender-v2.91-release' 2020-11-17 23:10:13 +01:00
Pablo Dobarro e580c18853 Fix T82542: Boundary brush crash with dyntopo
This brush needs to be disabled for dyntopo as it stores its custom data
and deforms from original coordiantes.

Reviewed By: sergey

Maniphest Tasks: T82542

Differential Revision: https://developer.blender.org/D9516
2020-11-17 23:01:33 +01:00
Bastien Montagne 9b20bbc3bf LibOverride: PointCache: Add UI feedback about need to enable Disk Cache.
Note that I chose to modify the label of the main `Bake` button instead
of adding an extra label line, as that would disturb the UI in a
annoying way.
2020-11-17 21:33:28 +01:00
Hans Goudey df2bf164c7 Cleanup: Use LISTBASE_FOREACH macro 2020-11-17 13:00:43 -05:00
Hans Goudey da6c968a95 Cleanup: Clang tidy else after return 2020-11-17 12:58:26 -05:00
Hans Goudey 7d23dd4430 Cleanup: Clang tidy inconsistent parameter name 2020-11-17 12:57:35 -05:00
Bastien Montagne 75dbbaeda6 Merge branch 'blender-v2.91-release' 2020-11-17 17:39:47 +01:00
Bastien Montagne 22161b6451 Cleanup: Fix incorrect RNA property label/tooltip re active NLA track.
The joys of copy/paste again.
2020-11-17 17:39:08 +01:00
Hans Goudey ea7aae88cf Cleanup: Remove unecessary NULL check
Panels for active uiBlocks always have a type, because the process that
makes them uses the types. Add an assert just to make it clear that the
assumption is purposeful.
2020-11-17 10:28:57 -05:00
Hans Goudey d952d1792a Merge branch 'blender-v2.91-release' 2020-11-17 10:17:00 -05:00
Jeroen Bakker d73130cc28 Fix T82770: Artifacts when painting on generated transparent image
Regression introduced by {b17cca6966}. When centralizing the gpu texture
premultiplication setting it was assumed that generated images
(`IMA_TYPE_UV_TEST`) were stored as premultiplied. That assumption was
totally wrong as the alpha association is determined by the existing of
the float/byte buffer.

NOTE: This change will render generated images with pure emissive
colors (show colors when alpha=0.0) what might add more reports. Any
reports could be merged in the next report {T82790}.

Reviewed By: Clément Foucault, Philipp Oeser

Differential Revision: https://developer.blender.org/D9585
2020-11-17 16:10:42 +01:00
Hans Goudey cc0b8cb359 Fix T82341: Warning in terminal during property search
After recent changes to the context panel layout (rB187cc5e26d28b1a8),
there has been an error printed when running propery search:

> Error: separator_spacer() not supported in popups.

The layout code thinks it's drawing in a menu because region->visible
isn't properly set for the other tab searches. This patch sets that field
for the temporary searching region, but it also disables searching in the
context breadcrumbs panel, because at best this will just give results
for the names of the active object, etc. This isn't helpful since
those labels are mostly in every tab anyway.

Differential Revision: https://developer.blender.org/D9425
2020-11-17 10:08:39 -05:00
Julian Eisel 0724fabcf5 Fix T81227: Modifier menu and text switch places
Logic was incorrect, mistake in f3b8792b96.

Updated comment to make intent more clear.

Same as fd78f8699e, but needed conflict resolution as the panel-type
flags where renamed in master.
2020-11-17 15:58:05 +01:00
Clément Foucault dede4aac5b Fix T77561 EEVEE: Refraction BSDF is using world probe during glossy bake
This fixes light leaking during baking indoor environment when using
refraction bsdfs.
2020-11-17 15:56:24 +01:00
Julian Eisel fd78f8699e Fix T81227: Modifier menu and text switch places
Logic was incorrect, mistake in f3b8792b96.

Updated comment to make intent more clear.
2020-11-17 15:31:50 +01:00
Campbell Barton c12664a37f Merge branch 'blender-v2.91-release' 2020-11-18 00:27:40 +11:00
Campbell Barton 9d716b929d Merge branch 'blender-v2.91-release' 2020-11-18 00:27:36 +11:00
Campbell Barton 90e516d1a5 Merge branch 'blender-v2.91-release' 2020-11-18 00:27:33 +11:00
Campbell Barton 71def9738e Merge branch 'blender-v2.91-release' 2020-11-18 00:27:29 +11:00
Campbell Barton 9296ba8674 Fix T82637: pack UV islands fails with some non-manifold meshes
Edges with 3 or more connected UV's caused UV pack to fail.

Instead of using functions from uvedit_parametrizer.c which are intended
specifically for ABF/LSCM unwrapping, use a simpler method for packing
which stores arrays of BMesh faces.
2020-11-18 00:25:30 +11:00
Campbell Barton a993600323 BMesh: support for comparing loops when calculating face-groups
Add an optional callback to check source/destination loops for
BM_mesh_calc_face_groups.

This is needed so it can be used to calculate UV islands.
2020-11-18 00:02:54 +11:00
Campbell Barton 6694d7ac5f BMesh: add UV face transform and minmax utility functions 2020-11-17 23:57:16 +11:00
Campbell Barton 7785a9c9d2 BLI_rect: add a float version of the 'pad' function 2020-11-17 23:57:16 +11:00
Jeroen Bakker 03ad2958d3 Merge branch 'blender-v2.91-release' 2020-11-17 13:12:21 +01:00
Jeroen Bakker 1e1c39fc89 Fix T82064: Add Image Clone tool to overlay engine
The clone tool in the image editor can show a second texture on top
of the image. This wasn't ported and now results into alpha and depth
issues. This fix adds the clone tool drawing to the overlay engine.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D9352
2020-11-17 13:10:39 +01:00
Ankit Meel 88de58fd1a Clang-tidy, fix bugprone-exception-escape.
Remove redundant call to `ofstream::close()` from `~PSStrokeRenderer`
and `~TextStrokeRenderer`. ofstream will be destructed automatically.

- For `~Depsgraph`, `std::function`'s constructor can throw.
- Passing throwing statements in the lambda will not be detected by
  clang-tidy.
Fix these issues by using lambda as function argument.

Reviewed By: sergey, sybren
Differential Revision: https://developer.blender.org/D9497
2020-11-17 17:33:25 +05:30
Richard Antalik 417224a31b Merge branch 'blender-v2.91-release' 2020-11-17 13:02:30 +01:00
Richard Antalik 8b6ce77f16 VSE: Fix prefetch initialization sequence
In 8d1978a8e0 bmain entry is updated when prefetching is started,
but this must be done before seq_prefetch_update_context(). Otherwise
created cache keys will be incorrect.

This happens immediately after prefetch is started. When it's refreshed
problem goes away.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9581
2020-11-17 13:00:00 +01:00
Bastien Montagne cd9ce01657 RNA define: check and report invalid usages of ID pointers properties.
Some RNA structs, like operators or keymaps, are not allowed to have ID
pointer properties. now this check will ignore those, and report an
error message in the console.

Related to T82597.

Notes: While a bit more involved than rBf39fbb3e6046, this commit
remains fairly localized and non-intrusive.

It relies on some rather obscure and weird behaviors of our RNA code
though, a cleaner solution could be e.g. to add a tye to
`StructOrFunctionRNA`, so that we could properly 'rebuild' (re-cast) the
pointer to either `StructRNA` or `FunctionRNA` when needed in internal
code...
2020-11-17 12:56:26 +01:00
Sybren A. Stüvel a25bc79633 Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-17 11:11:34 +01:00
Wayde Moss 709ceddab2 Fix T82774: NLA Sync Length Typo Fix
When offsetting strips to the left, to make space when syncing strip
length, move the preceding NLA strips instead of the succeeding strips.

The bug seems to be from a copy/pasting typo.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9583
2020-11-17 11:01:28 +01:00
Sybren A. Stüvel 02efc0111c Fix T82588: Box Select selects keyframes hidden by "Only Show Selected"
Select only editable keys on selected curves when "Only Show Selected
Curves" is enabled in the Graph Editor's View menu.

This prevents selecting invisible keys with box, circle, and lasso
select in the Graph Editor.

Reviewed By: looch

Differential Revision: https://developer.blender.org/D9580
2020-11-17 10:58:40 +01:00
Jeroen Bakker fb033341f9 Merge branch 'blender-v2.91-release' 2020-11-17 09:37:41 +01:00
Jeroen Bakker 2e1498ff16 Fix T82042: Crash when rendering huge images
Crash is related to the definition of the GL_MAX_TEXTURE_SIZE. OpenGL does not clearly
defined `GL_MAX_TEXTURE_SIZE` exactly means. Both on AMD and NVIDIA we have issues with
huge textures that they don't get created even if they are smaller. (See {D9530} for
research).

This patch will try to create the texture in a smaller size when the texture creation
failed.

Final implementation by: Clément Foucault

We should create a solution that doesn't need downscaling. For this specific case ARB_sparse_texture might help to create cleaner code, but you still have to commit the whole image what introduces several draw calls. Other improvement is to optimize the scaling; current implementation isn't optimized for performance.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D9524
2020-11-17 09:33:47 +01:00
Richard Antalik 797dfa6a0a Merge branch 'blender-v2.91-release'
Conflicts:
	source/blender/editors/render/render_opengl.c
	source/blender/sequencer/intern/effects.c
2020-11-17 04:10:51 +01:00
Richard Antalik 75bd286813 Fix T82703: Image not scaled when rendering
This is was caused by incorrectly set preview_render_size in VSE
rendering context. Value was set to SEQ_PROXY_RENDER_SIZE_FULL, but
it should be SEQ_PROXY_RENDER_SIZE_SCENE as scene render size is
being used.

This is same fix as 0d7036b40e, but I did not checked openGL
render pipeline.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9562
2020-11-17 03:56:53 +01:00
Richard Antalik 55be1dde5c Fix incorrect text size with downscaled preview
Use either scene render size or fixed preview scale factor.

Previously scene render size was used as baseline value for text size
correction. This is incorrect.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9563
2020-11-17 03:55:52 +01:00
Clément Foucault 82b8c15684 Fix T81827: MacOS lines that should be thick are green instead
The issue was the use of alpha values of 0 when there were no blending
enabled.

This patch just disables the smoothing of the wires in this case.
2020-11-17 01:31:32 +01:00
Nathan Craddock 09045ff64d Merge branch 'blender-v2.91-release' 2020-11-16 14:19:11 -07:00
Nathan Craddock 1d4f3e2a26 Outliner: Collection icon color tweaks
The icons originally chosen for the collection colors were selected
during development and had a few issues with contrast in the light
theme, and the gray color was not a good choice against the default gray
backgrounds.

The new colors are more readable in both default Blender themes. Gray
was replaced with pink.

Differential Revision: https://developer.blender.org/D9504
2020-11-16 13:54:05 -07:00
Nicholas Rishel 96200110eb Fix T76699: Support macOS inbetween mouse/tablet.
Coalescing on macOS overwrites a singular unprocessed mouse event. To
receive all mouse and tablet events coalescing is disabled.

Disabling coalescing for macOS disables coalescing for trackpad
gestures. Repeat trackpad events are unnecessary and found to
negatively impact performance thus are re-coalesced in Window Manager.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9574
2020-11-16 12:46:16 -08:00
Clément Foucault 07bd8eab97 Fix unreported wireframe opacity color blending broken
This was introduced by rBdb7d8281c5a2.

The color needs to be premultiplied as there is no blend mode and
the output color is replacing the framebuffer color & alpha.
2020-11-16 18:31:43 +01:00
Hans Goudey 328aad8c98 UI: Remove X axis panel dragging
X axis panel dragging traces back to Blender versions before 2.5,
where panels could be aligned horizontally. But for many years now
panels have been vertically aligned. Considering this, keeping the
X axis dragging around is a bit odd. It makes interaction confusing,
or at least more complicated. It also looks bad, since any part of
the panel outside the region is cropped.

Differential Revision: https://developer.blender.org/D9549
2020-11-16 11:47:11 -05:00
Bastien Montagne c1d8df47f6 Revert "RNA define: check and report invalid usages of ID pointers properties."
This reverts commit f39fbb3e60.

Code is not valid, `DefRNA.laststruct` does not always point to the
proper struct when defined from Python, need to be done differently.
2020-11-16 17:13:12 +01:00
Hans Goudey c48063d1f6 Merge branch 'blender-v2.91-release' 2020-11-16 11:00:23 -05:00
Hans Goudey c645da98d8 Fix T82439: Crash moving collections between scenes
The original code for viewlayer collection flag syncing across moves
from D9158 didn't consider the case where the collection could no longer
be found in its original view layer (moving a collections betwen scenes).

The fix is to just check if the collection starts in the same scene as
it will be moved to before trying to do the flag syncing. I thought about
this for a while and tried a couple other solutions, but I couldn't come
up with a proper way to support syncing the layer collection flags across
scenes without making too many changes.

Differential Revision: https://developer.blender.org/D9568
2020-11-16 10:59:49 -05:00
Bastien Montagne 13bcb000fa Fix broken pointcache on disk in some cases.
Root of the issue is that point caches are added to the object's list
on-demand, which often ends up with them being added only during
depsgraph evaluation, i.e. on COW objects.

This could result in having 'orig' data caches with invalid/unset stack
index at some points (e.g. when reading a file and applying
liboverrides), leading to discarding valid existing disk cache files.
Fact that one of those index is signed, and the other not, does not
help...

While this is very weak, fixing broken PointCache code is out of the
scope of a bug fix, so this patch merely:
* Simplifies and factorizes the code generating the 'extension' part of
  caches filenames;
* Ensures `BKE_object_insert_ptcache` is called when needed so that we
  always have a valid stack index to generate that filename extension.

This is only a bandaid, but it is simple and should be safe enough for
now.

Related to T82503.
2020-11-16 14:39:31 +01:00
Bastien Montagne 97d52daf96 Fix (unreported) potential buffer overflow in PointCache code. 2020-11-16 14:39:31 +01:00
Bastien Montagne f39fbb3e60 RNA define: check and report invalid usages of ID pointers properties.
Some RNA structs, like operators or keymaps, are not allowed to have ID
pointer properties. now this check will ignore those, and report an
error message in the console.

Related to T82597.
2020-11-16 14:39:31 +01:00
Sybren A. Stüvel b78bebb2af Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-16 14:15:01 +01:00
Fabrício Luis 75af3165ca Fix T82519: Adding 2nd driver doesn't recalculate
Remove `return` from for-loop which blocked the recalculation of driven
values when it found the first driver.

Reviewed By: sybren, sergey

Differential Revision: https://developer.blender.org/D9515
2020-11-16 14:10:24 +01:00
Robert Guetzkow 62c4d0419c Merge branch 'blender-v2.91-release' 2020-11-16 13:23:59 +01:00
Robert Guetzkow 8b815c7ce5 Fix T81271: Fix crash in BLI_gzopen on Windows
Previously the return value of `ufopen` wasn't checked and if it failed,
`NULL` was passed into `fclose()` which resulted in a crash. This patch
avoids this by returning from `BLI_gzopen` when the file cannot be created.

Reviewed By: sebbas, iss

Differential Revision: https://developer.blender.org/D9576
2020-11-16 13:17:24 +01:00
Philipp Oeser 8b88739848 Merge branch 'blender-v2.91-release' into master 2020-11-16 12:55:50 +01:00
Philipp Oeser 7db42b8f2a Fix T82460: Color Management Curves do not update when Image/UV Editor
is present

Caused by rB4212b6528afb.

'updateGLSLCurveMapping()' compares cacheIDs and in certain scenarios,
these are the same when they should not.

- whenever we had multiple viewports that are colormanaged with
curvemappings this worked right (cacheIDs were different)
- for example, this also worked right when the ImageEditor displays a
Render Result or a Compositor Viewer
- but it worked wrong when the Image Editor displays any other Image (or
no Image at all)
- it also worked right if there were multiple Image Editors [and one of
them displays a Render Result e.g]

Now why is this so?

For comparison, the curve mapping's pointer/address is used.

- update_glsl_display_processor frees the curve_mapping, see
BKE_curvemapping_free(global_glsl_state.curve_mapping)
- similar, update_glsl_display_processor creates a new curvemapping, see
BKE_curvemapping_copy(view_settings->curve_mapping)
- now for the situation that a viewport with curvemapping and a viewport
without curvemapping is present and you make changes to the curvemapping
the following happens:
-- curve_mapping_settings->cache_id is set once [to the memory address
of curvemapping before change]
-- change happens
-- viewport 1 frees curvemapping
-- viewport 2 duplicates using BKE_curvemapping_copy, but this one gets
the same address like before the change
-- this means we have different data on the same address with the same
cacheID...

Solution: to really make the cache ID unique we can combine the pointer
with its 'changed_timestamp' [which increases on every change].

Reviewers: jbakker

Maniphest Tasks: T82460

Differential Revision: https://developer.blender.org/D9559
2020-11-16 12:52:24 +01:00
Sybren A. Stüvel cb9f6dfebd Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-16 12:23:05 +01:00
Sybren A. Stüvel ada79b4707 Fix T82740: Drivers on movie clip datablock crash on file open
Add call to `BKE_animdata_blend_read_data()` after remapping the MovieClip
datablock address.
2020-11-16 12:21:03 +01:00
Campbell Barton af013ff76f Cleanup: clang-tidy 2020-11-16 21:54:28 +11:00
Jacques Lucke 64aa6c68d5 Fix T81817: use-after-free when trying to open file from splash screen
The issues was that Blender was trying to refresh the
splash screen region. However, opening the file browser
closed the splash screen and freed the region.

The fix is to simply not refresh the region.

Has been approved in T81817.
2020-11-16 11:30:24 +01:00
Campbell Barton 8fd27c152a Correct T82753 Fix from 979fe4f1be 2020-11-16 18:27:11 +11:00
Campbell Barton 979fe4f1be Fix T82753: Crash using add-object tool when gizmos are disabled 2020-11-16 18:24:02 +11:00
Campbell Barton 64ab084ca5 Grease Pencil: adjust behavior of target object detection
First detect the other selected object, then check it can be written to.

Otherwise the target object could be the first one found when
looping over objects which is random from the user perspective.

Move the type check to the operator, which also checks the data isn't
library data which was being ignored.
2020-11-16 16:48:44 +11:00
Campbell Barton a3a6d6a670 Cleanup: spelling 2020-11-16 16:48:41 +11:00
Campbell Barton 4eac03d821 Cleanup: clang-format 2020-11-16 16:48:19 +11:00
Richard Antalik 01db805a82 Cleanup: split sequencer.c file
Move most functions into separate files.

File sequencer.c is reserved for alloc, free and duplicating functions.

There should be no functional changes.
2020-11-16 05:02:30 +01:00
Howard Trickey 52a189936b Merge branch 'blender-v2.91-release'
Bring in exact boolean fix.
2020-11-15 20:26:14 -05:00
Howard Trickey fbffff26e4 Fix T82736, Exact Boolean fail with repeated subtraction of same object.
Two problems were fixed. One, the code for dissolving vertices
left a face around if dissolving a vertex would leave less than
three vertices. Instead, the face should be deleted.
Two, with transformations like "rotate 180 degrees", this should
be no problem with exact, but the current transformation matrix
has very small non-zero entries where it shouldn't. Cleaning the
transformation matrix makes it more likely that user expectations
about coplanar faces will be fulfilled.
2020-11-15 20:24:59 -05:00
Nathan Craddock 194a57fd63 Outliner: Fix memory errors in runtime data
Fix a heap-use-after-free when duplicating outliner editors, and fully
free runtime data when freeing outliner editors.
2020-11-14 14:24:40 -07:00
Antonio Vazquez 6ac5e0b3e8 GPencil: Missing initialization in previous commit 2020-11-14 15:21:20 +01:00
Antonio Vazquez c2f76f1550 GPencil: Cleanup clang format 2020-11-14 15:16:27 +01:00
Antonio Vazquez b6041bfc6c GPencil: Fix unreported crash in some cases when duplicate a stroke
Some pointers were not initialized.
2020-11-14 15:16:02 +01:00
Antonio Vazquez a3ce05d00e GPencil: Fix callback parameter list error
In the previous commit the bGPDframe parameter was removed, but this parameter is required to keep the same function signature.
2020-11-14 09:44:55 +01:00
Nathan Craddock 83d0810a9f Merge branch 'blender-v2.91-release' 2020-11-13 20:52:06 -07:00
Nathan Craddock 9b54c81414 Collections: Prevent setting scene collection color tag from rna
It should not be possible to set the scene collection's color tag
through rna. Also adds a missing notifier for setting the collection
color tag from python.
2020-11-13 20:36:35 -07:00
Nathan Craddock 0633a89e18 UI: Remove remaining uses of old collection icon
After rB452a1c7b3838 there were still a few cases where the old
collection icon was used in the interface. Replace these with the new
filled collection icon.
2020-11-13 20:28:28 -07:00
Falk David 2abbcaa021 GPencil: Fix compiler warning, unused variable 2020-11-13 22:31:58 +01:00
Falk David 0be88c7d15 GPencil: Merge GSoC curve edit mode
Differential Revision: https://developer.blender.org/D8660

This patch is the result of the GSoC 2020 "Editing Grease Pencil Strokes
Using Curves" project. It adds a submode to greasepencil edit mode that
allows for the transformation of greasepencil strokes using bezier
curves. More information about the project can be found
here: https://wiki.blender.org/wiki/User:Filedescriptor/GSoC_2020.
2020-11-13 21:43:00 +01:00
Hans Goudey 9d28353b52 Cleanup: Make panel type flag names more clear
The overlap with the `Panel` flags that start with "PNL" was quite
confusing because wasn't clear which enum a flag was from. The
new names are a bit longer, but the clarity is worth it.
2020-11-13 13:57:20 -05:00
Hans Goudey 4c193f731e Cleanup: Move PanelType flag from DNA to BKE header
Since this flag isn't saved in files and PanelType itself is defined in
BKE, the flag makes more sense there.
2020-11-13 13:15:41 -05:00
Antonio Vazquez e9b955b99c GPencil: Remove ID from operators to fix T82597
Instead to use the ID of the object, now the parameter is an Enum with Selected object or New.

If use selected mode, the first grease pencil object selected is used. If none of the selected objects is a grease pencil object, a new object is created.

Small cleanup changes to the original patch.

Differential Revision: https://developer.blender.org/D9529
2020-11-13 15:21:15 +01:00