Commit Graph

104285 Commits

Author SHA1 Message Date
Jacques Lucke
a9fc9ce0ae Cleanup: remove dead code 2021-03-07 16:08:59 +01:00
Howard Trickey
b30f89918e Fix T85632 Improve Exact boolean in cell fracture of Suzanne.
The Exact boolean used in the cell fracture addon incorrectly
kept some outside faces: due to some raycasts going into open
eye socket then out of the head, leading to one ray direction
(out of 8) saying the face was inside the head. The current
code allowed 1 of 8 rays only as "inside" to accommodate the
case of a plane used in boolean to bisect. But this cell fracture
case needs more confidence of being inside. So changed the
test for intersection to require at least 3 of 8 rays to be inside.

Maybe the number of rays to indicate insideness should be exposed
as an option, to allow user tuning according to the degree of
"non-volumeness" of the arguments, but will try at least for now
to magically guess the right value of the rays-inside threshold.

Note: all of this only for the case where the arguments are not
all PWN (approx: manifold). The all-PWN case doesn't use raycast.
2021-03-07 08:55:11 -05:00
Jacques Lucke
e72dc1e6c6 Cleanup: compiler warnings 2021-03-07 14:46:48 +01:00
Jacques Lucke
c14770370f Cleanup: fix implicit conversion warning 2021-03-07 14:27:08 +01:00
Jacques Lucke
649916f098 BLI: make it harder to forget to destruct a value
Instead of returning a raw pointer, `LinearAllocator.construct(...)` now returns
a `destruct_ptr`, which is similar to `unique_ptr`, but does not deallocate
the memory and only calls the destructor instead.
2021-03-07 14:24:52 +01:00
Jacques Lucke
456d3cc85e BLI: reduce wasted memory in linear allocator
The main change is that large allocations are done separately now.
Also, buffers that small allocations are packed into, have a maximum
size now. Using larger buffers does not really provider performance
benefits, but increases wasted memory.
2021-03-07 14:15:20 +01:00
Campbell Barton
84da76a96c Cleanup: use POINTER_OFFSET macro 2021-03-07 19:27:11 +11:00
Jacques Lucke
8618c4159c Cleanup: use class instead of struct in forward declaration 2021-03-06 17:54:28 +01:00
Jacques Lucke
9828882b8e Cleanup: clang tidy 2021-03-06 16:54:09 +01:00
Jacques Lucke
d2869943d2 Nodes: refactor derived node tree
This is a complete rewrite of the derived node tree data structure.
It is a much thinner abstraction about `NodeTreeRef` than before.
This gives the user of the derived node tree more control and allows
for greater introspection capabilities (e.g. before muted nodes were
completely abstracted away; this was convenient, but came with
limitations).

Another nice benefit of the new structure is that it is much cheaper
to build, because it does not inline all nodes and sockets in nested
node groups.

Differential Revision: https://developer.blender.org/D10620
2021-03-06 16:51:06 +01:00
Howard Trickey
cfd766cebd Fix T86308 Crash in Exact Boolean when have custom normal layer.
Custom Normal layers can't be interpolated, so needed a check
for non-interpolatable layers before trying to interpolate.
2021-03-06 09:05:55 -05:00
Campbell Barton
11efc9087b Cleanup: remove workaround for Python 3.7x crashing with libedit
This removes workaround for T43491. It's no longer needed as
Python 3.9x supports libedit as an alternative to readline
on all platforms.
2021-03-06 19:31:49 +11:00
Campbell Barton
995bb0860a Cleanup: remove redundant draw callback 2021-03-06 19:26:18 +11:00
Campbell Barton
37793b90be Cleanup: unused imports 2021-03-06 19:26:18 +11:00
Campbell Barton
9dc0c44aa1 Cleanup: unused arguments 2021-03-06 19:26:18 +11:00
Campbell Barton
bd79691599 Cleanup: unused variables 2021-03-06 19:00:18 +11:00
Campbell Barton
753f1cf0ad Cleanup: redundant pose bone assignment 2021-03-06 18:33:54 +11:00
Campbell Barton
b22b037229 Cleanup: rename wm_get_cursor_position
Match naming of other wm_cursor_position_* functions.
2021-03-06 18:33:54 +11:00
Campbell Barton
3bc406274b Cleanup: comments 2021-03-06 18:33:54 +11:00
Hans Goudey
f117ea2624 Geometry Nodes: Expose vertex normals as an attribute
This attribute exposes mesh vertex normals as a `vertex_normal`
attribute for use with nodes. Since the normal vector stored in
vertices is only a cache of data computable from the surrounding faces,
the attribute is read-only. A proper error message for attempting to
write this attribute is part of T85749. A write-only normal attribute
will likely come later, most likely called `corner_normal`.

The normals are recomputed before reading if they are marked dirty.
This involves const write-access to the mesh, protected by the mutex
stored in `Mesh_Runtime`. This is essential for correct behavior after
nodes like "Edge Split" or nodes that adjust the position attribute.

Ref T84297, T85880, T86206

Differential Revision: https://developer.blender.org/D10541
2021-03-05 15:16:25 -06:00
Hans Goudey
becc36cce5 Geometry Nodes: Sort attribute search items when menu opens
Because the search didn't run when the menu first opens, the attributes
appeared in a different order than after you typed anything into the
search field. This commit instead runs the search when the menu
is first opened, but it only sorts items without filtering.
2021-03-05 14:45:09 -06:00
Julian Eisel
4addcf1efc Cleanup: Remove redundant special handling after previous commit
Not needed anymore since 3a907e7425.
2021-03-05 18:14:56 +01:00
Julian Eisel
3a907e7425 Outliner: Barebones to port IDs to new Outliner tree-element code design
Continuation of work in 2e221de4ce and 249e4df110 .
This prepares things so we can start porting the individual ID types to
the new code design. I already added some code for library IDs, because
they need some special handling during construction, which I didn't want
to break.

The `AbstractTreeElement::isExpandValid()` check can be removed once
types were ported and can be assumed to have a proper `expand()`
implemenation.

Also makes `TreeElementGPencilLayer` `final` which I forgot in
e0442a955b.
2021-03-05 18:07:35 +01:00
Julian Eisel
ae005393dc Fix incorrect assert in Outliner ID deletion
Mistake in aa3a4973a3. The expanded `ELEM()` check would include
`0 && te->idcode != 0`, which always evaluates to `false`/`0`. That
wouldn't cause the asset to fail, but the `te->idcode` part would never
be checked.

Fixed the error and cleaned up the check against "0" with a check
against `TSE_SOME_ID`, see b9e54566e3.
2021-03-05 17:46:49 +01:00
Julian Eisel
b9e54566e3 Cleanup: Add & use enum value for ID Outliner element type
Code to check if the Outliner tree-element type was the general ID one
would always check against "0" (explicity or even implicitly). For
somebody unfamiliar with the code this is very confusing. Instead the
value should be given a name, e.g. through an enum.

Adds `TSE_SOME_ID` as the "default" ID tree-element type. Other types
may still represent IDs, as I explained in a comment at the definition.

There may also still be cases where the type is checked against "0". I
noted in the comment that such cases should be cleaned up if found.
2021-03-05 17:46:33 +01:00
Sebastián Barschkis
ed84161529 Cleanup: Rename func occurences to _fn
Use _fn as a suffix for callbacks.
2021-03-05 17:35:35 +01:00
Hans Goudey
f882bee431 Fix crash with pinned geometry node tree with no active object
The check for a null active object was after trying to retrieve the active
modifier from the object.
2021-03-05 10:13:42 -06:00
Jeroen Bakker
d5c727c6ea Fix windows compilation. 2021-03-05 16:08:11 +01:00
Jeroen Bakker
ffd5b0d91e Cleanup: Use blender::Vector. 2021-03-05 16:56:14 +01:00
Jeroen Bakker
0729376a13 Fix: compilation OpenCL kernels Compositor.
introduced during cleanup.
2021-03-05 16:56:14 +01:00
Jeroen Bakker
d4c673d4c6 Cleanup: use blender::Vector. 2021-03-05 16:56:14 +01:00
Jeroen Bakker
7c8ec99b9a Cleanup: use blender::Vector. 2021-03-05 16:56:14 +01:00
Jeroen Bakker
7bccbce512 Cleanup: use snake case. 2021-03-05 16:56:14 +01:00
Jeroen Bakker
921138cf5f Cleanup: rename private attribtue m_max_read_buffer_offset. 2021-03-05 16:56:14 +01:00
Jeroen Bakker
87842d6388 Cleanup: Use blender::Vector in ExecutionGroup. 2021-03-05 16:56:14 +01:00
Jeroen Bakker
fde150fee4 Cleanup: Use std::Vector for chunk execution status. 2021-03-05 16:56:14 +01:00
Jeroen Bakker
e1d9b095e4 Cleanup: Use enum class for eChunkExecutionState. 2021-03-05 16:56:14 +01:00
Jeroen Bakker
3d4a844a50 Cleanup: ExecutionSystem::find_output_execution_groups. 2021-03-05 16:56:14 +01:00
Jeroen Bakker
8b2fb7aeed Cleanup: Remove unused method. 2021-03-05 16:56:14 +01:00
Jeroen Bakker
6ebd34c802 Cleanup: Make WorkPackage a struct 2021-03-05 16:56:14 +01:00
Jeroen Bakker
ba5961b4cd Cleanup: use MIN2/MAX2 in compositor. 2021-03-05 16:56:14 +01:00
Jeroen Bakker
3d3a5bb892 Cleanup: Remove using statements. 2021-03-05 16:56:14 +01:00
Sybren A. Stüvel
bf030decd4 Animation: add function to apply a pose from an Action
Add `BKE_pose_apply_action(object, action, anim_eval_context)` function
and expose in RNA as `Pose.apply_action(action, evaluation_time)`.

This makes it possible to do the following:

- Have a rig in pose mode.
- Select a subset of the bones.
- Have some Action loaded that contains the pose you want to apply.
- Run `C.object.pose.apply_pose_from_action(D.actions['PoseName'])`
- The selected bones are now posed as determined by the Action.

Just like Blender's current pose library, having no bones selected acts
the same as having all bones selected.

Manifest Task: T86159

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D10578
2021-03-05 16:35:08 +01:00
Jacques Lucke
8d0fbcd6df Nodes: move vector rotate node to C++
This makes it easier to add an implementation that can
be used in Geometry Nodes.

There should be no functional changes.
2021-03-05 16:09:19 +01:00
Sybren A. Stüvel
fe35551df2 Asset Browser Space API: add activate_asset_by_id() function
Add an RNA function `activate_asset_by_id(asset_id: ID, deferred: bool)`
to the File Browser space type, which intended to be used to activate an
asset's entry as identified by its `ID *`. Calling it changes the active
asset, but only if the given ID can actually be found.

The activation can be deferred (by passing `deferred=True`) until the
next refresh operation has finished. This is necessary when an asset has
just been added, as it will be loaded by the filebrowser in a background
job.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D10549
2021-03-05 15:11:40 +01:00
Sergey Sharybin
0dd9a4a576 Cleanup: Libmv, clang-format
Is based on Google style which was used in the Libmv project before,
but is now consistently applied for the sources of the library itself
and to C-API. With some time C-API will likely be removed, and it
makes it easier to make it follow Libmv style, hence the diversion
from Blender's style.

There are quite some exceptions (clang-format off) in the code around
Eigen matrix initialization. It is rather annoying, and there could be
some neat way to make initialization readable without such exception.

Could be some places where loss of readability in matrix initialization
got lost as the change is quite big. If this has happened it is easier
to address readability once actually working on the code.

This change allowed to spot some missing header guards, so that's nice.

Doing it in bundled version, as the upstream library needs to have some
of the recent development ported over from bundle to upstream.

There should be no functional changes.
2021-03-05 15:05:08 +01:00
Julian Eisel
e0442a955b UI Code Quality: Port Outliner Grease Pencil layers to new design
Continuation of work in 2e221de4ce and 249e4df110. Now the tree-element
types have to be ported one by one. This is probably the most straight forward
type to port.
2021-03-05 14:45:46 +01:00
Jeroen Bakker
a592f7e6cb Cleanup: COM_convert_data_types parameters. 2021-03-05 13:46:25 +01:00
Jeroen Bakker
b12be5a872 Cleanup: Remove static struct without data. 2021-03-05 13:46:25 +01:00
Philipp Oeser
f3fb1df192 Fix T86293: crash undoing after executing the python console in certain
scenarios

In general, I could not find a reason executing from the python console
should not do an Undo push. Running a script from the Text Editor does
this as well and this seems generally useful.

Without an Undo push, one can easily run into situations were IDs have
been added or removed and undo on would then cause trouble (e.g. first
selection then bpy.ops.object.duplicate() -- this crashed as reported in
T86293 -- duplicate does not get its own undo push because it is not the
last op in the list, wm->op_undo_depth is not zero). This has changed
with the Undo refactor, so in essence the root cause is the same as
T77557, Legacy Undo does not suffer from the crash (but misses
the generally useful undo push from the console still)

Now add Undo to CONSOLE_OT_execute bl_options ('UNDO_GROUPED' seems more
appropriate than plain 'UNDO' since pasting multiple lines of code will
call CONSOLE_OT_execute multiple times in a row).

Maniphest Tasks: T86293

Differential Revision: https://developer.blender.org/D10625
2021-03-05 12:50:55 +01:00