WIP: Compositor Viewer shortcuts prototype #105268

Draft
Habib Gahbiche wants to merge 1 commits from zazizizou/blender-addons:com-wrangler-viewer-shortcuts into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

This is a prototype to be used for user validation.

Press Ctrl+1 to view selected node and set to favorites
Press 1 to view favorite node

Same goes for pressing 2, 3, 4 and 5

This is a prototype to be used for user validation. Press Ctrl+1 to view selected node and set to favorites Press 1 to view favorite node Same goes for pressing 2, 3, 4 and 5
Habib Gahbiche added 1 commit 2024-04-06 17:25:25 +02:00
7be7b70e3c Compositor Viewer shortcuts prototype
Press Ctrl+1 to view selected node and set to favorites
Press 1 to view favorite node

Same goes for pressing 2, 3, 4 and 5
Author
Member

@blender-bot package

@blender-bot package
Member

Can only build blender/blender and blender/blender-manual. See documentation for details.

Can only build blender/blender and blender/blender-manual. See [documentation](https://projects.blender.org/infrastructure/blender-bot/src/branch/main/README.md) for details.
Damien Picard reviewed 2024-04-06 19:14:30 +02:00
Damien Picard left a comment
Member

This looks very useful! RTS-style :D

This looks very useful! RTS-style :D
@ -489,0 +493,4 @@
bl_description = "Preview favorite nodes by pressing 1, 2, 3, 4 and 5"
bl_options = {'REGISTER', 'UNDO'}
# Workaround: simulating a dict with json.loads() and json.dumps()
Member

You can store the dict directly here, I don’t think you need to bother serializing to a property.

You can store the dict directly here, I don’t think you need to bother serializing to a property.
@ -489,0 +518,4 @@
temp_dict[self.viewer_index] = n1.name
self.node_preview_map = json.dumps(temp_dict)
bpy.ops.node.link_viewer()
Member

With a slight modification of NWPreviewNode, you could use this to make it work in shader trees as well:

                if context.space_data.tree_type in {'CompositorNodeTree', 'GeometryNodeTree'}:
                    bpy.ops.node.link_viewer()
                elif context.space_data.tree_type == 'ShaderNodeTree':
                    bpy.ops.node.nw_preview_node()

@@ -764,6 +764,8 @@ class NWPreviewNode(Operator, NWBase):
         if 'FINISHED' not in select_node:  # only run if mouse click is on a node
             return {'CANCELLED'}
 
+    def execute(self, context):
+        space = context.space_data
         base_node_tree = space.node_tree
         active_tree = context.space_data.edit_tree
         path = context.space_data.path
With a slight modification of `NWPreviewNode`, you could use this to make it work in shader trees as well: ```python if context.space_data.tree_type in {'CompositorNodeTree', 'GeometryNodeTree'}: bpy.ops.node.link_viewer() elif context.space_data.tree_type == 'ShaderNodeTree': bpy.ops.node.nw_preview_node() ``` --- ```diff @@ -764,6 +764,8 @@ class NWPreviewNode(Operator, NWBase): if 'FINISHED' not in select_node: # only run if mouse click is on a node return {'CANCELLED'} + def execute(self, context): + space = context.space_data base_node_tree = space.node_tree active_tree = context.space_data.edit_tree path = context.space_data.path ```
@ -2592,6 +2641,63 @@ class NWAddMultipleImages(Operator, NWBase, ImportHelper):
return {'FINISHED'}
class NWViewerFocus(bpy.types.Operator):
Member

I think this was added back by mistake?

I think this was added back by mistake?
Author
Member

@pioverfour thanks for looking into this! I was hoping I could create an installer directly with this patchset, but I will create a general devtalk thread with some other proposals and then address your comments, if we decide to move on with the solution as an add-on

@pioverfour thanks for looking into this! I was hoping I could create an installer directly with this patchset, but I will create a general devtalk thread with some other proposals and then address your comments, if we decide to move on with the solution as an add-on
Member

@pioverfour thanks for looking into this! I was hoping I could create an installer directly with this patchset, but I will create a general devtalk thread with some other proposals and then address your comments, if we decide to move on with the solution as an add-on

No problem! I hadn’t understood it was too early for review.

> @pioverfour thanks for looking into this! I was hoping I could create an installer directly with this patchset, but I will create a general devtalk thread with some other proposals and then address your comments, if we decide to move on with the solution as an add-on No problem! I hadn’t understood it was too early for review.
Habib Gahbiche changed title from Compositor Viewer shortcuts prototype to WIP: Compositor Viewer shortcuts prototype 2024-04-09 18:55:13 +02:00
This pull request is marked as a work in progress.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u com-wrangler-viewer-shortcuts:zazizizou-com-wrangler-viewer-shortcuts
git checkout zazizizou-com-wrangler-viewer-shortcuts
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#105268
No description provided.