vse_toolbox/bl_utils.py

56 lines
1.2 KiB
Python
Raw Normal View History

2023-03-14 13:38:04 +01:00
"""
Generic Blender functions
"""
import bpy
2023-03-21 18:33:29 +01:00
def get_scene_settings():
return bpy.context.scene.vsetb_settings
def get_strip_settings():
scn = bpy.context.scene
2023-04-25 18:43:04 +02:00
strip = bpy.context.active_sequence_strip
if not strip:
return
return strip.vsetb_strip_settings
2023-03-21 18:33:29 +01:00
2023-03-14 13:38:04 +01:00
def get_bl_cmd(blender=None, background=False, focus=True, blendfile=None, script=None, **kargs):
cmd = [str(blender)] if blender else [bpy.app.binary_path]
if background:
cmd += ['--background']
if not focus and not background:
cmd += ['--no-window-focus']
cmd += ['--window-geometry', '5000', '0', '10', '10']
cmd += ['--python-use-system-env']
if blendfile:
cmd += [str(blendfile)]
if script:
cmd += ['--python', str(script)]
if kargs:
cmd += ['--']
for k, v in kargs.items():
k = norm_arg(k)
v = norm_value(v)
cmd += [k]
if isinstance(v, (tuple, list)):
cmd += v
else:
cmd += [v]
return cmd
def get_addon_prefs():
addon_name = __package__.split('.')[0]
return bpy.context.preferences.addons[addon_name].preferences
2023-05-04 18:45:17 +02:00