Commit Graph

3573 Commits

Author SHA1 Message Date
Iliya Katueshenock
75d17b1db5 Cleanup: Move BKE_node to namespace
Move all header file into namespace.
Unnecessary namespaces was removed from implementations file.
Part of forward declarations in header was moved in the top part
of file just to do not have a lot of separate namespaces.

Pull Request: https://projects.blender.org/blender/blender/pulls/121637
2024-05-13 16:07:12 +02:00
Falk David
281bbe198d Cleanup: GPv3: Use get_drawing_at in modifier util functions
Part of #121565.

Instead of accessing the drawing indices directly, use
`get_drawing_at` in the utility functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/121732
2024-05-13 15:40:36 +02:00
Jacques Lucke
2f289857af Object: add Shade Auto Smooth operator
Based on the design in #120230.
* Replaces the `Shade Smooth by Angle` operator with `Shade Auto Smooth`
  in the object context menu menu.
* The new operator automatically adds and removes the modifier instead
  of being a destructive operation.
* The `Shade Smooth` and `Shade Flat` operators now remove the
  `Smooth by Angle` modifier automatically.
* Add a pin option to modifiers, which limits dragging and keeps the
  modifier after newly added modifiers in the list.

Co-authored-by: Hans Goudey <hans@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/121494
2024-05-08 20:24:10 +02:00
Falk David
fea091e18e Refactor: GPv3: insert_blank_frame
This is part of #121565.

Renames the `insert_blank_frame` function to `insert_frame`.

Instead of returning a boolean for if the keyframe was created,
return a pointer to the drawing. This aligns more with how
we're using this API. After inserting a keyframe, it's common
to then e.g. write to the newly created drawing.

Also use sensible default parameter values for the duration
(default = implicit hold) and the keyframe type
(dafault = `BEZT_KEYTYPE_KEYFRAME`).

With this change, we're moving closer to the goal of
only allowing to create drawings by creating keyframes.
2024-05-08 16:47:46 +02:00
Falk David
737572ed88 Cleanup: GPv3: Use GreasePencil::layer function instead of GreasePencil::layers
This also ensures that there is an assert that checks
for valid indices before accessing the span of layers.
2024-05-08 12:35:06 +02:00
YimingWu
3be6dbb02a Fix #121366: Invalid mat_nr after exact boolean
Material index of faces could be a invalid value after booleaning in
exact boolean in "Index Based" mode against objects with no material
slots, this is caused by the lack of initilization material remapping
array. Now all initilized to 0.

Assigning 0 explicitly in Fast mode as well for consistency.

Pull Request: https://projects.blender.org/blender/blender/pulls/121380
2024-05-04 13:29:35 +02:00
Campbell Barton
9918488bb1 Cleanup: use uppercase tags, following own style guide 2024-05-03 11:33:21 +10:00
Sergey Sharybin
1b0012d51c Refactor: Require C++ for users of BLI_simd.h
This is because sse2neon.h might be used to emulate SSE intrinsics
on ARM64 architecture, and it uses some preprocessor which is not
available for C language when using MSVC.

The old-style math file math_matrix.c uses this header, so needed
to become C++. Simple rename did not work since there is a new math
utility math_matrix.cc exists. Following some existing convention
the math_matrix.c is renamed to math_matrix_c.cc. Eventually all the
code should switch to use C++ style math, and the C style removed,
so it seems reasonable to not mix old and new style of API in the
same file.

There should be no functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/121335
2024-05-02 16:22:19 +02:00
Jacques Lucke
ebd2762239 Fix: crash when applying geometry nodes with bake node 2024-05-01 23:11:58 +02:00
Hans Goudey
a83e695c0a Cleanup: Use utility for safe division 2024-04-30 09:08:46 -04:00
Falk David
5ebce2c72c Fix: GPv3: Division by zero for single point curves
Makes sure to map curves with a single point to 0.0f in the
custom curve mapping.
2024-04-30 13:17:36 +02:00
Campbell Barton
08b3db500f Cleanup: correct asserts
Also remove redundant assert.
2024-04-25 12:02:14 +10:00
Brecht Van Lommel
15b9ae5436 Refactor: Use typed functions for blend file data reading
This makes the read and write API functions match more closely, and adds
asserts to check that the data size is as expected.

There are still a few places remaining that use BLO_read_data_address
and similar generic functions, these should eventually be replaced as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/120994
2024-04-24 17:01:22 +02:00
Campbell Barton
1865776767 Cleanup: doxygen syntax, use colons after "param" arguments, not "note" 2024-04-24 10:55:44 +10:00
Campbell Barton
fd589fdca4 Cleanup: various non functional C++ changes 2024-04-20 13:46:14 +10:00
Hans Goudey
11f0d88d13 Subdiv: Move most blenkernel subdiv code to C++ namespace
Move most code to `blender::bke::subdiv`. That helps organization
and makes using C++ in subdiv code easier, which will be useful for
removing the unnecessary opensubdiv C-API wrapper.
2024-04-19 09:03:31 -04:00
Hans Goudey
40b7bf30c8 Cleanup: Remove unused variable 2024-04-18 15:17:28 -04:00
Jesse Yurkovich
3f8ec963e3 Fix: Use correct datatype in MSC modify_geometry_set for the frame time
The recently added `modify_geometry_set` code path [1] inside the Mesh
Sequence Cache was meant to follow what was done inside `modify_mesh`
but failed to use the correct data type for the time offset. Double is
used throughout Blender when dealing with the frame time and this was
simply missed.

This results in rounding errors and downstream consumers like USD would
re-read the wrong frames. e.g. it would read frame 4 twice because the
values provided when switching from frame 4 to frame 5 were
`4.000000119209290` and `4.999999880790710` instead of
`4.000000000000000` and `5.000000000000000` with this patch.

[1] ea256346a8

Pull Request: https://projects.blender.org/blender/blender/pulls/120790
2024-04-18 20:55:13 +02:00
Hans Goudey
9a7f4a3b58 Modifiers: Affect all selected objects when holding alt
Support holding alt while invoking modifier operations for add, apply,
remove, and move to index in the property editor. This affects all selected
editable objects instead of just the active object.

Though the alt key is not that visible, it's consistent with the
existing multi-object property editing shortcut. If/when multi-
object editing is every made the default, the alt key could
be reversed here too.

Changes as part of #120230.

Pull Request: https://projects.blender.org/blender/blender/pulls/120695
2024-04-18 17:40:50 +02:00
Hans Goudey
fda57f8e84 Fix: Vertex normal calculation broken in array modifier
Mistake in 6023a6a423
2024-04-16 09:14:50 -04:00
Hans Goudey
75804f2dd0 Fix #120575: GPU subdivision ignores split normals from sharp edges
Fall back to CPU subdivision when there are split edges and the mesh
normals domain is face corners. This is required because splitting the
normals on faces adjacent to sharp edges doesn't work well with the
performance requirements of GPU subdivision.

This is related to 1111903416

Pull Request: https://projects.blender.org/blender/blender/pulls/120674
2024-04-15 21:19:54 +02:00
Damien Picard
abc0bf814f UI: Fix and improve a few messages
- "Log Encoding with Chroma inset and rotation": add "of primaries" in
  the description of the AgX Log color space to better explain the
  operation, based on wording in !106355.
- Remove a few double spaces.
- Make Line Art title case everywhere, to convey it's the system /
  brand / product name and not the generic concept.
- "Copy Absolute coordinates or Normal vector" -> "of Normal Vector":
typo.
- "Makes a link between selected output in input sockets" ->
  "Make...", "output and input": typo.
- "Purge Unused Data From This File" -> "from this": title case as per
  HIGs.
- GPencil -> Grease Pencil: no reason to use an abbreviation here.
- "Around Current Frame" -> "Around Frame": actual name of the
  onion-skinning method.
- "... (layer height for layer tool, i.e.)" -> "(i.e. the layer height
  for the layer tool)": put "i.e." at the start of the sentence.
- Expand description of toe-in stereo camera option.
- "Children collections their parent-collection-specific settings" ->
  "Children collections with their...": typo.
- "Generate vertex weights base on..." -> "based on" : typo, lower
  case.
- Expand description of GP modifier properties, based on their mesh
  counterparts.
- "AEnvelope" -> "Envelope": typo.
- "Falloff type the feather" -> "of the feather": typo.
- "usually make transition as long as effect strip": rephrase.
- "When disabled a users extensions directory is created" -> "a
  user's": typo.
- "successfull" -> "successful": typo.
- "Remove all attributes... a single wildcard (*).": remove trailing
  ".".
- "..., use "Save Preferences."": remove trailing ".".

Some issues reported by Marina Veselkova and Tamar Mebonia.

Pull Request: https://projects.blender.org/blender/blender/pulls/120649
2024-04-15 20:02:38 +02:00
Campbell Barton
49bf7ebbdd Cleanup: use const args & variables, remove redundant checks
- Declare const variables & arguments.
- Remove redundant null checks.
- Remove break after return.
- Replace suspicious "&" with "&&".
2024-04-15 09:50:47 +10:00
Hans Goudey
c91449836a Cleanup: Move BKE_workspace.h to C++ 2024-04-12 17:03:18 -04:00
Falk David
089a435376 Fix: GPv3: Default value for fill opacity in opacity modifier
Make sure the default value for the fill opacity is 1 instead of 0.
2024-04-12 17:42:42 +02:00
Hans Goudey
3d1bf4eb74 Fix: Properly free/allocate non-trivial shrinkwrap cache struct
Mistake in 0b80d5e755

Pull Request: https://projects.blender.org/blender/blender/pulls/120527
2024-04-11 16:15:18 +02:00
Lukas Tönne
68060a9ccf GPv3: Implement UV rotation mode for the noise modifier
UV rotation in the noise modifier was a todo since UVs were not
supported yet at the time the modifier was added. This patch adds the
missing UV rotation feature.

Pull Request: https://projects.blender.org/blender/blender/pulls/120336
2024-04-06 14:25:18 +02:00
Pablo Vazquez
4e90501377 UI: Fix label in Particle System modifier
Fix two issues with the current label:
1. "particle tab" should be "Particles tab" since that's the actual name
    of the tab.
2. "Settings are in..." is inconsistent with similar labels where the
   word used is "inside" instead of "in".

Pull Request: https://projects.blender.org/blender/blender/pulls/120319
2024-04-05 18:50:57 +02:00
Falk David
d7230516c1 Cleanup: GPv3: Add drawing API for fill color
This adds two functions to the `Drawing` class: `fill_colors()`
and `fill_colors_for_write()`.
In places where the attribute API was used directly, these
functions are now used instead.

This is part of #119080. The point is that developers
shouldn't need to remember the name, type, default value,
and domain of built-in attributes (e.g. used by the renderer).

Pull Request: https://projects.blender.org/blender/blender/pulls/120296
2024-04-05 15:28:28 +02:00
Hans Goudey
b195014e05 Cleanup: Clarify modifier depends_on_normals handling
Because normals are calcualted lazily for all cases "depends_on_normals"
except for BMesh original normals, this is mostly unnecessary. It's actually
probably not necessary at all, because in practice there is always a separate
positions array stored in `EditMeshData` during mesh edit mode modifier
evaluation, bringing us back to the lazy calculation. But anyway, removing
the usage for topology-changing modifiers and modifiers  which don't
accept BMesh as input anyway simplifies things.

Pull Request: https://projects.blender.org/blender/blender/pulls/120274
2024-04-04 22:46:41 +02:00
YimingWu
022e46a7e2 Fix #120213: GPv3: Tint modifier not working correctly
The GPv3 tint modifier will give incorrect result in fill tint due to
two reasons: 1) The material index being wrong; 2) The default value
for `fill_color` attribute needs to be explicitly assigned as
`ColorGeometry4f(float4(0.0f))` to ensure correct color mixing and
switching between fill/material color in the tint modifier.

Pull Request: https://projects.blender.org/blender/blender/pulls/120249
2024-04-04 15:08:10 +02:00
Campbell Barton
7e9f7320e4 Cleanup: spelling in comments & comment blocks 2024-04-04 11:26:28 +11:00
Campbell Barton
937776b555 Cleanup: sort CMake file lists 2024-04-01 16:48:44 +11:00
Campbell Barton
add3c6a3b1 Correction to commenting unused axis_v from last commit 2024-04-01 15:51:35 +11:00
Campbell Barton
3ecc626c3d Cleanup: comment unused variable 2024-04-01 15:48:35 +11:00
Lukas Tönne
d7c718dfd4 GPv3: Texture offset modifier
Port of the GPv2 texture modifier for transforming UVs of stroke points.

Pull Request: https://projects.blender.org/blender/blender/pulls/119050
2024-03-29 21:42:30 +01:00
Falk David
60e648a7e6 Fix: GPv3: Simplify modifier inconsistency with GPv2
The simplify modifier did not remove points in fixed mode
at level 1. This was the case in GPv2.
This makes sure to get the same result as in GPv2.
2024-03-29 16:48:36 +01:00
Falk David
96de8112ee Fix: GPv3: Crash in simplify modifier
The simplify modifier uses
`bke::curves_copy_point_selection` but didn't
build the `points_to_keep` index mask correctly.
This fixes the indices in the index mask and also
optimizes the edge cases of removing all the points/
keeping all the points.
2024-03-29 16:13:44 +01:00
casey bianco-davis
7669ba7a5c GPv3: Handle UVs in Smooth Modifier
The smooth modifier was made before UVs were implemented.
This adds smoothing to the UV rotations.

Pull Request: https://projects.blender.org/blender/blender/pulls/120032
2024-03-29 11:18:06 +01:00
Campbell Barton
3d2593b229 Cleanup: replace "derived mesh" with "evaluated mesh" in code comments
References to the evaluated mesh were referring to "derived mesh"
when DerivedMesh wasn't used.
2024-03-29 13:29:30 +11:00
Hans Goudey
72347f11fe Cleanup: Use float3, Span, Array for vertex positions 2024-03-28 18:28:35 -04:00
Falk David
8b7d5f8587 GPv3: Simplify Modifier
Implements the GPv2 simplify modifier.

Pull Request: https://projects.blender.org/blender/blender/pulls/120018
2024-03-28 18:16:14 +01:00
Falk David
5a6a9349e0 Revert "GPv3: Simplify modifier"
This reverts commit 279b8b5748.

The PR wasn't accepted.
2024-03-28 15:23:42 +01:00
YimingWu
279b8b5748 GPv3: Simplify modifier
Implements the simplify modifier from GPv2.

Co-authored-by: Falk David <falk@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/118546
2024-03-28 15:18:33 +01:00
Hans Goudey
7c01355cad Cleanup: Use forward declaration headers in a few places 2024-03-27 22:25:08 -04:00
Hans Goudey
c28db1f0a0 Cleanup: Use C++ namespace for object editors module
Move the public functions from the editors/object (`ED_object.hh`)
header to the `blender::ed::object` namespace, and move all of the
implementation files to the namespace too. This provides better code
completion, makes it easier to use other C++ code, removes unnecessary
redundancy and verbosity from local uses of public functions, and more
cleanly separates different modules.

See the diff in `ED_object.hh` for the main renaming changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/119947
2024-03-28 01:30:38 +01:00
Hans Goudey
0cdd429b44 Cleanup: Use newer API for creating IDProperties in most places
There are still a few places that are more complicated where the replacement
to `IDP_New` isn't obvious, but this commit replaces most uses of the ugly
`IDPropertyTemplate` usage.
2024-03-26 15:39:39 -04:00
Hans Goudey
e0567eadbd Cleanup: Use FunctionRef for IDProperty iteration callback
Avoid the need for a seaprate user_data argument.
2024-03-26 15:39:39 -04:00
Hans Goudey
efee753e8f Cleanup: Move BKE_idprop.h to C++ 2024-03-26 13:07:04 -04:00
Hans Goudey
f41ab9abc1 Cleanup: Combine BKE_idprop C and C++ headers
In preparation for moving the whole BKE_idprop.h to C++.
To keep the git history intact we remove the newer smaller file.
2024-03-26 13:07:04 -04:00