-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathzync_c4d_take_settings.py
More file actions
78 lines (62 loc) · 2 KB
/
zync_c4d_take_settings.py
File metadata and controls
78 lines (62 loc) · 2 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
""" Contains C4dTakeSettings class. """
from importlib import import_module
from zync_c4d_render_settings import C4dRenderSettings
import zync_c4d_utils
zync_threading = zync_c4d_utils.import_zync_module('zync_threading')
main_thread = zync_threading.MainThreadCaller.main_thread
c4d = import_module('c4d')
class C4dTakeSettings(zync_threading.MainThreadCaller):
"""
Implements various take-related operations using C4D API.
:param zync_threading.MainThreadExecutor main_thread_executor:
:param c4d.modules.takesystem.BaseTake take:
:param c4d.modules.takesystem.TakeData take_data:
:param int take_depth:
:param c4d.documents.BaseDocument document:
"""
def __init__(self, main_thread_executor, take, take_data, take_depth, document):
zync_threading.MainThreadCaller.__init__(self, main_thread_executor)
self._take = take
self._take_data = take_data
self._take_name = take.GetName()
self._take_indented_name = take_depth * ' ' + self._take_name
self._document = document
@main_thread
def get_camera_name(self):
"""
Returns the camera name.
:return str:
"""
camera = self._take.GetCamera(self._take_data)
if camera:
return camera.GetName()
else:
return ''
def get_indented_name(self):
"""
Returns the take name indented accordingly to its position in the take hierarchy.
:return str:
"""
return self._take_indented_name
def get_take_name(self):
"""
Returns the take name.
:return str:
"""
return self._take_name
@main_thread
def get_render_settings(self):
"""
Returns render settings.
:return C4dRenderSettings:
"""
return C4dRenderSettings(self._main_thread_executor,
self._take.GetEffectiveRenderData(self._take_data)[0], self._document,
self._take)
@main_thread
def is_valid(self):
"""
Checks if take is valid.
:return bool:
"""
return self._take.GetEffectiveRenderData(self._take_data) is not None