Commit Graph

80240 Commits

Author SHA1 Message Date
Bastien Montagne 6fde0050c4 Fix (unreported) LibOverride: RNA asserts when applying overrides.
Some RNA setters require ID data they operate on to be in G_MAIN.
Unfortunately, when we apply overrides as part of a .blend file reading,
new Main is not yet made global one, so we have to do it temporarily
here.

This is a fairly ugly hack, but it should be harmless and safe.
2020-09-23 11:07:03 +02:00
Bastien Montagne b93b75b5fb LibOverride: Tweak override creation code.
This is a first step towards supporting conversion of proxies, done
separately to make it easy to pinpoint in case it would create problems.

It is not expected to cause any change in behavior currently.
2020-09-23 11:07:03 +02:00
Campbell Barton a6b16cfd80 Cleanup: remove 'r_' prefix for variables
This is for return arguments, also remove redundant NULL check.
2020-09-23 18:22:46 +10:00
Campbell Barton 8963671bcc Fix T73858: Gizmo.use_draw_scale doesn't work as expected 2020-09-23 15:51:23 +10:00
Campbell Barton 02a204fe67 Fix T68024: Crash from missing original-index mesh layer
Constructive modifiers were not initializing an original index layer
in the case a previous deform modifier created 'mesh_final'.

This happened in the case of multiple deform modifiers that deform along
normals, as requesting normals caused the final mesh to be created.

Ensure mapping data is created in the case
only non-constructive modifiers have run.
2020-09-23 15:26:29 +10:00
Campbell Barton ea5c8c4e84 Cleanup: re-order constructive modifier checks
Minor changes to simplify fix (coming next), no functional changes.
2020-09-23 15:26:01 +10:00
Nathan Craddock 5a28090977 Fix outliner collection icon in light theme
Ensure the theme colors are used for the collection icon when there are
no color tags present, otherwise it draws completely black.
2020-09-22 21:06:48 -06:00
Hans Goudey 358a8e00bd Cleanup: Quiet unused variables warning 2020-09-22 13:36:06 -05:00
Antonio Vazquez 88970e3900 GPencil: Improve default brush draw mode
Mainly a UI adjustment, no functional changes

To have the default mode in the advanced panel as separated option is not the best solution.

Now, there is a pin option and when it is enabled, the brush keeps this mode.

Differential Revision: https://developer.blender.org/D8974
2020-09-22 20:11:28 +02:00
Alex Strand 3873a0f490 Fix COLLADA failing to export HDR emission strength
HDR is not supported by COLLADA, so clamp to export the closest approximation.

Differential Revision: https://developer.blender.org/D8955
2020-09-22 16:07:37 +02:00
Germano Cavalcante e77f986fa0 MeshAnalysis: Optimize the detection of intersecting geometry
For the self overlap result, each intersection pair does not need to
be tested twice.
2020-09-22 11:00:24 -03:00
Germano Cavalcante d1f906e874 Fix T80444: Triangle-Triangle intersection regression in 2.90
The problem is due to lack of precision with small and coplanar triangles.

Also, triangles that have vertices with the same coordinate are at the
threshold of the intersection.

We could add an epsilon to consider the minimum distance for intersection.

But that would add a lot of overhead to the code.

The solution used is to increase precision using doubles.
2020-09-22 11:00:24 -03:00
Hans Goudey cbae82ba96 Fix T78823: Slash in custom property name does not work
Some characters: `'`, `"`, and `\`, can cause problems with RNA paths.
Instead of using more complicated handling to deal with those cases,
we can just prevent these characters from being used in custom property
names.

This commit checks for these characters to `idp_try_read_name`, where
other checks like length are already done.

Differential Revision: https://developer.blender.org/D8839
2020-09-22 08:48:39 -05:00
Sebastián Barschkis 8d1123ba22 Refactor for effector / collider velocities
This refactor is in response to an unreported bug in which overlapping, moving colliders produced an unstable simulation.

Things that change apart from cleanup through this refactor:
- Effector objects with no velocities (either non-animated or animated but non-moving object) will explicitly set zero velocities in their flow bounding box.
- When applying object velocities to the global grid, they will now be accumulated per cell (add and not set velocities). Later they will be averaged with the object count at any cell.
2020-09-22 14:02:53 +02:00
Sebastián Barschkis 97ec16d68f Fluid: Refactor for initial velocities
Removed invel MAC grid since it is sufficient to use the cell centered vec3 representation. When setting initial velocities these will be interpolated by the setter functions.
2020-09-22 14:02:53 +02:00
Jeroen Bakker b17cca6966 Fix T81026: Image Editor: Alpha (like Bloom) not showing properly
With the new image editor drawing there were was some mutual exclusive
functionality. When rendering the alpha was shown correctly or the pure
emissive colors were shown correctly, but never both. The cause of this
is that the image_gpu did not used the correct alpha mode when generating
gpu textures for non-images (render results, compositors viewer)

The implementation always checked the alpha_mode. Alpha mode is an
attribute for images, but aren't set for non images. This patch adds
a more detailed check to ensure that the gpu texture is premultiplied.

The issue has been tested using several bug report files and production
files.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D8978
2020-09-22 13:52:54 +02:00
Jeroen Bakker 085329f114 Fix T81002: Images drawn with the Python gpu module no longer draw on top in the Image Editor
Since {D8234} the image editor is drawn using a depth buffer.
When using `draw_texture_2d` the image is drawn using the 2D_IMAGE
shader. inside the vertex buffer the image was pushed to the background.
This was introduced by {648924333234} what seems to be out dated as we
have done several overhauls in this area. (workbench refactor, overlay
engine refactor, color management pipeline).

This patch removes the pushing of the image to the background.
2020-09-22 11:17:17 +02:00
Jacques Lucke 222ed9f781 Fix T80943: return early when field to visualize is NULL 2020-09-22 10:43:11 +02:00
Jeroen Bakker ee89106ac1 Fix T80915: Image editor only displays the first frame during 'Viewport render animation'
During viewport render animation the gpu textures weren't tagged as
invalid. As the image uv editor now draws the gpu texture only the first
was shown as it wasn't refreshed with the actual image data.
2020-09-22 10:38:22 +02:00
Bastien Montagne 129d9f79c9 Cleanup in style from previous commit.
Forgot that arc land also did the pus ot originh.
2020-09-22 10:33:22 +02:00
Martijn Versteegh c5efd0939f Fix T80859: Thread safe pixeldata concersion from float to uchar and v.v.
I created a bugreport T80859 earlier.

The problem is in the file source/blender/editors/sculpt_paint/paint_image_proj.c (line numbers against commit d376aea61)

at the lines 5309 and 5320 the functions `IMB_rect_from_float(...)` and `IMB_float_from_rect(...)` are called from threaded code on a shared ibuf.
However, ps->reproject_ibuf is shared between threads, so this is not thread-safe.
This is a race condition and leads to wrong output when projecting float data onto a uchar texture or vice versa on a multithreaded system.
The checks on line 5308 and 5319 are already a race condition.

I created this patch which fixes the problem , but I'm not sure if I'm overlooking something.
This makes sure reproject_ibuf contains the correct formats *before* the threadpool is started.

I replaced the original location of the conversions with BLI_asserts(). That may be overkill?

Reviewed By: #sculpt_paint_texture, mont29

Maniphest Tasks: T80859

Differential Revision: https://developer.blender.org/D8936
2020-09-22 10:30:05 +02:00
Philipp Oeser af7378bf2a Fix T81013: Weight Paint Overlay XRay fails with clipping
When introduced in rB1ca1744c29e2, the Weight Paint Overlay XRay's
corresponding depth pass was not considering clipping planes.

Maniphest Tasks: T81013

Differential Revision: https://developer.blender.org/D8970
2020-09-22 10:22:49 +02:00
Jacques Lucke b67c90a822 Cleanup: reduce variable scopes 2020-09-22 10:08:02 +02:00
Philipp Oeser d037ac315b Fix T80996: Weight Proximity modifier: crash going to editmode on a
target in certain situations

Regression from rBdeaff945d0b96.

mesh_ensure_looptri_data would overflow.

Crash would only happen if a Data Transfer modifier (transferring
UVs) follows, so exact reason for this is not yet entirely clear. Also
there are edit-mode versions of the following BVH lookup functions so it
could be avoided (since this is a expensive operation), marking as TODO.

Similar fix as
- rB0945a79ed1eafae444d3021a5912cb39801a7209
- rB56d7e39b92997768b3db8ce2dbc262f869994145

Reviewers: mont29, campbellbarton

Maniphest Tasks: T80996

Differential Revision: https://developer.blender.org/D8973
2020-09-22 09:48:13 +02:00
Campbell Barton 3cbc5dd90e Object: check for negative index access with duplicator reading UV's 2020-09-22 15:54:17 +10:00
Campbell Barton a9dceed2a7 Cleanup: comments, spelling 2020-09-22 15:16:36 +10:00
Hans Goudey b2782f78ba Fix warning building without potrace
The library is no longer in extern, so it isn't necessary to include it
here.
2020-09-21 21:46:15 -05:00
Henrik Dick 8eda3ddc4f Weld Modifier: Performance improvement
This commit contains the Performance improvement, that was originally
proposed in D8966.

It improves the performance of the Weld Modifier by a lot.

It had a loop with execution time O(N^2) which is now O(N*log(N)) at a
bare maximum.
2020-09-21 16:29:33 -03:00
Hans Goudey 6a9e9bef44 Cleanup: Reduce indentation by returning early
Checking for NULL icons or draw info can remove some indentation later
in the funcitons, making the code more readable.
2020-09-21 13:21:22 -05:00
Antonio Vazquez 4d62bb8fe5 GPencil: New Trace images using Potrace
This patch adds a new operator to convert a black and white image into
grease pencil strokes.

If the image is not B/W, an internal conversion is done.

This is the first operator using Potrace, but we expect to add more features in next Blender versions.

Reviewed By: HooglyBoogly

Maniphest Tasks: T79877

Differential Revision: https://developer.blender.org/D8951
2020-09-21 20:03:25 +02:00
Hans Goudey d93db4f30c Cleanup: Declare variables where initialized 2020-09-21 12:14:31 -05:00
Sebastian Parborg e5a572157d Fix T80899: Crash on editing multiple UVs of multiple different objects at the same time
The issue was two fold.

First something sets the loop element tag and doesn't clear it before
the UV code in question tries to use the tags. Added a sanity clear to
make sure that it operates on a clean tag state.

The next one was that the UV maps in question had quite a few points
that had zero length UV loop edges. This would lead to division by
zero.

Reviewed By: Jeroen Bakker, Brecht

Differential Revision: http://developer.blender.org/D8967
2020-09-21 16:09:51 +02:00
Bastien Montagne 9d3550d781 Various fixes in UI messages.
Along some other typos in comments or variable names.
2020-09-21 15:18:13 +02:00
Julian Eisel a34e7c3e5d Cleanup (UI): Early-exit rather than having a big-ish conditional body
It's generally considered a better codestyle to check conditions early
and exit early when they are not met, over having most logic of a
function within a big `if`-block. Otherwise people have to go over the
entire block to see if there's possibly an `else` somewhere, or any
followup logic.
2020-09-21 15:03:02 +02:00
Julian Eisel 7883ccd29f Fix T80854: Search buttons fail in Adjust Last Operation Panel
There's the old and ugly hack where the `uiBut.poin` points to the
button itself. When reallocating the button we have to update that
pointer of course.
2020-09-21 15:01:40 +02:00
Bastien Montagne 87d2ac9681 Cleanup: move some paint helpers to ED_ 'namespace'.
Those two functions had `BKE_` prefix, were defined in BKE headers, but
implemented in ED code, yuck.

Moved everything to ED area for now, since those do not look fondamental
enough to belong to BKE, and none of their usages requires it currently.
2020-09-21 14:43:29 +02:00
Bastien Montagne 82aa300e1c Fix T79373: Forbid painting on linked image from 3DView.
As noted by @lichtwerk (thanks), one can have a local object and/or
material using a linked image data-block, this case needs some different
handling to prevent painting on such linked image.

For now, tweak `BKE_paint_proj_mesh_data_check` (eeeek, that name
prefix!) to consider paintslots with linked image as 'non-existing'.
2020-09-21 14:24:55 +02:00
Bastien Montagne 154752243d Add missing new liboverride option to py-defined collections props doc. 2020-09-21 13:54:58 +02:00
Julian Eisel 88a9d82bbb Cleanup: Remove weird assert in button handling
The function this was in already checks the conditions under which it
can operate (as it should). No need to force the caller to do these
(quite specific) checks, the function can just do nothing if the button
doesn't need these operations.
Otherwise we'd have to always execute these checks before calling, which
makes calling it a hassle, makes the code harder to follow and generally
harder to maintain (what if the conditions change?).
2020-09-21 13:15:43 +02:00
Julian Eisel 92454ae100 Fix assert failure when using Ctrl+Mousewheel on Object Mode button
Do a proper check to see if the button supports Ctrl+Mousewheel cycling.

See T80659.
2020-09-21 13:15:43 +02:00
Ankit Meel b3c6ab5084 Fix datatoc_icon linker errors with ASan enabled.
Error introduced in {rBf9fcb25d521d}.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8964
2020-09-21 16:38:31 +05:30
Sergey Sharybin 216a221876 Implement ID properties support for TimeMarker
Allows scripters to store additional information in the marker itself instead
of using work-around approach based on marker names and such.

Differential Revision: https://developer.blender.org/D8944
2020-09-21 12:25:45 +02:00
Sergey Sharybin 3791dbea1e Fix T79965: mesh.transform() modifies referenced layers
Originally was noticed when transforming mesh created by
object.to_mesh() from an object without modifier, in which case the
result references CustomData layers used by the object itself.

The issue goes a bit deeper: mesh.transform() should never modify
referenced layers, hence it should duplicate referenced layers.

This fix changes one specific aspect of the reported behavior. The
case where vertices coordinates are modified manually will still have
affect on the source mesh (as no referenced CustomData layers are being
duplicated). Proper fix for this case is not yet clear to me.

Differential Revision: https://developer.blender.org/D8939
2020-09-21 12:23:30 +02:00
Jeroen Bakker abc90d6b03 Fix T80931: Proporional Editing Cursor Draws Incorrect
The incorrect view was setup so it was drawn in pixel space. This patch
changes it to use UV space.
2020-09-21 11:39:32 +02:00
Bastien Montagne d72b5785eb Fix T79373: Forbid painting on linked image.
There is just no reason to support that kind of useless behavior.

Some remote TODO could be to define a process based on liboverride and
layers.
2020-09-21 10:49:39 +02:00
Jacques Lucke b8b60e132d Fix T59272: dead particles not included in render, but visible in viewport
The issue was that the pointcache was not storing dead particles,
even though they are displayed. This lead to the rendering issue,
because only alive particles can be read from the point cache in
the frame that is rendered.

This also fixes an issue unrelated to rendering: when dead particles
are displayed, their position is incorrect when some frames are
skipped during playback.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D8907
2020-09-21 10:46:35 +02:00
Bastien Montagne 3bb53b0ee6 Cleanup: Sculpt/Paint ED code: correct return constant types.
Mainly use false/true for bool, but also a few others.

No change in behavior expected.
2020-09-21 10:37:23 +02:00
Dalai Felinto 213445e389 Fix T66614: Text objects: Truncate overflow for non-top aligned text 2020-09-21 18:00:36 +10:00
Jeroen Bakker 701c3e499f Cleanup: correct naming IMAGE_Z_DEPTH
IMAGE_DEPTH is used for bit depth.
2020-09-21 07:53:40 +02:00
mano-wii f5b6b82598 Fix T80520: Tris to Quads ignores UV delimit option 2020-09-21 15:05:33 +10:00