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
2025-01-14 11:41:03 -05:00
2023-12-08 13:28:13 +11:00
2025-01-08 16:42:50 +01:00
2025-01-02 16:01:17 +11:00

Blender

Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline-modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.

Blender screenshot

Project Pages

Development

License

Blender as a whole is licensed under the GNU General Public License, Version 3. Individual files may have a different, but compatible license.

See blender.org/about/license for details.

Description
No description provided
Readme 841 MiB
Languages
C++ 78%
Python 14.9%
C 2.9%
GLSL 1.9%
CMake 1.2%
Other 0.9%