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
70 lines
1.4 KiB
Python
70 lines
1.4 KiB
Python
# SPDX-FileCopyrightText: 2009-2023 Blender Authors
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
from __future__ import annotations
|
|
|
|
# support reloading sub-modules
|
|
if "bpy" in locals():
|
|
from importlib import reload
|
|
_modules_loaded[:] = [reload(val) for val in _modules_loaded]
|
|
del reload
|
|
|
|
_modules = [
|
|
"add_mesh_torus",
|
|
"anim",
|
|
"assets",
|
|
"clip",
|
|
"connect_to_output",
|
|
"console",
|
|
"constraint",
|
|
"file",
|
|
"geometry_nodes",
|
|
"image",
|
|
"image_as_planes",
|
|
"mesh",
|
|
"node",
|
|
"object",
|
|
"object_align",
|
|
"object_quick_effects",
|
|
"object_randomize_transform",
|
|
"presets",
|
|
"rigidbody",
|
|
"screen_play_rendered_anim",
|
|
"sequencer",
|
|
"spreadsheet",
|
|
"userpref",
|
|
"uvcalc_follow_active",
|
|
"uvcalc_lightmap",
|
|
"uvcalc_transform",
|
|
"vertexpaint_dirt",
|
|
"view3d",
|
|
"world",
|
|
"wm",
|
|
]
|
|
|
|
import bpy
|
|
|
|
if bpy.app.build_options.freestyle:
|
|
_modules.append("freestyle")
|
|
|
|
__import__(name=__name__, fromlist=_modules)
|
|
_namespace = globals()
|
|
_modules_loaded = [_namespace[name] for name in _modules]
|
|
del _namespace
|
|
|
|
|
|
def register():
|
|
from bpy.utils import register_class
|
|
for mod in _modules_loaded:
|
|
for cls in mod.classes:
|
|
register_class(cls)
|
|
|
|
|
|
def unregister():
|
|
from bpy.utils import unregister_class
|
|
for mod in reversed(_modules_loaded):
|
|
for cls in reversed(mod.classes):
|
|
if cls.is_registered:
|
|
unregister_class(cls)
|