-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderer.js
More file actions
169 lines (139 loc) · 4.72 KB
/
Copy pathrenderer.js
File metadata and controls
169 lines (139 loc) · 4.72 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
// This file is required by the index.html file and will
// be executed in the renderer process for that window.
/*
// Perform action on DOM loaded.
window.addEventListener('DOMContentLoaded', async () => {
await loadRenderPreset();
});
*/
// Loads render preset list.
async function loadRenderPreset() {
var cbRenderPreset = document.getElementById('cbRenderPreset');
if (!cbRenderPreset.options || (cbRenderPreset.options.length === 0)) {
const renderPresetList = await window.resolveAPI.getRenderPresets();
for (var index in renderPresetList) {
option = document.createElement('option');
option.text = renderPresetList[index];
option.value = renderPresetList[index];
cbRenderPreset.appendChild(option);
}
}
}
// Creates a new project.
async function createProject() {
const projName = document.getElementById('projName').value;
if (!projName) {
alert('Error: Project name is empty!');
return;
}
project = await window.resolveAPI.createProject(projName);
if (!project) {
alert(`Error: Failed to create project: ${projName}`);
return;
}
const isSuccess = await window.resolveAPI.saveProject();
if (!isSuccess) {
alert(`Error: Failed to save project: ${projName}`);
return;
}
console.log(`Created project: ${projName}`);
}
// Opens a project.
async function openProject() {
const projName = document.getElementById('projName').value;
if (!projName) {
alert('Error: Project name is empty!');
return;
}
project = await window.resolveAPI.openProject(projName);
if (!project) {
alert(`Error: Failed to open project: ${projName}`);
return;
}
console.log(`Opened project: ${projName}`);
}
// Saves current project.
async function saveProject() {
const isSuccess = await window.resolveAPI.saveProject();
if (!isSuccess) {
alert('Error: Failed to save project');
return;
}
console.log('Saved project');
}
// Selects a timeline using name.
async function selectTimeline() {
const timelineName = document.getElementById('timelineName').value;
if (!timelineName) {
alert('Error: Timeline name is empty!');
return;
}
// Set current timeline
const isSuccess = await window.resolveAPI.selectTimeline(timelineName);
if (!isSuccess) {
alert(`Error: Failed to select timeline: ${timelineName}`);
return;
}
console.log(`Selected timeline: ${timelineName}`);
}
// Render current timeline.
async function renderTimeline() {
const targetDirPath = document.getElementById('targetDirPath').value;
if (!targetDirPath) {
alert('Error: Target directory path is empty!');
return;
}
const targetClipName = document.getElementById('targetClipName').value;
if (!targetClipName) {
alert('Error: Target clip name is empty!');
return;
}
const renderPresetName = document.getElementById('cbRenderPreset').value;
await window.resolveAPI.openPage('deliver');
// Start rendering render job
const isSuccess = await window.resolveAPI.renderTimeline(timelineName, renderPresetName, targetDirPath, targetClipName);
if (!isSuccess) {
alert(`Error: Failed to render timeline: ${timelineName}`);
return;
}
console.log(`Render timeline started: ${timelineName}`);
}
// Added by Alaric
function clearEDL() {
document.getElementById("EDLTextArea").value = "";
}
function clearXML() {
document.getElementById("XMLTextArea").value = "";
}
async function makeEDL() {
const EDLtext = document.getElementById('EDLTextArea');
EDLtext.value = await window.resolveAPI.makeEDL();
}
async function makeXML() {
const XMLtext = document.getElementById('XMLTextArea');
const variableZ = document.getElementById('cbvariablez').checked;
const annotationText = document.getElementById('annotationText').value;
console.log(`Call makeXML: ${variableZ} ${annotationText}`);
XMLtext.value = await window.resolveAPI.makeXML(variableZ, annotationText);
}
function saveEDL() {
const EDLtext = document.getElementById('EDLTextArea').value;
if (!EDLTextArea.value) {
alert('Error: EDL Area is empty!');
return;
}
console.log(`calling saveEDL function`);
console.log(`calling saveEDL. EDLtext: ${EDLtext}`);
window.resolveAPI.saveEDL(EDLtext);
console.log(`calling saveEDL function`);
}
function saveXML() {
const XMLtext = document.getElementById('XMLTextArea').value;
if (!XMLTextArea.value) {
alert('Error: XML Area is empty!');
return;
}
console.log(`calling saveXML function`);
console.log(`calling saveXML. XMLtext: ${XMLtext}`);
window.resolveAPI.saveXML(XMLtext);
}