1 # SPDX-License-Identifier: GPL-2.0-or-later
3 Node Templates - Vignette, Vector Blur
5 Add a set of nodes with one click, in this version I added a "Vignette"
8 There is no official way to make a vignette, this is just my approach at
9 it. Templates: On the Compositor's header, "Template" pulldown. Or hit W.
10 Vignette: Adjust the size and position of the vignette with the Ellipse
11 Mask's X/Y and width, height values.
15 from amaranth
.node_editor
.templates
.vectorblur
import AMTH_NODE_OT_AddTemplateVectorBlur
16 from amaranth
.node_editor
.templates
.vignette
import AMTH_NODE_OT_AddTemplateVignette
23 class AMTH_NODE_MT_amaranth_templates(bpy
.types
.Menu
):
24 bl_idname
= 'AMTH_NODE_MT_amaranth_templates'
25 bl_space_type
= 'NODE_EDITOR'
26 bl_label
= "Templates"
27 bl_description
= "List of Amaranth Templates"
29 def draw(self
, context
):
32 AMTH_NODE_OT_AddTemplateVectorBlur
.bl_idname
,
34 icon
='FORCE_HARMONIC')
36 AMTH_NODE_OT_AddTemplateVignette
.bl_idname
,
41 def node_templates_pulldown(self
, context
):
42 if context
.space_data
.tree_type
== 'CompositorNodeTree':
44 row
= layout
.row(align
=True)
46 row
.menu("AMTH_NODE_MT_amaranth_templates",
51 bpy
.utils
.register_class(AMTH_NODE_MT_amaranth_templates
)
52 bpy
.utils
.register_class(AMTH_NODE_OT_AddTemplateVignette
)
53 bpy
.utils
.register_class(AMTH_NODE_OT_AddTemplateVectorBlur
)
54 bpy
.types
.NODE_HT_header
.append(node_templates_pulldown
)
55 kc
= bpy
.context
.window_manager
.keyconfigs
.addon
56 km
= kc
.keymaps
.new(name
="Node Editor", space_type
="NODE_EDITOR")
57 kmi
= km
.keymap_items
.new("wm.call_menu", "W", "PRESS")
58 kmi
.properties
.name
= "AMTH_NODE_MT_amaranth_templates"
59 KEYMAPS
.append((km
, kmi
))
63 bpy
.utils
.unregister_class(AMTH_NODE_MT_amaranth_templates
)
64 bpy
.utils
.unregister_class(AMTH_NODE_OT_AddTemplateVignette
)
65 bpy
.utils
.unregister_class(AMTH_NODE_OT_AddTemplateVectorBlur
)
66 bpy
.types
.NODE_HT_header
.remove(node_templates_pulldown
)
67 for km
, kmi
in KEYMAPS
:
68 km
.keymap_items
.remove(kmi
)