Commit Graph

117 Commits

Author SHA1 Message Date
Clément Foucault
6b0f57facf Fix #142285: 3D cursor placement ignores unselectable objects
This was caused by 3dfec1ff73
which introduce the new behavior. This was to fix workflows
using a lot of semi-transparent objects which made nagivation
difficult.

This patch first roll back to the previous behavior: The
unselectable object will affect depth-aware operators.

This patch introduces a new visibility property to remove
the influence of objects in all depth picking operations
and selection operations. However the object is still
selectable through non-drawing selection operators
(e.g. select by material) and through the outliner.
This is to adress the aforementionned navigation issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/146706
2025-10-16 19:17:18 +02:00
Hans Goudey
a68d39e9d9 Cleanup: Formatting
Run `make format` after the library update in the previous commit.
2025-10-02 12:55:42 -04:00
Bastien Montagne
ead0af6ef7 Fix #146995: Liboverride: Add support for LightLinking data.
Collection side is trivial, Object one is a bit more intricate, as
its LightLinking data behave similar to AnimData of IDs, which requires
a custom liboverride `apply` callback.

Pull Request: https://projects.blender.org/blender/blender/pulls/147039
2025-10-01 18:11:19 +02:00
Casey Bianco-Davis
f8d2a3af38 Python: Rename bpy.types.GreasePencilv3 to bpy.types.GreasePencil
This renames python Grease Pencil type
from `bpy.types.GreasePencilv3` to `bpy.types.GreasePencil`.

Part of #125058.

Pull Request: https://projects.blender.org/blender/blender/pulls/146902
2025-09-29 12:25:23 +02:00
Bastien Montagne
62d1c3d998 Fix more cases of invalid ID refcounting status in RNA.
* NodeTree space does not refcount the displayed nodegroup
* Collections used by light linking _do_ ID refcount (unlike default
  expected behavior for Collection usages).
2025-08-08 12:04:00 +02:00
Damien Picard
5998795aa6 UI: Replace contractions with long-form text
Avoid using contractions for can't, aren't, doesn't, and shouldn't.
Following the writing style guide in the Human Interface Guidelines.

Pull Request: https://projects.blender.org/blender/blender/pulls/143852
2025-08-05 11:16:22 +02:00
Bastien Montagne
aa50de76a7 Fix assert when assigning active material of an object through RNA.
This is yet another fully virtual property (it does not exist as-is in
DNA, and requires both getter and setter) that does handle ID
refcounting of the affected materials. Now these require an explicit
definition of `PROP_ID_REFCOUNT`, as this flag cannot be defined
automatically by makesrna.
2025-08-01 18:24:54 +02:00
Bastien Montagne
f4ae983dfb RNA: Improve handling of ID refcounting by Pointer properties.
This commit works on two related issues:
1. It is too easy to forget to handle ID refcounting in custom RNA setters.
2. It is not possible to fully force RNA refcounting ON or OFF for some
   properties.

Issue 1. has bit us several times recently (e.g. in animation or
compositor areas, see latest fix blender/blender!143577).

This commit addresses it by adding some debug-only checks around the
call to `PointerPropertyRNA::set()` in `RNA_property_pointer_set()`,
that validates that usercount of both previously and newly assigned IDs
matches expected (changes of) values.

While not ideal, this should make it way easier for developers to catch
that issue in the future.

The second issue was discovered while working on the first, leading to
e.g. questionable work-arounds like the `rna_DriverTarget_id_set`
setter, only defined to by-pass the automatically assigned
`PROP_ID_USERCOUNT` flag (and related automatic refcounting of the
default setter code).

It is addressed by adding an internal `PROP_INTERN_PTR_ID_REFCOUNT_FORCED`
flag, which keeps track of calls to
`RNA_def_property_flag`/`RNA_def_property_clear_flag` which explicitely
sets or clears the `PROP_ID_USERCOUNT` flag, and prevents automatic
setting of that flag in that case.

Pull Request: https://projects.blender.org/blender/blender/pulls/143660
2025-08-01 14:01:24 +02:00
Falk David
20383e4d82 Python: Rename legacy Grease Pencil types to Annotation
This renames the legacy Grease Pencil python types to what
they are used for now: Annotations!

## Updated types
| Before | After |
| --- | --- |
| `bpy.types.GPencilStrokePoint` | `bpy.types.AnnotationStrokePoint` |
| `bpy.types.GPencilStroke` | `bpy.types.AnnotationStroke` |
| `bpy.types.GPencilFrame` | `bpy.types.AnnotationFrame` |
| `bpy.types.GPencilFrames` | `bpy.types.AnnotationFrames` |
| `bpy.types.GPencilLayer` | `bpy.types.AnnotationLayer` |
| `bpy.types.GPencilLayers` | `bpy.types.AnnotationLayers` |
| `bpy.types.GreasePencil` | `bpy.types.Annotation` |
| `bpy.types.BlendDataGreasePencils` | `bpy.types.BlendDataAnnotations` |

## Updated properties
| Before | After |
| --- | --- |
| `bpy.data.grease_pencils` | `bpy.types.annotations` |
| `MovieClip.grease_pencil` | `MovieClip.annotation` |
| `NodeTree.grease_pencil` | `NodeTree.annotation` |
| `Scene.grease_pencil` | `Scene.annotation` |
| `SpaceImageEditor.grease_pencil` | `SpaceImageEditor.annotation` |
| `SpaceSequenceEditor.grease_pencil` | `SpaceSequenceEditor.annotation` |
| `MovieTrackingTrack.grease_pencil` | `MovieTrackingTrack.annotation` |

Pull Request: https://projects.blender.org/blender/blender/pulls/142236
2025-07-18 12:57:01 +02:00
Hans Goudey
c16ee2c939 Refactor: Use C++ bounds corners function
Remove the last uses of `BKE_boundbox_init_from_minmax` in
favor of the newer `bounds::corners`. Besides clearer naming
and better ergonomics, it's also inline-able which seems to be a
good thing for such a simple function.

In order to get the same behavior as before I changed the
C++ bounds function to give the same vertex order as the
older function.

Pull Request: https://projects.blender.org/blender/blender/pulls/140401
2025-06-16 15:49:14 +02:00
Campbell Barton
8fea423e00 Fix #139133: Crash entering edit mode for curve/text objects
- Make Curve::type the source of truth for the curve type,
  instead of Curve::vfont, since it's possible for this to be
  set to null from RNA which effectively changed it's type.
  See #138730.

- Update objects to match the curve type on file read.

  Without this, an object may link to a curve in another file which
  can be replaced by a curve data-block of a different type.

  Note that updating the object type was already being done
  when reloading library data and setting object data,
  just not on file load.

Ref !139137
2025-05-20 19:28:49 +10:00
Damien Picard
81d9e94218 UI: Fix and improve a few messages
- "Parameters for custom (OSL-based) Cameras" -> "cameras": lower case
  in tooltips.
- "Connect two nodes ... (automatically determined": missing
  parenthesis.
- "Join curve... control points are detected(if disabled...": add
  missing space.
- "Add Selected to Active Objects Collection" -> "Active Object's":
  typo.
- "Duplicate the acive shape key" -> "active": typo.
- "Copy selected points ": remove trailing space.
- "Move cursor" -> "Cursor": title case for operator.
- "Paste text to clipboard" -> "from clipboard": typo.
- "An empty Action considered as both a 'layered' and a 'layered'
  Action." -> "is considered as both a 'legacy' and a 'layered'
  Action": likely copy-paste error.
- "Target's Z axis will constraint..." -> "will constrain": typo.
- "The layer groups is expanded in the UI" -> "layer group": typo.
- Deprecation warnings: add missing parentheses.
- "... on low poly geometry.Offset rays...": add missing space after
  period.
- "... relative to the files directory" -> "... to the file's
  directory": typo.
- "The unit multiplier for pixels per meter" -> "The base unit": this
  property description was copy and pasted.
- "... beyond the faces UVs..." -> "the faces' UVs: typo.
- "Is tracking data contains ..." -> "Whether the tracking data
  contains": grammar.
- "Selected text" -> "Text": title case for prop.
- "The user has been shown the "Online Access" prompt and make a
  choice" -> "made a choice": grammar.
- "Glare ": remove trailing space.
- "Don't collapse a curves" -> "Do not collapse curves": grammar.

Some issues reported by Tamar Mebonia.

Pull Request: https://projects.blender.org/blender/blender/pulls/139118
2025-05-19 22:12:17 +02:00
Jacques Lucke
e8d1491e62 Refactor: Depsgraph: simplify query API further
* Remove `DEG_get_evaluated_object` in favor of `DEG_get_evaluated`.
* Remove `DEG_is_original_object` in favor of `DEG_is_original`.
* Remove `DEG_is_evaluated_object` in favor of `DEG_is_evaluated`.

Pull Request: https://projects.blender.org/blender/blender/pulls/138317
2025-05-02 15:08:29 +02:00
Clément Foucault
81c00bf272 EEVEE: Shadow Terminator Normal Bias
This implement the design detailed in #135935.

A new per object property called `Shadow Terminator Normal Offset` is
introduced to shift the shadowed position along the shading normal.

The amount of shift is defined in object space on the object datablock.

This amount is modulated by the facing ratio to the light. Faces
already facing the light will get no offset. This avoids most light
leaking artifacts.

In case of multiple shading normal, the normal used for the shift
is arbitrary. Note that this is the same behavior for other biases.

The magnitude of the bias is controlled by `Shadow Terminator Normal Offset`.
The amount of faces affected by the bias is controlled using
`Shadow Terminator Geometry Offset` just like cycles.

Tweaking the `Shadow Terminator Geometry Offset` allows to avoid too much
shadow distortion on surfaces with bump mapping.

Cycles properties are copied from the Cycles object datablock to the
blender datablock. This break the python API for Cycles.

The defaults are set to no bias because:
- There is no good default. The best value depends on the geometry.
- The best value might depend on real-time displacement.
- Any bias will introduce light leaking on surfaces that do not need it.
- There is an additional cost of enabling it, which is proportional
  to the amount of pixels on screen using it.

Pull Request: https://projects.blender.org/blender/blender/pulls/136935
2025-04-25 19:12:04 +02:00
Campbell Barton
12e17e2477 Cleanup: use const arguments, variables 2025-03-28 00:59:11 +00:00
Johnny Matthews
633b8d30db Fix #135071: Vertex Parenting: Provide Index Access Options
When using vertex parenting, an option for using the parent object
final evaluated indices is exposed in the Object Properties: Relations
panel. This allows the calculation of the parent vertex position to
ignore the the CD_ORIGINDEX layer and instead use the final indices
that may have been altered by the node tree evaluation.

The indices that will be used for the vertex parenting are also exposed
to the UI in the same panel, allowing them to be altered after the
vertex parent has been created.
2025-03-21 23:43:48 +01:00
Campbell Barton
3f9c08d960 Docs: add a doc-string for rotation_mode
Based on the report #135332, it's not obvious that rotation modes that
aren't selected aren't used, note this in the doc-string.

Ref !136103
2025-03-18 22:39:30 +11:00
Christoph Lendenfeld
6e4413d50f Merge branch 'blender-v4.4-release' 2025-02-25 12:14:52 +01:00
Christoph Lendenfeld
5100a80f7f Fix #110650: Drivers not removed if removing their container
This applies to modifiers, constraints and shape keys.
Any driver on such data was not removed with it,
leaving invalid drivers on objects.

With this patch, the drivers are removed, but animation is left untouched.
This is because animation might be reused somewhere else and we don't
want to introduce potential side effects there.

This also adds unit tests for the fixed cases

Pull Request: https://projects.blender.org/blender/blender/pulls/134511
2025-02-25 12:11:15 +01:00
Pratik Borhade
d961f8f9ec Grease Pencil: Remove legacy object type references
Remove GP legacy obtype and unused functions
Few hidden bugs are fixed with that:
- Outliner drag-drop for GP material/effect elements now works
- Correct stats are shown in status bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/133957
2025-02-25 10:46:27 +01:00
Bastien Montagne
6b0ad2e16b Refactor: Replace RNA_POINTER_INVALIDATE RNA/BPY macro usages.
Add `PointerRNA::reset()` and `PointerRNA::invalidate()` utils functions
(both simply reset the PointerRNA data to empty state).

Replace `RNA_POINTER_INVALIDATE` macro by `PointerRNA::invalidate()`.

Follow-up to !134393 and e55d478c64.
2025-02-18 12:43:43 +01:00
Bastien Montagne
87a4c0d3a8 Refactor: Make Library.runtime an allocated pointer.
Move `Library.runtime` to be a pointer, move the related
`LibraryRuntime` struct to `BKE_library.hh`. Similar to e.g.
Mesh.runtime, that pointer is expected to always be valid, and is
allocated at readtime or when creating a new Library ID.

Related smaller changes:
* Write code now uses standard ID writing codepath for Library IDs too.
  * Runtime pointer is reset to nullptr before writing.
* Looking up a library by its absolute path is now handled through a
  dedicated utils, `search_filepath_abs`, instead of using
  `BLI_findstring`.

Pull Request: https://projects.blender.org/blender/blender/pulls/134188
2025-02-07 17:47:16 +01:00
Bastien Montagne
45f231141d Core: Add info about chain of ancestors (owner data) of a PointerRNA.
The general idea is to store an array of (type, data) pointers of all
PointerRNA ancestors of the current one.

This will help solving cases in our code where the owner (or sometimes
even the owner of the owner) of a random PointerRNA needs to be
accessed. Current solution mainly relies on linear search from the owner
ID, which is sub-optimal at best, and may not even be possible in case a
same data is shared between different owners.

This lead to refactoring quite a bit of existing PointerRNA creation code.

At a high level (i.e. expected usages outside of RNA internals):
* Add `RNA_pointer_create_with_parent` and
  `RNA_pointer_create_id_subdata` to create RNA pointers with
  ancestors info.
* `RNA_id_pointer_create` and `RNA_main_pointer_create` remain
  unchanged, as they should never have ancestors currently.
* Add `RNA_pointer_create_from_ancestor` to re-create a RNA pointer
  from the nth ancestor of another PointerRNA.
* Add basic python API to access this new ancestors data.
* Update internal RNA/bpy code to handle ancestors generation in most
  common generic cases.
  - The most verbose change here is for collection code, as the owner of the
    collection property is now passed around, to allow collection items to get
    a valid ancestors chain.

Internally:
* `PointerRNA` now has an array of `AncestorPointerRNA` data to store
  the ancestors.
* `PointerRNA` now has constructors that take care of setting its data for
  most usual cases, including handling of the ancestor array data.
* Pointer type refining has been fully factorized into a small utils,
  `rna_pointer_refine`, that is now used from all code doing that operation.
* `rna_pointer_inherit_refine` has been replaced by
  `rna_pointer_create_with_ancestors` as the core function taking care of
  creating pointers with valid ancestors info.
  - Its usage outside of `rna_access` has been essentially reduced to custom
    collection lookup callbacks.

Implements #122431.

--------------

Some notes:
* The goal of this commit is _not_ to fully cover all cases creating
  PointerRNA that should also store the ancestors' chain info. It only
  tackles the most generic code paths (in bpyrna and RNA itself mainly).
  The remaining 'missing cases' can be tackle later, as needs be.
* Performances seem to be only marginally affected currently.
* Currently `AncestorPointerRNA` only stores PointerRNA-like data.
  This will help `StructPathFunc` callbacks to more efficiently generate
  an RNA paths when calling e.g. `RNA_path_from_ID_to_property`, but will
  not be enough info to build these paths without these callbacks. And some
  cases may still remain fuzzy. We'd have to add thinks like a `PropertyRNA`
  pointer, and for RNA collection ones, an index and string identifier, to store
  a complete unambiguous 'RNA path' info. This is probably not needed, nor
  worth the extra processing and memory footprint,  for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/122427
2025-02-05 15:45:04 +01:00
Hans Goudey
fc1fe4e78c Cleanup: Rename object materials "test" functions
"test" wasn't descriptive. Rename that part to "sync_length".
Also expose documentation from the function implementation
to describe what the functions do.

Pull Request: https://projects.blender.org/blender/blender/pulls/134058
2025-02-04 17:46:08 +01:00
Brecht Van Lommel
93d7b85264 Cleanup: Various clang-tidy warnings in makesrna
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
2025-01-31 17:03:18 +01:00
Hans Goudey
74a5530207 Cleanup: Formatting 2025-01-27 13:13:46 -05:00
Nika Kutsniashvili
cc8c8c83a6 UI: Fix incorrect name for shape key property
"Shape Key Lock", the current name for the property to isolate
a shape key is non-descriptive. The pin icon helps a bit but
it is still unrelated.

Rename "Shape Key Lock" to "Solo Active Shape Key".

More details and screenshots in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/133377
2025-01-27 17:44:26 +01:00
Bastien Montagne
fe9478ff0b Cleanup: RNA: Use RNA_id_pointer_create for IDs, and return PointerRNA_NULL.
There is no (good) reason to use 'refine' internal code to create RNA
pointers of IDs, these always ignore any 'ID inheritance', since by
definition the 'owner ID' info of an ID PointerRNA is always that ID.

Similarily, do not call RNA pointers creation code with null data, this
will simply return `PointerRNA_NULL`, can as well return that directly.

Pull Request: https://projects.blender.org/blender/blender/pulls/133668
2025-01-27 17:15:54 +01:00
Bastien Montagne
9c237af041 Refactor: RNA: add discrete suffix to RNA_pointer_create.
This is a noisy preliminary step to the 'RNA ancestors' change. The
rename helps clearly tell what each `pointer_create` function does.

Pull Request: https://projects.blender.org/blender/blender/pulls/133475
2025-01-24 16:45:32 +01:00
Harley Acheson
67e7cb6b8a UI: Remove RNA Defaults from Negative Boolean Properties
Until the refactor of 255f031e3e, Negative Boolean Properties would
restore the opposite value for "Reset to Defaults".  Now that this
works, this PR removes the RNA property defaults that are no longer
needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/133076
2025-01-15 01:21:57 +01:00
Bastien Montagne
255f031e3e Refactor: RNA definition of Boolean bitset/bitflags properties.
Existing code had several issues:
* The 'DNA bitset as RNA array' behavior was totally undocumented,
  virtually impossible to discover, very confusing, and without any
  checks that given parameters (like the array length) were valid.
* The DNA defaults handling was fully broken for 'negative' boolean
  properties.

This commit:
* Factorizes all rna define code for boolean properties storing a `booleanbit`
  value into a new static util (this revealed and fixed the 'negative defaults'
  issue).
* Forbids calling `RNA_def_property_array` on a Boolean property with a
  non-null `booleanbit` value.
* Introduces a new `RNA_def_property_boolean_bitset_array_sdna`,
  strictly to define 'DNA bitsets as RNA array' properties.
* Adds several validation checks, in particular regarding the bitset
  case: it takes into account the fact that bitshift operations on
  negative numbers are typically
  [arithmetic ones](https://en.cppreference.com/w/cpp/language/operator_arithmetic),
  which means that they preserve the sign of the value, and that the
  left-most bit should never be used with signed integers for bitsets.

-------------------

The fix to DNA defaults handling on 'negative' properties revealed
several RNA errors, listed below. Fixing them is not necessarily trivial
(as some seem to contradict the DNA default values, e.g. the
`View3DShading.use_studiolight_view_rotation` one), so it is kept
outside of this refactor. Conflicting cases should likely be handled by
the relevant modules (to decide whether the DNA, or the RNA default
should be kept).

-------------------

Also realized that many DNA types are ignored when trying to find DNA
default values. This will also be tackled separately, as fixing it is
fairly straightforward.

Pull Request: https://projects.blender.org/blender/blender/pulls/132917
2025-01-14 18:19:27 +01:00
Falk David
d413b0064f Cleanup: Move BKE_material.h to C++
The `BKE_material.h` is only renamed to `.hh` to preserve
the history of the file. Changes to the file are done in
the following commit.
2025-01-09 18:11:46 +01:00
Campbell Barton
363b2f31b6 Merge branch 'blender-v4.3-release' 2024-10-16 21:08:12 +11:00
Pratik Borhade
ceea1a4d99 Fix #129024: GPv3: Renaming a vertex group removes group assignment
GPv3 stores the vertex group inside `CurvesGeometry`.
When the object level vertex group name is changed, we have to loop over
the vertex group list of each drawing. If a matching name is
found, copy the new name to the vertex group in `CurvesGeometry`. A separate
function is created to handle this: `BKE_grease_pencil_vgroup_name_update`.

Pull Request: https://projects.blender.org/blender/blender/pulls/129038
2024-10-16 10:27:09 +02:00
Damien Picard
5715693a97 UI: Use title case for Grease Pencil, Freestyle, Line Art
This was already the case for the vast majority of occurrences, and is
recommended by the human interface guideline's writing style.

Pull Request: https://projects.blender.org/blender/blender/pulls/129000
2024-10-15 13:00:47 +02:00
Falk David
5f5b1b83d0 GPv3: Rename mode enum names and python identifiers
This renames the mode identifiers to be consistent with e.g. the context mode identifiers and other names used for the new Grease Pencil.

For `object.mode`:
* `PAINT_GPENCIL` -> `PAINT_GREASE_PENCIL`
* `SCULPT_GPENCIL` -> `SCULPT_GREASE_PENCIL`
* `VERTEX_GPENCIL` -> `VERTEX_GREASE_PENCIL`
* `WEIGHT_GPENCIL` -> `WEIGHT_GREASE_PENCIL`

For the internal `ob->mode` flag:
* `OB_MODE_PAINT_GPENCIL_LEGACY` -> `OB_MODE_PAINT_GREASE_PENCIL`
* `OB_MODE_SCULPT_GPENCIL_LEGACY` -> `OB_MODE_SCULPT_GREASE_PENCIL`
* `OB_MODE_VERTEX_GPENCIL_LEGACY` -> `OB_MODE_VERTEX_GREASE_PENCIL`
* `OB_MODE_WEIGHT_GPENCIL_LEGACY` -> `OB_MODE_WEIGHT_GREASE_PENCIL`

Resolves #127374.

Pull Request: https://projects.blender.org/blender/blender/pulls/128604
2024-10-04 19:20:00 +02:00
Pablo Vazquez
1e98b7d2a3 UI: Show material link type icon in dropdown
Enums that are displayed as icon-only should have their icons defined
in RNA, not just through the layout in Python. That way they are shown
in the dropdown itself and users make the connection between the listed
item label and the icon while collapsed.
2024-09-12 19:23:15 +02:00
Jacques Lucke
5861b078f7 Core: rename ID.flag and ID.tag values
Previously, values for `ID.flag` and `ID.tag` used the prefixes `LIB_` and
`LIB_TAG` respectively. This was somewhat confusing because it's not really
related to libraries in general. This patch changes the prefix to `ID_FLAG_` and
`ID_TAG_`. This makes it more obvious what they correspond to, simplifying code.

Pull Request: https://projects.blender.org/blender/blender/pulls/125811
2024-08-07 12:12:17 +02:00
Harley Acheson
bfa36039c2 UI: Add Periods to RNA multi-sentence descriptions
We are now wanting tooltip descriptions to not include a terminal
period unless they are multi-sentence (so internally containing a
period). #125460 removed the automatic addition of the terminal period,
but now we have to manually add them back where needed. This PR removes
the error message shown if these items end in period, and then adds one
for all RNA descriptions that are multi-sentence.

Pull Request: https://projects.blender.org/blender/blender/pulls/125507
2024-08-01 00:55:02 +02:00
Falk David
0f42f277b7 Grease Pencil: Remove legacy modifiers
This removes the legacy Grease Pencil modifiers from the code.
These should have already been inaccessible from the UI and hidden from
the user. The modifiers have been reimplemented for the new GPv3
data structure.

On top of the modifier code, some other related things have been
removed as well:
 * Operators related to the legacy modifiers.
 * Keymaps for the legacy modifier operators.
 * Some bits of code that used modifier functions.

Some code has to be kept, because it is still used:
 * The core line art code, which is used by the new line art modifier. It's
    moved to `modifiers/lineart`.
 * The DNA structs for the legacy modifiers. They are still needed for
    conversion.
 * A few kernel functions for the modifiers are kept (also for conversion).

Co-authored-by: Lukas Tönne <lukas@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/125102
2024-07-29 10:37:29 +02:00
Falk David
10af923eac Grease Pencil: Move GPv3 out of experimental
This removes the experimental flags related to the GPv3 project.

Note that this doesn't remove GPv2 code just yet.
It just exposes GPv3 by default now.

Pull Request: https://projects.blender.org/blender/blender/pulls/122723
2024-06-17 13:50:41 +02:00
Christoph Lendenfeld
669b15a53d Fix #119945: Dependency Graph not updated properly when adding constraints through python
The issue was that when adding a constraint through
python to an object that is already animated,
the constraint did not evaluate properly at first.
The fix is to update the depsgraph when creating a
constraint through the API.
Such an update already happened when running the
operator to create a constraint.

Pull Request: https://projects.blender.org/blender/blender/pulls/122198
2024-05-28 11:08:26 +02:00
Brecht Van Lommel
a926f5b67d Refactor: Replace ID_IS_LINKED by !ID_IS_EDITABLE
Add new ID_IS_EDITABLE macro that checks if the ID can be edited in the
user interface. Replace usage of ID_IS_LINKED where it is used with this
meaning.

Also add a corresponding ID.is_editable property for Python.

This prepares for the ability to edit some linked datablocks for brush
assets.

Pull Request: https://projects.blender.org/blender/blender/pulls/121838
2024-05-16 14:53:09 +02:00
Hans Goudey
5b6c776ef4 Cleanup: Rename modifier_clear function to add plural
Make it more obvious that the function removes all modifiers.
2024-04-30 16:02:08 -04:00
Falk David
fe0e2907b3 GPv3: Remove OB_MODE_PAINT_GREASE_PENCIL flag
This reverts part of 36cda3b3116acba3b895daf68689f8af01b62392
and replaces the use of `OB_MODE_PAINT_GREASE_PENCIL`
`OB_MODE_PAINT_GPENCIL_LEGACY` flag instead.
The `OB_MODE_PAINT_GREASE_PENCIL` is removed.

The `GREASE_PENCIL_OT_draw_mode_toggle` operator is removed
and the `GPENCIL_OT_paintmode_toggle`  operator is adapted to
work with GPv3.

Pull Request: https://projects.blender.org/blender/blender/pulls/121027
2024-04-25 14:23:46 +02:00
Hans Goudey
d95b1f120b Mesh: Store BMEditMesh in shared pointer
The main motivation for this is that it's part of a fix for #113377,
where I want to propagate the edit mesh pointers through copied
meshes in modifiers and geometry nodes, instead of just setting the
edit mesh pointer at the end of the modifier stack. That would have
two main benefits:
1. We avoid the need to write to the evaluated mesh, after evaluation
  which means it can be shared directly among evaluated objects.
2. When an object's mesh is completely replaced by the mesh from another
   object during evaluation (with the object info node), the final edit
   mesh pointer will not be "wrong", allowing us to skip index-mapped
   GPU data extraction.

Beyond that, using a shared pointer just makes things more automatic.
Handling of edit mesh data is already complicated enough, this way some
of the worry and complexity can be handled by RAII.

One thing to keep in mind is that the edit mesh's BMesh is still freed
manually with `EDBM_mesh_free_data` when leaving edit mode. I figured
that was a more conservative approach for now. Maybe eventually that
could be handled automatically with RAII too.

Pull Request: https://projects.blender.org/blender/blender/pulls/120276
2024-04-18 13:52:20 +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
Philipp Oeser
6c045f7335 Fix #114428: clamp setting object active_material_index
There were multiple reports with objects having many empty material
slots.
The underlying reason for this is the behavior of adding/assigning
materials [which makes room in the form of empty material slots based on
the current `active_material_index` -- which atm. can be set to
arbitrary values]. So just e.g. setting this to 100 in a fresh file and
assigning a material would create 99 empty slots.

To resolve, now clamp to the existing number of material slots.

NOTE: there is already a range function defined, but this actually only
kicks in from the animation system (so clamping would take place there),
so clamping is expected to happen in the set functions (there is also a
related comment in `RNA_property_int_set`)

Pull Request: https://projects.blender.org/blender/blender/pulls/120434
2024-04-12 17:35:22 +02: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
436c0a773e Cleanup: Remove object vgroup functions to proper header
These functions were declared in the editors/mesh module but
defined in the editors/object module. This commit moves them to
a separate header associated with the object editors module.
2024-03-26 23:45:43 -04:00