""" Generic Blender functions """ import bpy def get_scene_settings(): return bpy.context.scene.vsetb_settings def get_strip_settings(): scn = bpy.context.scene return scn.sequence_editor.active_strip.vsetb_strip_settings 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