kt-forpro-tools 1.1.0 → 1.1.2

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,6 +1,6 @@
1
1
  {
2
2
  "name": "kt-forpro-tools",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "",
5
5
  "author": "Miguel de Mendoza",
6
6
  "main": "src/index.ts",
package/src/slides.ts CHANGED
@@ -3,6 +3,8 @@ import { KT_Layers } from "kt-ae-tools-layers";
3
3
  import { KT_AeIs as is } from "kt-ae-is-checkers";
4
4
  import { IO } from "kt-io";
5
5
 
6
+ const BACKGROUND_LABEL = 13;
7
+
6
8
  const colorSelector = () => {
7
9
  let lastColorIndex = -1;
8
10
  const numColors = 16;
@@ -10,6 +12,9 @@ const colorSelector = () => {
10
12
 
11
13
  // ✅ Pre-generar pool de colores disponibles
12
14
  for (let i = 0; i < numColors; i++) {
15
+ if (i === BACKGROUND_LABEL) {
16
+ continue;
17
+ }
13
18
  colorPool.push(i);
14
19
  }
15
20
 
@@ -33,6 +38,7 @@ export type KT_SlidesOptions = {
33
38
  comp?: CompItem;
34
39
  slideMultiplier?: number;
35
40
  slideDistance?: number;
41
+ lazyInit?: boolean;
36
42
  };
37
43
 
38
44
  class KT_Slides {
@@ -43,7 +49,7 @@ class KT_Slides {
43
49
  backgroundComp!: CompItem;
44
50
  compedSlidesFolder!: FolderItem;
45
51
  duration: number = 30;
46
- masterComp: CompItem;
52
+ masterComp!: CompItem;
47
53
  slidesFootage: FootageItem[] = [];
48
54
  width: number = 1920;
49
55
  height: number = 1080;
@@ -54,6 +60,9 @@ class KT_Slides {
54
60
  name: string = "Slides";
55
61
  slideMultiplier: number = 1;
56
62
  backgroundColor: [number, number, number] = [1, 1, 1];
63
+ backgroundPivotPrefix: string = "_BG_";
64
+ private initialized: boolean = false;
65
+ private initialComp?: CompItem;
57
66
  private getNextColor = colorSelector();
58
67
 
59
68
  constructor(options: KT_SlidesOptions = {}) {
@@ -67,6 +76,7 @@ class KT_Slides {
67
76
  comp,
68
77
  slideMultiplier,
69
78
  slideDistance,
79
+ lazyInit = true,
70
80
  } = options;
71
81
  this.name = name || this.name;
72
82
  this.duration = duration || this.duration;
@@ -76,14 +86,27 @@ class KT_Slides {
76
86
  this.inDuration = inDuration || this.inDuration;
77
87
  this.slideMultiplier = slideMultiplier || this.slideMultiplier;
78
88
  this.slideDistance = slideDistance || this.slideDistance;
89
+
90
+ this.initialComp = comp;
91
+ if (lazyInit === false) {
92
+ this.ensureInitialized();
93
+ }
94
+ }
95
+
96
+ private ensureInitialized = () => {
97
+ if (this.initialized) {
98
+ return;
99
+ }
100
+
79
101
  this.initFolders();
80
102
  const compExists = KT_Project.find.comps({ name: this.name + " Master" });
81
103
  if (compExists && compExists.length > 0) {
82
104
  this.masterComp = compExists[0] as CompItem;
105
+ this.initialized = true;
83
106
  return;
84
107
  }
85
108
  this.masterComp =
86
- comp ||
109
+ this.initialComp ||
87
110
  (KT_Project.add.comp({
88
111
  name: this.name + " Master",
89
112
  width: this.width,
@@ -91,7 +114,8 @@ class KT_Slides {
91
114
  duration: this.duration,
92
115
  parentFolder: this.rootFolder,
93
116
  }) as CompItem);
94
- }
117
+ this.initialized = true;
118
+ };
95
119
 
96
120
  initFolders = (options: KT_SlidesOptions = {}): void => {
97
121
  const rootFolder = KT_Project.find.folders({ name: this.name + " Project" });
@@ -154,7 +178,7 @@ class KT_Slides {
154
178
  this.width,
155
179
  this.height,
156
180
  1,
157
- this.duration
181
+ this.duration,
158
182
  );
159
183
  }
160
184
 
@@ -169,10 +193,6 @@ class KT_Slides {
169
193
  };
170
194
 
171
195
  import = (slideMultiplier?: number) => {
172
- if (!this.masterComp) {
173
- $.writeln("Master comp not found");
174
- return;
175
- }
176
196
  this.slideMultiplier = slideMultiplier || this.slideMultiplier;
177
197
  const path = IO.fs.openFolderDialog("Select Slides Folder");
178
198
  if (!path) {
@@ -180,6 +200,13 @@ class KT_Slides {
180
200
  return;
181
201
  }
182
202
 
203
+ this.ensureInitialized();
204
+
205
+ if (!this.masterComp) {
206
+ $.writeln("Master comp not found");
207
+ return;
208
+ }
209
+
183
210
  let footage = KT_Project.import.images({
184
211
  path: path.fsName,
185
212
  footageFolder: this.footageFolder,
@@ -206,6 +233,8 @@ class KT_Slides {
206
233
 
207
234
  footage.forEach((item, index) => {
208
235
  const randomColorIndex = this.getNextColor();
236
+ const groupStartTime = (index * this.slideMultiplier + 0) * this.inDuration * 2;
237
+ let lowerGroupLayer: Layer | null = null;
209
238
  for (let i = 0; i < this.slideMultiplier; i++) {
210
239
  const subComp = this.precompSlide(item as FootageItem, i);
211
240
 
@@ -213,31 +242,128 @@ class KT_Slides {
213
242
  subComp as AVItem,
214
243
  this.inDuration * 2,
215
244
  this.masterComp,
216
- (index * this.slideMultiplier + i) * this.inDuration * 2
245
+ (index * this.slideMultiplier + i) * this.inDuration * 2,
217
246
  );
218
247
  this.enableTimeRemap(layer as AVLayer);
219
248
  layer.outPoint = this.masterComp.duration;
220
249
  layer.label = randomColorIndex;
221
250
  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;
251
+ lowerGroupLayer = layer;
226
252
  }
227
253
  this.slides.push(layer);
228
254
  }
229
- });
230
255
 
256
+ const bgPivot = this.masterComp.layers.add(this.backgroundComp);
257
+
258
+ this.fitLayerToComp(bgPivot, this.masterComp);
259
+ bgPivot.name = this.backgroundPivotPrefix + item.name.split("-")[0];
260
+ bgPivot.startTime = groupStartTime;
261
+ bgPivot.outPoint = this.masterComp.duration;
262
+ bgPivot.label = BACKGROUND_LABEL;
263
+ this.enableTimeRemap(bgPivot as AVLayer);
264
+ if (lowerGroupLayer) {
265
+ bgPivot.moveAfter(lowerGroupLayer);
266
+ }
267
+ });
268
+ this.batchSplitSlides();
231
269
  return this;
232
270
  };
233
271
  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++) {
272
+ const layers = KT_Layers.find.layers({ comps: this.masterComp });
273
+ const backgroundPivots = this.getBackgroundPivots(layers);
274
+
275
+ if (backgroundPivots.length === 0) {
276
+ const legacyBatches = this.getLegacySlideBatches(layers);
277
+ legacyBatches.forEach((batchLayers) => {
278
+ this.splitSlides(batchLayers);
279
+ });
280
+ return;
281
+ }
282
+
283
+ backgroundPivots.forEach((pivotLayer, index, collection) => {
284
+ const nextPivot = collection[index + 1];
285
+ const nextPivotStart = nextPivot ? nextPivot.startTime : Number.MAX_VALUE;
286
+
287
+ const groupSlides = layers.filter((layer) => {
288
+ if (this.isBackgroundPivot(layer)) {
289
+ return false;
290
+ }
291
+ return layer.startTime >= pivotLayer.startTime && layer.startTime < nextPivotStart;
292
+ });
293
+
294
+ if (groupSlides.length === 0) {
295
+ return;
296
+ }
297
+
298
+ this.splitSlides(groupSlides);
299
+ });
300
+ };
301
+
302
+ migrateBackgroundPivots = () => {
303
+ const layers = KT_Layers.find.layers({ comps: this.masterComp });
304
+ const backgroundPivots = this.getBackgroundPivots(layers);
305
+ if (backgroundPivots.length > 0) {
306
+ return 0;
307
+ }
308
+
309
+ const batches = this.getLegacySlideBatches(layers);
310
+ let addedPivots = 0;
311
+
312
+ batches.forEach((batchLayers) => {
313
+ if (!batchLayers || batchLayers.length === 0) {
314
+ return;
315
+ }
316
+
317
+ let firstLayer = batchLayers[0];
318
+ let lowerGroupLayer = batchLayers[0];
319
+ batchLayers.forEach((layer) => {
320
+ if (layer.startTime < firstLayer.startTime) {
321
+ firstLayer = layer;
322
+ }
323
+ if (layer.index > lowerGroupLayer.index) {
324
+ lowerGroupLayer = layer;
325
+ }
326
+ });
327
+
328
+ const bgPivot = this.masterComp.layers.add(this.backgroundComp);
329
+ this.fitLayerToComp(bgPivot, this.masterComp);
330
+ bgPivot.name = this.backgroundPivotPrefix + firstLayer.name.split("-")[0];
331
+ bgPivot.startTime = firstLayer.startTime;
332
+ bgPivot.outPoint = this.masterComp.duration;
333
+ bgPivot.label = BACKGROUND_LABEL;
334
+ this.enableTimeRemap(bgPivot as AVLayer);
335
+ bgPivot.moveAfter(lowerGroupLayer);
336
+ addedPivots += 1;
337
+ });
338
+
339
+ return addedPivots;
340
+ };
341
+
342
+ private getBackgroundPivots = (layers: Layer[]) => {
343
+ const pivots = layers.filter((layer) => this.isBackgroundPivot(layer));
344
+ pivots.sort((a, b) => a.startTime - b.startTime);
345
+ return pivots;
346
+ };
347
+
348
+ private isBackgroundPivot = (layer: Layer) => {
349
+ const avLayer = layer as AVLayer;
350
+ if (avLayer.source && avLayer.source === this.backgroundComp) {
351
+ return true;
352
+ }
353
+ return layer.name.indexOf(this.backgroundPivotPrefix) === 0;
354
+ };
355
+
356
+ private getLegacySlideBatches = (layers: Layer[]) => {
357
+ const batches: Layer[][] = [];
358
+ const batchSize = this.slideMultiplier > 0 ? this.slideMultiplier : 1;
359
+
360
+ for (let i = 0; i < layers.length; ) {
361
+ const batchLayers = layers.slice(i, i + batchSize);
362
+ if (batchLayers.length === 0) {
363
+ break;
364
+ }
365
+
366
+ for (let j = 0; j < batchLayers.length - 1; j++) {
241
367
  const layer = batchLayers[j] as AVLayer;
242
368
  const nextLayer = batchLayers[j + 1] as AVLayer;
243
369
  if (layer.inPoint - nextLayer.inPoint > this.inDuration * 3) {
@@ -245,15 +371,23 @@ class KT_Slides {
245
371
  break;
246
372
  }
247
373
  }
374
+
375
+ batches.push(batchLayers);
248
376
  i += batchLayers.length;
249
- this.splitSlides(batchLayers);
250
377
  }
378
+
379
+ return batches;
251
380
  };
381
+
252
382
  splitSlides = (layers?: Layer[]) => {
253
383
  if (!Array.isArray(layers) || layers.length <= 1) {
254
384
  layers = this.masterComp.selectedLayers;
255
385
  }
256
386
 
387
+ if (layers) {
388
+ layers = layers.filter((layer) => !this.isBackgroundPivot(layer));
389
+ }
390
+
257
391
  if (!layers || layers.length === 0) {
258
392
  $.writeln("No layers selected for precomp");
259
393
  return;
@@ -322,6 +456,7 @@ class KT_Slides {
322
456
  pivotIndex += 1;
323
457
  // Ajustar la duración de la precomp
324
458
  const solid = precomp.layers.add(this.backgroundComp);
459
+ this.fitLayerToComp(solid, precomp);
325
460
  solid.moveToEnd();
326
461
  precomp.duration = this.duration;
327
462
  });
@@ -333,6 +468,9 @@ class KT_Slides {
333
468
  const compsToKeep: string[] = [];
334
469
  for (let i = 1; i <= layers.length; i++) {
335
470
  const layer = layers[i];
471
+ if (this.isBackgroundPivot(layer)) {
472
+ continue;
473
+ }
336
474
  const nameSplit = layer.name.split("-");
337
475
  const slideIndex = parseInt(nameSplit[nameSplit.length - 1]) - 1;
338
476
  const slideName = this.getSlideName(layer, slideIndex, "_Slide_");
@@ -345,7 +483,10 @@ class KT_Slides {
345
483
  const keep = compsToKeep.indexOf(item.name) >= 0;
346
484
  if (!keep) {
347
485
  $.writeln(
348
- "Removing comp: " + item.name + "indexof: " + compsToKeep.indexOf(item.name)
486
+ "Removing comp: " +
487
+ item.name +
488
+ "indexof: " +
489
+ compsToKeep.indexOf(item.name),
349
490
  );
350
491
  item.remove();
351
492
  }
@@ -357,11 +498,12 @@ class KT_Slides {
357
498
  source: AVItem,
358
499
  duration: number,
359
500
  comp: CompItem = app.project.activeItem as CompItem,
360
- startTime?: number
501
+ startTime?: number,
361
502
  ) {
362
503
  const layer = comp.layers.add(source);
363
504
  layer.startTime = 0;
364
505
  layer.outPoint = duration;
506
+ this.fitLayerToComp(layer, comp);
365
507
  this.slideUp(layer);
366
508
  this.disolveIn(layer);
367
509
  layer.startTime = startTime || 0;
@@ -380,7 +522,7 @@ class KT_Slides {
380
522
  private getSlideName = (
381
523
  item: _ItemClasses | Layer,
382
524
  index: number,
383
- infix: string = "-"
525
+ infix: string = "-",
384
526
  ): string => {
385
527
  return item.name.split("-")[0] + infix + (index + 1);
386
528
  };
@@ -414,13 +556,32 @@ class KT_Slides {
414
556
  });
415
557
  };
416
558
 
559
+ private fitLayerToComp = (layer: Layer, comp: CompItem): Layer => {
560
+ const avLayer = layer as AVLayer;
561
+ if (!avLayer.source) return layer;
562
+ const src = avLayer.source as CompItem | FootageItem;
563
+ const sourceWidth = src.width;
564
+ const sourceHeight = src.height;
565
+ if (!sourceWidth || !sourceHeight) return layer;
566
+ const scalePercent = Math.min(comp.width / sourceWidth, comp.height / sourceHeight) * 100;
567
+ const currentScale = layer.scale.value as number[];
568
+ const newScale: number[] = [scalePercent, scalePercent];
569
+ if (currentScale.length > 2) newScale.push(currentScale[2]);
570
+ layer.scale.setValue(newScale as any);
571
+ const center: number[] = [comp.width / 2, comp.height / 2];
572
+ const currentPos = layer.position.value as number[];
573
+ if (currentPos.length > 2) center.push(currentPos[2]);
574
+ layer.position.setValue(center as any);
575
+ return layer;
576
+ };
577
+
417
578
  private enableTimeRemap = (layer: AVLayer) => {
418
579
  layer.timeRemapEnabled = true;
419
580
  const property = layer.property("ADBE Time Remapping") as Property;
420
581
  if (!is.layer || layer.canSetTimeRemapEnabled === false) return layer;
421
582
  if (property) {
422
583
  property.addKey(
423
- property.keyTime(property.numKeys) - layer.containingComp.frameDuration
584
+ property.keyTime(property.numKeys) - layer.containingComp.frameDuration,
424
585
  );
425
586
  property.removeKey(property.numKeys);
426
587
  }
@@ -433,24 +594,44 @@ export { KT_Slides };
433
594
  class __KT_SlidesAPI {
434
595
  private slidesInstance: KT_Slides | null = null;
435
596
  static import = (options: KT_SlidesOptions = {}) => {
436
- const slides = new KT_Slides(options);
597
+ const slides = new KT_Slides({
598
+ ...options,
599
+ lazyInit: true,
600
+ });
437
601
  slides.import(options.slideMultiplier);
438
602
  return slides;
439
603
  };
440
604
 
441
605
  static refreshAll = (options: KT_SlidesOptions) => {
442
- const slidesInstance = new KT_Slides(options);
606
+ const slidesInstance = new KT_Slides({
607
+ ...options,
608
+ lazyInit: false,
609
+ });
443
610
  slidesInstance.batchSplitSlides();
444
611
  };
445
612
 
446
613
  static refreshSelected = (options: KT_SlidesOptions) => {
447
- const slidesInstance = new KT_Slides(options);
614
+ const slidesInstance = new KT_Slides({
615
+ ...options,
616
+ lazyInit: false,
617
+ });
448
618
  slidesInstance.splitSlides();
449
619
  };
450
620
  static cleanUp = (options: KT_SlidesOptions) => {
451
- const slidesInstance = new KT_Slides(options);
621
+ const slidesInstance = new KT_Slides({
622
+ ...options,
623
+ lazyInit: false,
624
+ });
452
625
  slidesInstance.cleanUp();
453
626
  };
627
+
628
+ static migrate = (options: KT_SlidesOptions) => {
629
+ const slidesInstance = new KT_Slides({
630
+ ...options,
631
+ lazyInit: false,
632
+ });
633
+ return slidesInstance.migrateBackgroundPivots();
634
+ };
454
635
  }
455
636
 
456
637
  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
+ });
@@ -9,80 +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
- 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;
12
+ // import "./freezer.test";
13
+ import "./slides.test";
14
+ // import "./batchSplitSlides.test";
15
+ // import "./splitSlides.test";
19
16
 
20
- // KT_ForproTools.Cleanup();
21
- // KT_ForproTools.utils.cleanNamePrecomp();
22
- // KT_ForproTools.utils.sendCleanupToMediaEncoder(["esp", "cat"]);
23
- // KT_ForproTools.utils.sendLanguagesToMediaEncoder();
24
- // KT_ForproTools.utils.sendCleanupToMediaEncoder();
25
- // KT_ForproTools.utils.autoPrecompAndKeyOut();
26
- // KT_ForproTools.utils.copyMarkersToComp(app.project.activeItem as CompItem);
27
- // KT_ForproTools.utils.copyMasksFromMasterToLayer();
28
- // const folder = Folder.selectDialog("Select a folder with language subfolders");
29
- // $.writeln("Selected folder: " + folder?.fsName);
30
- // KT_ForproTools.utils.precompAndKeyOut("cat");
31
- // 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;
32
23
 
33
- // const slides = new KT_Slides({
34
- // name: "Test Slides",
35
- // duration: duration,
36
- // width: width,
37
- // height: height,
38
- // comp: app.project.activeItem as CompItem,
39
- // slideMultiplier: slideMultiplier,
40
- // });
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();
41
36
 
42
- // slides.cleanUp();
43
- // slides.import();
44
- // slides.splitSlides();
45
- // const startTime = new Date().getTime();
46
- // slides.batchSplitSlides();
47
- // // 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
+ // });
48
45
 
49
- // const endTime = new Date().getTime();
50
- // const timeTaken = endTime - startTime;
51
- // //display time taken in minutes and seconds format mm:ss
52
- // $.writeln(
53
- // "Time taken: "
54
- // .concat(Math.floor(timeTaken / 60000).toFixed(0), ":")
55
- // .concat(((timeTaken % 60000) / 1000).toFixed(0), "s")
56
- // );
46
+ // slides.cleanUp();
47
+ // slides.import();
48
+ // slides.splitSlides();
49
+ // const startTime = new Date().getTime();
50
+ // slides.batchSplitSlides();
51
+ // // slides.splitSlides();
57
52
 
58
- // const comp = app.project.activeItem as CompItem;
59
- // const layer = comp.layers[1];
60
- // const masks = layer.mask;
61
- // const mask1 = masks.property(1);
62
- // 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
+ // );
63
61
 
64
- // const layer2 = comp.layers[2];
65
- // 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;
66
67
 
67
- // var newMask = masks2.property("maskShape");
68
- // var theShape = newMask.value;
69
- // var inspectProps = [];
70
- // for (let i = 1; i <= mask1.numProperties; i++) {
71
- // inspectProps.push(mask1.property(i));
72
- // }
68
+ // const layer2 = comp.layers[2];
69
+ // const masks2 = layer2.Masks.addProperty("Mask");
73
70
 
74
- // const newShape = new Shape();
75
- // newShape.vertices = maskShape.vertices;
76
- // newShape.inTangents = maskShape.inTangents;
77
- // newShape.outTangents = maskShape.outTangents;
78
- // newShape.isClosed = maskShape.isClosed;
79
- // newMask.setValue(newShape);
80
- // masks2.inverted = mask1.inverted;
81
- // masks2.maskMode = mask1.maskMode;
82
- // 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
+ // }
83
77
 
84
- // expect(maskShape).toBeGreaterThan(0);
85
- });
86
- });
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
+ // });
87
91
 
88
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
+ });