Commit Graph

354 Commits

Author SHA1 Message Date
Campbell Barton 3b8818cb6e Docs: avoid potential error with templated strings
Use a method of declaring templated strings that properly escapes
characters.

Also use utf-8 encoding for the conf.py.
2024-03-27 15:53:27 +11:00
Aaron Carlisle 32db305899 Docs: Python: Refactor the config file out of 'sphinx_doc_gen.py'
This was done originally because we need access to some information that is avalable from `bpy` however, we only need a few pieces of information.

Instead, I have refactored the code to a traditional `conf.py` file that uses template strings that get substituted when the file is copied to the build folder.

The goal here is to make it simpler to adjust the configuration.

This change also moves the config generation from `rna2sphinx` to the main function.

Pull Request: https://projects.blender.org/blender/blender/pulls/119904
2024-03-27 04:27:40 +01:00
Aaron Carlisle 3b3a6ccecd Docs: Python: Use headings instead of rubrics
This allows these headings to show under "On this page".
2024-03-26 01:48:32 -04:00
Aaron Carlisle 7d29f25ee1 Docs: Python: Fixes for sphinx Idioms
- There is no need to use the low level css add function use `html_css_files` instead.
- There is no need to specify each file for `html_extra_path`, just use the directory.
2024-03-26 01:23:55 -04:00
Aaron Carlisle f032da82af Merge branch 'blender-v4.1-release' 2024-03-25 12:52:47 -04:00
Aaron Carlisle 5a9b292ac4 Docs: Python API: Enable version switch menu 2024-03-25 12:50:01 -04:00
Aaron Carlisle 1f3582bf95 Merge branch 'blender-v4.1-release' 2024-03-20 16:17:11 -04:00
Aaron Carlisle 12407be18b Docs: Python API: Switch theme to Furo
Since moving from the Wiki we have used the `sphinx_rtd_theme` which has worked well but has become a little dated and has had slow development. This changes to use "Furo" instead.

[Furo](https://github.com/pradyunsg/furo) is a lightweight theme that is responsive and has native dark mode support.

Dark mode is one of the major enhancements but this change also brings:

- Content is slightly larger making text and images easier to view
- Site navigation and page navigation is split into two navigation trees. The site navigation is on the left and page on the right if the page has multiple headings.
- Return to top button
- Content is centered on the screen which helps with wide monitors
- No more breadcrumbs
- Remove google analytics

So far the caveat that I have noticed with this is slower compile times and larger pages, this is due to the better sidebar navigation.

This change also brings a lot of simplifications to customizations that we made to the `sphinx_rtd_theme`. There is still likely room for improvement in the future.

Pull Request: #119684
2024-03-20 16:08:31 -04:00
Brecht Van Lommel 7a395e2e7f Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was f57e4c5b98.

After this one more fix was committed, this one is preserved as well:
67bd678887.
2024-03-18 15:04:12 +01:00
Campbell Barton 2119d271e0 Cleanup: remove "-noaudio" argument in background mode
This is no longer needed as background mode implies -noaudio.
2024-02-14 00:13:38 +11:00
Brecht Van Lommel 303c19f736 Fix: API doc build error after adding missing texture_node to context 2024-01-12 17:11:09 +01:00
Campbell Barton 59dc67974a PyAPI: support returning non ID types when accessing Context.property
Previously accessing properties without an associated ID would return
None, even when the non-ID data was available.

Ref !116981
2024-01-10 23:43:29 +11:00
Campbell Barton ea86a77bc5 Docs: add notes on populating bpy.app.driver_namespace
Address issues raised by #114155.

Also fix sphinx documentation generation using incorrect identifiers
when looking up references from PyStruct types
(was looking for `bpy.app.bpy.app.driver_namespace.py`).
2023-10-31 21:34:32 +11:00
Julian Eisel aaefb0249c Fix documentation build (validation?) error
Necessary after 974d70918b and ca58f97cda.
2023-09-19 17:14:31 +02:00
Campbell Barton 09f61f6881 Cleanup: enforce documented convention for RNA enum naming
This was noted in code comments and checked in Python documentation
generation but not at build time.

Since these enums are identifiers that end up included in various places
enforce the `rna_enum_*_items` convention which was noted as
the convention but not followed strictly.

Partially reverts [0], avoids having to deal with multiple prefix types.

[0]: 3ea7117ed1
2023-08-25 13:35:58 +10:00
Aaron Carlisle 3ea7117ed1 PyAPI Docs: Fix generation after recent node RNA changes
This commit allows both `rna_enum_` and `rna_node_`to be used for enum prefixes

This also fixes one enum by adding `rna_` to the prefix.

Together these changes fix the API documentation generation.
2023-08-16 17:37:41 -04:00
Campbell Barton 92c4756d02 Fix replacement of "Blender Foundation" in recent header change
The recent change to header copyrights [0] unintentionally changed
"Blender Foundation" to "Blender Authors" for the WIN32 file path
which blender is installed into.

Revert lines changed that aren't related to copyright text.

[0]: e955c94ed3
2023-08-16 21:21:55 +10:00
Campbell Barton e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Jacques Lucke cc4d5c432c RNA: move headers to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/111022
2023-08-10 22:40:27 +02:00
Sergey Sharybin fa5a8b3769 Fix documentation building since recent changes in GPv3
The #109197 introduced the following error to the documentation
builders:

  Error: context key 'grease_pencil' not found in context_type_map; update ../doc/python_api/sphinx_doc_gen.py

To reproduce the issue locally the following command could be
used:

```
./bin/Blender.app/Contents/MacOS/Blender \
    --background \
    --factory-startup \
    -noaudio \
    --python ../../blender/doc/python_api/sphinx_doc_gen.py -- \
    --output ./sphinx/build_doc_api \
    --api-changelog-generate \
    --api-dump-index-path \
    ./sphinx/api_dump_index.json
```

Note that even after this fix the command from above would still
fail locally because the script expect information from previous
Blender version to be in the index. It is possible to bypass by
manually editing api_dump_index.json and adding 3.6 key.

Pull Request: https://projects.blender.org/blender/blender/pulls/109365
2023-06-26 11:34:54 +02:00
Campbell Barton 65f99397ec License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
Josh Maros 6ba0346797 Python API: add bpy.context.property, for property under the mouse cursor
This can be useful for example to add custom operators to the property
context menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/107280
2023-05-26 21:33:26 +02:00
Aaron Carlisle d727f64ad2 PyAPI DocS: Fix source code link markup
FIxes https://projects.blender.org/blender/blender/issues/106212#
2023-04-05 22:27:51 -04:00
Aaron Carlisle d6d2e98e5e PyAPI Docs: Fix Broken link to source files
With the move to Gitea the URI for line numbers changed from `$1234` to `#L1234`.

The change also removes a superfluous space character from the generated RST syntax.
2023-03-07 20:03:07 -05:00
Sergey Sharybin 03806d0b67 Re-design of submodules used in blender.git
This commit implements described in the #104573.

The goal is to fix the confusion of the submodule hashes change, which are not
ideal for any of the supported git-module configuration (they are either always
visible causing confusion, or silently staged and committed, also causing
confusion).

This commit replaces submodules with a checkout of addons and addons_contrib,
covered by the .gitignore, and locale and developer tools are moved to the
main repository.

This also changes the paths:
- /release/scripts are moved to the /scripts
- /source/tools are moved to the /tools
- /release/datafiles/locale is moved to /locale

This is done to avoid conflicts when using bisect, and also allow buildbot to
automatically "recover" wgen building older or newer branches/patches.

Running `make update` will initialize the local checkout to the changed
repository configuration.

Another aspect of the change is that the make update will support Github style
of remote organization (origin remote pointing to thy fork, upstream remote
pointing to the upstream blender/blender.git).

Pull Request #104755
2023-02-21 16:39:58 +01:00
Campbell Barton d851c91856 PyDocs: update links in generated API docs for GITEA migration
- Correct broken link for undocumented modules.
  Point to the contributing page, it seems #51062 was lost with the
  GITEA task migration.
- Correct Blender Version link to the SHA1.
2023-02-14 12:41:51 +11:00
Campbell Barton 91346755ce Cleanup: use '#' prefix for issues instead of 'T'
Match the convention from Gitea instead of Phabricator's T for tasks.
2023-02-12 14:56:05 +11:00
Sergey Sharybin bd6b0bac88 Update references to the new projects platform and main branch 2023-02-07 14:18:19 +01:00
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
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 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
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
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]: cd21022b78
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 0ea173165b Revert "TEST COMMIT: API doc generation changes."
This reverts commit d86af60429.
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 52b93c423d.
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 510f3fe9a9.
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 5a30fe29ef.
2022-06-16 19:35:55 +02:00
Bastien Montagne 5a30fe29ef Revert "Revert "TEST COMMIT: API doc generation changes.""
This reverts commit 502089f275.

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 298372fa06.
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
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