Cleanup: style

This commit is contained in:
Campbell Barton 2018-10-29 18:33:38 +11:00
parent 7fb1a1ca26
commit b39a0d5198
3 changed files with 41 additions and 27 deletions

View File

@ -28,7 +28,8 @@ bl_info = {
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
"Scripts/System/Demo_Mode#Running_Demo_Mode",
"support": 'OFFICIAL',
"category": "System"}
"category": "System",
}
# To support reload properly, try to access a package var, if it's there, reload everything
if "bpy" in locals():
@ -70,9 +71,11 @@ class DemoModeSetup(bpy.types.Operator):
)
mode: EnumProperty(
name="Method",
items=(('AUTO', "Auto", ""),
('PLAY', "Play", ""),
('RENDER', "Render", ""))
items=(
('AUTO', "Auto", ""),
('PLAY', "Play", ""),
('RENDER', "Render", ""),
)
)
run: BoolProperty(
@ -243,9 +246,15 @@ def menu_func(self, context):
layout.separator()
classes = (
DemoModeSetup,
DemoModeRun,
)
def register():
bpy.utils.register_class(DemoModeSetup)
bpy.utils.register_class(DemoModeRun)
from bpy.utils import register_class
for cls in classes:
register_class(cls)
bpy.types.TOPBAR_MT_file.prepend(menu_func)
@ -253,8 +262,9 @@ def register():
def unregister():
bpy.utils.unregister_class(DemoModeSetup)
bpy.utils.unregister_class(DemoModeRun)
from bpy.utils import unregister_class
for cls in classes:
unregister_class(cls)
bpy.types.TOPBAR_MT_file.remove(menu_func)

View File

@ -65,7 +65,7 @@ def as_string(dirpath, random_order, exit, **kwargs):
"\n",
"exit = %r\n" % exit,
"\n",
]
]
# All these work but use nicest formatting!
if 0: # works but not nice to edit.

View File

@ -44,23 +44,26 @@ DEMO_CFG = "demo.py"
# populate from script
global_config_files = []
global_config = dict(anim_cycles=1,
anim_render=False,
anim_screen_switch=0.0,
anim_time_max=60.0,
anim_time_min=4.0,
mode='AUTO',
display_render=4.0)
global_config = dict(
anim_cycles=1,
anim_render=False,
anim_screen_switch=0.0,
anim_time_max=60.0,
anim_time_min=4.0,
mode='AUTO',
display_render=4.0,
)
# switch to the next file in 2 sec.
global_config_fallback = dict(anim_cycles=1,
anim_render=False,
anim_screen_switch=0.0,
anim_time_max=60.0,
anim_time_min=4.0,
mode='AUTO',
display_render=4.0)
global_config_fallback = dict(
anim_cycles=1,
anim_render=False,
anim_screen_switch=0.0,
anim_time_max=60.0,
anim_time_min=4.0,
mode='AUTO',
display_render=4.0,
)
global_state = {
"init_time": 0.0,
@ -253,9 +256,10 @@ def demo_mode_update():
demo_mode_next_file()
return
# above cycles and minimum display time
if (time_total > global_config["anim_time_min"]) and \
(global_state["anim_cycles"] > global_config["anim_cycles"]):
if (
(time_total > global_config["anim_time_min"]) and
(global_state["anim_cycles"] > global_config["anim_cycles"])
):
# looped enough now.
demo_mode_next_file()
return