Commit Graph

354 Commits

Author SHA1 Message Date
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]: 1e8f266591
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
Campbell Barton 57b87feda1 PyDoc: suppress duplicate object description warning
RenderEngine.render is both a method and an attribute,
while this should be avoided it's not causing a problem in practice
so quiet the warning when generating docs.

Sphinx now builds docs without any warnings.
2022-05-25 13:43:01 +10:00
Campbell Barton 1e882b8657 PyDoc: quiet output and minor cleanup
Suppress printing unnecessary output when generating docs.
2022-05-23 12:37:28 +10:00
Campbell Barton 4d509fd6e1 Fix error in sphinx_doc_gen.py when logging
Regression in 45ed325443
2022-05-23 12:37:22 +10:00
Campbell Barton 45ed325443 PyDoc: resolve/quiet warnings for pylint
- Duplicate keys in dict.
- Redefining names.
- Unused arguments.
- Use lazy % formatting in logging functions.
2022-05-22 13:31:36 +10:00
Campbell Barton 84901adec5 PyDoc: cleanup doc-generator
- Full sentences for comments.
- Use double quotes for strings (which aren't enum ID's).
- Reduce right-shift.
2022-05-22 13:08:38 +10:00
Campbell Barton 708547ab06 Merge branch 'blender-v3.2-release' 2022-05-18 21:48:34 +10:00
Campbell Barton 136a06285f Fix T88792: WindowManager.clipboard missing in Python API docs
Support RNA types using the Py/C-API PyGetSetDef defined properties.
Currently `WindowManager.clipboard` is the only instance of this.
2022-05-18 21:43:38 +10:00
Campbell Barton c536791f36 Cleanup: remove unused variables, redundant assignments 2022-05-18 17:53:45 +10:00
Campbell Barton c8edc458d1 PyDoc: support building full API docs on macOS & WIN32
Accessing context members depended on `ctypes` to access symbols
which were hidden for macOS & WIN32.

Add an API call that doesn't require the symbols to be exported.

This allows most symbols to be hidden on Linux, see D14971.
2022-05-18 17:06:03 +10:00
Campbell Barton 67516d0dae Cleanup: run autopep8 with max-line-length=120 2022-04-20 15:47:24 +10:00
Campbell Barton 7e045094c1 PyDoc: quiet warnings for duplicate members bpy.context 2022-04-19 12:19:08 +10:00
Campbell Barton 76acc5e999 PyDoc: fix including literal text immediately after function args
Literal text from examples could be included directly after function
arguments, this caused a warning with mis-matching indentation.
2022-04-19 12:17:58 +10:00
Bastien Montagne 1ec93507e1 API doc: Tweak sphinx to get date of source commit instead of build date.
This commit disables the 'last updated' value (which is the date the
sphinx doc is generated), and instead modifies the 'commit' field from
the 'html_context' data to get:
  - a link to the commit itself.
  - the date of that commit.

This avoids having the whole documentation detected as changed every
time it is re-generated by the buildbot.

Reviewed By: dfelinto, campbellbarton

Differential Revision: https://developer.blender.org/D14429
2022-04-06 11:43:14 +02:00
Campbell Barton c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00
Hans Goudey 40e8b9775d Fix: Missing changes in recent "Curves" rename
More missing changes in fe1816f67f. This will hopefully fix a
Python API docs build error, and fixes the "Object Types Visibility"
popover.
2022-02-10 15:51:26 -06:00
Aaron Carlisle e7f74a7d6a Py Docs: Fix typo in previous commit
- Correct spacing
- Add missing comma
2022-02-03 14:37:55 -05:00
Aaron Carlisle 6a2fc3230f Py Docs: Implement version switch to switch between versions on the website
This commit adds a version switch similar to the one on the user manual,
in the future it would be nice to refactor both of these into a more generic
code that works for both. Maybe develop this into a sphinx extension.

As part of this change I had to change how the blender hash is displayed.
Instead of the version hash in the top left it has been moved to the page footer.

This change will also be backported to 2.93 LTS, 2.93 LTS, and 3.0.
2022-02-03 14:25:26 -05:00
Aaron Carlisle 9a2d1cd5b7 PyAPI Docs: Prepare for Sphinx 4.5 2022-01-19 14:08:38 -05:00
Aaron Carlisle 50fb0fd636 Docs: Incorrect link to context type
Fixes T93773
2021-12-06 22:07:38 -05:00
Alexander Gavrilov 057cb7e5e7 Context: add accessors returning selected actions for animation editors.
Add a new 'selected_visible_actions' property to allow querying
actions that are selected in animation related editors for use in
UI and operators. The 'selected_editable_actions' variant excludes
linked actions (the only reason an action can be read-only).

In the Action and Shape Key editors there is only one action
that is specified by the field at the top of the editor.

In Dope Sheet it scans the channel rows and returns all actions
related to the selected items. This includes summary items for
actions and groups.

In Graph Editor, it lists actions associated with selected curves.

The new property is also used for Copy To Selected and Alt-Click.

Ref D11803
2021-11-24 15:58:32 +03:00
Hans Goudey 42df2a7b57 Cleanup: Grammar in comments 2021-11-07 23:20:29 -06:00
Sybren A. Stüvel 4adde62f60 Python doc generator: add missing `selected_ids` context key
Add the context key I introduced in rB03c0581c6ed to the Python API docs
generator.

No functional changes to Blender.
2021-10-28 10:32:13 +02:00
Sybren A. Stüvel 2501d00268 Python doc generator: raise explanatory error when context key is missing
When a new key is added to the context, it also needs to be added to the
`sphinx_doc_gen.py` file for generating the Python API documentation.
When this isn't done, the script would raise a generic `KeyError`. Now
it explains what needs to be updated to solve the problem.

No functional changes to Blender.
2021-10-28 10:32:13 +02:00
Brecht Van Lommel e4a5fd4298 Fix broken Python API doc generation after addition of selected_ids 2021-10-27 22:16:36 +02:00
Philipp Oeser 25c173ffd1 Tracking: support editing all selected tracks
This patch adds a "selected_movieclip_tracks" context member and enables
editing properties of multiple selected tracks via the usual Alt-click
editing (as well as the "Copy To Selected" operator). Both use
UI_context_copy_to_selected_list() to gather a list of other selected
items [which are now taken via said new context member]. Strictly
speaking, this could be done without the context member as well [just
gathering other selected tracks in UI_context_copy_to_selected_list()
without relying on a context member], but this might come in handy in
other places (e.g. Addons).

note: some could be desired for markers (e.g. editing pattern/search
areas of all selected track markers, but since this is burried in a
uiTemplate, this is a bit more work for another patch).

Differential Revision: https://developer.blender.org/D12923
2021-10-20 11:36:33 +02:00
Julian Eisel c4dca65228 Asset Browser: Support dragging assets into catalogs
With this it is possible to select any number of assets in the Asset
Browser and drag them into catalogs. The assets will be moved to that
catalog then. However, this will only work in the "Current File" asset
library, since that is the only library that allows changing assets,
which is what's done here.

While dragging assets over the tree row, a tooltip is shown explaining
what's going to happen.

In preparation to this, the new UI tree-view API was already extended
with custom drop support, see 4ee2d9df42.

----

Changes here to the `wmDrag` code were needed to support dragging multiple
assets. Some of it is considered temporary because a) a proper #AssetHandle
design should replace some ugly parts of this patch and b) the multi-item
support in `wmDrag` isn't that great yet. The entire API will have to be
written anyway (see D4071).

Maniphest Tasks: T91573

Differential Revision: https://developer.blender.org/D12713

Reviewed by: Sybren Stüvel
2021-10-03 23:58:20 +02:00
Julian Eisel f62eb8ac16 BPY-Docs: Add missing file context members documentation
Context members of the file space would not be shown in the context API
docs.
2021-09-01 16:28:44 +02:00
Campbell Barton aabe6e3b45 Context: add "active_nla_track" & "active_nla_strip" context members
Selection was already accessible but not active.

Add utility functions:

- ANIM_nla_context_track to access the active track,
  following the convention of ANIM_nla_context_strip.

- ANIM_nla_context_*_ptr versions of these functions,
  needed to for creating context members to access the ID pointer.

Part of fix for T90723.
2021-08-31 12:06:47 +10:00
Aaron Carlisle d374ff5b8f PyDoc: Fix compilation after recent contex_member addition
Fixes missing change needed for rB0a8f53a7b847d9c8bdcefc025de70fd2608012b7
2021-08-30 18:17:11 -04:00
Germano Cavalcante 9ad56627cf Docs: retitle 'GPU Shader Module' to 'GPU Module'
We already have a module for GPU Shader (`gpu.shader`).

So, remove the name "Shader" from the title to avoid confusion.
2021-08-30 09:21:38 -03:00
nutti 69fdcea978 Docs: add API docs for gpu.capabilities
Adds Python API documentations for gpu.capabilities module.

Ref D12226
2021-08-17 15:04:35 +10:00
nutti d60e28093f Docs: add API docs for gpu.platform
Adds Python API documentations for gpu.platform module.

Ref D12222
2021-08-17 14:45:40 +10:00
Campbell Barton 61040a36aa PyDoc: fix for renamed context member
Missing change from 9cff9f9f5d.
2021-08-10 17:28:09 +10:00
Julian Eisel 807bb450a0 Fix API doc generation after recent context additions 2021-07-20 22:07:41 +02:00
Aaron Carlisle e6a69f7653 Docs: Capitalize first word of sentence 2021-05-30 11:09:01 -04:00
Aaron Carlisle f5d14e36e8 PyDoc: Use em dash instead of comma for enum items 2021-05-29 12:16:13 -04:00
Campbell Barton 7e552b356d Merge branch 'blender-v2.93-release' 2021-05-17 18:04:22 +10:00
Campbell Barton e3a76feeef Fix PyAPI doc generation error in 43369ca80e
Files without doc-strings were not included.
2021-05-17 18:02:56 +10:00
Campbell Barton 44db4e50b2 PyAPI: remove context.active_base
All other access to the Base structure from Python was removed,
it seems this was left in by accident.

Ref T85675
2021-05-12 22:02:18 +10:00
Campbell Barton 43369ca80e PyDoc: quiet warning with literalinclude including blank lines
Files that only contain a doc-string still included the last blank line,
since this normally contains code examples.

There are some cases where only a docstring exists
which made sphinx report warnings.
2021-03-31 17:47:31 +11:00
Campbell Barton d5f2043ab3 PyDoc: fix indentation with multi-line property descriptions
New lines were written without indentation,
causing invalid RST to be generated.
2021-03-31 17:43:30 +11:00
Germano Cavalcante 6c6b1c015c GPU Python: Implement gpu.texture.from_image
It can be useful to replace `image.bindcode` and `image.gl_load`.

Used for example in https://docs.blender.org/api/current/gpu.html#d-image

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D10458
2021-03-01 17:38:57 -03:00
Aaron Carlisle b1b9671c93 Cleanup: commented/out of date rpdb2 import 2021-02-25 18:27:57 -05:00
Germano Cavalcante cccdd6626d PyAPI Docs: Add 'gpu.state' module
Also exclude `gpu.shader` from quick tests.
2021-02-25 09:16:48 -03:00
Campbell Barton c47990f41c PyAPI: expose imbuf.types.ImBuf, include in API docs
Without this, the ImBuf type wasn't part of documentation.
2021-02-25 12:04:23 +11:00
Aaron Carlisle cb3e092d45 Merge branch 'blender-v2.92-release' 2021-02-19 02:00:56 -05:00
Aaron Carlisle 241273d362 API Docs: Fix generation failing with unused context members
Instead of raising an expection a warnign is generated instead. This 
fixes the issue where `['hair', 'pointcloud']` are disabled for release 
builds. In the future a better solution would be to generate the context 
map dynamically but this would require refactoring of the API: D9988
2021-02-19 01:58:16 -05:00
Aaron Carlisle 7266d8e32a PyAPI Docs: Fix deprecation warning with new theme version 2021-02-18 23:55:23 -05:00
Aaron Carlisle e6acc4db72 Instead of raising an expection a warnign is generated instead.
This fixes the issue where `['hair', 'pointcloud']` are disabled for 
release builds.
In the future a better solution would be to generate the context map 
dynamically but this would require refactoring of the API: D9988

Fixes T80364

Differential revision: https://developer.blender.org/D10468
2021-02-18 22:51:24 -05:00
Campbell Barton 28169cea3d PyDoc: avoid blank lines at the beginning of code-examples 2020-12-08 20:49:28 +11:00
Campbell Barton 07db110add Fix T82493: PyDoc generation throws exception on exit
Since add-ons now unregister on exit
(as of fa566157a5)
clearing functions in `bpy.app.handlers` caused an error on exit.

Resolve by restoring handlers before exiting.
2020-11-20 18:59:59 +11:00
Campbell Barton 5d92fd8a90 Correct last commit 2020-10-16 20:51:58 +11:00
Campbell Barton b002fdc4bf PyDoc: update to account for new context member 2020-10-16 20:29:55 +11:00
Aaron Carlisle df3d124e91 Pydoc: Fix bpy.utils submodule showing in main toctree 2020-10-11 18:38:55 -04:00
Aaron Carlisle e8a2931299 Pydoc: Cleanup: Rename function
The new name makes more sense as the file is called index and we are not 
writing the contents of all rst files
2020-10-11 17:02:41 -04:00
Aaron Carlisle a38c2dcfe6 Pydoc: Add index and genindex to main index 2020-10-11 16:54:52 -04:00
Aaron Carlisle fbcb26fb33 Pydoc: Add submodule heading to submodule lists 2020-10-11 16:09:42 -04:00
Campbell Barton 05710171cb PyDoc: resolve duplicate module warnings
Remove submodule listings from the module docstring,
as this information already exists in the generator.
2020-10-09 12:11:00 +11:00
Aaron Carlisle fb20efae59 PyDoc: fix most of the sphinx-build warnings
Use `.. currentmodule::` instead of `.. module::` for `bpy.types` and
`bpy.ops`. This change fixes most of the errors.

Ref D9139
2020-10-08 16:27:42 +11:00
Campbell Barton 0b4aeffda9 PyDoc: support building without sphinx_rtd_theme
This is no longer bundled with sphinx, support building without it.
2020-10-08 12:32:50 +11:00
Aaron Carlisle d88da4db67 PyDoc: Render in text class name using class link syntax 2020-10-07 17:00:57 -04:00
Aaron Carlisle 021b94f27c PyDoc: Fix sphinx warnign from missing newline 2020-10-07 15:51:29 -04:00
Aaron Carlisle e748abda92 PyDoc: Remove workaround for slow sphinx builds
Tesing with newer versions of sphinx to directory `sphinx-build` is 
executed has no affect on the build time. Testing even gave a 2-3% speed 
boost.
2020-10-07 10:25:46 -04:00
Aaron Carlisle 7951312d4b API Doc Gen: Do not ignore objects file
This is used by the Blender manual or other sphinx website that would 
like to link to Blender's API documentation.
2020-10-05 16:26:40 -04:00
Campbell Barton 41d2d6da0c Cleanup: pep8 (indentation, spacing, long lines) 2020-10-02 11:59:16 +10:00
Campbell Barton bab9de2a52 Cleanup: pep8, blank lines 2020-10-02 11:59:16 +10:00
Aaron Carlisle 4d7b664e1a API Docs: Minor text improvements 2020-09-28 20:11:06 -04:00
Max Schlecht aead4b3cab API Docs: Fix xref urls
Fully revert D7913 "Fix T77276: Generating Python API docs raises many warnings"

{D7913} broke xrefs/links to other types and permalinks in the docs. This makes the python api docs for 2.90 and 2.91 completely unusable.
It got partially reverted in commit e893430a63. That didn't fix those two issues though, so it should be fully reverted.

As you can see here, i'm not able to click `bpy_struct.id_data`, because no <a> tag got generated in the html.
{F8889934}

Here you can see a working, but wrong permalink, generated by clicking the little chain. (It should be `bpy.types.MeshVertices`, not `bpy.types.MeshVertices.MeshVertices`)
{F8889938}

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D8913
2020-09-24 23:14:15 -04:00
Aaron Carlisle e893430a63 Partly revert "Fix T77276: Generating Python API docs raises many warnings"
This commit reverts the "noindex" part of the original commit.
using noindex made it imposible to link to a specific property.

The original warnings do not pose an issue so until a proper solution is 
found I am reverting this commit.

This reverts commit 953c232db3
2020-07-27 13:01:28 -04:00
Campbell Barton a197b81090 Docs: include 'bl_math' module 2020-07-22 14:36:30 +10:00
Aaron Carlisle b0449cac66 API Docs: Small edits to recent commit
- Revert string formatting change
- Add missing text edit
2020-06-23 17:10:07 -04:00
Campbell Barton bab2b02507 Cleanup: style, raw multi-line string sphinx updater 2020-06-23 23:32:47 +10:00
Campbell Barton 6d639a606c Docs: quiet deprecation warning, add missing context members 2020-06-23 23:32:36 +10:00
Campbell Barton 502e6bd839 Fix doc generation for enum & attr's with multi-line descriptions 2020-06-18 16:26:16 +10:00
Aaron Carlisle 953c232db3 Fix T77276: Generating Python API docs raises many warnings 2020-06-04 22:31:54 +10:00
Brecht Van Lommel c93a88413d Merge branch 'blender-v2.83-release' 2020-05-29 18:05:04 +02:00
Brecht Van Lommel a86b5df005 Blender: change bugfix release versioning from a/b/c to .1/.2/.3
The file subversion is no longer used in the Python API or user interface,
and is now internal to Blender.

User interface, Python API and file I/O metadata now use more consistent
formatting for version numbers. Official releases use "2.83.0", "2.83.1",
and releases under development use "2.90.0 Alpha", "2.90.0 Beta".

Some Python add-ons may need to lower the Blender version in bl_info to
(2, 83, 0) or (2, 90, 0) if they used a subversion number higher than 0.
https://wiki.blender.org/wiki/Reference/Release_Notes/2.83/Python_API#Compatibility

This change is in preparation of LTS releases, and also brings us more
in line with semantic versioning.

Fixes T76058.

Differential Revision: https://developer.blender.org/D7748
2020-05-29 17:48:26 +02:00
Campbell Barton 9947b1fda6 Merge branch 'blender-v2.83-release' 2020-05-12 12:53:48 +10:00
Aaron Carlisle 5852f97dc2 API Docs: Fix broken url markup 2020-05-11 21:35:33 -04:00
Campbell Barton 0e41305344 Cleanup: reference 'bpy.types.bpy_struct' directly
Previously there wasn't a way to access this directly from bpy.types.
2020-05-11 16:56:09 +10:00
Campbell Barton 364780bce5 Docs: list inherited C/Python API functions 2020-05-11 16:43:49 +10:00
Campbell Barton 63849aac95 Fix duplicate property references in generated API docs 2020-05-11 16:41:06 +10:00
Campbell Barton e3673fd869 Fix building docs with sphinx 3.x 2020-05-11 16:09:56 +10:00
Bastien Montagne 5d3c7d1218 usual PY API doc gen fix after adding a new member to Context... 2020-04-06 12:16:07 +02:00
Bastien Montagne db4d264e70 fix API doc generation after new `volume` entry in context... 2020-03-20 10:48:30 +01:00
Sybren A. Stüvel 2d5773d11a Documentation: added bpy.msgbus description and examples
The `bpy.msgbus` namespace was not included in the documentation generation.
I've added it, and ported Campbell's examples from P563.
2020-03-06 14:29:03 +01:00
Aaron Carlisle dc257318d0 PyAPI Doc: Add missing Imbuf documentantion
The documentation existed but it was never added to the script.
2020-02-25 23:17:01 -05:00
Bastien Montagne dfa3f51e52 Fix (unreported) broken PY API doc gen after recent GP changes.
As usual... Adding/removing members from context requires updates of the
API building script.
2020-01-13 15:58:05 +01:00
Bastien Montagne 50b478e328 Fix Py API doc generation after Mantaflow merge. 2019-12-23 15:19:03 +01:00
Campbell Barton 0384cc6f78 API Docs: don't show functions in 'bpy.app.handlers'
This shows the function and it's memory location,
it's not useful for docs so remove it.
2019-11-16 02:41:17 +11:00
Campbell Barton 4ca87085e0 API Docs: only document built-in types
Some types were documented in bpy.types aren't accessible there.

For now, disable documenting types from add-ons and some types from
bl_operators, bl_ui... since these are mostly for internal use.
2019-11-16 02:39:51 +11:00
Aaron Carlisle 52cf94eeb5 API Docs: Change handling of Blender Version 2019-07-08 20:53:15 -04:00
Aaron Carlisle 1f2f5f660b API Docs: Use Opensearch 2019-07-06 17:01:11 -04:00
Aaron Carlisle f702830a79 API Docs: Theme: Prevent Super Long Enums 2019-07-06 17:01:10 -04:00
Aaron Carlisle 6fad70d551 Cleanup: API Doc Gen: move copying static dir to own function 2019-07-06 17:01:10 -04:00
Aaron Carlisle 66a69fa220 API Docs: Theme Options
- Limit Nav depth to 1
- Turn off stick nav
- Add canonical_url
2019-07-03 22:46:52 -04:00
Campbell Barton 52b4afacb2 Fix errors raised at generating Python API docs
D5121 by @Nutti
2019-06-24 20:07:20 +10:00