Commit Graph

1477 Commits

Author SHA1 Message Date
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
Campbell Barton
01806a62e3 Cleanup: spelling (make check_spelling_*) 2025-10-07 10:19:46 +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
729b76f454 Cleanup: use str.format to format strings in Python
Also replace redundant `{!s}` with `{:s}`.
2025-08-12 10:21:38 +10: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
Bastien Montagne
11ca8729cc Merge branch 'blender-v4.5-release' 2025-06-06 11:53:26 +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
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
0f78cb5edb Merge branch 'blender-v4.5-release' 2025-06-06 10:49:58 +10:00
Campbell Barton
db22e6cb8b PyDocs: quiet context member warning without experimental features 2025-06-06 10:48:25 +10:00
Bastien Montagne
a405e9ae1e Merge branch 'blender-v4.5-release' 2025-06-05 13:42:34 +02: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
4167f09c0d Merge branch 'blender-v4.5-release' 2025-06-05 15:41:47 +10:00
Campbell Barton
6396859466 Merge branch 'blender-v4.5-release' 2025-06-05 15:41:43 +10:00