Commit Graph

1169 Commits

Author SHA1 Message Date
Campbell Barton
92734d868b PyDoc: resolve bpy.types & bpy.ops expanding sub-modules inline
The bpy.types page was unreasonably long (over 17k lines).
Resolve by setting the `maxdepth` for this and the `bpy.ops` page too.

This problem showed up in v3.4 release and may be caused by changes
to Sphinx's default behavior as there doesn't seem to be any change
that would cause this in the generated docs.
2023-01-20 14:04:34 +11:00
Damien Picard
30c90f0ad0 Cleanup: Replace "UV's" with "UVs"
An apostrophe should not be used because it is not a mark of plural,
even for initialisms. This involves mostly comments, but a few UI
messages are affected as well.

Differential Revision: https://developer.blender.org/D16749
2023-01-10 14:50:13 -05:00
Alexander Gavrilov
7be5ca63ae Python API Docs: explain the CANCELLED return code of operators.
The effect of CANCELLED on the undo stack is quite obscure, and
mistakenly using it after doing some changes causes confusing
behavior. It's better to describe it explicitly in the docs.
2022-12-26 14:47:38 +02:00
Campbell Barton
530b232309 Cleanup: use more descriptive name for function in BMesh doc generation
Avoid the term "print" as the function doesn't print.
2022-12-15 12:02:57 +11:00
Campbell Barton
a5d391919c Cleanup: format 2022-12-08 13:46:26 +11:00
Michal Srb
be5afe9987 PyAPI Docs: Add default values for bmesh API
This diff improves the docs for bmesh by adding the default values to all methods. This is motivated by this issue https://github.com/nutti/fake-bpy-module/issues/118 in fake-bpy-module which generates a typed API for authoring Blender scripts and addons from the docs.

After this diff gets merged, the Blender docs get updated, and `fake-bpy-module` gets regenerated, the type signatures in `fake-bpy-module` will match the reality of Blender's API.

Here's a diff for the docs using the modified script:
https://gist.github.com/xixixao/1c83153adbcefbe0859f9cc9ba757d46

I "hardcoded" the defaults based on the types of the arguments, after some testing and consulting the Blender .c source for these APIs.

Here's a test script that verifies that the arguments with defaults added in this diff are indeed not required by Blender 3.3: https://gist.github.com/xixixao/adc4e5a076e80a63735bd60c7c9e7a0d

I made the minimum changes required to get this doc generation script fixed, but let me know if I should restructure this script more.

I also amended the comments of three args, 2 to align them with Python (NULL -> None) and one to mark it as optional (CurveProfile).

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D16400
2022-12-07 15:48:41 -06:00
Bastien Montagne
429771fed5 Add 'work around' to accessing data from volatile iterators in py API.
Re T102550.
2022-11-30 17:04:37 +01:00
Alexander Gavrilov
d961119563 Python API Docs: document when fields use mathutils types.
When accessing certain structure fields from Python, they return
mathutils types instead of generic arrays (this is based on subtype).

This exposes this information in the Python API documentation.

Differential Revision: https://developer.blender.org/D16626
2022-11-28 00:33:41 +02:00
Aaron Carlisle
ecda9483f1 Merge branch 'blender-v3.4-release' 2022-11-03 23:41:11 -04:00
Aaron Carlisle
eb8155ebcd PyDoc: Make rst files more readable
This commit reduces the amount of white space generated and keeps parameter documentation of a single line.

This makes the resulting rst files easier to read in the case of debugging.

This was useful while looking into T97464
2022-11-03 23:36:12 -04:00
Thomas Dinges
ba8754cf11 Blender 3.5 Alpha: Start of new release cycle. 2022-11-03 10:11:13 +01:00
Aaron Carlisle
5ba045af7b PyDocs: Upgrade Theme to 1.1.0
Updates to kbd and breadcrumbs along with some fixes to API docs that should'nt affect us.
2022-11-02 22:37:39 -04:00
Aaron Carlisle
ea94d5723f PyDocs: Upgrade Sphinx to 5.3.0
Trivial changes, should not affect us in anyway.
2022-11-02 22:35:42 -04:00
Aaron Carlisle
9cd99684b0 Py Docs: Update to sphinx 5.2.3
Notable change is the improvements made to search.
2022-10-10 23:17:23 -04:00
Campbell Barton
0f6d5c9a9d Docs: minor improvements to info_advanced_blender_as_bpy wording 2022-09-23 15:04:02 +10:00
Germano Cavalcante
2ce8b01c59 PyGPU: call 'GPU_shader_bind' in 'GPUShader.uniform_' methods
This simplifies python code.

When we call a method like shader.uniform_float("color", (1,1,1,1)),
we expect the shader's uniform to be updated regardless of whether the
shader is bound or not.

And `batch.draw()` already calls `GPU_shader_bind` inside.

Differential Revision: https://developer.blender.org/D15929
2022-09-19 09:40:20 -03:00
Aaron Carlisle
72253f427d Docs: Update sphinx 2022-09-15 22:30:47 -04:00
Campbell Barton
27e17fed28 PyDoc: hide overly long titles from the side-bar
The side-bar included both title and description for documentation
pages including quickstart, tips & tricks .. etc.

Titles often wrapped and took up a lot of vertical space in the side-bar.

Now these pages are linked on the main page, with the side-bar
used for top-level Python modules.
2022-09-15 14:34:23 +10:00
Campbell Barton
39c341bf4a Cleanup: remove redundant braces from assert & raise
autopep8 v1.7 added a space after assert & raise,
remove the braces as they aren't needed.
2022-09-14 16:18:59 +10:00
Campbell Barton
260b75a952 PyDoc: add an "Advanced" section to document WITH_PYTHON_MODULE
Document the use cases, usage and limitations
of using Blender as a Python module.
2022-09-14 15:17:51 +10:00
Julian Eisel
00d2bda241 Py Docs: Document delayed setting of UI data
Blender may not apply certain UI data changes immediately when done via BPY.
This is a rather typical gotcha, better to have it documented.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D15614
2022-09-01 15:03:51 +02:00
Germano Cavalcante
cb771dbe76 PyDoc: update the shader creation examples with gpu module
The old way of creating shaders is being replaced by using
`GPUShaderCreateInfo` for more portability.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14634
2022-09-01 08:31:56 -03:00
Luca Rood
9a65dca37c Merge branch 'blender-v3.3-release' 2022-08-18 15:26:30 +02:00
Luca Rood
8a799b00f8 Fix T100423: Addon's custom context menu entries get overridden by other addons
This introduces a new `UI_MT_button_context_menu` class which is
registered at startup. Addons can append/prepend draw functions to this
class, in order to add their custom context menu entries.

The new class replaces the old `WM_MT_button_context` class, thus
requiring a small change in addons using this feature. This is done
because addons were previously required to register the class
themselves, which caused addons to override each other's context menu
entries.

Now the class registration is handled by Blender, and addons need only
append their draw functions. The new class name ensures that addons
using the old method don't override menu entries made using the new
class.

Menu entries added with the legacy `WM_MT_button_context` class are
still drawn for backwards compatibility, but this class must not be used
going forward, as any addon using it still runs the risk of having its
menu entries overridden, and support for the legacy class is subject to
removal in a future version.

Reviewed By: campbellbarton

Maniphest Tasks: T100423

Differential Revision: https://developer.blender.org/D15702
2022-08-18 14:46:30 +02:00
Bastien Montagne
6c6e59e846 Merge branch 'blender-v3.3-release' 2022-08-12 16:23:28 +02:00
Bastien Montagne
fd57f520ac Py API doc: Add warning that py-defined property accessor callbacks may be called in threaded context.
At least Depsgraph evaluation and liboverride diffing do process IDs in
parallel, so python code in py-defined properties should not access any
data outside of their owner ID.

Ref. T100203.
2022-08-12 16:23:12 +02:00
Thomas Dinges
9015952c9c Blender 3.4 Alpha: Start of new release cycle. 2022-07-27 16:53:19 +02:00
Campbell Barton
37ad72ab23 Fix T99966: Python API docs fail to generate
The recent addition of "active_action" [0] required updating in the
API docs type information.

[0]: cd21022b78fe48c16ab11d04682bb92271873a9c
2022-07-26 12:51:01 +10:00
Campbell Barton
3c016fbfd0 Fix error indenting new-lines in generated RST API docs
New-lines in RNA type descriptions caused invalid RST indentation.

This resolve the error noted by @nutti in D15481.
2022-07-18 20:00:21 +10:00
Campbell Barton
68d037190f Cleanup: format 2022-06-29 10:19:02 +10:00
Bastien Montagne
614aa9d8ec Py API Doc: add runtime changelog generation to sphinx_doc_gen.py.
Optionally use `sphinx_changelog_gen.py` to dump current version of the
API in a JSON file, and use closest previous one listed in given index
file to create a changelog RST page for Sphinx.

Part of {T97663}.
2022-06-28 16:53:12 +02:00
Bastien Montagne
f9f73473d6 Py API Doc: refactor changelog generation script.
Main change is to make it use JSON format for its dump files, instead of
some Python code.

It also introduces an index for those API dump files, mapping a blender
version to the relevant file path.

This is then used to automatically the most recent (version-number wise)
previous API dump to compare against current one, when generating the
change log RST file.

Part of {T97663}.
2022-06-28 16:52:46 +02:00
Bastien Montagne
0ea173165b Revert "TEST COMMIT: API doc generation changes."
This reverts commit d86af604290be0507db113dc8c82540bb30d4fd3.
2022-06-17 18:21:28 +02:00
Bastien Montagne
d86af60429 TEST COMMIT: API doc generation changes.
This commit is intended to be reverted within a few minutes.

commit 50adc860a652508570dbc7102ef288049a9ffed4
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:43:13 2022 +0200

    Py API Doc: add runtime changelog generation to `sphinx_doc_gen.py`.

    Optionally use `sphinx_changelog_gen.py` to dump current version of the
    API in a JSON file, and use closest previous one listed in given index
    file to create a changelog RST page for Sphinx.

commit 88fc683e78f866f1b3cda379c3b90e1f2916ce00
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:36:19 2022 +0200

    Py API Doc: refactor changelog generation script.

    Main change is to make it use JSON format for its dump files, instead of
    some Python code.

    It also introduces an index for those API dump files, mapping a blender
    version to the relevant file path.

    This is then used to automatically the most recent (version-number wise)
    previous API dump to compare against current one, when generating the
    change log RST file.
2022-06-17 17:07:37 +02:00
Bastien Montagne
3c0162295f Revert "TEST COMMIT: API doc generation changes."
This reverts commit 52b93c423dc0db774dbcfb656702ecc01f8d6818.
2022-06-17 17:03:32 +02:00
Bastien Montagne
52b93c423d TEST COMMIT: API doc generation changes.
This commit is intended to be reverted within a few minutes.

commit 9442d8ef0f255d3c18b610b42aff71229904aaee
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:43:13 2022 +0200

    Py API Doc: add runtime changelog generation to `sphinx_doc_gen.py`.

    Optionally use `sphinx_changelog_gen.py` to dump current version of the
    API in a JSON file, and use closest previous one listed in given index
    file to create a changelog RST page for Sphinx.

commit f7fb537078641d2e2de015c08554f5281ce9debd
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:36:19 2022 +0200

    Py API Doc: refactor changelog generation script.

    Main change is to make it use JSON format for its dump files, instead of
    some Python code.

    It also introduces an index for those API dump files, mapping a blender
    version to the relevant file path.

    This is then used to automatically the most recent (version-number wise)
    previous API dump to compare against current one, when generating the
    change log RST file.
2022-06-17 16:39:36 +02:00
Bastien Montagne
b8f489c65b Revert "TEST COMMIT: API doc generation changes."
This reverts commit 510f3fe9a977798d44e81add078944745c1585bf.
2022-06-17 16:30:42 +02:00
Bastien Montagne
510f3fe9a9 TEST COMMIT: API doc generation changes.
This commit is intended to be reverted within a few minutes.

commit 088497c870630d9b0d405aaa5fd796c77b380731
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:43:13 2022 +0200

    Py API Doc: add runtime changelog generation to `sphinx_doc_gen.py`.

    Optionally use `sphinx_changelog_gen.py` to dump current version of the
    API in a JSON file, and use closest previous one listed in given index
    file to create a changelog RST page for Sphinx.

commit 91801f47ad03f4739e97ae4b4edee09687e2cb85
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:36:19 2022 +0200

    Py API Doc: refactor changelog generation script.

    Main change is to make it use JSON format for its dump files, instead of
    some Python code.

    It also introduces an index for those API dump files, mapping a blender
    version to the relevant file path.

    This is then used to automatically the most recent (version-number wise)
    previous API dump to compare against current one, when generating the
    change log RST file.
2022-06-17 10:46:06 +02:00
Bastien Montagne
b6b5f317a3 Revert "Revert "Revert "TEST COMMIT: API doc generation changes."""
This reverts commit 5a30fe29ef2e1f424df0403284b3ebba5644403f.
2022-06-16 19:35:55 +02:00
Bastien Montagne
5a30fe29ef Revert "Revert "TEST COMMIT: API doc generation changes.""
This reverts commit 502089f275ded113732c24cad2a96e2a899ecd5c.

Enable again temporarily the new test code for API doc generation.
2022-06-16 16:36:42 +02:00
Bastien Montagne
502089f275 Revert "TEST COMMIT: API doc generation changes."
This reverts commit 298372fa06cbe0887534b95c9b23b491e46419d4.
2022-06-15 17:11:00 +02:00
Bastien Montagne
298372fa06 TEST COMMIT: API doc generation changes.
This commit is intended to be reverted within a few minutes.

commit 39ffb045a52d16994c1c87ccf3249ff3222a8fca
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:43:13 2022 +0200

    Py API Doc: add runtime changelog generation to `sphinx_doc_gen.py`.

    Optionally use `sphinx_changelog_gen.py` to dump current version of the
    API in a JSON file, and use closest previous one listed in given index
    file to create a changelog RST page for Sphinx.

commit fbe354d3fcfa2ad1ed430c3c27e19b99a0266dda
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:36:19 2022 +0200

    Py API Doc: refactor changelog generation script.

    Main change is to make it use JSON format for its dump files, instead of
    some Python code.

    It also introduces an index for those API dump files, mapping a blender
    version to the relevant file path.

    This is then used to automatically the most recent (version-number wise)
    previous API dump to compare against current one, when generating the
    change log RST file.
2022-06-15 16:48:30 +02:00
Aaron Carlisle
bb9647b703 PyDocs: remove sphinx-intl
Cop paste mistake from rB3cd283a424ec92ef85e1856d66f0baa4d2253fc5
2022-06-05 23:13:26 -04:00
Aaron Carlisle
3cd283a424 Py Docs: Update Sphinx and dependencies
- Adds python 3.10 support
- Slightly improves performance
2022-06-05 23:05:48 -04:00
Campbell Barton
3ca76ae0e8 Cleanup: remove "<pep8 compliant>" from headers
It can be assumed that all scripts comply with basic pep8 formatting
regarding white-space, indentation etc.

Also remove note in best practices page & update `tests/python/pep8.py`.

If we want to exclude some scripts from make format,
this can be done by adding them to `ignore_files` in:
source/tools/utils_maintenance/autopep8_format_paths.py

Or using `# nopep8` for to ignore for individual lines.

Ref T98554
2022-06-02 20:16:20 +10:00
Campbell Barton
d73adfdc86 PyDoc: changes to the generated conf.py file
- Set the highlight language to python3 (excludes python2 syntax).
- Set the encoding for code highlighting to utf-8 (no need to detect).
- Update deprecated variable name.
- Remove redundant unicode prefixed string.
2022-06-02 15:02:25 +10:00
Campbell Barton
f60ac5068a PyDoc: remove CSS override for scrolling long enum lists
Adding a scroll-bar to in-line lists has the down-side that it cuts
of text including warnings or notes that can be included, see: T87008.

Now enums are referenced [0] this is no longer needed, reverting [1].

[0]: 1c6b66c9cf80b3c9b4542b27948ae232f930a211
[1]: 1e8f2665916c049748a3985a2fce736701925095
2022-06-02 10:03:00 +10:00
Campbell Barton
1bf35f1b19 Cleanup: minor changes to sphinx_doc_gen
- Remove unused pymethod2sphinx.
- Correct exception string formatting.
- Define encoding for file reading with execfile(..).
2022-06-01 15:48:20 +10:00
Campbell Barton
1c6b66c9cf PyDoc: replace in-lined enum references with links where possible
Avoid in-lining large enums such as icons and event types, linking
to them instead.

This mitigates T76453, where long enums took a lot of space in the docs,
this was a problem with `UILayout` where each icon argument would list
all icons. [0] worked around the issue using CSS to scroll the list.
However this has the draw-back where some items are clipped in a way
that's not obvious, see: T87008.

The reason this isn't a complete solution is that Python defined enums
aren't written into their own pages which can be linked to, although
currently there are no large Python enums included in the API docs.
All in-lined enums are now under 20 items.

[0]: 1e8f2665916c049748a3985a2fce736701925095
2022-05-31 14:19:06 +10:00
Campbell Barton
fb86f3ee18 PyDoc: document static enums from RNA_enum_items.h
Create a page for every enum in RNA_enum_items.h, which includes
the enum values and the doc-string for each item.

Each page creates a references which the API reference can be linked to
via the same name as the enum, so :ref:`rna_enum_icon_items` links
to the list of icons for e.g.

This has two main advantages:

- No need to manually duplicate enum values in the doc-strings of
  functions defined in Python's C/API (not RNA defined functions),
  `bpy.props` for example.

- The generated Python API docs can reference these instead of including
  the enums in-line - resulting in unreasonably long lists in the case
  if icons and event types (for example).

These changes will be made separately.
2022-05-31 14:18:32 +10:00