46 Commits

Author SHA1 Message Date
Aras Pranckevicius
5ad6d42c83 IO: Remove Collada import/export
Removes Collada import/export (has been deprecated since 4.2).

Pull Request: https://projects.blender.org/blender/blender/pulls/139337
2025-06-06 08:38:57 +02:00
Pratik Borhade
e82c22f55e Cleanup: Grease Pencil: Remove old IO operator reference
Operator code is removed though they are still referenced in list of
"cleanup operator preset"

Pull Request: https://projects.blender.org/blender/blender/pulls/136062
2025-03-17 07:56:26 +01:00
Campbell Barton
be0c9174aa Cleanup: argument wrapping for Python scripts
- Wrap the closing parenthesis onto it's own line
  which makes assignments to the return value
  read better.
- Reduce right-shift with multi-line function calls.
2025-01-14 12:53:32 +11:00
Campbell Barton
c5203ef7fd Cleanup: use context-manager for opening files 2025-01-04 22:26:18 +11:00
Campbell Barton
0f1e1bcdae Fix error adding presets with Python 3.13
A separate name-space from the functions body is cleaner
and avoids unlikely but possible errors if names ever conflict.
2025-01-04 22:24:00 +11:00
Damien Picard
5715693a97 UI: Use title case for Grease Pencil, Freestyle, Line Art
This was already the case for the vast majority of occurrences, and is
recommended by the human interface guideline's writing style.

Pull Request: https://projects.blender.org/blender/blender/pulls/129000
2024-10-15 13:00:47 +02:00
Campbell Barton
a7ab81d927 PyAPI: remove use of BaseException
BaseException was used as a catch-all in situations where it
didn't make sense and where "Exception" is more appropriate
based on Python's documentation & error checking tools,
`pylint` warns `broad-exception-caught` for e.g.

BaseException includes SystemExit, KeyboardInterrupt & GeneratorExit,
so unless the intention is to catch calls to `sys.exit(..)`,
breaking a out of a loop using Ctrl-C or generator-exit,
then it shouldn't be used.

Even then, it's preferable to catch those exceptions explicitly.
2024-10-01 13:18:46 +10:00
Lukas Tönne
400c738db9 GPv3: Import and export for SVG and PDF
Implements the SVG import/export and PDF export operators for GPv3.

Pull Request: https://projects.blender.org/blender/blender/pulls/123996
2024-08-20 11:41:37 +02:00
Campbell Barton
74fae7f943 Presets: remove poll functions that scan the file-system
The poll functions for theme & key-map preset operators used functions
documented not to be used on redraw draw and could make the interface
slow when extensions (for example) are stored on a network file-system.

While the file-system lookups are typically cached, it can still cause
occasional stuttering or hanging. In general scanning the file-system
on poll should be avoided.
2024-08-15 16:06:17 +10:00
Campbell Barton
9e09351b5b Fix active theme behavior when adding/removing themes
Regression in [0] which displays the filename for the active
theme but still used the label internally.

This meant actions such as removing the theme would not always apply
to the name being displayed.

- Adding a new theme was not setting it active.
- Detecting if a theme was built-in used the run-time label as a lookup.
- Theme removal first require it to be re-selected.

[0]: 0bb6317035c179b7fb520969c2de328df8c820bd
2024-08-15 16:06:13 +10:00
Campbell Barton
9f931ee3d2 Presets: consider presets within the extensions repo to be "built-in"
It was possible to remove a preset defined within an extension,
the only way to restore it was to uninstall & re-install the extension.
2024-08-15 16:06:11 +10:00
Lukas Stockner
6967255906 Color management: Support white balance as part of the display transform
This implements a von-Kries-style chromatic adaption using the Bradford matrix.
The adaption is performed in scene linear space in the OCIO GLSL shader, with
the matrix being computed on the host.

The parameters specify the white point of the input, which is to be mapped to
the white point of the scene linear space. The main parameter is temperature,
specified in Kelvin, which defines the blackbody spectrum that is used as the
input white point. Additionally, a tint parameter can be used to shift the
white point away from pure blackbody spectra (e.g. to match a D illuminant).

The defaults are set to match D65 so there is no immediate color shift when
enabling the option. Tint = 10 is needed since the D-series illuminants aren't
perfect blackbody emitters.

As an alternative to manually specifying the values, there's also a color
picker. When a color is selected, temperature and tint are set such that this
color ends up being balanced to white.
This only works if the color is close enough to a blackbody emitter -
specifically, for tint values within +-150. Beyond this, there can be ambiguity
in the representation.
Currently, in this case, the input is just ignored and temperature/tint aren't
changed. Ideally, we'd eventually give UI feedback for this.

Presets are supported, and all the CIE standard illuminants are included.

One part that I'm not quite happy with is that the tint parameter starts to
give weird results at moderate values when the temperature is low.
The reason for this can be seen here:
https://commons.wikimedia.org/wiki/File:Planckian-locus.png
Tint is moving along the isotherm lines (with the plot corresponding to +-150),
but below 4000K some of that range is outside of the gamut. Not much can
be done there, other than possibly clipping those values...

Adding support for this to the compositor should be quite easy and is planned
as a next step.

Pull Request: https://projects.blender.org/blender/blender/pulls/123278
2024-06-27 23:27:58 +02:00
Campbell Barton
42e1239ba8 Core: support restricting the types an XML preset may load
Prevent potential problems from untrusted XML (typically themes)
traversing into data outside the intended targets.

From what I can tell it's not currently possible but changes to RNA
could allow for this which would likely go by unnoticed.

Further details in code-comments.
2024-06-27 21:21:07 +10:00
Jeroen Bakker
bb9e3df6d2 Fix #122766: Add missing Fast GI options to raytracing presets
The UI has changed and fast GI options was moved to the raytracing
panel in the UI. When this was done they were not added to the
raytracing presets what adds confusion when adding the presets.

This PR adds the fast GI options to the presets.

Pull Request: https://projects.blender.org/blender/blender/pulls/123061
2024-06-11 14:07:03 +02:00
Harley Acheson
d08cebf6d7 Fix #122838: Save and Removal of Themes with Multi-Word Names
In Preferences / Themes you can add a new theme with a name that has
multiple words and the resulting file name will have spaces converted
to underscores. Unfortunately such multi-word themes will not pass the
poll function for saving and deletion. This PR just adds calls that
convert from the display name to file name in order for these to work.

Pull Request: https://projects.blender.org/blender/blender/pulls/122848
2024-06-07 20:20:06 +02: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
Campbell Barton
0c4d3754f1 Cleanup: replace {!s} with {:s} when used with strings
When passing strings to str.format(..) use `{:s}` format specifier
which only takes strings and wont run `.__str__()` on non-strings.

While `{!s}` is an equivalent to `%s`, for the most part `%s` was
used for strings, so using `{:s}` is clearer and more specific.
2024-04-27 16:02:37 +10:00
Campbell Barton
0e3b594edb Refactor: scripts under scripts/startup/ to use str.format
Part of modernizing scripts in Blender, where the previous convention
was to use percentage formatting which has become the "old" way to
format strings in Python.

See proposal for details #120453.

Ref !120552
2024-04-27 16:02:36 +10:00
YimingWu
7a8e4995c8 Fix #120966: Remove sample_clamp for EEVEE raytracing presents
Variable `sample_clamp` has been removed from EEVEE Raytracing presents
by d44ee7bf11, so clean up the code for making presents.

Pull Request: https://projects.blender.org/blender/blender/pulls/120977
2024-04-23 15:55:49 +02:00
Jesse Yurkovich
8392f69e10 Fix 120863: Update presets with recent rename in EEVEE-Next settings
The `screen_trace_max_roughness` setting was renamed to
`trace_max_roughness` but the Presets were not updated [1].

[1] See 9dd164e1ad2555d44bd580f5e7647c1299320c58

Pull Request: https://projects.blender.org/blender/blender/pulls/120865
2024-04-20 22:34:47 +02:00
Campbell Barton
cee184e97a Fix error from recent preset refactor
The recent change in [0] which added a filepath argument to pre/post
callbacks broke adding presets.

Remove the argument from operators as the the filename is sometimes
created based on values set in the pre-callback.

This mostly reverts the change, only keeping the filepath argument
for the static-method callbacks declared on the menu or panels.

[0]: 72e6191c89be7a22b0c6b732e8aae0a0244e6b3e
2024-04-12 16:28:06 +10:00
Campbell Barton
0bb6317035 Theme: store the last loaded preset as a filepath
This is needed so we can reliably know which extension is associated
with a theme, so a theme can be refreshed on update and cleared when
uninstalled, needed to resolve !120289.
2024-04-12 13:23:09 +10:00
Campbell Barton
72e6191c89 PyAPI: include a filepath in preset pre_cb/post_cb callbacks
This is needed so the presets path can be stored in the theme,
so it's possible to keep track of the current theme.

Needed for fixing #120289.
2024-04-12 13:21:42 +10:00
Campbell Barton
182f1746b7 Theme: reset the theme to the default when removing a preset
It's strange to keep the theme displayed after its removal.
2024-04-11 17:44:27 +10:00
Jesse Yurkovich
509a7870c3 Collection Exporters: Enable file exporters to be specified on Collections
This implements the ability to have file exporters added and configured on Collections.

Exporting is reachable from several locations:
- Individually on each exporter configuration: The `Export` button in each panel header
- For all exporters on the collection: The `Export All` button in the main panel interface
- For all exporters on all collections in the scene: The `File`->`Export All Collections` button

Visibility of which collections currently have exporters configured is done by ways of an icon added to the Collection row in the Outliner.

Adding multiple exporters for the same file type is permitted. The user is free to setup several exports of the same format but with different file locations or settings etc.

Notes:
Only USD and Wavefront OBJ are enabled for the initial commit. Additional formats, including those implemented in Python will be added as separate commits after this.

Ref #115690
Pull Request: https://projects.blender.org/blender/blender/pulls/116646
2024-04-08 22:10:39 +02:00
Campbell Barton
a2dae7e4b4 Cleanup: consistent quotes for Python scripts 2024-03-29 10:07:28 +11:00
Campbell Barton
2a55aabbd8 Fix minor error in recent theme preset save operator
Changes to recent commit [0].

- Replace poll_message_set with report in the execute function.
- Remove f-string use which violates string formatting convention.
- Remove unnecessary string to bool.

[0]: ee38a7b723f8f12b695ae30ba300ecc93f29fe76
2024-03-27 15:04:03 +11:00
Harley Acheson
ee38a7b723 UI: Button to Save Custom Themes
Add a new "Save" to the Themes list in Preferences to save (overwrite)
custom themes. The operator has a poll function to disable for built-in
themes. Shows a confirmation when overwriting.

Pull Request: https://projects.blender.org/blender/blender/pulls/119491
2024-03-27 01:11:50 +01:00
Campbell Barton
d07d6f1c10 Cleanup: un-wrap lines that fit within 120 width for Python scripts 2024-03-15 10:04:03 +11:00
Campbell Barton
40ab79c887 Cleanup: format 2024-03-15 09:57:36 +11:00
Harley Acheson
57729aa8bb UI: Improved Operator to Delete Custom Keyconfigs
Changes to python operators that add and remove custom keyconfigs.
Removal gets poll function, separate name and description, and
confirmation.

Pull Request: https://projects.blender.org/blender/blender/pulls/118778
2024-03-14 22:40:04 +01:00
Hans Goudey
726b18eefb Cleanup: Make format 2024-03-14 17:25:36 -04:00
Harley Acheson
a0a2e7e0dd UI: Improved Operator to Delete Custom Themes
Changes to python operators that add and remove custom themes. Removal
gets poll function, separate name and description, and confirmation.

Pull Request: https://projects.blender.org/blender/blender/pulls/118775
2024-03-14 22:01:34 +01:00
Campbell Barton
d5598838a2 Fixes for operator preset cleanup utility
Various fixes to operator preset cleanup:

- Only remove properties that match exactly the properties to exclude
  exactly (taking word boundaries into account).
- When the preset path doesn't exist, don't construct paths relative
  to the working directory.
- Enforce UTF8 encoded text.

Other minor changes:

- Rename "properties" to "properties_exclude" for clarity.
- Use single underscore for private methods.
- Match each line against a single regex instead of constructing a
  string and checking startswith(..) for every property to exclude.
- Use os instead of pathlib, as us used in blender's built in operators
  that handle paths.
- Prefer doc-string over bl_description.
- Double quote strings.
- Use single indentation for lists to reduce right-shift.
2024-02-29 14:00:05 +11:00
Guillermo Venegas
0d7282e69b Fix: Presets overriding drag-n-drop data
Currently, internal I/O operators can be invoked with drag-n-drop path
data, and when this happens a quick popup menu is shown to customize
import settings.

If these operators support operator presets, using a preset can
override path data given by drag-n-drop, and that can be unwanted
behavior.

While this can be fixed by setting path properties to SKIP_SAVE, doing
this would make these properties also to stop using ghost values. These
ghost values are used by the file select window to open operator last
import directory, and using this flag makes the file select windows
always open the home directory.

To fix that, add an explicit flag PROP_SKIP_PRESET that skips properties
writing to presets. Also clarify that PROP_HIDDEN and PROP_SKIP_SAVE
also avoid writing to presets.

Added a operator that can clean operator's specific property presets.
Importing presets from previous versions runs an automatic cleanup.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/117673
2024-02-06 20:02:27 +01:00
Damien Picard
3bd41cf9bc I18n: Go over TIP_ and IFACE_ usages, change to RPT_ when relevant
The previous commit introduced a new `RPT_()` macro to translate
strings which are not tooltips or regular interface elements, but
longer reports or statuses.

This commit uses the new macro to translate many strings all over the
UI.

Most of it is a simple replace from `TIP_()` or `IFACE_()` to
`RPT_()`, but there are some additional changes:
- A few translations inside `BKE_report()` are removed altogether
  because they are already handled by the translation system.
- Messages inside `UI_but_disable()` are no longer translated
  manually, but they are handled by a new regex in the translation
  system.

Pull Request: https://projects.blender.org/blender/blender/pulls/116804

Pull Request: https://projects.blender.org/blender/blender/pulls/116804
2024-01-12 13:37:32 +01:00
Campbell Barton
0ba83fde1f Cleanup: spelling in comments 2024-01-08 11:24:37 +11:00
Jeroen Bakker
2bb7d767c4 EEVEE-Next: Add Raytracing Presets
This PR adds raytracing presets. It contains a preset with default settings and
users are able to add their own.

Pull Request: https://projects.blender.org/blender/blender/pulls/116223
2023-12-24 22:17:31 +01: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
53e6803977 Cleanup: check for "BaseException" instead of "Exception"
Prefer the more generic exception type as it's possible exceptions
derive from this and not "Exception".

Also use the name 'ex' for exceptions instead of 'e'.
2023-07-30 16:14:13 +10:00
Campbell Barton
9f5be2a861 Cleanup: quiet pylint warnings using BaseException 2023-07-30 16:14:11 +10:00
Campbell Barton
65f99397ec License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
guishe
e16ec95a16 UI: Add a custom text editor preference
Add a user preference to set up a custom text editor for editing text
files with the "Edit Source" action in the UI context menu.

- An operator TEXT_OT_jump_to_file_at_point has been added.
- A custom editor can be set in the user preferences.
- A preset has been included for "Visual Studio Code".
- When the editor is not set, use Blender's internal editor.

Ref !108299.
2023-06-07 14:09:19 +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
Damien Picard
38bf3e1911 I18n: translate default preset name
The "New Preset" message was already translated and used in some
preset panels, but not all.

Pull Request: https://projects.blender.org/blender/blender/pulls/106973
2023-04-17 15:00:07 +02: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