Initial commit
This commit is contained in:
+45
@@ -0,0 +1,45 @@
|
||||
|
||||
"""
|
||||
Generic Blender functions
|
||||
"""
|
||||
|
||||
import bpy
|
||||
|
||||
def get_settings():
|
||||
return bpy.context.window_manager.vsetb_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
|
||||
Reference in New Issue
Block a user