Commit Graph

105144 Commits

Author SHA1 Message Date
Jacques Lucke 19dfb6ea1f Cleanup: enable modernize-use-equals-default check
This removes a lot of unnecessary code that is generated by
the compiler automatically.

In very few cases, a defaulted destructor in a .cc file is
still necessary, because of forward declarations in the header.

I removed some defaulted virtual destructors, because they are not
necessary, when the parent class has a virtual destructor already.

Defaulted constructors are only necessary when there is another
constructor, but the class should still be default constructible.

Differential Revision: https://developer.blender.org/D10911
2021-04-08 11:07:27 +02:00
Philipp Oeser 0ea66039dd Fix T87267: Texture Paint stencil texture not drawing
Typo in {rBafcfc6eb0842}.

Maniphest Tasks: T87267

Differential Revision: https://developer.blender.org/D10915
2021-04-08 08:36:23 +02:00
Germano Cavalcante b7b1b2325c Fix T87274: Curve 2D resets to 3D on reload
This code is incompatible with .blend files from subversion 16 and 17.

The ideal would be to create a new subversion when landed rBf674976edd88.

But for now, due to the delay, moving the code to the previous subversion
can solve it.
2021-04-07 18:03:10 -03:00
Hans Goudey 79ba4fde15 Cleanup: Rename function, switch order of arguments
The function name was not very specific, this makes it clearer that it
works on instances rather than only real geometry. Also use `r_`
prefix for the return argument.
2021-04-07 15:49:02 -05:00
Hans Goudey 1a8db9ec04 Geometry Nodes: Rename grid output UV attribute
During review of D10730 it was discovered that the "uv" name causes
issues for cycles, which uses it as a default internal data name. While
that could be fixed in the future, there was no particular reason to use
"uv" instead of "uv_map", so we use the latter instead here, which
is consistent with the lowercase naming scheme chosen for attributes.
2021-04-07 13:23:32 -05:00
Hans Goudey 22ba85b510 Geometry Nodes: Greatly improve speed of some mesh primitives
Some of the BMesh primitive operators have a lot of overhead due to the
fact that they use other operators like extrusion, removing doubles,
and rotation, to build each shape rather than filling arrays directly.

Implementing the primitives directly with the Mesh data structure is
much more efficient, since it's simple to fill the result data based
on the known inputs. It also allows also skip the conversion from BMesh
to Mesh after the calculations.

Speed matters more for procedural operations than for the existing
operators accessible from the add menu, since they will be executed
every evaluation rather than once before a destructive workflow.

| Shape    |  Before (ms) |  After (ms) | Speedup (x times faster) |
| -------- | -------------| ------------| -------------------------|
| Cylinder | 1.1676       | 0.31327     | 3.72                     |
| Cone     | 4.5890       | 0.17762     | 25.8                     |
| Sphere   | 64213.3      | 13.595      | 4720                     |

The downside of this change is that there will be two implementations
for these three primitives, in these nodes and in `bmo_primitive.c`.
One option would be re-implementing the BMesh primitives in terms of
this code, but that would require `BMesh` to depend on `Mesh`, which
is currently avoided. On the other hand, it will be easier to add new
features to these nodes like different fill types for the top and the
bottom of a cylinder, rings for a cylinder, and tagging the output with
boolean attributes. Another factor to consider is that the add mesh
object operator could be implemented with these nodes, just providing
more benefit for a faster implementation.

As a future cleanup, there is room to share code that generates the
"rings" topology between different nodes that generate meshes.

Differential Revision: https://developer.blender.org/D10730
2021-04-07 13:15:43 -05:00
Philipp Oeser 7c04ef210e Fix T87263: Animation decorator not working on Grease Pencil Build modifier Factor value
When having a checkbox and a value both in one row together with an
animation decorator it is questionable whether the decorator should act
on animating the checkbox or the corresponding value. At the moment,
usage in modifiers does not seem to be very consistent:

Here the animation decorator works for animating the checkbox:
- `Build` (greasepencil) > `Factor` (this was reported and is changed in
this patch to act on the value instead of the checkbox)
- `DataTransfer` > `Topology Mapping` > `Max Distance` (this I guess
should also act on the value instead of the checkbox)
- `Edge Split` > `Edge Angle` (questionable)
- `Mirror` > `Merge` (questionable)
- `Screw` > `Merge` (questionable)
- `Wireframe` > `Crease Edges` (questionable)

Here the animation decorator works for animating the value:
- `VertexWeightEdit` > `Group Add/Remove Threshold`
- `Decimate` > `Symmetry`

So in this patch only the behavior in the greasepencil Build modifier UI
is changed, since I think it is quite obvious that one would more often
use the decorator for animating the factor value than for animating the
checkbox.

Maniphest Tasks: T87263

Differential Revision: https://developer.blender.org/D10910
2021-04-07 18:44:15 +02:00
Julian Eisel 554d921124 UI: Remove confusing "Unset" context menu entry
This was added in 37b82a2d26, doesn't have much purpose and doesn't even do
anything in the vast majority of cases. It only affects custom properties. So
at the very least it shouldn't be shown for regular RNA property buttons. But
even for cases where it may do something, we couldn't find a good use-case. If
this operator has use-cases with some add-ons, the add-ons can expose it
differently, e.g. with a little 'x' icon next to the button, like it's done in
the keymap editor.

So removing the context menu entry now. Should this turn out to be a problem,
it can be brought back but much more selectively (only where it actually does
something). Or we could combine it with "Reset to Default".

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

Reviewed by: Brecht Van Lommel, Hans Goudey
2021-04-07 18:04:43 +02:00
Leon Leno 965425bcbc Fix T86463: Colored collection icons don't scale with zoom level
This patch fixes the issue in T86463 that colored collection icons in
the collection search box don't scale according to the zoom level.

The issue was caused by the drawing function for the colored
collection icons not allowing to change the size of the icons.
This patch addresses that by scaling the icon based on the drawing
width.

Reviewed By: #user_interface, natecraddock, Severin

Differential Revision: https://developer.blender.org/D10708
2021-04-07 08:54:05 -06:00
Hans Goudey 02a7289fe3 Fix T87264: Button to remove physics modifier doesn't work
This is caused by rB9f323e9bf79f. When hover shortcuts are used,
we cannot use the modifier from the context (which will be the
active modifier), or they won't be hover shortcuts anymore!

There didn't use to be an editor-level "modifier" context variable,
which is why this worked before.

The fix is simple, just specify the modifier name for this particular
remove button.

Differential Revision: https://developer.blender.org/D10870
2021-04-07 09:12:34 -05:00
Ankit Meel 15670ebb95 Cleanup: Fix pessimizing move warning. 2021-04-07 15:20:45 +05:30
Hans Goudey 2fbee4598c Fix T87195: Boolean node multi-input socket only accepts one link
The default insert link callback for nodes was trying to move the
existing link away, since it didn't properly handle multi-input sockets
(though the problem wasn't exposed for the join node). We can basically
skip all of this "moving existing links" for multi-input sockets, unless
we are at the link limit.
2021-04-07 00:32:16 -05:00
Hans Goudey fd0a0096dd Cleanup: Various cleanup of node link handling functions
Use LISTBASE_FOREACH macro, rename variables, comment formatting,
simplification of logic, etc.
2021-04-07 00:26:03 -05:00
Hans Goudey e0a1a2f49d Geometry Nodes: Bounding Box Node
This commit adds a simple node to output the min and max of an
axis-aligned bounding box for the input geometry, as well a rectangular
prism mesh created from these values for convenience.

The initial use case for this node is a "bounding box boolean", where
doing the boolean with just a bounding box could be signigicantly
faster, for cases like cutting a hole in a wall for a window. But it's
easy to imagine other cases where it could be useful.

This node supports mesh and point cloud data right now, volume support
will come as a separate patch. Also note that there is plenty of room
to improve the performance of this node through parallelization.

Differential Revision: https://developer.blender.org/D10420
2021-04-06 16:02:55 -05:00
Wannes Malfait 93114180d7 Geometry Nodes: Use distance units for socket values
This adds the property subtybe `PROP_DISTANCE` where appropriate.

Differential Revision: https://developer.blender.org/D10900
2021-04-06 12:02:28 -05:00
Philipp Oeser b61b34a5d2 Fix T87236: crash reading file with grease pencil palettes
Caused by typo in {rB76689e851700}.

Since Palettes and bGPDpalette are not the same size, this would not
only cause a crash in versioning code, but could only go downhill from
here on.

Maniphest Tasks: T87236

Differential Revision: https://developer.blender.org/D10903
2021-04-06 17:01:06 +02:00
Jacques Lucke b93c445809 BLI: return pointer to added resource
Without this, the caller often has to get the pointer to the
resource before adding it to the resource scope.
2021-04-06 15:49:43 +02:00
Germano Cavalcante 490801ba1d Fix T86889: Rotation with top plane view glitches
The `InputAngle` function uses a flawed algorithm to fix precision issues.

This commit refactor the logic of that function by using BLI utilities.

Differential Revision: https://developer.blender.org/D10880
2021-04-06 10:41:45 -03:00
Brecht Van Lommel 24d71acd86 Fix Cycles rendering files with Simplify wrong after recent changes
The versioning code was not taking into account the old default for AO
bounces.
2021-04-06 15:34:13 +02:00
Brecht Van Lommel 9676a1f61e Fix render crash in some .blend files after Persistent Data changes
Must always clear recalc flags, even if no editors use them, the depsgraph
execution itself also depends on them.
2021-04-06 15:02:30 +02:00
Jeroen Bakker 19ff2479cf Compositor: Add Streaming Operator for NodeOperationBuilder.
For debugging purposes to convert the internal state of the
NodeOperationBuilder to a graphviz.

Usage:

	std::cout << *this << "\n";

Inside any method of the NodeOperationBuilder.
2021-04-06 12:06:47 +02:00
Philipp Oeser 663a82b10d Fix T86932: Curve: pick shortest path missing update of active point drawing
For curves, we need to tag the curve ID_RECALC_COPY_ON_WRITE for batch
cache update (same as in {rB24b2fe50f3ec}).

Maniphest Tasks: T86932

Differential Revision: https://developer.blender.org/D10826
2021-04-06 11:14:38 +02:00
Philipp Oeser e71408d0d7 Fix T84623: Curve/Surface force not working in normal direction
Tweaking e.g. a field strength would then not use the curve/surface
normal anymore [but the object center instead].

If a curve has a forcefield with effector shape Curve (in code its shape
is PFIELD_SHAPE_SURFACE then), it wil get a SurfaceModifier.

Changing properties will free the SurfaceModifierData's bvhtree and mesh
And these dont get copied along when doing the CoW copy, these are
explicitly set to NULL. So this was also failing for meshes, not just
curves.

Without the mesh & bvhtree though, get_effector_data() will not set the
EffectorData's normal correctly (it is closest_point_on_surface() which
does this). And without the right EffectorData's normal, the effector
will of course work unexpected.

Going in and out of editmode made this work because that goes down this
route:
- BKE_object_handle_data_update
- BKE_displist_make_curveTypes
- do_makeDispListCurveTypes
- curve_calc_modifiers_post
-- BKE_mesh_new_nomain_from_curve_displist
-- we then have our desired updated mesh from the curve
-- this will also call the SurfaceModifiers deformVerts [which - given we
have a valid mesh - will update the bvhtree properly]

Also note that _animating_ the effector actually works, (have not done
the deep dive why this works, assume the curve geometry is updated in
this case)

So, now just carefully tag the curve ID_RECALC_GEOMETRY in
rna_FieldSettings_update for this specific case.

Maniphest Tasks: T84623

Differential Revision: https://developer.blender.org/D10092
2021-04-06 11:06:24 +02:00
Evan Wilson 7334c481c0 Fix T86175: Missing viewport update when toggling HDRI preview
Caused by rB0f95f51361d7.

Similar to T85515, T84717, T85543 and their related fixes.
In this case, add missing shading notifier as in rB9274bd457a25.

Reviewed By: brecht, lichtwerk

Maniphest Tasks: T86175

Differential Revision: https://developer.blender.org/D10604
2021-04-06 09:57:40 +02:00
Jeroen Bakker c6ddc2abd3 Suppress compiler warning. 2021-04-06 08:39:41 +02:00
Philipp Oeser 9c20228128 Fix T48167: Mesh select random factor is not accurate
Selecting random percentage would not reliably guarantee the precise
percentage of selected elements now randomize an index array instead
and use the precise number of elements from this array.

Note that this change has only been made to edit-mesh
and should be applied to all random selection operators.
2021-04-06 14:59:10 +10:00
Campbell Barton 3f3b4745b6 Fix T87187: Area.type & ui_type empty area access fails
Reading Area.type & ui_type printed an error from `pyrna_enum_to_py`
and returned an empty string.

As empty is a valid value, include it in the property enum list.
2021-04-06 13:08:35 +10:00
Aaron Carlisle 074b0b6da0 Py API Docs: Update sphinx and theme versions 2021-04-05 17:28:36 -04:00
Germano Cavalcante cf0e7af07e BLI: fix axis order in 'BLI_array_iter_spiral_square'
x and y were inverted.
2021-04-05 14:28:43 -03:00
Germano Cavalcante 44c76e4ce3 3D View Utils: Add 'margin' parameter to 'ED_view3d_depth_read_cached'
Matches the alternative function ED_view3d_autodist_depth, but is more
efficient since it uses the cache.

No functional changes.
2021-04-05 10:48:37 -03:00
Brecht Van Lommel 50782df425 Render: faster animation and re-rendering with Persistent Data
For Cycles, when enabling the Persistent Data option, the full render data
will be preserved from frame-to-frame in animation renders and between
re-renders of the scene. This means that any modifier evaluation, BVH
building, OpenGL vertex buffer uploads, etc, can be done only once for
unchanged objects. This comes at an increased memory cost.

Previously there option was named Persistent Images and had a more limited
impact on render time and memory.

When using multiple view layers, only data from a single view layer is
preserved to keep memory usage somewhat under control. However objects
shared between view layers are preserved, and so this can speedup such
renders as well, even single frame renders.

For Eevee and Workbench this option is not available, however these engines
will now always reuse the depsgraph for animation and multiple view layers.
This can significantly speed up rendering.

These engines do not support sharing the depsgraph between re-renders, due
to technical issues regarding OpenGL contexts. Support for this could be added
if those are solved, see the code comments for details.
2021-04-05 14:05:01 +02:00
Brecht Van Lommel 3fa580866e Cycles: update Light Paths preset
* Add Fast GI / AO bounces to presets
* Add Default preset matching defaults
* Add Fast Approximate GI preset
* Lower Full GI depths to 32
2021-04-05 14:05:01 +02:00
Brecht Van Lommel edd2f51b4e Cycles: make AO bounces settings more discoverable
* Move out of Simplify panel, into Light Paths > Fast Global Illumination
* Add separate boolan setting to enable/disable it separate from Simplify
* Default AO bounces to 1
* Put ambient occlusion distance in this panel as well
2021-04-04 15:20:23 +02:00
Germano Cavalcante 8681504f06 Fix inversion of snapping failing in measure tool
Comparison of event change has to be more specific and compare the x and y
values of the mouse as well.
2021-04-03 13:32:42 -03:00
Germano Cavalcante 62f8d9e478 Fix T87162: Measure Tool Not Working
The non-enabled gizmo was overwriting the projected coordinate value.
2021-04-03 12:48:46 -03:00
Harley Acheson 321eef6a0c UI: Align Spreadsheet Booleans to Center
Aligning spreadsheet Booleans to the middle of their cells.

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

Reviewed by Hans Goudey
2021-04-02 14:26:16 -07:00
Hans Goudey 46d75052eb Geometry Nodes: Separate grid primitive X and Y size
Since you can already specify a separate size for X and Y with the
grid node, it makes sense to be able to specify the size separately
for each axis also.

This also avoids some awkward math with a Transform node afterwards
when you want a specific size for each direction.

Versioning (except for animation and drivers) is handled in this commit.

Differential Revision: https://developer.blender.org/D10834
2021-04-02 14:35:48 -05:00
Philipp Oeser e0a07700bf GPencil: Prevent RNA assignment of invalid materials in modifiers
Materials used in grease pencil modifiers have the requirement that they
are already used on the object. In the UI dropdown, this restriction is
ensured by calling uiItemPointerR with appropriate searchptr and
searchpropname, so only giving the user the choice of materials already
used on the object.

From python though, it was still possible to assign materials outside of
this this restriction. This led to reports like T86981 [which have been
partially solved by clamping the material index in the modifier code to
be in the valid range].

Now make sure we dont assign "invalid" materials through RNA by
appropriate RNA pointer functions.

This also adds a proper warning (red, alert) in case of the LineArt
modifier if such a invalid material is still in the file [same as other
modifiers already do].

Differential Revision: https://developer.blender.org/D10873
2021-04-02 21:23:37 +02:00
Philipp Oeser fcc3227efd Fix T86654: wrong Vertex Interpolation option default when importing alembic caches
This resulted in bad motion blur from alembic animation when imported
after rB83980506957c (because it was now OFF by default).
When imported in a version prior to rB83980506957c and saved, this was
still working fine.

Vertex interpolation option introduced in rBbab2260b59c7 was defaulting
to ON (correct) in that commit, but was lost in rB83980506957c.

Now switch this to ON by default again.

Note: if you have a file that was (incorrectly) imported with a version
after rB83980506957c you'll have to enable Vertex Interpolation option
on every MeshSequenceCache modifier by hand.

Maniphest Tasks: T86654

Differential Revision: https://developer.blender.org/D10876
2021-04-02 21:18:34 +02:00
Hans Goudey 0e8fa1d44b Geometry Nodes: Allow float input for point scale node
This allows easily changing the scale attribute with a uniform scale
within a single simple node.
2021-04-02 12:03:27 -05:00
Hans Goudey bd9c479475 Geometry Nodes: Change point translate and scale node defaults
Since these nodes are usually used for more basic operations and the
attribute nodes are used when more complexity is necessary, it makes
sense to give these nodes more accessible defaults-- hopefully this can
make learning about the core concepts of geometry nodes a bit easier.
2021-04-02 11:45:05 -05:00
Harley Acheson 8bd0bde012 UI: Align Spreadsheet Reals and Integers to Right
Aligning spreadsheet cell numbers to the right to aid readability.

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

Reviewed by Hans Goudey
2021-04-02 09:03:36 -07:00
Jeroen Bakker 8aff86a0c7 Cleanup: Remove blender namespace from Map. 2021-04-02 16:16:33 +02:00
Jeroen Bakker 36427a8d03 Cleanup: remove loading blender namespace from Vector. 2021-04-02 16:13:27 +02:00
Jeroen Bakker b6ab1107c2 Cleanup: Added leading `e` to enum types. 2021-04-02 16:11:13 +02:00
Jeroen Bakker 5a491adc17 Cleanup: rename eChunkExecutionState to eWorkPackageState. 2021-04-02 16:07:46 +02:00
Jeroen Bakker 210f7f0f8e Compositor: stream operators for WorkPackages.
Helps developers during debugging.
2021-04-02 15:41:16 +02:00
Jeroen Bakker a0f705f18c Compositor: Debug stream operator.
Stream operators for NodeOperator and ExecutionGroup to help during
debugging.
2021-04-02 15:24:34 +02:00
Sebastian Parborg fa9b05149c Fix T84520: Make the different weight paint code paths exclusive to each other
Before this change, you could have the new sculpt symmetry code and the
older weight paint symmetry code active at the same time. This would
lead to users easily trashing their weigh paint data if they were not
careful when switching between modes.

Now the specific weight paint symmetry code is an exclusive toggle so
the user can't accidentally mirror strokes and vertex groups at the same
time. This also paves the way of supporting Y and Z symmetry in the
future for weight groups mirroring if we decide to add it in the future.

Reviewed By: Sybren

Differential Revision: http://developer.blender.org/D10426
2021-04-02 14:44:26 +02:00
Antonio Vazquez e7a0a75919 Fix T87131: SVG as GPencil elements with both Stroke and Fill fails
The importer was not checking if both were enabled. Now a new material is created if it's needed.
2021-04-02 13:45:58 +02:00