8 Commits

Author SHA1 Message Date
Campbell Barton
b4fbc0c32d Cleanup: remove f-strings use, use double quotes, quiet pylint warnings 2025-09-26 14:31:05 +10: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
7cbc94d835 Fix some exceptions in Python operators when poll fails 2024-10-31 18:50:03 +11:00
Campbell Barton
a9dee36974 Cleanup: remove unused variables, imports 2024-09-27 23:37:18 +10:00
Damien Picard
f87d4e4e40 I18n: Extract and disambiguate a few messages
Extract
- Cycles denoiser enum.
- Extensions user preferences UI.
- Node operator poll message from new node function.

Improve
- Split "(Enabled|Disabled) on startup, overriding the preference."
into two messages.

Disambiguate
- "Add" when describing the action of adding something should use the
  Operator context.
- "Dimensions", in noise textures.
- "Transform" as a noun, the matrix transform type of Geometry Nodes,
  as opposed to the verb to move things in space.
- "Parent" as a noun or verb (the parent of an object, to parent an
  object to another).

Some issues reported by Satoshi Yamasaki, deathblood, and Gabriel Gazzán.

Pull Request: https://projects.blender.org/blender/blender/pulls/122969
2024-06-13 12:15:55 +02:00
Damien Picard
15ec49ff28 Nodes: improve temp viewer from Connect to Output
This PR changes the temporary viewers created in node groups by Connect to Output in two ways:
- Rename it, as it is currently called "tmp_viewer", which stands out
  as strange and code-like. It is renamed to "(Viewer)", which can be
  translated.
- Use the actual connected socket type.
  Currently the viewer uses hardcoded socket types (Geometry for Geometry
  Nodes, Shader for shader nodes). While in GN we can only connect
  geometry to the output, in shader nodes other types can be inspected.
  This change allows the tmp_viewer to use the type of the actual socket
  being inspected, to have a better idea of what it contains from
  outside the group.

  It can be especially useful if a group is used in multiple materials
  and different sockets are being previewed in each one.

It also does some cleanup, details in the commits.

Pull Request: https://projects.blender.org/blender/blender/pulls/122520
2024-06-06 14:47:23 +02:00
Campbell Barton
ddb00ad5e4 License headers: add SPDX header 2024-05-29 12:49:07 +10:00
Nika Kutsniashvili
61178b22a2 Nodes: port "Connect to Output" operator from Node Wrangler
As Node Wrangler add-on is moving to extensions platform and maybe isn't shipped
with Blender from 4.2 onwards, some of it's more important functionalities which are
crucial for Blender UX can be ported inside core. Also see #121749.

This PR ports "Preview Node" operator from add-on inside `scripts/startup/bl_operators`.

When Shift-Ctrl (or Shift-Alt) clicked on the node operator connects output socket of the
node to active Output node in the tree (group, material, light, or world output). For Geometry
Nodes this is just handy operator, but in Shader Nodes, because Viewer Node isn't
implemented, this has always been the only way to quickly preview nodes by connecting
it to Material Output.

Changes made from Node Wrangler version:
- Renamed operator from "Preview Node" to "**Connect to Output**", because node previews
  already mean a different thing in context of compositor and shader editor, and viewer node
  is used for previewing in geometry nodes. Connect to Output is correct name because in every
  context it's called that's what it does.
- Assigned shortcut Shift-Alt-Click in shader editor as well. Even though Shift-Ctrl click already
  works, it's good to have consistency with geometry nodes, so that users can use same shortcut
  in both contexts.

Operator doesn't work in compositor. It's not clear if that's wanted (to connect to Composite node),
and if it is it'll be added in separate PR.

Original authors of the add-on: Bartek Skorupa, Greg Zaal, Sebastian Koenig, Christian Brinkmann, Florian Meyer

Pull Request: https://projects.blender.org/blender/blender/pulls/122016
2024-05-28 16:42:55 +02:00