BGE: Some as of yet unmerged work I did in the Swiss branch. These changes include:
[blender-staging.git] / release / scripts / startup / bl_ui / properties_game.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 from bpy.types import Panel
22
23
24 class PhysicsButtonsPanel():
25     bl_space_type = 'PROPERTIES'
26     bl_region_type = 'WINDOW'
27     bl_context = "physics"
28
29
30 class PHYSICS_PT_game_physics(PhysicsButtonsPanel, Panel):
31     bl_label = "Physics"
32     COMPAT_ENGINES = {'BLENDER_GAME'}
33
34     @classmethod
35     def poll(cls, context):
36         ob = context.active_object
37         rd = context.scene.render
38         return ob and ob.game and (rd.engine in cls.COMPAT_ENGINES)
39
40     def draw(self, context):
41         layout = self.layout
42
43         ob = context.active_object
44         game = ob.game
45         soft = ob.game.soft_body
46
47         layout.prop(game, "physics_type")
48         layout.separator()
49
50         physics_type = game.physics_type
51
52         if physics_type == 'CHARACTER':
53             layout.prop(game, "use_actor")
54             layout.prop(ob, "hide_render", text="Invisible")  # out of place but useful
55             layout.prop(game, "step_height", slider=True)
56             layout.prop(game, "jump_speed")
57             layout.prop(game, "fall_speed")
58
59         elif physics_type in {'DYNAMIC', 'RIGID_BODY'}:
60             split = layout.split()
61
62             col = split.column()
63             col.prop(game, "use_actor")
64             col.prop(game, "use_ghost")
65             col.prop(ob, "hide_render", text="Invisible")  # out of place but useful
66
67             col = split.column()
68             col.prop(game, "use_material_physics_fh")
69             col.prop(game, "use_rotate_from_normal")
70             col.prop(game, "use_sleep")
71
72             layout.separator()
73
74             split = layout.split()
75
76             col = split.column()
77             col.label(text="Attributes:")
78             col.prop(game, "mass")
79             col.prop(game, "radius")
80             col.prop(game, "form_factor")
81
82             col = split.column()
83             sub = col.column()
84             sub.prop(game, "use_anisotropic_friction")
85             subsub = sub.column()
86             subsub.active = game.use_anisotropic_friction
87             subsub.prop(game, "friction_coefficients", text="", slider=True)
88
89             split = layout.split()
90
91             col = split.column()
92             col.label(text="Velocity:")
93             sub = col.column(align=True)
94             sub.prop(game, "velocity_min", text="Minimum")
95             sub.prop(game, "velocity_max", text="Maximum")
96
97             col = split.column()
98             col.label(text="Damping:")
99             sub = col.column(align=True)
100             sub.prop(game, "damping", text="Translation", slider=True)
101             sub.prop(game, "rotation_damping", text="Rotation", slider=True)
102
103             layout.separator()
104
105             split = layout.split()
106
107             col = split.column()
108             col.label(text="Lock Translation:")
109             col.prop(game, "lock_location_x", text="X")
110             col.prop(game, "lock_location_y", text="Y")
111             col.prop(game, "lock_location_z", text="Z")
112
113             col = split.column()
114             col.label(text="Lock Rotation:")
115             col.prop(game, "lock_rotation_x", text="X")
116             col.prop(game, "lock_rotation_y", text="Y")
117             col.prop(game, "lock_rotation_z", text="Z")
118
119         elif physics_type == 'SOFT_BODY':
120             col = layout.column()
121             col.prop(game, "use_actor")
122             col.prop(game, "use_ghost")
123             col.prop(ob, "hide_render", text="Invisible")
124
125             layout.separator()
126
127             split = layout.split()
128
129             col = split.column()
130             col.label(text="Attributes:")
131             col.prop(game, "mass")
132             # disabled in the code
133             # col.prop(soft, "weld_threshold")
134             col.prop(soft, "location_iterations")
135             col.prop(soft, "linear_stiffness", slider=True)
136             col.prop(soft, "dynamic_friction", slider=True)
137             col.prop(soft, "collision_margin", slider=True)
138             col.prop(soft, "use_bending_constraints", text="Bending Constraints")
139
140             col = split.column()
141             col.prop(soft, "use_shape_match")
142             sub = col.column()
143             sub.active = soft.use_shape_match
144             sub.prop(soft, "shape_threshold", slider=True)
145
146             col.separator()
147
148             col.label(text="Cluster Collision:")
149             col.prop(soft, "use_cluster_rigid_to_softbody")
150             col.prop(soft, "use_cluster_soft_to_softbody")
151             sub = col.column()
152             sub.active = (soft.use_cluster_rigid_to_softbody or soft.use_cluster_soft_to_softbody)
153             sub.prop(soft, "cluster_iterations", text="Iterations")
154
155         elif physics_type == 'STATIC':
156             col = layout.column()
157             col.prop(game, "use_actor")
158             col.prop(game, "use_ghost")
159             col.prop(ob, "hide_render", text="Invisible")
160
161             layout.separator()
162
163             split = layout.split()
164
165             col = split.column()
166             col.label(text="Attributes:")
167             col.prop(game, "radius")
168
169             col = split.column()
170             sub = col.column()
171             sub.prop(game, "use_anisotropic_friction")
172             subsub = sub.column()
173             subsub.active = game.use_anisotropic_friction
174             subsub.prop(game, "friction_coefficients", text="", slider=True)
175
176         elif physics_type == 'SENSOR':
177             col = layout.column()
178             col.prop(game, "use_actor", text="Detect Actors")
179             col.prop(ob, "hide_render", text="Invisible")
180
181         elif physics_type in {'INVISIBLE', 'NO_COLLISION', 'OCCLUDE'}:
182             layout.prop(ob, "hide_render", text="Invisible")
183
184         elif physics_type == 'NAVMESH':
185             layout.operator("mesh.navmesh_face_copy")
186             layout.operator("mesh.navmesh_face_add")
187
188             layout.separator()
189
190             layout.operator("mesh.navmesh_reset")
191             layout.operator("mesh.navmesh_clear")
192
193         if physics_type not in {'NO_COLLISION', 'OCCLUDE'}:
194             layout.separator()
195             split = layout.split()
196
197             col = split.column()
198             col.prop(game, "collision_group")
199             col = split.column()
200             col.prop(game, "collision_mask")
201
202 class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, Panel):
203     bl_label = "Collision Bounds"
204     COMPAT_ENGINES = {'BLENDER_GAME'}
205
206     @classmethod
207     def poll(cls, context):
208         game = context.object.game
209         rd = context.scene.render
210         return (game.physics_type in {'DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC', 'CHARACTER'}) and (rd.engine in cls.COMPAT_ENGINES)
211
212     def draw_header(self, context):
213         game = context.active_object.game
214
215         self.layout.prop(game, "use_collision_bounds", text="")
216
217     def draw(self, context):
218         layout = self.layout
219
220         game = context.active_object.game
221
222         layout.active = game.use_collision_bounds
223         layout.prop(game, "collision_bounds_type", text="Bounds")
224
225         row = layout.row()
226         row.prop(game, "collision_margin", text="Margin", slider=True)
227         row.prop(game, "use_collision_compound", text="Compound")
228
229
230 class PHYSICS_PT_game_obstacles(PhysicsButtonsPanel, Panel):
231     bl_label = "Create Obstacle"
232     COMPAT_ENGINES = {'BLENDER_GAME'}
233
234     @classmethod
235     def poll(cls, context):
236         game = context.object.game
237         rd = context.scene.render
238         return (game.physics_type in {'DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC'}) and (rd.engine in cls.COMPAT_ENGINES)
239
240     def draw_header(self, context):
241         game = context.active_object.game
242
243         self.layout.prop(game, "use_obstacle_create", text="")
244
245     def draw(self, context):
246         layout = self.layout
247
248         game = context.active_object.game
249
250         layout.active = game.use_obstacle_create
251
252         row = layout.row()
253         row.prop(game, "obstacle_radius", text="Radius")
254         row.label()
255
256
257 class RenderButtonsPanel():
258     bl_space_type = 'PROPERTIES'
259     bl_region_type = 'WINDOW'
260     bl_context = "render"
261
262     @classmethod
263     def poll(cls, context):
264         rd = context.scene.render
265         return (rd.engine in cls.COMPAT_ENGINES)
266
267
268 class RENDER_PT_embedded(RenderButtonsPanel, Panel):
269     bl_label = "Embedded Player"
270     COMPAT_ENGINES = {'BLENDER_GAME'}
271
272     def draw(self, context):
273         layout = self.layout
274
275         rd = context.scene.render
276
277         row = layout.row()
278         row.operator("view3d.game_start", text="Start")
279         row.label()
280         row = layout.row()
281         row.label(text="Resolution:")
282         row = layout.row(align=True)
283         row.prop(rd, "resolution_x", slider=False, text="X")
284         row.prop(rd, "resolution_y", slider=False, text="Y")
285
286
287 class RENDER_PT_game_player(RenderButtonsPanel, Panel):
288     bl_label = "Standalone Player"
289     COMPAT_ENGINES = {'BLENDER_GAME'}
290
291     def draw(self, context):
292         layout = self.layout
293
294         gs = context.scene.game_settings
295
296         row = layout.row()
297         row.operator("wm.blenderplayer_start", text="Start")
298         row.label()
299
300         row = layout.row()
301         row.label(text="Resolution:")
302         row = layout.row(align=True)
303         row.prop(gs, "resolution_x", slider=False, text="X")
304         row.prop(gs, "resolution_y", slider=False, text="Y")
305         row = layout.row()
306         col = row.column()
307         col.prop(gs, "show_fullscreen")
308         col = row.column()
309         col.prop(gs, "use_desktop")
310         col.active = gs.show_fullscreen
311
312         col = layout.column()
313         col.label(text="Quality:")
314         col.prop(gs, "samples")
315         col = layout.column(align=True)
316         col.prop(gs, "depth", text="Bit Depth", slider=False)
317         col.prop(gs, "frequency", text="Refresh Rate", slider=False)
318
319
320 class RENDER_PT_game_stereo(RenderButtonsPanel, Panel):
321     bl_label = "Stereo"
322     COMPAT_ENGINES = {'BLENDER_GAME'}
323
324     def draw(self, context):
325         layout = self.layout
326
327         gs = context.scene.game_settings
328         stereo_mode = gs.stereo
329
330         # stereo options:
331         layout.prop(gs, "stereo", expand=True)
332
333         # stereo:
334         if stereo_mode == 'STEREO':
335             layout.prop(gs, "stereo_mode")
336             layout.prop(gs, "stereo_eye_separation")
337
338         # dome:
339         elif stereo_mode == 'DOME':
340             layout.prop(gs, "dome_mode", text="Dome Type")
341
342             dome_type = gs.dome_mode
343
344             split = layout.split()
345
346             if dome_type in {'FISHEYE', 'TRUNCATED_REAR', 'TRUNCATED_FRONT'}:
347                 col = split.column()
348                 col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
349                 col.prop(gs, "dome_angle", slider=True)
350
351                 col = split.column()
352                 col.prop(gs, "dome_tessellation", text="Tessellation")
353                 col.prop(gs, "dome_tilt")
354
355             elif dome_type == 'PANORAM_SPH':
356                 col = split.column()
357                 col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
358
359                 col = split.column()
360                 col.prop(gs, "dome_tessellation", text="Tessellation")
361
362             else:  # cube map
363                 col = split.column()
364                 col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
365
366                 col = split.column()
367
368             layout.prop(gs, "dome_text")
369
370
371 class RENDER_PT_game_shading(RenderButtonsPanel, Panel):
372     bl_label = "Shading"
373     COMPAT_ENGINES = {'BLENDER_GAME'}
374
375     def draw(self, context):
376         layout = self.layout
377
378         gs = context.scene.game_settings
379
380         layout.prop(gs, "material_mode", expand=True)
381
382         if gs.material_mode == 'GLSL':
383             split = layout.split()
384
385             col = split.column()
386             col.prop(gs, "use_glsl_lights", text="Lights")
387             col.prop(gs, "use_glsl_shaders", text="Shaders")
388             col.prop(gs, "use_glsl_shadows", text="Shadows")
389             col.prop(gs, "use_glsl_color_management", text="Color Management")
390
391             col = split.column()
392             col.prop(gs, "use_glsl_ramps", text="Ramps")
393             col.prop(gs, "use_glsl_nodes", text="Nodes")
394             col.prop(gs, "use_glsl_extra_textures", text="Extra Textures")
395
396
397 class RENDER_PT_game_system(RenderButtonsPanel, Panel):
398     bl_label = "System"
399     COMPAT_ENGINES = {'BLENDER_GAME'}
400
401     def draw(self, context):
402         layout = self.layout
403
404         gs = context.scene.game_settings
405         col = layout.column()
406         row = col.row()
407         col = row.column()
408         col.prop(gs, "use_frame_rate")
409         col.prop(gs, "restrict_animation_updates")
410         col = row.column()
411         col.prop(gs, "use_display_lists")
412         col.active = gs.raster_storage != 'VERTEX_BUFFER_OBJECT'
413                 
414         row = layout.row()
415         row.prop(gs, "raster_storage")
416         
417         row = layout.row()
418         row.label("Exit Key")
419         row.prop(gs, "exit_key", text="", event=True)
420
421
422 class RENDER_PT_game_display(RenderButtonsPanel, Panel):
423     bl_label = "Display"
424     COMPAT_ENGINES = {'BLENDER_GAME'}
425
426     def draw(self, context):
427         layout = self.layout
428
429         gs = context.scene.game_settings
430
431         layout.prop(context.scene.render, "fps", text="Animation Frame Rate", slider=False)
432
433         flow = layout.column_flow()
434         flow.prop(gs, "show_debug_properties", text="Debug Properties")
435         flow.prop(gs, "show_framerate_profile", text="Framerate and Profile")
436         flow.prop(gs, "show_physics_visualization", text="Physics Visualization")
437         flow.prop(gs, "use_deprecation_warnings")
438         flow.prop(gs, "show_mouse", text="Mouse Cursor")
439
440         col = layout.column()
441         col.label(text="Framing:")
442         col.row().prop(gs, "frame_type", expand=True)
443         if gs.frame_type == 'LETTERBOX':
444             col.prop(gs, "frame_color", text="")
445
446
447 class SceneButtonsPanel():
448     bl_space_type = 'PROPERTIES'
449     bl_region_type = 'WINDOW'
450     bl_context = "scene"
451
452
453 class SCENE_PT_game_navmesh(SceneButtonsPanel, Panel):
454     bl_label = "Navigation mesh"
455     bl_options = {'DEFAULT_CLOSED'}
456     COMPAT_ENGINES = {'BLENDER_GAME'}
457
458     @classmethod
459     def poll(cls, context):
460         scene = context.scene
461         return (scene and scene.render.engine in cls.COMPAT_ENGINES)
462
463     def draw(self, context):
464         layout = self.layout
465
466         rd = context.scene.game_settings.recast_data
467
468         layout.operator("mesh.navmesh_make", text="Build navigation mesh")
469
470         col = layout.column()
471         col.label(text="Rasterization:")
472         row = col.row()
473         row.prop(rd, "cell_size")
474         row.prop(rd, "cell_height")
475
476         col = layout.column()
477         col.label(text="Agent:")
478         split = col.split()
479
480         col = split.column()
481         col.prop(rd, "agent_height", text="Height")
482         col.prop(rd, "agent_radius", text="Radius")
483
484         col = split.column()
485         col.prop(rd, "slope_max")
486         col.prop(rd, "climb_max")
487
488         col = layout.column()
489         col.label(text="Region:")
490         row = col.row()
491         row.prop(rd, "region_min_size")
492         row.prop(rd, "region_merge_size")
493
494         col = layout.column()
495         col.label(text="Polygonization:")
496         split = col.split()
497
498         col = split.column()
499         col.prop(rd, "edge_max_len")
500         col.prop(rd, "edge_max_error")
501
502         split.prop(rd, "verts_per_poly")
503
504         col = layout.column()
505         col.label(text="Detail Mesh:")
506         row = col.row()
507         row.prop(rd, "sample_dist")
508         row.prop(rd, "sample_max_error")
509
510
511 class RENDER_PT_game_sound(RenderButtonsPanel, Panel):
512     bl_label = "Sound"
513     COMPAT_ENGINES = {'BLENDER_GAME'}
514
515     def draw(self, context):
516         layout = self.layout
517
518         scene = context.scene
519
520         layout.prop(scene, "audio_distance_model")
521
522         col = layout.column(align=True)
523         col.prop(scene, "audio_doppler_speed", text="Speed")
524         col.prop(scene, "audio_doppler_factor")
525
526
527 class WorldButtonsPanel():
528     bl_space_type = 'PROPERTIES'
529     bl_region_type = 'WINDOW'
530     bl_context = "world"
531
532
533 class WORLD_PT_game_context_world(WorldButtonsPanel, Panel):
534     bl_label = ""
535     bl_options = {'HIDE_HEADER'}
536     COMPAT_ENGINES = {'BLENDER_GAME'}
537
538     @classmethod
539     def poll(cls, context):
540         rd = context.scene.render
541         return (context.scene) and (rd.use_game_engine)
542
543     def draw(self, context):
544         layout = self.layout
545
546         scene = context.scene
547         world = context.world
548         space = context.space_data
549
550         split = layout.split(percentage=0.65)
551         if scene:
552             split.template_ID(scene, "world", new="world.new")
553         elif world:
554             split.template_ID(space, "pin_id")
555
556
557 class WORLD_PT_game_world(WorldButtonsPanel, Panel):
558     bl_label = "World"
559     COMPAT_ENGINES = {'BLENDER_GAME'}
560
561     @classmethod
562     def poll(cls, context):
563         scene = context.scene
564         return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
565
566     def draw(self, context):
567         layout = self.layout
568
569         world = context.world
570
571         row = layout.row()
572         row.column().prop(world, "horizon_color")
573         row.column().prop(world, "ambient_color")
574
575
576 class WORLD_PT_game_mist(WorldButtonsPanel, Panel):
577     bl_label = "Mist"
578     COMPAT_ENGINES = {'BLENDER_GAME'}
579
580     @classmethod
581     def poll(cls, context):
582         scene = context.scene
583         return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
584
585     def draw_header(self, context):
586         world = context.world
587
588         self.layout.prop(world.mist_settings, "use_mist", text="")
589
590     def draw(self, context):
591         layout = self.layout
592
593         world = context.world
594
595         layout.active = world.mist_settings.use_mist
596
597         layout.prop(world.mist_settings, "falloff")
598
599         row = layout.row(align=True)
600         row.prop(world.mist_settings, "start")
601         row.prop(world.mist_settings, "depth")
602
603         layout.prop(world.mist_settings, "intensity", text="Minimum Intensity")
604
605
606 class WORLD_PT_game_physics(WorldButtonsPanel, Panel):
607     bl_label = "Physics"
608     COMPAT_ENGINES = {'BLENDER_GAME'}
609
610     @classmethod
611     def poll(cls, context):
612         scene = context.scene
613         return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
614
615     def draw(self, context):
616         layout = self.layout
617
618         gs = context.scene.game_settings
619
620         layout.prop(gs, "physics_engine")
621         if gs.physics_engine != 'NONE':
622             layout.prop(gs, "physics_gravity", text="Gravity")
623
624             split = layout.split()
625
626             col = split.column()
627             col.label(text="Physics Steps:")
628             sub = col.column(align=True)
629             sub.prop(gs, "physics_step_max", text="Max")
630             sub.prop(gs, "physics_step_sub", text="Substeps")
631             col.prop(gs, "fps", text="FPS")
632
633             col = split.column()
634             col.label(text="Logic Steps:")
635             col.prop(gs, "logic_step_max", text="Max")
636
637             col = layout.column()
638             col.label(text="Physics Deactivation:")
639             sub = col.row(align=True)
640             sub.prop(gs, "deactivation_linear_threshold", text="Linear Threshold")
641             sub.prop(gs, "deactivation_angular_threshold", text="Angular Threshold")
642             sub = col.row()
643             sub.prop(gs, "deactivation_time", text="Time")
644
645             col = layout.column()
646             col.prop(gs, "use_occlusion_culling", text="Occlusion Culling")
647             sub = col.column()
648             sub.active = gs.use_occlusion_culling
649             sub.prop(gs, "occlusion_culling_resolution", text="Resolution")
650
651         else:
652             split = layout.split()
653
654             col = split.column()
655             col.label(text="Physics Steps:")
656             col.prop(gs, "fps", text="FPS")
657
658             col = split.column()
659             col.label(text="Logic Steps:")
660             col.prop(gs, "logic_step_max", text="Max")
661
662
663 class WORLD_PT_game_physics_obstacles(WorldButtonsPanel, Panel):
664     bl_label = "Obstacle simulation"
665     COMPAT_ENGINES = {'BLENDER_GAME'}
666
667     @classmethod
668     def poll(cls, context):
669         scene = context.scene
670         return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
671
672     def draw(self, context):
673         layout = self.layout
674
675         gs = context.scene.game_settings
676
677         layout.prop(gs, "obstacle_simulation", text="Type")
678         if gs.obstacle_simulation != 'NONE':
679             layout.prop(gs, "level_height")
680             layout.prop(gs, "show_obstacle_simulation")
681
682
683 class DataButtonsPanel():
684     bl_space_type = 'PROPERTIES'
685     bl_region_type = 'WINDOW'
686     bl_context = "data"
687
688
689 class DATA_PT_shadow_game(DataButtonsPanel, Panel):
690     bl_label = "Shadow"
691     COMPAT_ENGINES = {'BLENDER_GAME'}
692
693     @classmethod
694     def poll(cls, context):
695         COMPAT_LIGHTS = {'SPOT', 'SUN'}
696         lamp = context.lamp
697         engine = context.scene.render.engine
698         return (lamp and lamp.type in COMPAT_LIGHTS) and (engine in cls.COMPAT_ENGINES)
699
700     def draw_header(self, context):
701         lamp = context.lamp
702
703         self.layout.prop(lamp, "use_shadow", text="")
704
705     def draw(self, context):
706         layout = self.layout
707
708         lamp = context.lamp
709
710         layout.active = lamp.use_shadow
711
712         split = layout.split()
713
714         col = split.column()
715         col.prop(lamp, "shadow_color", text="")
716
717         col = split.column()
718         col.prop(lamp, "use_shadow_layer", text="This Layer Only")
719         col.prop(lamp, "use_only_shadow")
720
721         col = layout.column()
722         col.label("Buffer Type:")
723         col.prop(lamp, "ge_shadow_buffer_type", text="", toggle=True)
724         col.label("Quality:")
725         col = layout.column(align=True)
726         col.prop(lamp, "shadow_buffer_size", text="Size")
727         col.prop(lamp, "shadow_buffer_bias", text="Bias")
728         col.prop(lamp, "shadow_buffer_bleed_bias", text="Bleed Bias")
729
730         row = layout.row()
731         row.label("Clipping:")
732         row = layout.row(align=True)
733         row.prop(lamp, "shadow_buffer_clip_start", text="Clip Start")
734         row.prop(lamp, "shadow_buffer_clip_end", text="Clip End")
735
736         if lamp.type == 'SUN':
737             row = layout.row()
738             row.prop(lamp, "shadow_frustum_size", text="Frustum Size")
739
740
741 if __name__ == "__main__":  # only for live edit.
742     bpy.utils.register_module(__name__)