Commit Graph

97200 Commits

Author SHA1 Message Date
Falk David
5967cb53e9 GPv3: Make visibility and lock state inheritable
This adds functions to check if a `LayerGroup` is visible or locked.
Additionally, visibility and the lock state is now inherited.
E.g. `Layer`s that are the children of a hidden `LayerGroup` will also
be hidden. This does not change their stored visibility. It just means
that the function `is_visible()` on the layers will return `false`.
The same applies for locking.
2023-06-27 15:48:07 +02:00
Philipp Oeser
258ba398ed Fix #109198: Enum properties don't display text in Dope Sheet sliders
`uiDefAutoButR` (or actually `uiDefButR_prop` > `ui_def_but_rna` later
down the line) has this behavior when "" string is passed in, it will
not display text on or next to the button.
This is of course desired in most scenarios -- it might even be desired
for non-icon enums in certain cases (though this is already a bit harder
to find cases for), so changing behavior in said functions is probably
not what we want.

The behavior - from the dopsheet sliders - would seem like a bug though.

Passing NULL (instead of "") to `uiDefAutoButR` results in properly
displaying the chosen item on the dropdown for enums, but for other
property types it would then show the property ui name alongside the
button (which is not what we want in the dopsheet, UI names are already
drawn there separately).

So now, pass "" or NULL conditionally (depending on property type
`PROP_ENUM`).

Pull Request: https://projects.blender.org/blender/blender/pulls/109205
2023-06-27 15:32:53 +02:00
Richard Antalik
91ff6457be Fix VSE ensuring handle adds duplicate handle.
This happened, because `SEQ_retiming_find_segment_start_handle()` does
not consider last handle as valid return value, so it was never checked
against.
2023-06-27 12:52:27 +02:00
Xavier Hallade
1d847b2ee3 EEVEE: Restrict GPU_finish workaround to Nvidia OpenGL backend
GPU_finish was initially added by
3f0873fa1e to work-around a Nvidia driver
issue but it introduces important GPU execution gaps during rendering on
other GPUs.

Pull Request: https://projects.blender.org/blender/blender/pulls/109382
2023-06-27 12:47:17 +02:00
Hans Goudey
47a52bd286 Fix: Crash in 3.6 when loading mesh edge crease from 4.0
In 3.6, the legacy to current mesh format conversion of edge creases
would crash when loading a file from 4.0, because it expected there to
be an `MEdge` array, which doesn't exist in 4.0. This didn't happen
previously because edge creases were stored in the same format for 4.0.
Other "legacy to current" format conversions have similar null checks,
it was just missing here.

Pull Request: https://projects.blender.org/blender/blender/pulls/109386
2023-06-27 10:14:23 +02:00
Jacques Lucke
bf9687f9bb Fix: handle invalid node trees more gracefully 2023-06-27 10:09:56 +02:00
Xavier Hallade
1be64e532d Revert "EEVEE: Remove unneeded GPU_finish"
This reverts commit 4038cabc6d.
Rendering red_autumn_forest.blend from cmd line was leading to a crash
in ntreeExecGPUNodes.
2023-06-27 09:39:27 +02:00
Philipp Oeser
c47074f3bb Fix #108171: bpy.ops.uv.pack_islands crash
Originally caused by edc12436c6, the fix c4f39eab88 also had a mistake
unfortunately (double free of `UVPackIslandsData` since it already
called `pack_islands_freejob`).

Pull Request: https://projects.blender.org/blender/blender/pulls/109377
2023-06-27 08:55:01 +02:00
Campbell Barton
8ff65fe63f Fix region snap-size threshold check
Checking to snap the region within a threshold didn't use the absolute
delta before comparison, making a larger snap size always pass
the threshold check.

Also assign variables for clarity.
2023-06-27 16:23:27 +10:00
Campbell Barton
64bfbddf35 Cleanup: quiet narrowing warning 2023-06-27 16:23:21 +10:00
Pratik Borhade
d66e12104b GPv3: Crash when drawing on new layers
Crash occurs during drawing on fresh added layer due to missing keyframe
on it. Use `insert_frame` to add frame on new layer.

This is similar to GPv2 (`BKE_gpencil_layer_frame_get` is used there to
add default keyframe on new layer)

Pull Request: https://projects.blender.org/blender/blender/pulls/109321
2023-06-27 08:19:37 +02:00
Campbell Barton
1a0be7be9d Cleanup: replace magic numbers with defines 2023-06-27 15:38:28 +10:00
Campbell Barton
d27be2b95d Cleanup: remove sprintf use in guarded allocator
Also remove vsprintf in exr_printf (commented out).
2023-06-27 15:31:21 +10:00
Campbell Barton
3c6239969e Cleanup: add size suffix to IMA_MAX_RENDER_TEXT
This read like a flag, when it's a string buffer size.
2023-06-27 14:51:03 +10:00
Campbell Barton
9c105065ee Cleanup: remove unused flags 2023-06-27 14:48:46 +10:00
Campbell Barton
0222876a34 Cleanup: replace defines with enum in DNA
- Group ambiguous flags Object::flag & Base::legacy_flag.
- Replace ambiguous hints (e.g. `paf->flag` with doxygen types).
- Remove unused flag PAF_MAXMULT.
2023-06-27 14:45:00 +10:00
Campbell Barton
863d93fe46 License headers: add SPDX-FileCopyrightText 2023-06-27 13:00:06 +10:00
Campbell Barton
562aca75d3 Cleanup: split anim/sequence loading into two functions
Also simplify image sequence reading loop.
2023-06-27 10:42:18 +10:00
Campbell Barton
c761f5b6fb PlayAnim: scale the font by the window DPI 2023-06-27 10:08:17 +10:00
Campbell Barton
4bbbf9007b Refactor: split out buffer loading for the animation player
- Simplify freeing resources on error.
- Correct check for failure to access the file size.
- Print the `errno` on failure.
- Use logging.
2023-06-27 10:06:34 +10:00
Iliya Katueshenock
3957a1ad03 Geometry Nodes: Mix Rotations
Add support a new Rotation socket/data type to a Mix node.

Rotation socket avala ible only in Geometry Nodes right now,
list of supported types for node depend on own node tree type.

Mixing kind is slerp (interpolation) of a quaternion. As initial
phase this is enough. In a future, other modes of interpolation
can be added (Euler for XY+Z, YZ+X, ZX+Y, ...). Clamping for
factor work the same as for all other data types.

Drag and drop should take care avoiding create links between
Rotation sockets and all other socket types, this requires chages
is mix node callback for drag & drop system.

See: https://projects.blender.org/blender/blender/issues/92967

Pull Request: https://projects.blender.org/blender/blender/pulls/109084
2023-06-27 00:50:53 +02:00
Hans Goudey
bef20cd3f1 Curves: Share positions array for single point profile at origin
This is the same as 48fad9cd0c but applied to the positions
array instead of other generic attributes. For test case with 90k poly
curves, this reduced the conversion time from 1.7 to 1.3 ms, and reduced
memory usage from 67 to 59 MiB (as reported by Blender).
2023-06-26 15:45:41 -04:00
Iliya Katueshenock
6bccea2ceb Cleanup: Remove unused variable in a add node search function
Pull Request: https://projects.blender.org/blender/blender/pulls/109385
2023-06-26 19:59:42 +02:00
Hans Goudey
49977c3aee Cleanup: Remove unused variable in curve to mesh conversion 2023-06-26 13:56:26 -04:00
Hans Goudey
48fad9cd0c Curves: Optimize curve to mesh with single point profile
When the profile is a single point, and all the curves are poly curves,
the mesh has the same number of points as the curves, and attributes
can be shared, reducing memory usage and time spend copying. This
doesn't apply to positions yet though. With 8 attributes, the
time for the conversion in a test went from 55 to 14 ms.

When profile is a single point but the curves aren't poly curves,
we can evaluate main point attributes directly into the mesh attribute
arrays rather than using a temporary buffer. In a test with 8
attributes, the time went from 3.7 to 1.6 ms.
2023-06-26 13:52:52 -04:00
Hans Goudey
6e9f54cbda Curves: Avoid calculations in curve to mesh single point case
When the profile is the default (or manually set to a single point at
the origin), avoid computing tangents and normals, and avoid evaluating
the radius attribute. That data is only used to build the transforms of
the new points. In a simple test case, this changed the total time from
34.4 to 14.7 ms (removing the cost 4.7, 8.4, and 2.1 ms) cost of
calculating tangents, normals, and radii.
2023-06-26 13:52:52 -04:00
Xavier Hallade
4038cabc6d EEVEE: Remove unneeded GPU_finish
A GPU_finish for each EEVEE_render_draw was initially added by
3f0873fa1e but it introduces
important GPU execution gaps during rendering.

Removing it gives a ~10% improvement on Intel Arc / Windows from
our testing with Red Autumn Forest scene.

Pull Request: https://projects.blender.org/blender/blender/pulls/109382
2023-06-26 19:36:09 +02:00
Germano Cavalcante
7d54a756b9 Snap: Optimization: Create BVHTree from loose vertices only
Since snapping to endpoints is already done when you snap to edges
together, there is no need to create a bvhtree with all the vertices.

Also use the appropriate endpoint definition for snap to armatures.
2023-06-26 14:04:03 -03:00
Germano Cavalcante
fcb2b99f2b Cleanup: Rename variables used in snap code
Many variables have been renamed to make their usage clearer in the
snap code.

- `color_line` -> `source_color`;
- `color_point` -> `target_color`;
- `loc_prev` -> `source_loc`;
- `loc_curr` -> `target_loc`;
- `normal` -> `target_normal`;
- `snap_elem_type` -> `target_type`;
- `snapElem` -> `target_type`;
- `Nearest2dUserData` -> `SnapData`;
- `SCE_SNAP_TO_VERTEX` -> `SCE_SNAP_TO_POINT` or `SCE_SNAP_TO_EDGE_ENDPOINT`;
- `SnapData_EditMesh` -> `SnapCache_EditMesh`;
- `sod` -> `em_cache`;

Also: make-format
2023-06-26 13:47:06 -03:00
Richard Antalik
438ff8fd04 VSE: Ensure retiming handle at strip right handle
When strip is split it is hard to add new retiming handle to it's end.
Ensuring this handle exists greatly improves workflow.
2023-06-26 18:26:58 +02:00
Falk David
b61316c7ad GPv3: Add operator to add new layer group 2023-06-26 18:23:08 +02:00
Falk David
8a39f438c3 Fix compiler warning 2023-06-26 18:22:33 +02:00
Falk David
34d65eff1b Fix: Memory leak in grease_pencil.layer_reorder 2023-06-26 18:14:05 +02:00
Falk David
3d4cdd6b88 Fix: Typo in grease_pencil.layer_add description 2023-06-26 18:14:05 +02:00
Germano Cavalcante
9b1e56f013 Transform: Show Snap Base when adding multiple snap points
This is part of what was implemented in #109062

When adding multiple snap points (`A` key), the 'Snap Base' location no longer corresponds to the snap target point, so it becomes invisible.

Therefore, show the resulting `Snap Base` during this operation.

Pull Request: https://projects.blender.org/blender/blender/pulls/109379
2023-06-26 17:41:15 +02:00
Falk David
b69bba25ad GPv3: Add python endpoint to get/set active layer 2023-06-26 17:04:15 +02:00
Falk David
9f05936212 GPv3: Change name_plural to "grease_pencils_v3"
This is more consistent with the rest of the RNA names used.
2023-06-26 17:04:15 +02:00
Almaz Shinbay
4094cd207a Outliner: Remove isExpandValid() from AbstractTreeElement and its sub-classes
No user visible changes expected.

Part of #96713, continuation of work started in 249e4df110 and 2e221de4ce.
Refer to these for a motivation and design overview.

Removes `isExpandValid()` from `AbstractTreeElement` and its sub-classes as all ID elements are ported to new tree-element code design. It was meant to be temporary for this transition phase.

Pull Request: https://projects.blender.org/blender/blender/pulls/109380
2023-06-26 16:59:44 +02:00
Julian Eisel
adb370e6ba UI: Use new C++ button apply function
No user visible changes expected.

This function was added in 86b2cf4574 as a more type safe and more
convenient way of setting button callbacks. So use it for simple cases.
2023-06-26 16:56:05 +02:00
Julian Eisel
0b19ab2cde UI: Add type-safe C++ button apply function object
No user visible changes expected.

Rather than relying on a C-style function pointer with void pointer
arguments, allow storing a `std::function` object, which can hold
arbitrary data in a type safe way. This can be conveniently used with
lambdas for example.

This is not used yet, but will be with #104831 merged. Replacing the
existing C-style callback uses with this can be done separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/109016
2023-06-26 16:39:51 +02:00
Germano Cavalcante
c856d29e9f Fix assert in recent commit
It was supposed to be `!=` instead of `==`.
2023-06-26 11:20:41 -03:00
Almaz Shinbay
89f61015d1 Outliner: Port remaining ID elements to new tree-element code design
No user visible changes expected.

Part of #96713, continuation of work started in 249e4df110 and 2e221de4ce.
Refer to these for a motivation and design overview.

Adds a default expansion for `TreeElementID`, removing the need for `outliner_add_id_contents()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/109256
2023-06-26 16:11:30 +02:00
Germano Cavalcante
c02333f37e Fix snap to perpendicular acting on default Snap Base
Snap to Edge Perpendicular has been disabled in Set Snap Base.
2023-06-26 11:03:47 -03:00
Germano Cavalcante
bfe4fb92f9 Fix #109346: Strange snapping behaviour
The problem was caused because the `Nearest2dUserData::obmat_` member
was deallocated in derived classes even before the main class
destructor was called.

This is strange behavior and only seen in Mac or Linux Release builds.

The solution is to not rely on the destructor to register snap values.

So create a separate function.
2023-06-26 10:52:50 -03:00
Falk David
2418252ea7 Refactor: Move stroke_cache to gpencil runtime
This moves the `stroke_cache` that was previously stored on every
drawing to the `GreasePencilRuntime` struct.

Since this cache is only used for when a user is drawing a stroke, there
can only ever be one. It makes more sense to have this cache on the
data-block runtime data, rather than every drawings runtime data.
2023-06-26 15:49:18 +02:00
Falk David
5dd29c9a05 Fix: Uses of foreach_editable_drawing callbacks
Some of the uses of the API have not been updated properly.
2023-06-26 15:19:12 +02:00
Miguel Pozo
97d6b5ad72 Fix GCC warnings 2023-06-26 15:11:11 +02:00
Damien Picard
44d012ce1d I18n: disambiguate a few messages
- "Front"/"Back": 'put something at the front/back' or 'the front/back
  face of something'. (e. g. the Empty Image options, Depth and Side
  option, both use the same strings as enum, which should be avoided
  in some languages).
- "Flip": invert, as in normals, or mirror, as in an image.
- "Path": a path to a resource, in general a file but sometimes a
  datablock, as opposed to a trajectory in space.
- "Join": disambiguate for the Grease Pencil operator, which may use a
  different word as that for meshes.
- "Wave": an ondulating motion, as opposed to a fluid dynamics motion.
- "Step": can mean the distance between two things, or a number of
  times to do something. In this case it is better to use the plural.
- "Edge": generally the edges of a mesh, but can also mean edge
  detection. Additionally, it was used for the option to enable
  Freestyle. This was changed to "Use Freestyle".
- "Boundary": the limit of a grease pencil drawing for filling
  purposes, as opposed to the external limit of a (non-manifold) mesh.
- "Rotations": can be translated to something like "Turns", in the
  context of a spiral.

Pull Request: https://projects.blender.org/blender/blender/pulls/108213
2023-06-26 15:07:06 +02:00
Falk David
0a693165c8 Refactor: Move GreasePencilDrawing functionality
Moves the functions from `GreasePencilDrawing` to a C++ wrapper class.
2023-06-26 14:58:42 +02:00
Jacques Lucke
af476f6a62 Nodes: fix zone detection for some special cases
This fixes crashes in the cases when:
* Two zones have a cyclic parent relationship.
* A node has more than one direct parent zone.
2023-06-26 14:33:37 +02:00