30 Commits

Author SHA1 Message Date
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
Habib Gahbiche
fb7818e55e Python: Create default node tree for new materials and worlds
The motivation is to keep backward compatibility after deprecating
 `material.use_nodes()` and `world.use_nodes`. For example the
following script would behave the same way in 4.5 and 5.0:
```python
mat = bpy.data.materials.new("My new mat")
mat.use_nodes = True
```

Pull Request: https://projects.blender.org/blender/blender/pulls/147052
2025-10-01 15:05:16 +02:00
Habib Gahbiche
1b4daf9d2e Nodes: remove "Use Nodes" in Shader Editor for Object Materials
"Use Nodes" was removed in the compositor to simplify the compositing
workflow. This introduced a slight inconsistency with the Shader Node
Editor.

This PR removes "Use Nodes" for object materials.

For Line Style, no changes are planned (not sure how to preserve
compatibility yet).
This simplifies the state of objects; either they have a material or
they don't.

Backward compatibility:
- If Use Nodes is turned Off, new nodes are added to the node tree to
simulate the same material:
- DNA: Only `use_nodes` is marked deprecated
- Python API:
  - `material.use_nodes` is marked deprecated and will be removed in
6.0. Reading it always returns `True` and setting it has no effect.
  - `material.diffuse_color`, `material.specular` etc.. Are not used by
EEVEE anymore but are kept because they are used by Workbench.

Forward compatibility:
Always enable 'Use Nodes' when writing blend files.

Known Issues:
Some UI tests are failing on macOS

Pull Request: https://projects.blender.org/blender/blender/pulls/141278
2025-09-14 17:53:54 +02:00
Damien Picard
ddbc6ed858 I18n: Allow translation of some messages using string formatting
- Add `iface_` translation functions and `translate=False` to a few UI
  elements.
- Add `rpt_` translation functions to a few reports.
2025-09-12 18:30:56 +02:00
Brecht Van Lommel
7acd5b3397 Fix: Image as planes add-on sets wrong alpha for OpenEXR files
This simply removes the operator property to set the alpha mode, so that
this can be automatically determined. The None case was already handled
by Use Transparency, and Channel Packed doesn't make sense here.

Ref #144009

Pull Request: https://projects.blender.org/blender/blender/pulls/144074
2025-08-11 13:58:47 +02:00
Campbell Barton
715a8268fa Build: resolve errors & deprecation warnings with Python 3.14 beta
Python 3.14 has moved some functionality into the public API,
use the updated names even with older Python versions.

Also resolve an error caused by variable reuse with delayed annotation
evaluation for TextureProperties_MixIn on startup.

Resolve #140695.
2025-06-20 14:34:25 +10:00
Bastien Montagne
2d490d47a4 Merge branch 'blender-v4.5-release' 2025-06-16 12:43:46 +02:00
Damien Picard
0bd797a433 I18n: Allow translation of a few reports using formatting
Reports whose message uses string formatting needs to be first
translated, then formatted. Also in one instance, use rpt_() instead
of iface_().
2025-06-16 12:39:02 +02:00
Clément Foucault
4fe75da973 EEVEE: Remove all remaining reference of EEVEE next
This changes the engine identifier back to `BLENDER_EEVEE`.

We keep the `BLENDER_EEVEE_NEXT` identifier around for
versioning reasons (have to detect when it is the active
engine of a older file).

This also rename a bunch of pannels that were using `next`
in their name.

This is a breaking change for Addons compatibility.

Pull Request: https://projects.blender.org/blender/blender/pulls/140282
2025-06-13 12:36:14 +02: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
Damien Picard
45f0d52dc8 I18n: Disambiguate "Extension"
"Extension" means how to extend an image past its bounds, as opposed
to file extension.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Campbell Barton
e97e2e4b6d Merge branch 'blender-v4.3-release' 2024-11-03 22:04:42 +11:00
Campbell Barton
901359abf7 Cleanup: replace doc-strings with comments for internal logic
There is no need to store text in memory for comments on functions
that aren't exposed publicly and are only of used when reading
the code.
2024-11-03 21:50:33 +11:00
Damien Picard
9b78b8d1ed UI: Fix and improve a few messages
- "Export additional animationsThis feature..." -> Add period and
  newline to separate sentences.
- "name from laoded image" -> "Name from loaded image": typo.
- "Duplicate Active Keyframe (All Layer)" -> "All Layers": grammar.
- "%s is no directory" -> "%s is not a directory": grammar.
- "Can't ensure directory: %s" -> "Cannot", see HIG.
- "Duplicate active Frame(s)": title case.
- "Delete active keyframes of all layer" -> "... layers": grammar.
- "Grease Pencil group color tag": title case.
- "color tag": title case.
- "Bake all line art modifiers" -> "... Line Art...": title case for
  product name
- "... imported USD files.Export remaining..." -> "... imported USD
  files.\nExport remaining...": missing newline.
- "Premanently delete brush. This can't be undo." -> "Permanently
  delete brush. This cannot be undone.": typos.
- "Samplerate" -> "Sample Rate": use more correct two-word form.
- Decimate Keyframe operator: rename and rephrase a property to better
  reflect what it does.
  - "Remove" -> "Factor"
  - "The ratio of remaining keyframes after the operation" ->
    "The ratio of keyframes to remove"
- "Add a repository referencing an remote repository" -> "an": typo.
- "... unique within the Action.This is used..." -> "... unique within
  the Action.\nThis is used...": missing newline.
- "Threashold in screen space ... within this threashold " ->
  "Threshold in screen space ... within this threshold ": typo
- "... occluded by other faces (Slower performance)" -> ... (slower
  performance): no need for the capital here.
- "Indices must be sorted in acending order" -> "ascending": typo.
- "Enable the new Overlay code-base" -> "codebase": typo.
- "dectected by plane tracks" -> "detected": typo.
- "the same index can occure" -> "occur": typo.
- "Single element geometry..." -> "Single-element": spelling.
- "it can be quite inefficient to splitup large geometries" -> "split
  up": spelling.
- "If true, true gizmo is displayed..." -> "the gizmo": typo.

Some issues reported by Tamuna Mebonia.

Pull Request: https://projects.blender.org/blender/blender/pulls/129001
2024-10-16 19:05:48 +02:00
Campbell Barton
6cbdf0223b Cleanup: defer imports on startup 2024-10-01 10:01:16 +10:00
Campbell Barton
a9dee36974 Cleanup: remove unused variables, imports 2024-09-27 23:37:18 +10:00
Campbell Barton
e34d9eeac7 Cleanup: use C-style comments, double quote Python text 2024-09-03 21:22:34 +10:00
Campbell Barton
8a7ff41a85 Cleanup: wrap long lines in Python scripts 2024-08-19 10:48:07 +10:00
Campbell Barton
dc74a98b9e Cleanup: remove unused imports 2024-07-23 15:58:21 +10:00
Jeroen Bakker
b761d3435f Image Plane: Add support for EEVEE
- Fixes incorrect handling of incompatible engines. There is a global list of compatible
  engines, but `create_cycles_material` didn't use it, displaying an incorrect warning
  when using the operator.
- Add `BLENDER_EEVEE_NEXT` to compatible engines.
- Remove `BLENDER_EEVEE` from compatible engines.
- Add render method option. This replaces the material `blend_method`
- Remove material blend method option (replaced by `render_method`)
- Remove material shadow option. Not needed anymore as shadows use
  the node tree for evaluation.

**TODO**
- Manual should still be updated. Will be done after this patch lands.
- I did some basic tests. I am not familiar with this operator, but think it
  should handle all the different cases. Would be nice to have some
  render tests for this to detect regressions.

Implements: #122315
Pull Request: https://projects.blender.org/blender/blender/pulls/124094
2024-07-15 15:35:57 +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
Nika Kutsniashvili
1d894aa1a7 Add Convert Image Empty to Mesh Plane operator
Since import images as mesh planes operator was added recently in core
Blender, it is now easy to also support converting image empties to mesh
planes by reusing the same code.

This results in a fast workflow where you can use Blender's drag & drop
& align feature for reference images, and quickly turn them into meshes
without registering second file handler and clicking anything before
import is finished.

Ref !122546
2024-06-06 11:15:47 +10:00
Jeroen Bakker
c7807a425a EEVEE: Alias/remove legacy RNA material attributes
- `bpy.types.Material.blend_method` aliases `bpy.types.Material.surface_render_method`.
  'Opaque' and 'Alpha Clip' maps to deferred.
- Renamed `show_transparent_back` to `use_transparency_overlap`
- Renamed `use_screen_refraction` to `use_raytrace_refraction`
- Deprecate `use_sss_translucency` and `use_sss_translucency`

Related to: #113976

**NOTE**
The light probe changes will be done in a different patch.
Both patches should land just before we remove EEVEE Legacy
from the code-base.

Pull Request: https://projects.blender.org/blender/blender/pulls/122297
2024-06-04 14:48:40 +02:00
Damien Picard
4b4ae72837 Import Images as Planes: improve option panels
- Layout changes
  - Use panels instead of boxes resulting in a more compact UI,
    more suitable to the drag-and-drop UI.
  - Make all enum options to drop-down menus.
  - Rename the title of `Position` box to `Transform`.
  - Remove sub-headers `Plane dimensions`,
    `Orientation` under Transform box.
  - Move offset related options to the bottom. Importing a single
    plane would be more common use case.
- Rename "Animate Image Sequences" to "Detect Image Sequences".
- Rename several labels and option names. Since drop-down allows more
  space, make some option names verbose.
- Remove the warning `'Opaque' does not support alpha`. It should be
  obvious from usual Blender usage, and doesn't need a special warning
  from the add-on.
- Disable Alpha Mode options instead of hiding it when use alpha is
  unchecked.
- Hide Track Camera option instead of disabling it when supported
  align modes are selected.
- Fix or rewrite several tool-tips.

Original PR by Sun Kim: blender/blender-addons!104936

Ref: !122345

Co-authored-by: Sun Kim <perplexing.sun@gmail.com>
2024-05-29 10:02:52 +10:00
Campbell Barton
aea2ac4c78 Fix images-as-planes potentially using linked-library data-blocks
Ensure data-block lookups never return linked-library data.
2024-05-28 16:00:22 +10:00
Campbell Barton
b776d2f5c5 Cleanup: avoid exception handling 2024-05-28 15:58:46 +10:00
Campbell Barton
ca9b105e6c Cleanup: spelling in comments 2024-05-28 13:47:43 +10:00
Damien Picard
3865eb5cdb Fix: error when selecting Size Mode in Import Images as Planes
When importing images as planes, on Size Mode update, this error would
be raised in the console because the update tried to assign a value to
a nonexistent member of the class:

Ref: !122343
2024-05-28 12:01:43 +10:00
Campbell Barton
7911e2614f Cleanup: remove redundant check in image as planes
There was a logical error in some code that didn't run,
remove the check.
2024-05-27 13:02:55 +10:00
Campbell Barton
b5003fa56c Support "Add -> Image -> Mesh Plane" as a built-in operator
Add the operator from the io_import_images_as_planes add-on,
making it a built-in operator.

The main differences with the add-on are:

- Compositor integration has been removed.
- The file handler for dropping images has been removed
  to avoid a popup whenever images are dropped onto Blender.

There were also changes to follow Blender's core scripts more closely:

- Defer imports where possible.
- Use `str.format`.
- Use double-quotes for non-enum strings.
- Remove or "_" prefix unused arguments.
- Avoid unnecessary use back-slashes for wrapping lines.

Otherwise all other functionality has been kept.

Ref !122223

Co-authored-by: Aaron Carlisle <carlisle.b3d@gmail.com>
Co-authored-by: Bastien Montagne <bastien@blender.org>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Co-authored-by: Brendon Murphy <meta.androcto1@gmail.com>
Co-authored-by: CoDEmanX <codemanx@gmx.de>
Co-authored-by: Dalai Felinto <dalai@blender.org>
Co-authored-by: Damien Picard <dam.pic@free.fr>
Co-authored-by: Daniel Salazar <zanqdo@gmail.com>
Co-authored-by: Florian Meyer <florianfelix@web.de>
Co-authored-by: Jacques Lucke <mail@jlucke.com>
Co-authored-by: Jesse Yurkovich <jesse.y@gmail.com>
Co-authored-by: Jonathan Smith <j.jaydez@gmail.com>
Co-authored-by: Luca Bonavita <mindrones@gmail.com>
Co-authored-by: meta-androcto <meta.androcto1@gmail.com>
Co-authored-by: Philipp Oeser <info@graphics-engineer.com>
Co-authored-by: Pratik Borhade <pratikborhade302@gmail.com>
Co-authored-by: Rick Astley <mrbimax>
Co-authored-by: Sergey Sharybin <sergey@blender.org>
Co-authored-by: Sibo Van Gool <SiboVG>
Co-authored-by: Sun Kim <perplexing.sun@gmail.com>
Co-authored-by: Thomas Dinges <blender@dingto.org>
Co-authored-by: Victor Chedeville <victor-09@noreply.localhost>
2024-05-27 12:42:36 +10:00