Commit Graph

1195 Commits

Author SHA1 Message Date
Campbell Barton
c10d9a1a3c Cleanup: remove unused context members from sphinx_doc_gen.py
Quiet warnings building docs.
2025-10-01 16:46:17 +10:00
Julian Eisel
eef971e377 UI/BPY: Remove grid layout for UI lists
The grid layout for UI lists wasn't used in practice from all we can
tell. It was badly maintained for a long time (bugs went unnoticed). I
think it was added for an earlier version of the asset UI design.

This was planned for removal in 5.0, see blender/blender#110461.

Usages in bundled scripts were already removed in efa8d942b8.

Pull Request: https://projects.blender.org/blender/blender/pulls/146656
2025-09-29 13:07:31 +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
Nick Alberelli
db88381e75 Docs: Include get_prim_map() in bpy.types.USDHook example code
Provide an example of using the `get_prim_map()` in the existing USD
Hook sample.

Related: blender/blender@0df5d8220b

Pull Request: https://projects.blender.org/blender/blender/pulls/146866
2025-09-27 01:58:44 +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
Jacques Lucke
c3f49cd24e Shader Nodes: add Python API for inlined shader nodes
This makes the shader node inlining from #141936 available to external renderers
which use the Python API. Existing external renderer add-ons need to be updated
to get the inlined node tree from a material like below instead of using the
original node tree of the material directly.

The main contribution are these three methods: `Material.inline_shader_nodes()`,
`Light.inline_shader_nodes()` and `World.inline_shader_nodes()`.

In theory, there could be an inlining API for node trees more generally, but
some aspects of the inlining are specific to shader nodes currently. For example
the detection of output nodes and implicit input handling. Furthermore, having
the method on e.g. `Material` instead of on the node tree might be more future
proof for the case when we want to store input properties of the material on the
`Material` which are then passed into the shader node tree.

Example from API docs:
```python
import bpy

# The materials should be retrieved from the evaluated object to make sure that
# e.g. edits of Geometry Nodes are applied.
depsgraph = bpy.context.view_layer.depsgraph
ob = bpy.context.active_object
ob_eval = depsgraph.id_eval_get(ob)
material_eval = ob_eval.material_slots[0].material

# Compute the inlined shader nodes.
# Important: Do not loose the reference to this object while accessing the inlined
#   node tree. Otherwise there will be a crash due to a dangling pointer.
inline_shader_nodes = material_eval.inline_shader_nodes()

# Get the actual inlined `bpy.types.NodeTree`.
tree = inline_shader_nodes.node_tree

for node in tree.nodes:
    print(node.name)
```

Pull Request: https://projects.blender.org/blender/blender/pulls/145811
2025-09-11 06:08:30 +02:00
luz paz
656c3f65ad Cleanup: fix typos in doc subdirectory
Fix several documentation related typos.
Found via `codespell -S "*.desktop,*.diff,./intern,./extern,./locale,./AUTHORS,./source/blender/blenlib/tests/BLI_string_utf8_test.cc,./doc/license/bf-members.txt" -L accessort,abd,aci,alo,ans,ba,bording,childrens,clen,constructin,datas,dependees,domin,eary,ege,eiter,elemt,eles,endianess,enew,espace,finded,fiter,fpt,groupd,hist,implementating,indext,ine,infront,inout,inouts,inpt,ist,lene,listenter,lod,maks,masia,mata,mis,mke,nam,nd,ned,opose,ot,outlow,parm,parms,passt,pinter,pixelx,poin,pres,ptd,re-usable,re-use,re-used,re-uses,re-using,ridiculus,schem,soler,strack,suh,te,tesselate,tham,ue,vai,varius,wew`

Pull Request: https://projects.blender.org/blender/blender/pulls/145824
2025-09-06 08:03:16 +02:00
Bastien Montagne
ede8e3af91 Docs: Update bpy.props docs/examples for getters and setters.
Mostly addresses recent changes in the area (adding 'transform'
accessors), but also tweak/fix some minor issues with existing doc.

Pull Request: https://projects.blender.org/blender/blender/pulls/145582
2025-09-03 17:25:55 +02:00
Falk David
423203c0fb Fix: PyDocs: Missing tool_settings in context_type_map
This has to be added now, because `sequencer_context_dir` specifically
lists `tool_settings` as a member. This was changed in
1122a05cb6.
2025-08-25 12:45:01 +02:00
Falk David
916f249f7c Fix: PyDocs: Missing sequencer_scene in context_type_map 2025-08-25 12:25:38 +02:00
Campbell Barton
e964f078b5 PyDoc: correct use of back ticks for literal text 2025-08-22 15:10:29 +10:00
Campbell Barton
990f0863e8 PyDoc: include buffer access in examples, cleanup
Note that buffer access is possible, also minor mathutils test cleanup.
2025-08-16 17:39:35 +10:00
clankill3r
ac962c02f6 Fix: PyDocs: typo fix in example
by -> be

Pull Request: https://projects.blender.org/blender/blender/pulls/144448
2025-08-12 17:20:04 +02:00
Campbell Barton
eb2cc80cd0 PyAPI: move bpy_types.py to a private module
Use an underscore prefix as this module should not be accessed directly.
2025-08-10 13:45:40 +10:00
Aaron Carlisle
b05c7e96b7 PyDocs: Update Sphinx / Theme 2025-08-09 19:06:34 -04:00
Aaron Carlisle
9188ce10e7 Cleanup: Format 2025-08-09 19:01:39 -04:00
Aaron Carlisle
86cd240c57 PyDocs: Add Macro example
- Adds a doc string for the Macro class
- Adds a basic example

Fixes #blender-manual/issues/51387
2025-08-09 18:43:14 -04:00
Campbell Barton
53cae68ee8 Cleanup: hyphenate the term data-blocks in strings/doc-strings 2025-08-08 08:47:13 +10:00
Campbell Barton
08cf60c66e PyDoc: generate a list of types that support custom properties
Methods for `bpy_struct` such as `get()` & `items()` noted that only
some types support custom-properties.

Since these docs were written many more types support custom properties.
Replace the inline list with a link to a generated list since there are
now too many to include inline.

Resolves #141450.
2025-08-07 14:37:38 +10:00
Campbell Barton
6d899a6726 Cleanup: naming & reduce declaration scope in the PyAPI for lib loading
Use terms source/destination instead of from/to.
2025-08-02 02:10:59 +00:00
Campbell Barton
3de916ca25 RNA: support for marking properties as deprecated
Deprecation meta-data support for RNA properties.

- Properties may have a deprecated note and version.
- Warnings shown when these are accessed from Python.
- A note is included in the generated documentation.

Support for marking functions as deprecated can be added in the future.

Ref !139487
2025-07-29 22:09:59 +10:00
Campbell Barton
895189dd19 PyDocs: always quote enum values in docs
While this was an intentional change in [0],
it seemed like an error to removing quoting (based on #141853).

Restore the quotes while keeping the string literals.

[0]: 0fb80f698a
2025-07-27 19:36:13 +10:00
Campbell Barton
f7fb02dcf9 Cleanup: use dash for bullet points in generated docs
Follow the user manual style guide.
2025-07-27 16:56:21 +10:00
Campbell Barton
d2a48cc12f Fix #141733: bmesh.ops API docs not showing function names
Formatting changes in [0] broke doc-string extraction.

[0]: a5eb65bac8
2025-07-11 14:44:09 +10:00
Campbell Barton
084ded1c07 Merge branch 'blender-v4.5-release' 2025-06-30 17:21:10 +10:00
Campbell Barton
0fb80f698a PyDoc: use string literals for enum values
Use literals since their literal values need to be used in code.
2025-06-30 17:12:04 +10:00
Campbell Barton
ae452ba698 Merge branch 'blender-v4.5-release' 2025-06-18 15:19:28 +10:00
Campbell Barton
4dba0113fd Fix #140396: bmesh.ops.dissolve_edges fails to dissolve vertices
Add an optional init function which operators

An alternative to [0] which missed Python API support (causing #140451).
While that could be resolved, tracking which "slots" have been set
would have to be flagged on every map/hash insertion which seems
excessive and is prone to bmesh operators failing if the flag is ever
missed. Prefer a simpler init function so dissolve edges doesn't have
a zero threshold.

Also support multi-line comment blocks in the generated API docs.

[0]: bd3a66a416
2025-06-18 04:42:42 +00:00
Brecht Van Lommel
789db82dfd Merge branch 'blender-v4.5-release' 2025-06-17 20:09:12 +02:00
Brecht Van Lommel
984ae99624 Fix: Python API doc build fails after previous pointcloud fix
This is now always in context, not just for experimental features.

Ref #140516
2025-06-17 20:06:51 +02:00
Bastien Montagne
e28a714245 Merge branch 'blender-v4.5-release' 2025-06-16 16:31:38 +02:00
Alberto-Luaces
e7191f8390 Python API: update animation example in quickstart docs for slots
Update the Animation example in the Python API: Quickstart documentation
to use slotted Actions.

Pull Request: https://projects.blender.org/blender/blender/pulls/140334
2025-06-16 15:59:48 +02:00
Clément Foucault
decd88f67e Python: Remove deprecated BGL API
The API was in a deprecation state for many years now.
This API was not compatible with Metal nor Vulkan.

This also remove `Image.bindcode`.

Pull Request: https://projects.blender.org/blender/blender/pulls/140370
2025-06-16 12:50:50 +02:00
John Kiril Swenson
a37c5e7d6c Fix: API doc build error after adding asset to context
Introduced by 3f9c943243.
2025-06-12 15:36:42 -05:00
Steve-Paws
d8e88572dd Fix: PyDocs: Syntax error in PointerProperty assignment
syntax error on `info_overview` PyAPI docs page for
property assignment

Pull Request: https://projects.blender.org/blender/blender/pulls/140090
2025-06-10 08:09:06 +02:00
Andrej730
6e70b755ce Fix: PyAPI Docs: Document more msgbus limitations
Added the following notes to documentation:
- `msgbus` interaction with undo system that particularly makes
 it not completely reliable, since users they easily skip it's effect.
- Details on when and how often message bus updates are triggered.

Pull Request: https://projects.blender.org/blender/blender/pulls/138557
2025-06-06 10:58:23 +02:00
Campbell Barton
db22e6cb8b PyDocs: quiet context member warning without experimental features 2025-06-06 10:48:25 +10:00
Bastien Montagne
aca960500e Fix PyAPI doc generation: add back a 'context' entry removed by mistake.
Reverts part of 6fbef14f4b.
2025-06-05 13:42:06 +02:00
Campbell Barton
6fbef14f4b PyDoc: quiet wanings/prints when building docs 2025-06-05 05:31:51 +00:00
Campbell Barton
2d86699209 PyDoc: improve BMesh operator docs
- Place doc-strings before arguments (avoid over long lines).
- Enable clang-format for BMesh operator definitions.
- Remove invalid comments (likely left in from copy-paste).
- Use double back-ticks for RST.
- Use full sentences.

No functional changes.
2025-06-05 15:31:36 +10:00
Campbell Barton
6a1fa176ef Cleanup: spelling in comments & duplicate terms (check_spelling.py)
Also minor clarification in doc-string.
2025-06-04 01:51:29 +00:00
Hans Goudey
77b14f2dcb Cleanup: Grammar: Fallback vs. fall back
The former is a noun or adjective, the latter is a verb.
2025-06-02 17:13:56 -04:00
Jesse Yurkovich
0fa8c0f62a Docs: Grammar and wording cleanups for FileHandler examples
Cleanup grammar and simplify the wording used in the FileHandler
Python API examples.

Pull Request: https://projects.blender.org/blender/blender/pulls/139366
2025-06-02 19:21:38 +02:00
Jacques Lucke
a010c1c8b8 Python Docs: remove example for using timers with separate threads
This appears to be unreliable.

Resolves #139602.
2025-05-30 09:15:40 +02:00
Jeroen Bakker
a06c7fddbb Fix #139565: Update GPU polyline examples
Update GPU line examples to use polyline shaders.

Pull Request: https://projects.blender.org/blender/blender/pulls/139587
2025-05-30 09:10:51 +02: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
Jeroen Bakker
c56a855b9f Fix #139565: PyGPU: Add builtin point shaders
This PR adds builtin shaders for drawing points. Using `FLAT_COLOR`,
`SMOOTH_COLOR`, `UNIFORM_COLOR` can lead to undesired behavior
on Metal and Vulkan backends. To ensure future compatibility this PR
adds `POINT_FLAT_COLOR` and `POINT_UNIFORM_COLOR`.

The point size can be set using `gpu.state.point_size_set`.

Pull Request: https://projects.blender.org/blender/blender/pulls/139583
2025-05-29 14:36:32 +02:00
Campbell Barton
72f24fcbab Cleanup: resolve pylint warnings 2025-05-23 14:03:20 +10:00
Sybren A. Stüvel
58d0b0e4b4 Py Docs: Gotcha chapter on threading
Update the Python API documentation about crashes with multi-threaded
code.

- Move the "threading gotcha" into a file of its own. That way it's
  immediately clear from looking at the Gotcha table of contents that
  threading is not supported.
- Simplify the example code, so that it doesn't access `bpy`.
  Apparently the problem is much wider than just multi-threaded access
  to `bpy`, and involves _all_ Python threads, regardless of what they
  do / access.
- Add some more explanation and move some text from the bottom to the
  top, so that the first-read part (when reading top to bottom) has
  most of the information.

Pull Request: https://projects.blender.org/blender/blender/pulls/139279
2025-05-22 16:23:23 +02:00
Clément Foucault
f55e97a83a Documentation: Python: Add notice about MSL compatibility
See #139185
2025-05-22 11:47:06 +02:00