kt-forpro-tools 1.0.24 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,30 +1,30 @@
1
- {
2
- "name": "kt-forpro-tools",
3
- "version": "1.0.24",
4
- "description": "",
5
- "author": "Miguel de Mendoza",
6
- "main": "src/index.ts",
7
- "license": "MIT",
8
- "scripts": {
9
- "build": "kt-build",
10
- "build-tests": "kt-build build-tests",
11
- "debug-build-tests": "kt-build debug-build-tests"
12
- },
13
- "files": [
14
- "src",
15
- "tsconfig.json"
16
- ],
17
- "dependencies": {
18
- "kt-ae-is-checkers": "^1.0.7",
19
- "kt-ae-tools-layers": "^1.0.0",
20
- "kt-ae-tools-project": "^1.0.5",
21
- "kt-core": "*",
22
- "kt-io": "^1.1.0"
23
- },
24
- "devDependencies": {
25
- "kt-extendscript-builder": "*",
26
- "kt-testing-suite-ae": "*",
27
- "kt-testing-suite-core": "^1.7.7",
28
- "prettier": "^3.6.2"
29
- }
30
- }
1
+ {
2
+ "name": "kt-forpro-tools",
3
+ "version": "1.1.1",
4
+ "description": "",
5
+ "author": "Miguel de Mendoza",
6
+ "main": "src/index.ts",
7
+ "license": "MIT",
8
+ "scripts": {
9
+ "build": "kt-build",
10
+ "build-tests": "kt-build build-tests",
11
+ "debug-build-tests": "kt-build debug-build-tests"
12
+ },
13
+ "files": [
14
+ "src",
15
+ "tsconfig.json"
16
+ ],
17
+ "dependencies": {
18
+ "kt-ae-is-checkers": "^1.0.7",
19
+ "kt-ae-tools-layers": "^1.0.0",
20
+ "kt-ae-tools-project": "^1.0.5",
21
+ "kt-core": "*",
22
+ "kt-io": "^1.1.0"
23
+ },
24
+ "devDependencies": {
25
+ "kt-extendscript-builder": "*",
26
+ "kt-testing-suite-ae": "*",
27
+ "kt-testing-suite-core": "^1.7.7",
28
+ "prettier": "^3.6.2"
29
+ }
30
+ }
package/src/freeze.ts CHANGED
@@ -1,17 +1,12 @@
1
- import { KT_Project } from "kt-ae-tools-project";
1
+ import { KTSlidesFreezeConfig } from "./maps";
2
2
 
3
3
  class __KT_SlidesFreeze {
4
- courseTitle = KT_Project.find.comps("titulo-curso")[0];
5
- professorPastilla = KT_Project.find.comps("profesor-pastilla")[0];
6
- logo_in = KT_Project.find.comps("Logotipo")[0];
7
- logosCartela = KT_Project.find.comps("Logotipos-cartela")[0];
8
- logo_out = KT_Project.find.comps("logo_out")[0];
9
- chyrons = KT_Project.find.comps("chyrons")[0];
10
- //find comps named with only two digits
11
- lessons: CompItem[] = KT_Project.find.comps(/^\d{2}$/);
12
- init = () => {
13
- $.writeln("Dummy method to force transpilation");
14
- };
4
+ private config: KTSlidesFreezeConfig | null = null;
5
+
6
+ init(map: KTSlidesFreezeConfig) {
7
+ this.config = map;
8
+ }
9
+
15
10
  private frezzeExpression(property: Property) {
16
11
  if (property.canSetExpression && property.expressionEnabled) {
17
12
  const value = property.value;
@@ -26,27 +21,13 @@ class __KT_SlidesFreeze {
26
21
  }
27
22
  }
28
23
 
29
- private findProperties() {
30
- const properties: Property[] = [
31
- (this.courseTitle.layers.byName("titulo") as TextLayer).text.sourceText,
32
- (this.professorPastilla.layers.byName("profesor") as TextLayer).text.sourceText,
33
- (this.logosCartela.layers[1] as AVLayer).transform.opacity,
34
- (this.logosCartela.layers[2] as AVLayer).transform.opacity,
35
- (this.logo_in.layers[1] as AVLayer).transform.opacity,
36
- (this.logo_in.layers[2] as AVLayer).transform.opacity,
37
- (this.logo_out.layers[1] as AVLayer).transform.opacity,
38
- (this.logo_out.layers[2] as AVLayer).transform.opacity,
39
- (this.chyrons.layers.byName("profesor") as TextLayer).text.sourceText,
40
- (this.chyrons.layers.byName("titulo") as TextLayer).text.sourceText,
41
- (this.logo_out.layers.byName("logo-cat") as AVLayer).transform.opacity,
42
- (this.logo_out.layers.byName("logo-esp") as AVLayer).transform.opacity,
43
- ];
44
-
45
- this.lessons.forEach((comp) => {
46
- properties.push((comp.layers.byName("leccion") as TextLayer).text.sourceText);
47
- });
48
-
49
- return properties;
24
+ private findProperties(): Property[] {
25
+ if (!this.config) {
26
+ throw new Error(
27
+ "KT_SlidesFreeze: call init(map) before using freeze/unfreeze/checkFrozen",
28
+ );
29
+ }
30
+ return this.config.properties;
50
31
  }
51
32
 
52
33
  freeze() {
@@ -76,4 +57,5 @@ class __KT_SlidesFreeze {
76
57
  return allFrozen;
77
58
  }
78
59
  }
60
+
79
61
  export const KT_SlidesFreeze = new __KT_SlidesFreeze();
package/src/index.ts CHANGED
@@ -3,5 +3,14 @@ import { KT_ForproTools } from "./KT_ForproTools";
3
3
  import { KT_Slides } from "./slides";
4
4
  import { type KT_SlidesOptions } from "./slides";
5
5
  import { KT_SlidesFreeze } from "./freeze";
6
+ import { KTSlidesFreezeConfig, DefaultSlidesFreezeMap, OBMap } from "./maps";
6
7
 
7
- export { KT_ForproTools, KT_Slides, type KT_SlidesOptions, KT_SlidesFreeze };
8
+ export {
9
+ KT_ForproTools,
10
+ KT_Slides,
11
+ type KT_SlidesOptions,
12
+ KT_SlidesFreeze,
13
+ KTSlidesFreezeConfig,
14
+ DefaultSlidesFreezeMap,
15
+ OBMap,
16
+ };
@@ -0,0 +1,53 @@
1
+ import { KT_Project } from "kt-ae-tools-project";
2
+
3
+ export abstract class KTSlidesFreezeConfig {
4
+ abstract properties: Property[];
5
+ }
6
+
7
+ export class DefaultSlidesFreezeMap extends KTSlidesFreezeConfig {
8
+ properties: Property[] = [];
9
+ courseTitle = KT_Project.find.comps("titulo-curso")[0];
10
+ professorPastilla = KT_Project.find.comps("profesor-pastilla")[0];
11
+ logo_in = KT_Project.find.comps("Logotipo")[0];
12
+ logosCartela = KT_Project.find.comps("Logotipos-cartela")[0];
13
+ logo_out = KT_Project.find.comps("logo_out")[0];
14
+ chyrons = KT_Project.find.comps("chyrons")[0];
15
+ lessons: CompItem[] = KT_Project.find.comps(/^\d{2}$/);
16
+
17
+ constructor() {
18
+ super();
19
+ this.properties = [
20
+ (this.courseTitle.layers.byName("titulo") as TextLayer).text.sourceText,
21
+ (this.professorPastilla.layers.byName("profesor") as TextLayer).text.sourceText,
22
+ (this.logosCartela.layers[1] as AVLayer).transform.opacity,
23
+ (this.logosCartela.layers[2] as AVLayer).transform.opacity,
24
+ (this.logo_in.layers[1] as AVLayer).transform.opacity,
25
+ (this.logo_in.layers[2] as AVLayer).transform.opacity,
26
+ (this.logo_out.layers[1] as AVLayer).transform.opacity,
27
+ (this.logo_out.layers[2] as AVLayer).transform.opacity,
28
+ (this.chyrons.layers.byName("profesor") as TextLayer).text.sourceText,
29
+ (this.chyrons.layers.byName("titulo") as TextLayer).text.sourceText,
30
+ (this.logo_out.layers.byName("logo-cat") as AVLayer).transform.opacity,
31
+ (this.logo_out.layers.byName("logo-esp") as AVLayer).transform.opacity,
32
+ ];
33
+
34
+ this.lessons.forEach((comp) => {
35
+ this.properties.push((comp.layers.byName("leccion") as TextLayer).text.sourceText);
36
+ });
37
+ }
38
+ }
39
+
40
+ export class OBMap extends KTSlidesFreezeConfig {
41
+ properties: Property[] = [];
42
+ lesons: CompItem[] = KT_Project.find.comps(/^\d{2}$/);
43
+ chyrons: CompItem = KT_Project.find.comps("chyrons_base")[0];
44
+ constructor() {
45
+ super();
46
+ this.properties = [(this.chyrons.layers.byName("profesor") as TextLayer).text.sourceText];
47
+ this.lesons.forEach((comp) => {
48
+ this.properties.push((comp.layers.byName("profesor") as TextLayer).text.sourceText);
49
+ this.properties.push((comp.layers.byName("lesson-title") as TextLayer).text.sourceText);
50
+ this.properties.push((comp.layers.byName("course-title") as TextLayer).text.sourceText);
51
+ });
52
+ }
53
+ }
package/src/slides.ts CHANGED
@@ -54,6 +54,7 @@ class KT_Slides {
54
54
  name: string = "Slides";
55
55
  slideMultiplier: number = 1;
56
56
  backgroundColor: [number, number, number] = [1, 1, 1];
57
+ backgroundPivotPrefix: string = "_BG_";
57
58
  private getNextColor = colorSelector();
58
59
 
59
60
  constructor(options: KT_SlidesOptions = {}) {
@@ -154,7 +155,7 @@ class KT_Slides {
154
155
  this.width,
155
156
  this.height,
156
157
  1,
157
- this.duration
158
+ this.duration,
158
159
  );
159
160
  }
160
161
 
@@ -206,6 +207,8 @@ class KT_Slides {
206
207
 
207
208
  footage.forEach((item, index) => {
208
209
  const randomColorIndex = this.getNextColor();
210
+ const groupStartTime = (index * this.slideMultiplier + 0) * this.inDuration * 2;
211
+ let lowerGroupLayer: Layer | null = null;
209
212
  for (let i = 0; i < this.slideMultiplier; i++) {
210
213
  const subComp = this.precompSlide(item as FootageItem, i);
211
214
 
@@ -213,31 +216,128 @@ class KT_Slides {
213
216
  subComp as AVItem,
214
217
  this.inDuration * 2,
215
218
  this.masterComp,
216
- (index * this.slideMultiplier + i) * this.inDuration * 2
219
+ (index * this.slideMultiplier + i) * this.inDuration * 2,
217
220
  );
218
221
  this.enableTimeRemap(layer as AVLayer);
219
222
  layer.outPoint = this.masterComp.duration;
220
223
  layer.label = randomColorIndex;
221
224
  if (i === 0) {
222
- const backgroundlayer = layer.source.layers.add(this.backgroundComp);
223
- backgroundlayer.selected = false;
224
- backgroundlayer.moveToEnd();
225
- layer.source.layers[1].selected = true;
225
+ lowerGroupLayer = layer;
226
226
  }
227
227
  this.slides.push(layer);
228
228
  }
229
- });
230
229
 
230
+ const bgPivot = this.masterComp.layers.add(this.backgroundComp);
231
+
232
+ this.fitLayerToComp(bgPivot, this.masterComp);
233
+ bgPivot.name = this.backgroundPivotPrefix + item.name.split("-")[0];
234
+ bgPivot.startTime = groupStartTime;
235
+ bgPivot.outPoint = this.masterComp.duration;
236
+ bgPivot.label = randomColorIndex;
237
+ this.enableTimeRemap(bgPivot as AVLayer);
238
+ if (lowerGroupLayer) {
239
+ bgPivot.moveAfter(lowerGroupLayer);
240
+ }
241
+ });
242
+ this.batchSplitSlides();
231
243
  return this;
232
244
  };
233
245
  batchSplitSlides = () => {
234
- const slides = KT_Layers.find.layers({ comps: this.masterComp });
235
- const totalSlides = slides.length;
236
- let batchSize = this.slideMultiplier;
237
- for (let i = 0; i < totalSlides; i) {
238
- const batchLayers = slides.slice(i, i + batchSize);
239
- //reduce batchlayers if next layer inPoint is more than inDuration * 3 away
240
- for (let j = 0; j < batchLayers.length - 2; j++) {
246
+ const layers = KT_Layers.find.layers({ comps: this.masterComp });
247
+ const backgroundPivots = this.getBackgroundPivots(layers);
248
+
249
+ if (backgroundPivots.length === 0) {
250
+ const legacyBatches = this.getLegacySlideBatches(layers);
251
+ legacyBatches.forEach((batchLayers) => {
252
+ this.splitSlides(batchLayers);
253
+ });
254
+ return;
255
+ }
256
+
257
+ backgroundPivots.forEach((pivotLayer, index, collection) => {
258
+ const nextPivot = collection[index + 1];
259
+ const nextPivotStart = nextPivot ? nextPivot.startTime : Number.MAX_VALUE;
260
+
261
+ const groupSlides = layers.filter((layer) => {
262
+ if (this.isBackgroundPivot(layer)) {
263
+ return false;
264
+ }
265
+ return layer.startTime >= pivotLayer.startTime && layer.startTime < nextPivotStart;
266
+ });
267
+
268
+ if (groupSlides.length === 0) {
269
+ return;
270
+ }
271
+
272
+ this.splitSlides(groupSlides);
273
+ });
274
+ };
275
+
276
+ migrateBackgroundPivots = () => {
277
+ const layers = KT_Layers.find.layers({ comps: this.masterComp });
278
+ const backgroundPivots = this.getBackgroundPivots(layers);
279
+ if (backgroundPivots.length > 0) {
280
+ return 0;
281
+ }
282
+
283
+ const batches = this.getLegacySlideBatches(layers);
284
+ let addedPivots = 0;
285
+
286
+ batches.forEach((batchLayers) => {
287
+ if (!batchLayers || batchLayers.length === 0) {
288
+ return;
289
+ }
290
+
291
+ let firstLayer = batchLayers[0];
292
+ let lowerGroupLayer = batchLayers[0];
293
+ batchLayers.forEach((layer) => {
294
+ if (layer.startTime < firstLayer.startTime) {
295
+ firstLayer = layer;
296
+ }
297
+ if (layer.index > lowerGroupLayer.index) {
298
+ lowerGroupLayer = layer;
299
+ }
300
+ });
301
+
302
+ const bgPivot = this.masterComp.layers.add(this.backgroundComp);
303
+ this.fitLayerToComp(bgPivot, this.masterComp);
304
+ bgPivot.name = this.backgroundPivotPrefix + firstLayer.name.split("-")[0];
305
+ bgPivot.startTime = firstLayer.startTime;
306
+ bgPivot.outPoint = this.masterComp.duration;
307
+ bgPivot.label = firstLayer.label;
308
+ this.enableTimeRemap(bgPivot as AVLayer);
309
+ bgPivot.moveAfter(lowerGroupLayer);
310
+ addedPivots += 1;
311
+ });
312
+
313
+ return addedPivots;
314
+ };
315
+
316
+ private getBackgroundPivots = (layers: Layer[]) => {
317
+ const pivots = layers.filter((layer) => this.isBackgroundPivot(layer));
318
+ pivots.sort((a, b) => a.startTime - b.startTime);
319
+ return pivots;
320
+ };
321
+
322
+ private isBackgroundPivot = (layer: Layer) => {
323
+ const avLayer = layer as AVLayer;
324
+ if (avLayer.source && avLayer.source === this.backgroundComp) {
325
+ return true;
326
+ }
327
+ return layer.name.indexOf(this.backgroundPivotPrefix) === 0;
328
+ };
329
+
330
+ private getLegacySlideBatches = (layers: Layer[]) => {
331
+ const batches: Layer[][] = [];
332
+ const batchSize = this.slideMultiplier > 0 ? this.slideMultiplier : 1;
333
+
334
+ for (let i = 0; i < layers.length; ) {
335
+ const batchLayers = layers.slice(i, i + batchSize);
336
+ if (batchLayers.length === 0) {
337
+ break;
338
+ }
339
+
340
+ for (let j = 0; j < batchLayers.length - 1; j++) {
241
341
  const layer = batchLayers[j] as AVLayer;
242
342
  const nextLayer = batchLayers[j + 1] as AVLayer;
243
343
  if (layer.inPoint - nextLayer.inPoint > this.inDuration * 3) {
@@ -245,15 +345,23 @@ class KT_Slides {
245
345
  break;
246
346
  }
247
347
  }
348
+
349
+ batches.push(batchLayers);
248
350
  i += batchLayers.length;
249
- this.splitSlides(batchLayers);
250
351
  }
352
+
353
+ return batches;
251
354
  };
355
+
252
356
  splitSlides = (layers?: Layer[]) => {
253
357
  if (!Array.isArray(layers) || layers.length <= 1) {
254
358
  layers = this.masterComp.selectedLayers;
255
359
  }
256
360
 
361
+ if (layers) {
362
+ layers = layers.filter((layer) => !this.isBackgroundPivot(layer));
363
+ }
364
+
257
365
  if (!layers || layers.length === 0) {
258
366
  $.writeln("No layers selected for precomp");
259
367
  return;
@@ -322,6 +430,7 @@ class KT_Slides {
322
430
  pivotIndex += 1;
323
431
  // Ajustar la duración de la precomp
324
432
  const solid = precomp.layers.add(this.backgroundComp);
433
+ this.fitLayerToComp(solid, precomp);
325
434
  solid.moveToEnd();
326
435
  precomp.duration = this.duration;
327
436
  });
@@ -333,6 +442,9 @@ class KT_Slides {
333
442
  const compsToKeep: string[] = [];
334
443
  for (let i = 1; i <= layers.length; i++) {
335
444
  const layer = layers[i];
445
+ if (this.isBackgroundPivot(layer)) {
446
+ continue;
447
+ }
336
448
  const nameSplit = layer.name.split("-");
337
449
  const slideIndex = parseInt(nameSplit[nameSplit.length - 1]) - 1;
338
450
  const slideName = this.getSlideName(layer, slideIndex, "_Slide_");
@@ -345,7 +457,10 @@ class KT_Slides {
345
457
  const keep = compsToKeep.indexOf(item.name) >= 0;
346
458
  if (!keep) {
347
459
  $.writeln(
348
- "Removing comp: " + item.name + "indexof: " + compsToKeep.indexOf(item.name)
460
+ "Removing comp: " +
461
+ item.name +
462
+ "indexof: " +
463
+ compsToKeep.indexOf(item.name),
349
464
  );
350
465
  item.remove();
351
466
  }
@@ -357,11 +472,12 @@ class KT_Slides {
357
472
  source: AVItem,
358
473
  duration: number,
359
474
  comp: CompItem = app.project.activeItem as CompItem,
360
- startTime?: number
475
+ startTime?: number,
361
476
  ) {
362
477
  const layer = comp.layers.add(source);
363
478
  layer.startTime = 0;
364
479
  layer.outPoint = duration;
480
+ this.fitLayerToComp(layer, comp);
365
481
  this.slideUp(layer);
366
482
  this.disolveIn(layer);
367
483
  layer.startTime = startTime || 0;
@@ -380,7 +496,7 @@ class KT_Slides {
380
496
  private getSlideName = (
381
497
  item: _ItemClasses | Layer,
382
498
  index: number,
383
- infix: string = "-"
499
+ infix: string = "-",
384
500
  ): string => {
385
501
  return item.name.split("-")[0] + infix + (index + 1);
386
502
  };
@@ -414,13 +530,32 @@ class KT_Slides {
414
530
  });
415
531
  };
416
532
 
533
+ private fitLayerToComp = (layer: Layer, comp: CompItem): Layer => {
534
+ const avLayer = layer as AVLayer;
535
+ if (!avLayer.source) return layer;
536
+ const src = avLayer.source as CompItem | FootageItem;
537
+ const sourceWidth = src.width;
538
+ const sourceHeight = src.height;
539
+ if (!sourceWidth || !sourceHeight) return layer;
540
+ const scalePercent = Math.min(comp.width / sourceWidth, comp.height / sourceHeight) * 100;
541
+ const currentScale = layer.scale.value as number[];
542
+ const newScale: number[] = [scalePercent, scalePercent];
543
+ if (currentScale.length > 2) newScale.push(currentScale[2]);
544
+ layer.scale.setValue(newScale);
545
+ const center: number[] = [comp.width / 2, comp.height / 2];
546
+ const currentPos = layer.position.value as number[];
547
+ if (currentPos.length > 2) center.push(currentPos[2]);
548
+ layer.position.setValue(center);
549
+ return layer;
550
+ };
551
+
417
552
  private enableTimeRemap = (layer: AVLayer) => {
418
553
  layer.timeRemapEnabled = true;
419
554
  const property = layer.property("ADBE Time Remapping") as Property;
420
555
  if (!is.layer || layer.canSetTimeRemapEnabled === false) return layer;
421
556
  if (property) {
422
557
  property.addKey(
423
- property.keyTime(property.numKeys) - layer.containingComp.frameDuration
558
+ property.keyTime(property.numKeys) - layer.containingComp.frameDuration,
424
559
  );
425
560
  property.removeKey(property.numKeys);
426
561
  }
@@ -451,6 +586,11 @@ class __KT_SlidesAPI {
451
586
  const slidesInstance = new KT_Slides(options);
452
587
  slidesInstance.cleanUp();
453
588
  };
589
+
590
+ static migrate = (options: KT_SlidesOptions) => {
591
+ const slidesInstance = new KT_Slides(options);
592
+ return slidesInstance.migrateBackgroundPivots();
593
+ };
454
594
  }
455
595
 
456
596
  export const KT_SlidesAPI = __KT_SlidesAPI;
@@ -0,0 +1,23 @@
1
+ import { describe, it, expect } from "kt-testing-suite-core";
2
+ import { KT_Slides } from "../index";
3
+
4
+ describe("KT_Slides Tests", () => {
5
+ it("should batch split slides correctly", () => {
6
+ const duration = 30;
7
+ const slideMultiplier = 10;
8
+ const width = 3840;
9
+ const height = 2160;
10
+
11
+ const slides = new KT_Slides({
12
+ name: "Test Slides",
13
+ duration: duration,
14
+ width: width,
15
+ height: height,
16
+ comp: app.project.activeItem as CompItem,
17
+ slideMultiplier: slideMultiplier,
18
+ });
19
+
20
+ slides.batchSplitSlides();
21
+ slides.cleanUp();
22
+ });
23
+ });
@@ -0,0 +1,14 @@
1
+ import { expect, describe, it } from "kt-testing-suite-core";
2
+ import { KT_SlidesFreeze } from "../index";
3
+ import { OBMap } from "../index";
4
+
5
+ describe("KTSlidesFreeze Tests", () => {
6
+ it("should initialize and freeze slides", () => {
7
+ const map = new OBMap();
8
+ KT_SlidesFreeze.init(map);
9
+ KT_SlidesFreeze.freeze();
10
+ expect(KT_SlidesFreeze.checkFrozen()).toBe(true);
11
+ KT_SlidesFreeze.unfreeze();
12
+ expect(KT_SlidesFreeze.checkFrozen()).toBe(false);
13
+ });
14
+ });
@@ -9,84 +9,84 @@ import {
9
9
  afterEach,
10
10
  } from "kt-testing-suite-core";
11
11
  import { KT_Slides, KT_ForproTools, KT_SlidesFreeze } from "../index";
12
+ // import "./freezer.test";
13
+ // import "./slides.test";
14
+ // import "./batchSplitSlides.test";
15
+ import "./splitSlides.test";
12
16
 
13
- describe("KtForproTools Tests", () => {
14
- it("should import the slides module", () => {
15
- const duration = 30;
16
- const slideMultiplier = 16;
17
- const width = 3840;
18
- const height = 2160;
19
- KT_SlidesFreeze.init();
20
- KT_SlidesFreeze.freeze();
21
- expect(KT_SlidesFreeze.checkFrozen()).toBe(true);
22
- KT_SlidesFreeze.unfreeze();
23
- expect(KT_SlidesFreeze.checkFrozen()).toBe(false);
24
- // KT_ForproTools.Cleanup();
25
- // KT_ForproTools.utils.cleanNamePrecomp();
26
- // KT_ForproTools.utils.sendCleanupToMediaEncoder(["esp", "cat"]);
27
- // KT_ForproTools.utils.sendLanguagesToMediaEncoder();
28
- // KT_ForproTools.utils.sendCleanupToMediaEncoder();
29
- // KT_ForproTools.utils.autoPrecompAndKeyOut();
30
- // KT_ForproTools.utils.copyMarkersToComp(app.project.activeItem as CompItem);
31
- // KT_ForproTools.utils.copyMasksFromMasterToLayer();
32
- // const folder = Folder.selectDialog("Select a folder with language subfolders");
33
- // $.writeln("Selected folder: " + folder?.fsName);
34
- // KT_ForproTools.utils.precompAndKeyOut("cat");
35
- // KT_ForproTools.utils.createCleanupStructure();
17
+ // describe("KtForproTools Tests", () => {
18
+ // it("should import the slides module", () => {
19
+ // const duration = 30;
20
+ // const slideMultiplier = 16;
21
+ // const width = 3840;
22
+ // const height = 2160;
36
23
 
37
- // const slides = new KT_Slides({
38
- // name: "Test Slides",
39
- // duration: duration,
40
- // width: width,
41
- // height: height,
42
- // comp: app.project.activeItem as CompItem,
43
- // slideMultiplier: slideMultiplier,
44
- // });
24
+ // KT_ForproTools.Cleanup();
25
+ // KT_ForproTools.utils.cleanNamePrecomp();
26
+ // KT_ForproTools.utils.sendCleanupToMediaEncoder(["esp", "cat"]);
27
+ // KT_ForproTools.utils.sendLanguagesToMediaEncoder();
28
+ // KT_ForproTools.utils.sendCleanupToMediaEncoder();
29
+ // KT_ForproTools.utils.autoPrecompAndKeyOut();
30
+ // KT_ForproTools.utils.copyMarkersToComp(app.project.activeItem as CompItem);
31
+ // KT_ForproTools.utils.copyMasksFromMasterToLayer();
32
+ // const folder = Folder.selectDialog("Select a folder with language subfolders");
33
+ // $.writeln("Selected folder: " + folder?.fsName);
34
+ // KT_ForproTools.utils.precompAndKeyOut("cat");
35
+ // KT_ForproTools.utils.createCleanupStructure();
45
36
 
46
- // slides.cleanUp();
47
- // slides.import();
48
- // slides.splitSlides();
49
- // const startTime = new Date().getTime();
50
- // slides.batchSplitSlides();
51
- // // slides.splitSlides();
37
+ // const slides = new KT_Slides({
38
+ // name: "Test Slides",
39
+ // duration: duration,
40
+ // width: width,
41
+ // height: height,
42
+ // comp: app.project.activeItem as CompItem,
43
+ // slideMultiplier: slideMultiplier,
44
+ // });
52
45
 
53
- // const endTime = new Date().getTime();
54
- // const timeTaken = endTime - startTime;
55
- // //display time taken in minutes and seconds format mm:ss
56
- // $.writeln(
57
- // "Time taken: "
58
- // .concat(Math.floor(timeTaken / 60000).toFixed(0), ":")
59
- // .concat(((timeTaken % 60000) / 1000).toFixed(0), "s")
60
- // );
46
+ // slides.cleanUp();
47
+ // slides.import();
48
+ // slides.splitSlides();
49
+ // const startTime = new Date().getTime();
50
+ // slides.batchSplitSlides();
51
+ // // slides.splitSlides();
61
52
 
62
- // const comp = app.project.activeItem as CompItem;
63
- // const layer = comp.layers[1];
64
- // const masks = layer.mask;
65
- // const mask1 = masks.property(1);
66
- // const maskShape = mask1.property("Mask Path").value;
53
+ // const endTime = new Date().getTime();
54
+ // const timeTaken = endTime - startTime;
55
+ // //display time taken in minutes and seconds format mm:ss
56
+ // $.writeln(
57
+ // "Time taken: "
58
+ // .concat(Math.floor(timeTaken / 60000).toFixed(0), ":")
59
+ // .concat(((timeTaken % 60000) / 1000).toFixed(0), "s")
60
+ // );
67
61
 
68
- // const layer2 = comp.layers[2];
69
- // const masks2 = layer2.Masks.addProperty("Mask");
62
+ // const comp = app.project.activeItem as CompItem;
63
+ // const layer = comp.layers[1];
64
+ // const masks = layer.mask;
65
+ // const mask1 = masks.property(1);
66
+ // const maskShape = mask1.property("Mask Path").value;
70
67
 
71
- // var newMask = masks2.property("maskShape");
72
- // var theShape = newMask.value;
73
- // var inspectProps = [];
74
- // for (let i = 1; i <= mask1.numProperties; i++) {
75
- // inspectProps.push(mask1.property(i));
76
- // }
68
+ // const layer2 = comp.layers[2];
69
+ // const masks2 = layer2.Masks.addProperty("Mask");
77
70
 
78
- // const newShape = new Shape();
79
- // newShape.vertices = maskShape.vertices;
80
- // newShape.inTangents = maskShape.inTangents;
81
- // newShape.outTangents = maskShape.outTangents;
82
- // newShape.isClosed = maskShape.isClosed;
83
- // newMask.setValue(newShape);
84
- // masks2.inverted = mask1.inverted;
85
- // masks2.maskMode = mask1.maskMode;
86
- // expect(maskShape).toBeGreaterThan(0);
71
+ // var newMask = masks2.property("maskShape");
72
+ // var theShape = newMask.value;
73
+ // var inspectProps = [];
74
+ // for (let i = 1; i <= mask1.numProperties; i++) {
75
+ // inspectProps.push(mask1.property(i));
76
+ // }
87
77
 
88
- // expect(maskShape).toBeGreaterThan(0);
89
- });
90
- });
78
+ // const newShape = new Shape();
79
+ // newShape.vertices = maskShape.vertices;
80
+ // newShape.inTangents = maskShape.inTangents;
81
+ // newShape.outTangents = maskShape.outTangents;
82
+ // newShape.isClosed = maskShape.isClosed;
83
+ // newMask.setValue(newShape);
84
+ // masks2.inverted = mask1.inverted;
85
+ // masks2.maskMode = mask1.maskMode;
86
+ // expect(maskShape).toBeGreaterThan(0);
87
+
88
+ // expect(maskShape).toBeGreaterThan(0);
89
+ // });
90
+ // });
91
91
 
92
92
  runTests();
@@ -0,0 +1,40 @@
1
+ import { describe, it, expect } from "kt-testing-suite-core";
2
+ import { KT_Slides } from "../index";
3
+
4
+ describe("KT_Slides Tests", () => {
5
+ it("should configure slides module", () => {
6
+ const duration = 30;
7
+ const slideMultiplier = 10;
8
+ const width = 3840;
9
+ const height = 2160;
10
+
11
+ const slides = new KT_Slides({
12
+ name: "Test Slides",
13
+ duration: duration,
14
+ width: width,
15
+ height: height,
16
+ comp: app.project.activeItem as CompItem,
17
+ slideMultiplier: slideMultiplier,
18
+ });
19
+
20
+ // slides.cleanUp();
21
+ slides.import();
22
+ // slides.splitSlides();
23
+ // const startTime = new Date().getTime();
24
+ // slides.batchSplitSlides();
25
+
26
+ // const endTime = new Date().getTime();
27
+ // const timeTaken = endTime - startTime;
28
+ // $.writeln(
29
+ // "Time taken: "
30
+ // .concat(Math.floor(timeTaken / 60000).toFixed(0), ":")
31
+ // .concat(((timeTaken % 60000) / 1000).toFixed(0), "s")
32
+ // );
33
+
34
+ expect(duration).toBe(30);
35
+ expect(slideMultiplier).toBe(16);
36
+ expect(width).toBe(3840);
37
+ expect(height).toBe(2160);
38
+ expect(!!KT_Slides).toBe(true);
39
+ });
40
+ });
@@ -0,0 +1,23 @@
1
+ import { describe, it, expect } from "kt-testing-suite-core";
2
+ import { KT_Slides } from "../index";
3
+
4
+ describe("KT_Slides Tests", () => {
5
+ it("should split selectedslides correctly", () => {
6
+ const duration = 30;
7
+ const slideMultiplier = 10;
8
+ const width = 3840;
9
+ const height = 2160;
10
+
11
+ const slides = new KT_Slides({
12
+ name: "Test Slides",
13
+ duration: duration,
14
+ width: width,
15
+ height: height,
16
+ comp: app.project.activeItem as CompItem,
17
+ slideMultiplier: slideMultiplier,
18
+ });
19
+
20
+ slides.splitSlides();
21
+ // slides.cleanUp();
22
+ });
23
+ });