CMake: add WITH_LINKER_LLD option for unix platforms
[blender-staging.git] / release / scripts / startup / bl_ui / space_node.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2 #
3 #  This program is free software; you can redistribute it and/or
4 #  modify it under the terms of the GNU General Public License
5 #  as published by the Free Software Foundation; either version 2
6 #  of the License, or (at your option) any later version.
7 #
8 #  This program is distributed in the hope that it will be useful,
9 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 #  GNU General Public License for more details.
12 #
13 #  You should have received a copy of the GNU General Public License
14 #  along with this program; if not, write to the Free Software Foundation,
15 #  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20 import bpy
21 import nodeitems_utils
22 from bpy.types import Header, Menu, Panel
23 from bpy.app.translations import pgettext_iface as iface_
24 from bpy.app.translations import contexts as i18n_contexts
25 from bl_ui.utils import PresetPanel
26 from bl_ui.properties_grease_pencil_common import (
27     AnnotationDataPanel,
28 )
29 from bl_ui.space_toolsystem_common import (
30     ToolActivePanelHelper,
31 )
32 from bl_ui.properties_material import (
33     EEVEE_MATERIAL_PT_settings,
34     MATERIAL_PT_viewport
35 )
36 from bl_ui.properties_world import (
37     WORLD_PT_viewport_display
38 )
39 from bl_ui.properties_data_light import (
40     DATA_PT_light,
41     DATA_PT_EEVEE_light,
42 )
43
44
45 class NODE_HT_header(Header):
46     bl_space_type = 'NODE_EDITOR'
47
48     def draw(self, context):
49         layout = self.layout
50
51         scene = context.scene
52         snode = context.space_data
53         snode_id = snode.id
54         id_from = snode.id_from
55         tool_settings = context.tool_settings
56         is_compositor = snode.tree_type == 'CompositorNodeTree'
57
58         layout.template_header()
59
60         # Now expanded via the 'ui_type'
61         # layout.prop(snode, "tree_type", text="")
62
63         if snode.tree_type == 'ShaderNodeTree':
64             layout.prop(snode, "shader_type", text="")
65
66             ob = context.object
67             if snode.shader_type == 'OBJECT' and ob:
68                 ob_type = ob.type
69
70                 NODE_MT_editor_menus.draw_collapsible(context, layout)
71
72                 # No shader nodes for Eevee lights
73                 if snode_id and not (context.engine == 'BLENDER_EEVEE' and ob_type == 'LIGHT'):
74                     row = layout.row()
75                     row.prop(snode_id, "use_nodes")
76
77                 layout.separator_spacer()
78
79                 types_that_support_material = {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META',
80                                                'GPENCIL', 'VOLUME', 'HAIR', 'POINTCLOUD'}
81                 # disable material slot buttons when pinned, cannot find correct slot within id_from (#36589)
82                 # disable also when the selected object does not support materials
83                 has_material_slots = not snode.pin and ob_type in types_that_support_material
84
85                 if ob_type != 'LIGHT':
86                     row = layout.row()
87                     row.enabled = has_material_slots
88                     row.ui_units_x = 4
89                     row.popover(panel="NODE_PT_material_slots")
90
91                 row = layout.row()
92                 row.enabled = has_material_slots
93
94                 # Show material.new when no active ID/slot exists
95                 if not id_from and ob_type in types_that_support_material:
96                     row.template_ID(ob, "active_material", new="material.new")
97                 # Material ID, but not for Lights
98                 if id_from and ob_type != 'LIGHT':
99                     row.template_ID(id_from, "active_material", new="material.new")
100
101             if snode.shader_type == 'WORLD':
102                 NODE_MT_editor_menus.draw_collapsible(context, layout)
103
104                 if snode_id:
105                     row = layout.row()
106                     row.prop(snode_id, "use_nodes")
107
108                 layout.separator_spacer()
109
110                 row = layout.row()
111                 row.enabled = not snode.pin
112                 row.template_ID(scene, "world", new="world.new")
113
114             if snode.shader_type == 'LINESTYLE':
115                 view_layer = context.view_layer
116                 lineset = view_layer.freestyle_settings.linesets.active
117
118                 if lineset is not None:
119                     NODE_MT_editor_menus.draw_collapsible(context, layout)
120
121                     if snode_id:
122                         row = layout.row()
123                         row.prop(snode_id, "use_nodes")
124
125                     layout.separator_spacer()
126
127                     row = layout.row()
128                     row.enabled = not snode.pin
129                     row.template_ID(lineset, "linestyle", new="scene.freestyle_linestyle_new")
130
131         elif snode.tree_type == 'TextureNodeTree':
132             layout.prop(snode, "texture_type", text="")
133
134             NODE_MT_editor_menus.draw_collapsible(context, layout)
135
136             if snode_id:
137                 layout.prop(snode_id, "use_nodes")
138
139             layout.separator_spacer()
140
141             if id_from:
142                 if snode.texture_type == 'BRUSH':
143                     layout.template_ID(id_from, "texture", new="texture.new")
144                 else:
145                     layout.template_ID(id_from, "active_texture", new="texture.new")
146
147         elif snode.tree_type == 'CompositorNodeTree':
148
149             NODE_MT_editor_menus.draw_collapsible(context, layout)
150
151             if snode_id:
152                 layout.prop(snode_id, "use_nodes")
153
154         elif snode.tree_type == 'SimulationNodeTree':
155             row = layout.row(align=True)
156             row.prop(snode, "simulation", text="")
157             row.operator("simulation.new", text="", icon='ADD')
158             simulation = snode.simulation
159             if simulation:
160                 row.prop(snode.simulation, "use_fake_user", text="")
161
162         else:
163             # Custom node tree is edited as independent ID block
164             NODE_MT_editor_menus.draw_collapsible(context, layout)
165
166             layout.separator_spacer()
167
168             layout.template_ID(snode, "node_tree", new="node.new_node_tree")
169
170         # Put pin next to ID block
171         if not is_compositor:
172             layout.prop(snode, "pin", text="", emboss=False)
173
174         layout.separator_spacer()
175
176         # Put pin on the right for Compositing
177         if is_compositor:
178             layout.prop(snode, "pin", text="", emboss=False)
179
180         layout.operator("node.tree_path_parent", text="", icon='FILE_PARENT')
181
182         # Backdrop
183         if is_compositor:
184             row = layout.row(align=True)
185             row.prop(snode, "show_backdrop", toggle=True)
186             sub = row.row(align=True)
187             sub.active = snode.show_backdrop
188             sub.prop(snode, "backdrop_channels", icon_only=True, text="", expand=True)
189
190         # Snap
191         row = layout.row(align=True)
192         row.prop(tool_settings, "use_snap", text="")
193         row.prop(tool_settings, "snap_node_element", icon_only=True)
194         if tool_settings.snap_node_element != 'GRID':
195             row.prop(tool_settings, "snap_target", text="")
196
197
198 class NODE_MT_editor_menus(Menu):
199     bl_idname = "NODE_MT_editor_menus"
200     bl_label = ""
201
202     def draw(self, _context):
203         layout = self.layout
204         layout.menu("NODE_MT_view")
205         layout.menu("NODE_MT_select")
206         layout.menu("NODE_MT_add")
207         layout.menu("NODE_MT_node")
208
209
210 class NODE_MT_add(bpy.types.Menu):
211     bl_space_type = 'NODE_EDITOR'
212     bl_label = "Add"
213     bl_translation_context = i18n_contexts.operator_default
214
215     def draw(self, context):
216         layout = self.layout
217
218         layout.operator_context = 'INVOKE_DEFAULT'
219         props = layout.operator("node.add_search", text="Search...", icon='VIEWZOOM')
220         props.use_transform = True
221
222         layout.separator()
223
224         # actual node submenus are defined by draw functions from node categories
225         nodeitems_utils.draw_node_categories_menu(self, context)
226
227
228 class NODE_MT_view(Menu):
229     bl_label = "View"
230
231     def draw(self, context):
232         layout = self.layout
233
234         snode = context.space_data
235
236         layout.prop(snode, "show_region_toolbar")
237         layout.prop(snode, "show_region_ui")
238
239         layout.separator()
240
241         # Auto-offset nodes (called "insert_offset" in code)
242         layout.prop(snode, "use_insert_offset")
243
244         layout.separator()
245
246         layout.operator("view2d.zoom_in")
247         layout.operator("view2d.zoom_out")
248
249         layout.separator()
250
251         layout.operator("node.view_selected")
252         layout.operator("node.view_all")
253
254         if context.space_data.show_backdrop:
255             layout.separator()
256
257             layout.operator("node.backimage_move", text="Backdrop Move")
258             layout.operator("node.backimage_zoom", text="Backdrop Zoom In").factor = 1.2
259             layout.operator("node.backimage_zoom", text="Backdrop Zoom Out").factor = 1.0 / 1.2
260             layout.operator("node.backimage_fit", text="Fit Backdrop to Available Space")
261
262         layout.separator()
263
264         layout.menu("INFO_MT_area")
265
266
267 class NODE_MT_select(Menu):
268     bl_label = "Select"
269
270     def draw(self, _context):
271         layout = self.layout
272
273         layout.operator("node.select_box").tweak = False
274         layout.operator("node.select_circle")
275
276         layout.separator()
277         layout.operator("node.select_all").action = 'TOGGLE'
278         layout.operator("node.select_all", text="Inverse").action = 'INVERT'
279         layout.operator("node.select_linked_from")
280         layout.operator("node.select_linked_to")
281
282         layout.separator()
283
284         layout.operator("node.select_grouped").extend = False
285         layout.operator("node.select_same_type_step", text="Activate Same Type Previous").prev = True
286         layout.operator("node.select_same_type_step", text="Activate Same Type Next").prev = False
287
288         layout.separator()
289
290         layout.operator("node.find_node")
291
292
293 class NODE_MT_node(Menu):
294     bl_label = "Node"
295
296     def draw(self, _context):
297         layout = self.layout
298
299         layout.operator("transform.translate")
300         layout.operator("transform.rotate")
301         layout.operator("transform.resize")
302
303         layout.separator()
304         layout.operator("node.clipboard_copy", text="Copy")
305         layout.operator("node.clipboard_paste", text="Paste")
306         layout.operator("node.duplicate_move")
307         layout.operator("node.delete")
308         layout.operator("node.delete_reconnect")
309
310         layout.separator()
311
312         layout.operator("node.join", text="Join in New Frame")
313         layout.operator("node.detach", text="Remove from Frame")
314
315         layout.separator()
316
317         layout.operator("node.link_make").replace = False
318         layout.operator("node.link_make", text="Make and Replace Links").replace = True
319         layout.operator("node.links_cut")
320         layout.operator("node.links_detach")
321
322         layout.separator()
323
324         layout.operator("node.group_edit").exit = False
325         layout.operator("node.group_ungroup")
326         layout.operator("node.group_make")
327         layout.operator("node.group_insert")
328
329         layout.separator()
330
331         layout.operator("node.hide_toggle")
332         layout.operator("node.mute_toggle")
333         layout.operator("node.preview_toggle")
334         layout.operator("node.hide_socket_toggle")
335         layout.operator("node.options_toggle")
336         layout.operator("node.collapse_hide_unused_toggle")
337
338         layout.separator()
339
340         layout.operator("node.read_viewlayers")
341
342
343 class NODE_PT_active_tool(ToolActivePanelHelper, Panel):
344     bl_space_type = 'NODE_EDITOR'
345     bl_region_type = 'UI'
346     bl_category = "Tool"
347
348
349 class NODE_PT_material_slots(Panel):
350     bl_space_type = 'NODE_EDITOR'
351     bl_region_type = 'HEADER'
352     bl_label = "Slot"
353     bl_ui_units_x = 12
354
355     def draw_header(self, context):
356         ob = context.object
357         self.bl_label = (
358             "Slot " + str(ob.active_material_index + 1) if ob.material_slots else
359             "Slot"
360         )
361
362     # Duplicate part of 'EEVEE_MATERIAL_PT_context_material'.
363     def draw(self, context):
364         layout = self.layout
365         row = layout.row()
366         col = row.column()
367
368         ob = context.object
369         col.template_list("MATERIAL_UL_matslots", "", ob, "material_slots", ob, "active_material_index")
370
371         col = row.column(align=True)
372         col.operator("object.material_slot_add", icon='ADD', text="")
373         col.operator("object.material_slot_remove", icon='REMOVE', text="")
374
375         col.separator()
376
377         col.menu("MATERIAL_MT_context_menu", icon='DOWNARROW_HLT', text="")
378
379         if len(ob.material_slots) > 1:
380             col.separator()
381
382             col.operator("object.material_slot_move", icon='TRIA_UP', text="").direction = 'UP'
383             col.operator("object.material_slot_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
384
385         if ob.mode == 'EDIT':
386             row = layout.row(align=True)
387             row.operator("object.material_slot_assign", text="Assign")
388             row.operator("object.material_slot_select", text="Select")
389             row.operator("object.material_slot_deselect", text="Deselect")
390
391
392 class NODE_PT_node_color_presets(PresetPanel, Panel):
393     """Predefined node color"""
394     bl_label = "Color Presets"
395     preset_subdir = "node_color"
396     preset_operator = "script.execute_preset"
397     preset_add_operator = "node.node_color_preset_add"
398
399
400 class NODE_MT_node_color_context_menu(Menu):
401     bl_label = "Node Color Specials"
402
403     def draw(self, _context):
404         layout = self.layout
405
406         layout.operator("node.node_copy_color", icon='COPY_ID')
407
408
409 class NODE_MT_context_menu(Menu):
410     bl_label = "Node Context Menu"
411
412     def draw(self, context):
413         layout = self.layout
414
415         selected_nodes_len = len(context.selected_nodes)
416
417         # If nothing is selected
418         # (disabled for now until it can be made more useful).
419         '''
420         if selected_nodes_len == 0:
421             layout.operator_context = 'INVOKE_DEFAULT'
422             layout.menu("NODE_MT_add")
423             layout.operator("node.clipboard_paste", text="Paste")
424             return
425         '''
426
427         # If something is selected
428         layout.operator_context = 'INVOKE_DEFAULT'
429         layout.operator("node.duplicate_move")
430         props = layout.operator("wm.call_panel", text="Rename...")
431         props.name = "TOPBAR_PT_name"
432         props.keep_open = False
433         layout.operator("node.delete")
434         layout.operator("node.clipboard_copy", text="Copy")
435         layout.operator("node.clipboard_paste", text="Paste")
436         layout.operator_context = 'EXEC_DEFAULT'
437
438         layout.operator("node.delete_reconnect")
439
440         if selected_nodes_len > 1:
441             layout.separator()
442
443             layout.operator("node.link_make").replace = False
444             layout.operator("node.link_make", text="Make and Replace Links").replace = True
445             layout.operator("node.links_detach")
446
447             layout.separator()
448
449             layout.operator("node.group_make", text="Group")
450
451         layout.operator("node.group_ungroup", text="Ungroup")
452         layout.operator("node.group_edit").exit = False
453
454         layout.separator()
455
456         layout.operator("node.hide_toggle")
457         layout.operator("node.mute_toggle")
458         layout.operator("node.preview_toggle")
459         layout.operator("node.hide_socket_toggle")
460         layout.operator("node.options_toggle")
461         layout.operator("node.collapse_hide_unused_toggle")
462
463
464 class NODE_PT_active_node_generic(Panel):
465     bl_space_type = 'NODE_EDITOR'
466     bl_region_type = 'UI'
467     bl_category = "Item"
468     bl_label = "Node"
469
470     @classmethod
471     def poll(cls, context):
472         return context.active_node is not None
473
474     def draw(self, context):
475         layout = self.layout
476         node = context.active_node
477
478         layout.prop(node, "name", icon='NODE')
479         layout.prop(node, "label", icon='NODE')
480
481
482 class NODE_PT_active_node_color(Panel):
483     bl_space_type = 'NODE_EDITOR'
484     bl_region_type = 'UI'
485     bl_category = "Item"
486     bl_label = "Color"
487     bl_options = {'DEFAULT_CLOSED'}
488     bl_parent_id = 'NODE_PT_active_node_generic'
489
490     @classmethod
491     def poll(cls, context):
492         return context.active_node is not None
493
494     def draw_header(self, context):
495         node = context.active_node
496         self.layout.prop(node, "use_custom_color", text="")
497
498     def draw_header_preset(self, _context):
499         NODE_PT_node_color_presets.draw_panel_header(self.layout)
500
501     def draw(self, context):
502         layout = self.layout
503         node = context.active_node
504
505         layout.enabled = node.use_custom_color
506
507         row = layout.row()
508         row.prop(node, "color", text="")
509         row.menu("NODE_MT_node_color_context_menu", text="", icon='DOWNARROW_HLT')
510
511
512 class NODE_PT_active_node_properties(Panel):
513     bl_space_type = 'NODE_EDITOR'
514     bl_region_type = 'UI'
515     bl_category = "Item"
516     bl_label = "Properties"
517     bl_options = {'DEFAULT_CLOSED'}
518
519     @classmethod
520     def poll(cls, context):
521         return context.active_node is not None
522
523     def draw(self, context):
524         layout = self.layout
525         node = context.active_node
526         # set "node" context pointer for the panel layout
527         layout.context_pointer_set("node", node)
528
529         if hasattr(node, "draw_buttons_ext"):
530             node.draw_buttons_ext(context, layout)
531         elif hasattr(node, "draw_buttons"):
532             node.draw_buttons(context, layout)
533
534         # XXX this could be filtered further to exclude socket types
535         # which don't have meaningful input values (e.g. cycles shader)
536         value_inputs = [socket for socket in node.inputs if socket.enabled and not socket.is_linked]
537         if value_inputs:
538             layout.separator()
539             layout.label(text="Inputs:")
540             for socket in value_inputs:
541                 row = layout.row()
542                 socket.draw(
543                     context,
544                     row,
545                     node,
546                     iface_(socket.label if socket.label else socket.name, socket.bl_rna.translation_context),
547                 )
548
549
550 class NODE_PT_texture_mapping(Panel):
551     bl_space_type = 'NODE_EDITOR'
552     bl_region_type = 'UI'
553     bl_category = "Item"
554     bl_label = "Texture Mapping"
555     bl_options = {'DEFAULT_CLOSED'}
556     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
557
558     @classmethod
559     def poll(cls, context):
560         node = context.active_node
561         return node and hasattr(node, "texture_mapping") and (context.engine in cls.COMPAT_ENGINES)
562
563     def draw(self, context):
564         layout = self.layout
565         layout.use_property_split = True
566         layout.use_property_decorate = False  # No animation.
567
568         node = context.active_node
569         mapping = node.texture_mapping
570
571         layout.prop(mapping, "vector_type")
572
573         layout.separator()
574
575         col = layout.column(align=True)
576         col.prop(mapping, "mapping_x", text="Projection X")
577         col.prop(mapping, "mapping_y", text="Y")
578         col.prop(mapping, "mapping_z", text="Z")
579
580         layout.separator()
581
582         layout.prop(mapping, "translation")
583         layout.prop(mapping, "rotation")
584         layout.prop(mapping, "scale")
585
586
587 # Node Backdrop options
588 class NODE_PT_backdrop(Panel):
589     bl_space_type = 'NODE_EDITOR'
590     bl_region_type = 'UI'
591     bl_category = "View"
592     bl_label = "Backdrop"
593
594     @classmethod
595     def poll(cls, context):
596         snode = context.space_data
597         return snode.tree_type == 'CompositorNodeTree'
598
599     def draw_header(self, context):
600         snode = context.space_data
601         self.layout.prop(snode, "show_backdrop", text="")
602
603     def draw(self, context):
604         layout = self.layout
605         layout.use_property_split = True
606         layout.use_property_decorate = False
607
608         snode = context.space_data
609         layout.active = snode.show_backdrop
610
611         col = layout.column()
612
613         col.prop(snode, "backdrop_channels", text="Channels")
614         col.prop(snode, "backdrop_zoom", text="Zoom")
615
616         col.prop(snode, "backdrop_offset", text="Offset")
617
618         col.separator()
619
620         col.operator("node.backimage_move", text="Move")
621         col.operator("node.backimage_fit", text="Fit")
622
623
624 class NODE_PT_quality(bpy.types.Panel):
625     bl_space_type = 'NODE_EDITOR'
626     bl_region_type = 'UI'
627     bl_category = "Options"
628     bl_label = "Performance"
629
630     @classmethod
631     def poll(cls, context):
632         snode = context.space_data
633         return snode.tree_type == 'CompositorNodeTree' and snode.node_tree is not None
634
635     def draw(self, context):
636         layout = self.layout
637         layout.use_property_split = True
638         layout.use_property_decorate = False
639
640         snode = context.space_data
641         tree = snode.node_tree
642
643         col = layout.column()
644         col.prop(tree, "render_quality", text="Render")
645         col.prop(tree, "edit_quality", text="Edit")
646         col.prop(tree, "chunk_size")
647
648         col = layout.column()
649         col.prop(tree, "use_opencl")
650         col.prop(tree, "use_groupnode_buffer")
651         col.prop(tree, "use_two_pass")
652         col.prop(tree, "use_viewer_border")
653         col.separator()
654         col.prop(snode, "use_auto_render")
655
656
657 class NODE_UL_interface_sockets(bpy.types.UIList):
658     def draw_item(self, context, layout, _data, item, icon, _active_data, _active_propname, _index):
659         socket = item
660         color = socket.draw_color(context)
661
662         if self.layout_type in {'DEFAULT', 'COMPACT'}:
663             row = layout.row(align=True)
664
665             # inputs get icon on the left
666             if not socket.is_output:
667                 row.template_node_socket(color=color)
668
669             row.prop(socket, "name", text="", emboss=False, icon_value=icon)
670
671             # outputs get icon on the right
672             if socket.is_output:
673                 row.template_node_socket(color=color)
674
675         elif self.layout_type == 'GRID':
676             layout.alignment = 'CENTER'
677             layout.template_node_socket(color=color)
678
679
680 # Grease Pencil properties
681 class NODE_PT_annotation(AnnotationDataPanel, Panel):
682     bl_space_type = 'NODE_EDITOR'
683     bl_region_type = 'UI'
684     bl_category = "View"
685     bl_options = {'DEFAULT_CLOSED'}
686
687     # NOTE: this is just a wrapper around the generic GP Panel
688
689     @classmethod
690     def poll(cls, context):
691         snode = context.space_data
692         return snode is not None and snode.node_tree is not None
693
694
695 def node_draw_tree_view(_layout, _context):
696     pass
697
698
699 # Adapt properties editor panel to display in node editor. We have to
700 # copy the class rather than inherit due to the way bpy registration works.
701 def node_panel(cls):
702     node_cls_dict = cls.__dict__.copy()
703
704     # Needed for re-registration.
705     node_cls_dict.pop("bl_rna", None)
706
707     node_cls = type('NODE_' + cls.__name__, cls.__bases__, node_cls_dict)
708
709     node_cls.bl_space_type = 'NODE_EDITOR'
710     node_cls.bl_region_type = 'UI'
711     node_cls.bl_category = "Options"
712     if hasattr(node_cls, 'bl_parent_id'):
713         node_cls.bl_parent_id = 'NODE_' + node_cls.bl_parent_id
714
715     return node_cls
716
717
718 classes = (
719     NODE_HT_header,
720     NODE_MT_editor_menus,
721     NODE_MT_add,
722     NODE_MT_view,
723     NODE_MT_select,
724     NODE_MT_node,
725     NODE_MT_node_color_context_menu,
726     NODE_MT_context_menu,
727     NODE_PT_material_slots,
728     NODE_PT_node_color_presets,
729     NODE_PT_active_node_generic,
730     NODE_PT_active_node_color,
731     NODE_PT_active_node_properties,
732     NODE_PT_texture_mapping,
733     NODE_PT_active_tool,
734     NODE_PT_backdrop,
735     NODE_PT_quality,
736     NODE_PT_annotation,
737     NODE_UL_interface_sockets,
738
739     node_panel(EEVEE_MATERIAL_PT_settings),
740     node_panel(MATERIAL_PT_viewport),
741     node_panel(WORLD_PT_viewport_display),
742     node_panel(DATA_PT_light),
743     node_panel(DATA_PT_EEVEE_light),
744 )
745
746
747 if __name__ == "__main__":  # only for live edit.
748     from bpy.utils import register_class
749     for cls in classes:
750         register_class(cls)