660 Commits

Author SHA1 Message Date
Campbell Barton
1216651ca9 PyAPI: make internal modules explicitly "private"
Rename modules in `./scripts/modules/` to use an underscore prefix to
make it clear they aren't intended to be part of public API's. This
also means there is no implication that these modules should be stable,
allowing us to change them based on Blender's internal usage.

The following modules have been marked as private:

- `animsys_refactor`
- `bl_console_utils`
- `bl_i18n_utils`
- `bl_previews_utils`
- `bl_rna_utils`
- `bl_text_utils`
- `bl_ui_utils`
- `bpy_restrict_state`
- `console_python`
- `console_shell`
- `graphviz_export`
- `keyingsets_utils`
- `rna_info`
- `rna_manual_reference`
- `rna_xml`

Note that we could further re-arrange these modules
(under `_bpy_internal` in some cases), this change is mainly to mark
them as private, further changes can be handed on a case-by-case basis.

Ref !147773
2025-10-13 09:35:09 +00:00
Campbell Barton
01806a62e3 Cleanup: spelling (make check_spelling_*) 2025-10-07 10:19:46 +11:00
Thomas Dinges
762b65a060 Tools: Update clang version used in format script 2025-10-02 19:25:38 +02:00
Habib Gahbiche
fb7818e55e Python: Create default node tree for new materials and worlds
The motivation is to keep backward compatibility after deprecating
 `material.use_nodes()` and `world.use_nodes`. For example the
following script would behave the same way in 4.5 and 5.0:
```python
mat = bpy.data.materials.new("My new mat")
mat.use_nodes = True
```

Pull Request: https://projects.blender.org/blender/blender/pulls/147052
2025-10-01 15:05:16 +02:00
luz paz
bee5cdeaea Fix: Typo in tools/triage/issues_needing_info.py
Fixes user-facing typo. Found via codespell

Pull Request: https://projects.blender.org/blender/blender/pulls/146716
2025-09-25 10:32:04 +02:00
Habib Gahbiche
1b4daf9d2e Nodes: remove "Use Nodes" in Shader Editor for Object Materials
"Use Nodes" was removed in the compositor to simplify the compositing
workflow. This introduced a slight inconsistency with the Shader Node
Editor.

This PR removes "Use Nodes" for object materials.

For Line Style, no changes are planned (not sure how to preserve
compatibility yet).
This simplifies the state of objects; either they have a material or
they don't.

Backward compatibility:
- If Use Nodes is turned Off, new nodes are added to the node tree to
simulate the same material:
- DNA: Only `use_nodes` is marked deprecated
- Python API:
  - `material.use_nodes` is marked deprecated and will be removed in
6.0. Reading it always returns `True` and setting it has no effect.
  - `material.diffuse_color`, `material.specular` etc.. Are not used by
EEVEE anymore but are kept because they are used by Workbench.

Forward compatibility:
Always enable 'Use Nodes' when writing blend files.

Known Issues:
Some UI tests are failing on macOS

Pull Request: https://projects.blender.org/blender/blender/pulls/141278
2025-09-14 17:53:54 +02:00
Thomas Dinges
1a666b5722 Authors: de-duplicate 2025-09-12 12:37:45 +02:00
Campbell Barton
6361cedd62 Cleanup: remove tools/utils_build/cmake-flags
Since it's inclusion, we have more convenient ways to enable features
such as ASAN. Remove the script since this hasn't been updated in a long
time and would be better off as a 3rd party tool.
2025-08-21 12:02:33 +10:00
Campbell Barton
814eb05405 Tools: avoid redundant checks in code_clean for function-style-casts
Don't attempt to change `alignof(int)` or `(int);` to a function style
`int(...)` cast.

Avoid wasting time attempting edits that always fail.
2025-08-12 02:46:50 +00:00
Campbell Barton
87c4f47312 Fix #139585: Blender could erase OS root
Temporary directory handling had a logical error, assuming the
"session" temporary directory was owned and created by Blender
and could be recursively removed on exit.

However, it's possible creating the session sub-directory fails,
in that case the temporary directory was used for the "session".
This meant setting `C:\` as the temporary directory in the preferences
would attempt to recursively remove `C:\` on exit.

Resolve with the following changes:

- Only perform a recursive removal on the temporary directory
  if a session sub-directory was created.

- If the creating the user-preferences temporary "session" sub-directory
  fails fall back to the systems temporary directory and try to
  create the "session" directory there.

  Previously this was only done if the preference path didn't exist.
  The preferences path was still used if it existed but couldn't be
  written to.

Include a test to ensure this is working as expected.

Ref !144042
2025-08-06 23:13:58 +00: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
Sybren A. Stüvel
3ca28acbb3 Introduce Python code generator for OpenAPI spec to dataclasses
Add a [Python code generator][1] that takes an OpenAPI definition and
outputs the corresponding data model as [dataclasses][2]

This is intended to be used in the Remote Asset Library project, to
create, download, parse, and validate information of a remote asset
library.

[1]: https://koxudaxi.github.io/datamodel-code-generator/
[2]: https://docs.python.org/3/library/dataclasses.html

## Running the Generator

The generator is a Python script, which creates its own Python
virtualenv, installs the dependencies it needs, and then runs the
generator within that virtualenv.

The script is intended to run via the `generate_datamodels` CMake
target. For example, `ninja generate_datamodels` in the build
directory.

## Details

The virtualenv is created in Blender's build directory, and is not
cleaned up after running. This means that subsequent runs will just
use it directly, instead of reinstalling dependencies on every run.

## Generated Code & Interaction with Build System

It is my intention that the code generation _only_ happens when the
OpenAPI specification changes. This means that the generated code will
be committed to Git like any hand-written code. Building Blender will
therefore _not_ require the code generator to run. Only people working
on the area that uses the generated code will have to deal with this.

Pull Request: https://projects.blender.org/blender/blender/pulls/139495
2025-08-01 16:33:56 +02:00
Nika Kutsniashvili
7158e02aed Modeling: Set shape key default value to 1.0
When adding a shape key, set its blend value to 1.0 / 100%.

There is no practical use case where user wants to add shape key but
not work on it. New shape keys at value 0 have no purpose. Adding
shape key should be interpreted by Blender as user wanting to
sculpt/model on it. Also, being at 1.0 initially doesn't change
anything visually, because key isn't edited yet and it doesn't deform
mesh.

The default value of the shape key is also set to 1.0. When using
right-click to reset values, user most often wants to return to 1
(which is "correct" state of deformation without multiplication)
rather than 0 (which is no deformation at all).

Co-authored-by: Sybren A. Stüvel <sybren@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/133399
2025-08-01 15:43:31 +02:00
Campbell Barton
452aa80dc0 Tools: include UTF8 string functions in code_clean utility 2025-07-30 13:01:43 +10:00
Habib Gahbiche
445eceb02a Nodes: Remove "Use Nodes" in Shader Editor for World
Part of https://projects.blender.org/blender/blender/pulls/141278

Blend files compatibility:
If a World exists and "Use Nodes" is disabled, we add new nodes to the
existing node tree (or create one if it doesn't) that emulates the
behavior of a world without a node tree. This ensures backward and
forward compatibility.

Python API compatibility:
- `world.use_nodes` was removed from Python API => **Breaking change**
- `world.color` is still being used by Workbench, so it stays there,
although it has no effect anymore when using Cycles or EEVEE.

Python API changes:
Creating a World using `bpy.data.worlds.new()` now creates a World with
 an empty (embedded) node tree. This was necessary to enable Python
scripts to add nodes without having to create a node tree (which is
currently not possible, because World node trees are embedded).

Pull Request: https://projects.blender.org/blender/blender/pulls/142342
2025-07-28 14:06:08 +02:00
Brecht Van Lommel
eb8dc8f535 Fix: Operator, app template and benchmarking script errors after media type
Always set the media type before the file format.

Ref #142955

Pull Request: https://projects.blender.org/blender/blender/pulls/143433
2025-07-28 11:55:11 +02:00
Alaska
121e9464f5 Fix: Weekly report error when a user has a commit to a parent repo
With the recent Gitea update, parent repos (E.g. `blender/blender`) do
not have "parents" listed in the information gathered by API anymore.

This has lead to the weekly report script encountering errors if the
user has committed directly to a parent repo. This commit fixes that.

Pull Request: https://projects.blender.org/blender/blender/pulls/142701
2025-07-24 21:59:09 +02:00
Campbell Barton
81e4558ab6 Cleanup: reduce right-shift in Python scripts 2025-07-22 11:59:43 +10:00
Bastien Montagne
17de1678ba Fix 'raw' version of blendfile.py reader.
Broken after changes to blendfile header reading code, the
`BlendFileBlockRaw` class was not updated.
2025-07-21 15:51:24 +02:00
Campbell Barton
e5947bdf63 Cleanup: spelling (make check_spelling_*)
Also exclude some files that have too many false positives.
2025-07-20 14:59:19 +10: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
Bastien Montagne
6131168e12 Merge branch 'blender-v4.5-release' 2025-07-10 14:14:48 +02:00
Bastien Montagne
a7d7b808f0 Cleanup: Remove (unused) ubsan.supp file.
Committed by mistake with previous commit.
2025-07-10 14:14:05 +02:00
Bastien Montagne
67f9b5645a Merge branch 'blender-v4.5-release' 2025-07-10 14:13:39 +02:00
Bastien Montagne
1238cef46d LeakSanitizer: Exclude another error from Python (resize_compact). 2025-07-10 14:12:08 +02:00
Bastien Montagne
db8846c225 Merge branch 'blender-v4.5-release' 2025-07-10 10:47:49 +02:00
Bastien Montagne
26b8846d94 LeakSanitizer: Suppress errors in OpenEXR library.
This library generates a single recurrent leak report currently, likely
a badly handled global?

```
=================================================================
==192885==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 31 byte(s) in 1 object(s) allocated from:
    #0 0x7f8a5c9cf307 in operator new(unsigned long) (/lib64/libasan.so.6+0xb6307)
    #1 0x7f8a5b03a0ea in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) (/home/blender/git/blender-vexp/install_sanitizer/lib/libOpenEXR.so.32+0xef0ea)
SUMMARY: AddressSanitizer: 31 byte(s) leaked in 1 allocation(s).
======================================================================
```
2025-07-10 10:46:59 +02:00
Campbell Barton
bc0ab8c6d9 Merge branch 'blender-v4.5-release' 2025-07-10 12:51:37 +10:00
Campbell Barton
9d7e4890c8 Merge branch 'blender-v4.5-release' 2025-07-10 12:51:32 +10:00
Campbell Barton
2f2331d067 Tools: warn about duplicate authors in the author list generator 2025-07-10 12:49:08 +10:00
Campbell Barton
f72f5a2297 AUTHORS: de-duplicate 2025-07-10 12:48:33 +10:00
Campbell Barton
267d5179c0 Tools: remove print from batch_edit_text utility
Remove unnecessary noise.
2025-07-10 10:41:53 +10:00
Campbell Barton
0a2d3d9d85 Merge branch 'blender-v4.5-release' 2025-07-09 11:23:56 +10:00
Campbell Barton
85ad73809f AUTHORS: add 45 new authors 2025-07-09 01:22:00 +00:00
Campbell Barton
96111e9cc9 Tools: fix error running weekly_report.py without a date set
Oversight in !141281.
2025-07-05 08:41:40 +10:00
Sybren A. Stüvel
90c05aa2d0 Tools: add option to weekly log generator to only show a single day
Add a new CLI option `--date YYYY-MM-DD` to the weekly log generator. Using
it will make it ignore the `--weeks-ago` parameter, and just show the
activity for that specific day.

This is just something I personally found useful, to occasionally inspect
a specific date (WBSO daily log).

Pull Request: https://projects.blender.org/blender/blender/pulls/141281
2025-07-03 10:38:13 +02:00
Campbell Barton
0d3826b354 Cleanup: make the blend file header private
This was split out as part of a refactor but isn't intended to be a
new public module for other scripts to use.

Ref !141088
2025-06-28 08:40:31 +10:00
Jacques Lucke
f0c7e52ff2 Core: extract blendfile_header.py as common utility for parsing .blend files
This new file can parse the file header (first few bytes) as well as the block
headers.

Right now, this is used by two places:
* `blendfile.py` which is used by `blend2json.py`
* `blend_render_info.py`

This new module is shipped with Blender because it's needed for
`blend_render_info.py` which is shipped with Blender too. This makes using it in
`blendfile.py` (which is not shipped with Blender) a bit more annoying. However,
this is already not ideal, because e.g. `blend2json` also has to add to
`sys.path` already to be able to import `blendfile.py`.

This new file could also be used by blender-asset-tracer (BAT).

The new `BlendFileHeader` and `BlockHeader` types may be subclassed by code
using it, because it wants to store additional derived data (`blendfile.py` and
BAT need this).

New tests have been added that check that the file and block header is parsed
correctly for different kinds of .blend files.

Pull Request: https://projects.blender.org/blender/blender/pulls/140341
2025-06-23 12:53:55 +02:00
Campbell Barton
776dbe942c Cleanup: spelling (make check_spelling_*) 2025-06-22 11:34:32 +00:00
Campbell Barton
37fe1b9b8d Merge branch 'blender-v4.5-release' 2025-06-19 10:34:11 +10:00
Campbell Barton
41bf2f598f Cleanup: spelling in comments (make check_spelling_*) 2025-06-19 00:10:18 +00:00
Clément Foucault
4fe75da973 EEVEE: Remove all remaining reference of EEVEE next
This changes the engine identifier back to `BLENDER_EEVEE`.

We keep the `BLENDER_EEVEE_NEXT` identifier around for
versioning reasons (have to detect when it is the active
engine of a older file).

This also rename a bunch of pannels that were using `next`
in their name.

This is a breaking change for Addons compatibility.

Pull Request: https://projects.blender.org/blender/blender/pulls/140282
2025-06-13 12:36:14 +02:00
Campbell Barton
63600f806b Cleanup: spelling in comments (make check_spelling_*) 2025-06-13 11:23:28 +10:00
Bastien Montagne
18635b604c Fix missing update for blender_theme_as_c script after BE removal.
Follow-up to blender/blender@bc80ef136e.
2025-06-12 15:09:23 +02:00
Jacques Lucke
d83bfee347 Core: support LargeBHead8 in blendfile.py
This indirectly also fixes `blend2json.py` because it's build on top of
`blendfile.py`.

Main changes:
* Update .blend file header parsing to support the different header types.
* Support unpacking `LargeBHead8`.
* Use `namedtuple` instead of index access when accessing block header because
  the order of items is different now.
* Update comments that were either fully redundant or already outdated.

Pull Request: https://projects.blender.org/blender/blender/pulls/140195
2025-06-11 14:30:37 +02:00
Aras Pranckevicius
5ad6d42c83 IO: Remove Collada import/export
Removes Collada import/export (has been deprecated since 4.2).

Pull Request: https://projects.blender.org/blender/blender/pulls/139337
2025-06-06 08:38:57 +02:00
Campbell Barton
bd0855f443 Docs: update code layout diagram 2025-05-30 12:33:04 +10:00
Campbell Barton
50f3240abd Cleanup: spelling & duplicate terms (check_spelling.py) 2025-05-30 11:03:56 +10:00
Hans Goudey
91803e130f Cleanup: Grammar: Fix uses of "for e.g."
e.g. stands for "exempli gratia" in Latin which means "for example".
The best way to make sure it makes sense when writing is to just expand
it to "for example". In these cases where the text was "for e.g.", that
leaves us with "for for example" which makes no sense. This commit fixes
all 110 cases, mostly just just replacing the words with "for example",
but also restructuring the text a bit more in a few cases, mostly by
moving "e.g." to the beginning of a list in parentheses.

Pull Request: https://projects.blender.org/blender/blender/pulls/139596
2025-05-29 21:21:18 +02:00
Julian Eisel
7417a07adb Fix: Weekly report script error when no PR found for branch
Not all branches have a PR and code generally handled that case fine,
just this assert didn't treat it as a valid result.
2025-05-27 15:59:37 +02:00