Commit graph

1218 commits

Author SHA1 Message Date
Campbell Barton
791505e2ed PyDoc: use :param: instead of :arg: in Sphinx docstrings
While "arg" isn't deprecated "param" is preferred and used in all
Sphinx's examples & tutorials.

Ref !154039
2026-02-07 14:30:16 +11:00
Nick Alberelli
f7a3348637 PyDoc: add a Python API documentation contribution guide
Add a contribution guide for Blender's Python API documentation,
similar to the User Manual contribution guide.

Some parts of this process weren't so clear,
especially the example auto-discovery.

Cover:
- Setting up the build environment.
- Modifying API documentation.
- Adding example code snippets.
- File naming conventions and auto-discovery.
- Best practices and style guidelines.

PR !151750

Co-authored-by: Campbell Barton <campbell@blender.org>
2026-01-31 20:06:52 +11:00
Campbell Barton
845ca44a30 PyDoc: clarify threading example regarding Blender API usage
Address issue raised in #153398.
2026-01-28 09:29:48 +00:00
Campbell Barton
03975acb55 Doc: add Python API example for KeyMaps add-on registration
Add an example with some notes on keymap usage, targeted at add-on
developers.

- Avoid pitfalls, add-on developers sometimes incorrectly modify user
  keymaps directly, which persists after the add-on is disabled and
  interferes with user preferences.
- Documents subtle/non-obvious requirements.
- Mention edge case regarding modal operator key-maps.

Ref !153111
2026-01-22 07:23:50 +00:00
Campbell Barton
25bbf21575 Fix: Python API docs broken links for classes in submodules
Duplicating the module path in `.. class::` identifiers broke links.

This affected `bmesh.types`, `imbuf.types`, and `idprop.types`.
2026-01-21 17:07:18 +11:00
Campbell Barton
323bbeaa4d Fix #152607: Python API docs missing idprop module page 2026-01-21 17:07:18 +11:00
Nick Alberelli
e1008386eb PyAPI: support for context logging to suppress missing member access
Add hide_missing keyword argument to temp_override.logging_set().
This reduces noise from members that aren't available in the current
context while still showing members that exist but are empty.

- Add CTX_LogFlag enum with Access and HideMissing flags to control
  context member logging behavior during temporary overrides.

- Store & restore original logging with a temporary context so each
  context override properly stores & restores the logging options.

Ref !148760
2026-01-13 19:17:09 +11:00
Nick Alberelli
d11b9878c4 Docs: Add Action Slot example code to PyAPI docs
Add some example code for working with Action slots.

Reference: https://projects.blender.org/blender/blender-manual/issues/105297
Pull Request: https://projects.blender.org/blender/blender/pulls/151510
2026-01-09 16:32:49 +01:00
Nick Alberelli
6577606415 Fix #151742: Docs: Fix Typo in bpy.types.USDHook code
Changes to example code introduced with db88381e75 contains a typo,
using `data block` instead of the standard `data-block`.

This changes ensures consistency with the spelling of `data-block` with
other API example files.

Pull Request: https://projects.blender.org/blender/blender/pulls/151850
2025-12-18 18:36:25 +01:00
John Kiril Swenson
6f9556c561 Cleanup: UI: Standardize ellipsis for menu operators
This patch standardizes ellipses on labels that require further input
from the user before running the operator as per our
HIG.

- PR does not include buttons (e.g. "Purge" in Outliner) and only
  modifies menu items.
- PR does not include operators that wait for input from the user during
  modal operation (e.g. `view3d.select_box`, `paint.sample_color`).
- Some usage of ellipses were removed since they were only present to
  indicate the start of the sentence (to be finished by submenu items).
  E.g. "Make Local...", "Sort Elements...", "Move..." do not require extra
  input from the user.

Pull Request: https://projects.blender.org/blender/blender/pulls/150950
2025-12-04 23:04:28 +01:00
Bipin Yadav
6784fc424e Fix #150602: invalid string formatting in menu example
Ref !150802
2025-11-30 08:40:23 +00:00
Campbell Barton
f590b6ca66 Merge branch 'blender-v5.0-release' 2025-11-02 20:00:21 +11:00
nutti
7adf5b9705 PyDoc: support multi-line operator descriptions
Even though these aren't used at the moment, their inclusion shouldn't
cause errors, as they're supported elsewhere in Blender.

Ref !149167
2025-11-02 19:58:08 +11:00
nutti
2d07d2a72a Fix: invalid PyDoc format on bpy.types.Context
Currently PyDoc format on bpy.types.Context is not correct.
This PR fixes this.

Pull Request: https://projects.blender.org/blender/blender/pulls/148813
2025-11-01 06:20:36 +01:00
Campbell Barton
9d3dc4392b Merge branch 'blender-v5.0-release' 2025-10-23 14:00:12 +11:00
Campbell Barton
a370884486 Merge branch 'blender-v5.0-release' 2025-10-23 14:00:08 +11:00
Campbell Barton
cdb643f8b7 Cleanup: use ASCII comments, add tailing newline 2025-10-23 13:58:16 +11:00
Nathan Burnham
0e6ea19853 PyAPI Docs: Fix "On this page" covering content
Sphinx CSS "hides" the _On this page_ pane by setting its `position` to `fixed` and `right` to `-15em`—this assumes it has a fixed `width` of `15em`, which it doesn't if it is overridden to `auto`.

Fixes #148347; caused by [45fee7d851][0], which also affects the 4.5 LTS docs.

[0]: 45fee7d851

Pull Request: https://projects.blender.org/blender/blender/pulls/148603
2025-10-23 04:22:48 +02:00
Nick Alberelli
61da6403be USD: Add new get_prim_map API for the on_export hook
Similar to: 0df5d8220b

For consistency sake, we should have the `get_prim_map` function working
on the export side of USD hooks as well as the import side.

Pull Request: https://projects.blender.org/blender/blender/pulls/147242
2025-10-19 22:36:07 +02:00
Jeroen Bakker
e2dc63c5de Fix #147618: PyGPU incorrect colors when drawing images
644fb2b679 fixed a long standing issue
that offscreen example showed the wrong colors. However the fix assumes
that input texture color space is always sRGB.

This adds a shader variation that draws textures that are stored in scene referred
linear color space (like all of our Image data-block).

Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/147788
2025-10-16 19:12:16 +02:00
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
Nick Alberelli
0d9ea9d11c PyAPI: add Context.temp_override documentation & examples
Add a new section to the `Context` page that includes an explanation
on how to invoke "on demand" logging for context member access.

Design task: #144746
Logging added in: !144810

Ref !146862
2025-10-08 16:08:09 +11:00
Richard Antalik
598aa5f4b7 Fix: BPY docs build error
"strip" and "strip_modifier" were missing in `context_type_map`.
2025-10-03 18:42:28 +02:00
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