-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoutput.py
58 lines (49 loc) · 1.61 KB
/
output.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Nikita Akimov
#
# GitHub
# https://github.com/Korchy/bpy_plus
import bpy
from bpy.types import Context
from .file_system import Path
class Output:
@staticmethod
def extension(context: Context = bpy.context, animation: bool = False) -> str:
""" Return output file extension
:param context: context
:type context: Context
:param animation: False - for single image, True - for animation
:type animation: bool
:return: extension
:rtype: str
"""
if animation:
if context.scene.render.image_settings.file_format in ['AVI_JPEG', 'AVI_RAW']:
return 'avi'
elif context.scene.render.image_settings.file_format == 'FFMPEG':
ext = {
'MPEG1': 'mpeg1',
'MPEG2': 'mpeg2',
'MPEG4': 'mp4',
'AVI': 'avi',
'QUICKTIME': 'mov',
'DV': 'dv',
'OGG': 'ogg',
'MKV': 'mkv',
'FLASH': 'flv',
'WEBM': 'webm'
}
return ext[context.scene.render.ffmpeg.format]
else:
return context.scene.render.file_extension[1:]
@staticmethod
def path(context: Context = bpy.context) -> str:
""" Return output render path
:param context: context
:type context: Context
:return: render absolute output path
:rtype: str
"""
return Path.abs(
path=context.scene.render.filepath
)