Commit Graph

1040 Commits

Author SHA1 Message Date
Brecht Van Lommel
9068ea6d45 Merge branch 'blender-v4.2-release' 2024-06-14 15:48:27 +02:00
Brecht Van Lommel
1fec22e350 Fix #104061: RenderEngine Python example does not work in background mode
And add example of how to use bl_use_gpu_context.
2024-06-14 15:47:49 +02:00
Brecht Van Lommel
012a6fc573 Cleanup: make format 2024-06-12 17:43:44 +02:00
Matthew Hinson
a04d0b932f Fix: Broken Dependency Graph Python API example
Fix blender/blender-manual#104712

Pull Request: https://projects.blender.org/blender/blender/pulls/122563
2024-06-12 17:21:52 +02:00
Pratik Borhade
1395a958d7 Fix #122788: Typo in python api docs 2024-06-06 12:49:29 +05:30
Campbell Barton
0f5e816a7d Merge branch 'blender-v4.2-release' 2024-06-06 11:28:06 +10:00
Campbell Barton
949dfbfaa8 Cleanup: Python script formatting
- Double quotes for strings.
- Trailing commas when wrapped lines.
2024-06-06 11:26:28 +10:00
Pablo Vazquez
561f26e31a Docs: Update favicon
Use a higher resolution PNG version of the icon, matching other
websites related to development.

The previous favicon.ico is from the days of the old Typo3 blender.org

Part of infrastructure/blender-org#57107
2024-06-05 19:21:36 +02:00
Campbell Barton
a700fdc163 Fix class methods being excluded from the Python API docs
All class methods were excluded which makes sense for methods such
as poll, draw ... etc. however this would also exclude utility methods
that aren't associated with RNA classes.

The following methods for `bpy.types` classes are now included:

- Macro.define
- UI_UL_list.sort_items_by_name
- {Header/Menu/Panel/UIList}.{append/prepend/remove/is_extended}
2024-06-01 16:17:01 +10:00
Campbell Barton
20d506941b Cleanup: comments in sphinx doc generation 2024-06-01 16:08:54 +10:00
Campbell Barton
c4a0bbb1f4 Extensions: Support online extensions and move add-ons outside Blender
The extensions system allows to extend Blender with connectivity to the internet. Right now it means Blender can
discover and install add-ons and themes directly from the internet, and notify users about their updates.

By default this is disabled (opt-in), and users can enable it the first time they try to install an extension or visit
the Prefences > Extensions tab. If this is enabled, Blender will automatically check for updates for
extensions.blender.org upon startup.

When will Blender access the remote repositories:

* Every time you open the Preferences → Extensions: ALL the enabled repositories get checked for the latest info (json)
* Every time you try to install by dragging: ALL the enabled repositories get checked for the latest info (json).
* Every time you start Blender: selected repositories get checked for the latest info (json).

------------------

From the Blender code point of view, this means that most of the add-ons and themes originally bundled with Blender
will now be available from the online platform, instead of bundled with Blender. The exception are add-ons which are
deemed core functionality which just happened to be written as Python add-ons.

Links:
* Original Extenesions Platform Announcement: https://code.blender.org/2022/10/blender-extensions-platform/
* Extensions website: https://extensions.blender.org/
* User Manual: https://docs.blender.org/manual/en/4.2/extensions/index.html#extensions-index
* Technical specifications: https://developer.blender.org/docs/features/extensions/
* Changes on add-ons bundling: https://devtalk.blender.org/t/changes-to-add-on-bundling-4-2-onwards/34593

------------------

This PR does the following:

* Move extensions out of experimental.
* No longer install `scripts/addons` & `scripts/addons_contrib`.
* Add `scripts/addons_core` to blender's repository.

These add-ons will still be bundled with Blender and will be always enabled in the future, with their preferences
moved to be more closely integrated with the rest of Blender. This will happen during the remaining bcon2 period.
For more details, see #121830

From scripts/addons:

* copy_global_transform.py
* hydra_storm
* io_anim_bvh
* io_curve_svg
* io_mesh_uv_layout
* io_scene_fbx
* io_scene_gltf2
* pose_library
* ui_translate
* viewport_vr_preview

Extra: bl_pkg (scripts/addons_contrib)

Note: The STL (legacy) add-on is going to be moved to the extensions platform. There is already a C++ version on core
which is enabled by default.

All the other add-ons are already available at extensions.blender.org. To use them you need to:

* Go to User Preferences > Extensions
* You will be greated with an "Online Extensions" message, click on "Enable Repository".
* Search the add-on you are looking for (e.g, Import Images as Planes).
* Click on Install

Over time their maintaince will be transferred over to the community so their development can carry on. If you used to
help maintain a bundled add-on please read: https://devtalk.blender.org/t/changes-to-add-on-bundling-4-2-onwards/34593

Ref: !121825
2024-05-15 19:26:29 +02:00
Campbell Barton
8eb0abcc69 Cleanup: replace %-formatting with str.format in doc/ 2024-04-27 16:06:50 +10:00
Campbell Barton
98986c6562 Python: replace '%' with str.format for examples & templates
Use modern/preferred string formatting for user facing scripts.
2024-04-12 15:33:40 +10:00
Germano Cavalcante
ce354c4693 Fix #120484: Typo in Blender Python API docs 2024-04-10 14:28:22 -03:00
Aaron Carlisle
8d12c58f2c Docs: Use reference links when possible when linking to other API 2024-03-29 22:54:12 -04:00
Aaron Carlisle
7b4fa19fca Docs: Python: Add copy button to code blocks
Uses the sphinx-copybutton to add a copy icon to code block to quickly copy content to the clipboard.

Pull Request: #119948
2024-03-29 20:39:35 -04: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
976b2d47b4 Unbreak building PyDocs from error in recent refactor
Building docs with buildinfo was failing
2024-03-27 16:26:31 +11:00
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
7cb8c57728 Docs: Python: Update Sphinx to 7.2.6
This matches what we use for the manual.
Also updates corresponding dependencies.
2024-03-27 00:02:31 -04:00
Campbell Barton
2709888f2d Cleanup: de-duplicate date assignment
Use the same format when there is no build-info available.
2024-03-27 15:01:30 +11:00
Campbell Barton
81a636dcf4 Cleanup: remove unused import, consistent quote style 2024-03-27 14:54:00 +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
Julian Eisel
d470b65f6d Merge branch 'blender-v4.1-release' 2024-03-22 12:28:46 +01:00
Julian Eisel
303014bfac Fix #108078: Crash when inverting results in pose library sidebar
a958ae36e8 introduced support for UI lists to reference items that would
never be shown, regardless of filter settings. This was to skip assets
in the asset view template that were not of the requested type. UI list
sorting code wasn't updated to account for such items that should be
entirely ignored.

Pull Request: https://projects.blender.org/blender/blender/pulls/109157
2024-03-22 12:25:39 +01:00
Aaron Carlisle
02578117cd Merge branch 'blender-v4.1-release' 2024-03-21 23:48:14 -04:00
Aaron Carlisle
476e16a999 Docs: Python API: Fixes for mobile browsers
- Collapse field list on mobile browsers
- Allow horizontal lists to collapse when they do not have enough space
- Break long code reference links
2024-03-21 23:37:44 -04:00
Aaron Carlisle
0b29a63e38 Merge branch 'blender-v4.1-release' 2024-03-20 16:58:20 -04:00
Aaron Carlisle
91aa2a3d84 Docs: Python API: Fix builds on buildbot
Because sphinx-basic-ng does not have an official release on BYPI, pip could not satisfy the dependency.
2024-03-20 16:57:10 -04:00
Aaron Carlisle
1f3582bf95 Merge branch 'blender-v4.1-release' 2024-03-20 16:17:11 -04:00
Aaron Carlisle
429fea4abf Docs: Python API: Update the version switch to match the user manual
Not quite a 1:1 match, some customizations have to be made for the API URL differences and the face that there are no translations.

This also enables the version switch publicly now that this change fixes a few bugs.
2024-03-20 16:10:04 -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
Aaron Carlisle
49cd05020c Docs: Python API: Update the version switch to match the user manual
Not quite a 1:1 match, some customizations have to be made for the API URL differences and the face that there are no translations.

This also enables the version switch publicly now that this change fixes a few bugs.
2024-03-19 20:51:49 -04:00
Brecht Van Lommel
7a395e2e7f Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was f57e4c5b98c075f3dfc61faebbcb43c99a778956.

After this one more fix was committed, this one is preserved as well:
67bd678887d7f8aec9f3b23bbf1aaf29f80d0da4.
2024-03-18 15:04:12 +01:00
nutti
dad9248897 Fix: Invalid RST bpy.utils.register_cli_command formatting
Titles can't be used because this text is indented.

Ref: !119320
2024-03-15 13:31:01 +11: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
9372e0dfe0 CLI: support defining custom commands via C++ & Python API
Add support for add-ons to define commands using the new argument
`-c` or `--command`.

Commands behave as follows:

- Passing in a command enables background mode without the need to pass
  in `--background`.
- All arguments following the command are passed to the command
  (without the need to use the `--` argument).
- Add-ons can define their own commands via
  `bpy.utils.register_cli_command` (see examples in API docs).
- Passing in `--command help` lists all available commands.

Ref !119115
2024-03-08 11:10:13 +11:00
Aaron Carlisle
427dbaed14 Merge branch 'blender-v4.1-release' 2024-02-19 22:12:19 -05:00
Aaron Carlisle
db9a067934 Docs: Updates to python docs to reflect the user manual
These were renamed in the manual. This updates to using the full RNA path for these properties.
2024-02-19 22:11:40 -05:00
Brecht Van Lommel
0f2064bc3b Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was 4bf6a2e564ad2.
2024-02-19 15:59:59 +01:00
Jesse Yurkovich
551b846bcd Merge branch 'blender-v4.1-release' 2024-02-15 16:55:12 -08:00
Jesse Yurkovich
9e8bbc1129 Fix: USD hooks leak
If hooks are not unregistered Blender will report a leak on exit.

Store the hooks as unique_ptrs to remove manual memory management and
encapsulate the previous global list inside a function. These changes
ensure that everything is cleaned up on termination.

Also makes a small change to the hook documentation for a missing
`import` statement.

Pull Request: https://projects.blender.org/blender/blender/pulls/118294
2024-02-16 01:53:33 +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
Damien Picard
fa77e9142d UI: fix and improve a few messages
- "can not" -> "cannot" in many places (ambiguous, also see
  Writing Style guide).
- "Bezier" -> "Bézier": proper spelling of the eponym.
- Tool keymaps: make "Uv" all caps.
- "FFMPEG" -> "FFmpeg" (official spelling)
- Use MULTIPLICATION SIGN U+00D7 instead of MULTIPLICATION X U+2715.
- "LClick" -> "LMB", "RClick" -> "RMB": this convention is used
  everywhere else.
- "Save rendered the image..." -> "Save the rendered image...": typo.
- "Preserve Current retiming": title case for property.
- Bend status message: punctuation.
- "... class used to define the panel" -> "header": copy-paste error.
- "... class used to define the menu" -> "asset": copy-paste error.
- "Lights user to display objects..." -> "Lights used...": typo.
- "-setaudio require one argument" -> "requires": typo.

Some issues reported by Joan Pujolar and Tamar Mebonia.

Pull Request: https://projects.blender.org/blender/blender/pulls/117856
2024-02-05 17:08:17 +01:00
Michael Kowalski
ecbf3385c5 USD: basic support for on_import USD hooks
Added support for defining an on_import() function in
bpy.types.USDHook subclasses.  If on_import() is defined
on a given USD hook, it will be invoked in import_endjob().

The implementation closely follows the existing design of
export hooks.  USDHook.on_import() takes as an argument
an instance of an internally defined USDSceneImportContext
class which provides an accessor to the USD stage.

Also updated the USDHook documentation with an example
on_import() callback implementation.

Pull Request: https://projects.blender.org/blender/blender/pulls/117822
2024-02-05 14:26:02 +01:00