Commit graph

28 commits

Author SHA1 Message Date
Campbell Barton
3c09df88e4 PyDoc: add missing args, correct function directives
- Add missing doc-strings for function arguments & return.
- Remove unnecessary `bpy.type.` prefix.
- Correct function directives.

Ref !158251
2026-05-07 16:35:51 +10:00
Campbell Barton
998fe01e28 PyDoc: use type-hint syntax, add missing docs & some corrections
sphinx_doc_gen.py:
- Add _PRIVATE_ATTR_INCLUDE so underscore-prefixed types can be
  selectively included in API docs (needed to reference return values).
- Add :return:/:rtype: for operators.
- Fix context type entries (AnnotationLayer, FluidModifier, Curves).

bpy.props:
- Add :return:/:rtype: for property declaration functions.

gpu:
- Expose MatrixStackContext and OffScreenStackContext as documented
  gpu.types so :rtype: references resolve.

bmesh.ops:
- Use Sequence[float] for vector input params.
- Add default_value for single-element BMO_OP_SLOT_ELEMENT_BUF slots.

bpy.types:
- Convert `tuple of X` to `tuple[X, ...]` and `list of X` to `list[X]`.
- Add :return:/:rtype: to Context.path_resolve and Operator.as_keywords.
- Fix Menu example link reference.

bpy_extras:
- Convert Python type annotations to :param:/:type:/:rtype:,
  add missing doc-strings.

bpy.app.handlers:
- Add :type: with callable signatures.
- Fix depsgraph_update handler description
  (the second argument is optional).
- Fix missing argument descriptions for render and undo/redo handlers.

bpy.context
- Use type hints for for property listing.

mathutils.kdtree:
- Fix doc-string syntax.
- Clarify that the size is an upper limit.

Various minor corrections to other modules.
2026-02-12 20:41:34 +11:00
Campbell Barton
1d064dd124 PyDoc: use Literal[...] types for fixed string enum parameters
Replace `:type X: str` with `:type X: Literal[...]` for parameters
for more accurate typing information.
2026-02-10 09:51:28 +00:00
Campbell Barton
17f39b8893 PyDoc: type corrections for Python doc-strings
Also use uppercase 2D/3D.
2026-02-10 14:00:01 +11:00
Campbell Barton
b0fd6cec14 PyDoc: various corrections to doc-strings and examples
- Correct typos/grammar.
- Correct examples.
- Fixes for RST syntax examples.
- Add missing arguments.
2026-02-10 01:49:44 +00:00
Campbell Barton
81857ea926 PyDoc: add missing Python doc-strings
Various Python utility functions were missing doc-strings.
2026-02-10 01:04:51 +00:00
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
Campbell Barton
d7d8e7a1df Fix #152809: bpy_extras.io_utils.orientation_helper fails on Python 3.14
The workaround for #58772 created an empty `__annotations__` dict to
prevent modifying a parent class's annotations. In Python 3.14 (PEP 649),
this broke because it overwrote the lazily-evaluated annotations that
the new descriptor-based system would have created.

Skip the workaround for Python 3.14+ since lazy evaluation ensures
`cls.__annotations__` always returns a dict specific to that class.

Ref !153384
2026-01-26 10:00:56 +00:00
Campbell Barton
7a249222be Cleanup: tweak multi-line parenthesis for Python scripts
Reduce right shift, moving closing parenthesis onto own line
for clarity & reducing diff noise in some cases.

Ref !147857
2025-10-12 03:31:31 +00:00
Alaska
2f02866519 Fix #146322: Spelling mistake and missing return type for axis_conversion
Fix typo in PyApi doc of `axis_conversion` and add return type

Pull Request: https://projects.blender.org/blender/blender/pulls/146353
2025-09-22 15:48:11 +02:00
Damien Picard
5998795aa6 UI: Replace contractions with long-form text
Avoid using contractions for can't, aren't, doesn't, and shouldn't.
Following the writing style guide in the Human Interface Guidelines.

Pull Request: https://projects.blender.org/blender/blender/pulls/143852
2025-08-05 11:16:22 +02:00
Campbell Barton
81e4558ab6 Cleanup: reduce right-shift in Python scripts 2025-07-22 11:59:43 +10:00
Damien Picard
3aa633304a I18n: Disambiguate "Strip" for exporter filepath mode
"Strip" generally is a sequencer or animation strip, but in this
context it is a string manipulation action for file names. It is
defined as part of the Path Mode defined in the FBX and OBJ exporters.
Those exporters are defined in Python and C++, respectively. This
commit changes both exporters to use the "File browser" translation
context.

In addition, the tooltip for "Relative" from the FBX exporter was
changed to match its OBJ counterpart, and the "Strip Path" mode was
also matched to the other version which reads better as an enum item.

Reported by Ye Gui in #43295.
2025-07-07 12:02:25 +02:00
Jonas Holzman
0ee4ae89e4 UI: Capitalize default filenames from "untitled" to "Untitled"
Capitalize the default filename used for .blend files and other savable
and exportable file formats (like images, 3D formats, etc.) from
"untitled" to "Untitled".

Pull Request: https://projects.blender.org/blender/blender/pulls/132424
2025-01-13 20:06:27 +01:00
Campbell Barton
6ca1417103 Cleanup: suppress unused Python warnings
Suppress unused warnings using the "vulture" utility.

- Include public definitions in the modules `__all__`.
- Mark arguments & variables as unused with a "_" prefix.
2024-12-03 12:54:13 +11:00
Campbell Barton
f17379a5d0 Merge branch 'blender-v4.3-release' 2024-11-03 16:07:40 +11:00
Campbell Barton
3bcfb151c1 PyDoc: use Python's type annotation syntax for doc-strings
Replace plain-text type information with the type syntax used
for Python's type annotations as it's more concise, especially for
callbacks which often didn't include useful type information.

Note that this change only applies to inline doc-strings,
generated doc-strings from RNA need to be updated separately.

Details:

- Many minor corrections were made when "list" was incorrectly used
  instead of "sequence".
- Some type information wasn't defined in the doc-strings and has been
  added.
- Verbose type info would benefit from support for type aliases.
2024-11-03 15:44:35 +11:00
Campbell Barton
1a1e75c253 Cleanup: replace implicit BaseException with Exception
Exception is more appropriate as a general exception in these cases.
2024-10-08 09:41:51 +11:00
Campbell Barton
0afce08c20 Cleanup: use Python format specifiers 2024-10-01 10:14:48 +10:00
Damien Picard
b37d121e0a I18n: extract and disambiguate a few messages
Extract
- Add to Quick Favorites tooltip.
- "Mask", the name of a newly created mask (DATA_).
- "New" in the context of the new mask ID button.
- A few strings using BLI_STR_UTF8_ defines were not extracted.
  Take the special characters out of the translation macros.
- "External" menu items from the filebrowser's Files context
  menu (right-click on a file). These items were already extracted,
  but not translated.

Improve
- Separate formatted error message "%s is not compatible with
  ["the specified", "any"] 'refresh' options" into two messages.

Disambiguate
- Use Action context for new F-modifiers' names. This is already used
  for the "type" operator prop.
- Translate ImportHelper's default confirmation text using the
  Operator context, as it uses the operator name which is extracted
  with this context.
- "Scale" can be a noun, the scale of something, or a verb, to scale
  something. The latter mostly uses the Operator context, so apply
  this context to verbs, and the default contexts to nouns.
- "Scale Influence" can mean "Influence on Scale" (tracking
  stabilization) and "to Scale the Influence" (dynamic paint canvas).
- "Object Line Art" as type of Line Art to add, as opposed to the
  active object's Line Art settings.
- Float to Integer node: use NodeTree context for the node label, as
  this is already extracted and used for the enum.

Do not translate
- Sequencer labels containing only a string formatting field.

Some issues reported by Gabriel Gazzán and Ye Gui.

Pull Request: https://projects.blender.org/blender/blender/pulls/122283
2024-05-27 19:33:35 +02:00
Campbell Barton
5088b0154d Cleanup: replace %-formatting with str.format in scripts/modules/
The "bl_i18n_utils" module has been excluded I'm not sure how best
to run it with reasonable code coverage.
2024-04-27 16:06:51 +10:00
Hans Goudey
e6808cd558 Cleanup: Make format 2024-03-28 20:55:23 -04:00
Jesse Yurkovich
af7a34dee7 ImportHelper: Common methods for FileHandler drag and drop support
Provide common implementations for two operations that all Python
FileHandlers will typically use.

- `poll_file_object_drop` To be used inside the FileHandler `poll_drop`
   callback
- `invoke_popup` To be used inside the Operator `invoke` callback

The above code closely mirrors what is currently done inside the
existing Blender c++ FileHandlers.

Pull Request: https://projects.blender.org/blender/blender/pulls/119774
2024-03-29 01:22:51 +01:00
Campbell Barton
f347706ecd Cleanup: add "unreachable" message to "assert False" statements
Clarify that these blocks are unreachable so the intention is clear
if they're ever encountered.
2024-03-15 13:20:11 +11: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
Campbell Barton
65f99397ec License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
Campbell Barton
c4c1cc7cd3 Cleanup: double quotes for non-enum strings
Also use back-ticks for code-references in comments.
2023-04-18 10:51:32 +10: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
Renamed from release/scripts/modules/bpy_extras/io_utils.py (Browse further)