kt-forpro-tools 1.0.18 → 1.0.20

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.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "",
5
5
  "author": "Miguel de Mendoza",
6
6
  "main": "src/index.ts",
package/src/freeze.ts ADDED
@@ -0,0 +1,74 @@
1
+ import { KT_Project } from "kt-ae-tools-project";
2
+
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
+ };
15
+ private frezzeExpression(property: Property) {
16
+ if (property.canSetExpression && property.expressionEnabled) {
17
+ const value = property.value;
18
+ property.setValue(value);
19
+ property.expressionEnabled = false;
20
+ }
21
+ }
22
+
23
+ private unfreezeExpression(property: Property) {
24
+ if (property.canSetExpression && !property.expressionEnabled) {
25
+ property.expressionEnabled = true;
26
+ }
27
+ }
28
+
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_out.layers[1] as AVLayer).transform.opacity,
36
+ (this.logo_out.layers[2] as AVLayer).transform.opacity,
37
+ (this.chyrons.layers.byName("profesor") as TextLayer).text.sourceText,
38
+ (this.chyrons.layers.byName("titulo") as TextLayer).text.sourceText,
39
+ (this.logo_out.layers.byName("logo-cat") as AVLayer).transform.opacity,
40
+ (this.logo_out.layers.byName("logo-esp") as AVLayer).transform.opacity,
41
+ ];
42
+
43
+ this.lessons.forEach((comp) => {
44
+ properties.push((comp.layers.byName("Lección") as TextLayer).text.sourceText);
45
+ });
46
+
47
+ return properties;
48
+ }
49
+
50
+ freeze() {
51
+ const properties = this.findProperties();
52
+ properties.forEach((property) => {
53
+ this.frezzeExpression(property);
54
+ });
55
+ }
56
+ unfreeze() {
57
+ const properties = this.findProperties();
58
+ properties.forEach((property) => {
59
+ this.unfreezeExpression(property);
60
+ });
61
+ }
62
+
63
+ checkFrozen() {
64
+ const properties = this.findProperties();
65
+ let allFrozen = true;
66
+ properties.forEach((property) => {
67
+ if (property.canSetExpression && property.expressionEnabled) {
68
+ allFrozen = false;
69
+ }
70
+ });
71
+ return allFrozen;
72
+ }
73
+ }
74
+ export const KT_SlidesFreeze = new __KT_SlidesFreeze();
package/src/index.ts CHANGED
@@ -2,5 +2,6 @@ import { KT_Core } from "kt-core";
2
2
  import { KT_ForproTools } from "./KT_ForproTools";
3
3
  import { KT_Slides } from "./slides";
4
4
  import { type KT_SlidesOptions } from "./slides";
5
+ import { KT_SlidesFreeze } from "./freeze";
5
6
 
6
- export { KT_ForproTools, KT_Slides, type KT_SlidesOptions };
7
+ export { KT_ForproTools, KT_Slides, type KT_SlidesOptions, KT_SlidesFreeze };
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect, runTests, beforeAll, afterAll, beforeEach, afterEach } from "kt-testing-suite-core";
2
- import { KT_Slides, KT_ForproTools } from "../index";
2
+ import { KT_Slides, KT_ForproTools, KT_SlidesFreeze } from "../index";
3
3
 
4
4
  describe("KtForproTools Tests", () => {
5
5
  it("should import the slides module", () => {
@@ -7,12 +7,16 @@ describe("KtForproTools Tests", () => {
7
7
  const slideMultiplier = 16;
8
8
  const width = 3840;
9
9
  const height = 2160;
10
-
10
+ KT_SlidesFreeze.init();
11
+ KT_SlidesFreeze.freeze();
12
+ expect(KT_SlidesFreeze.checkFrozen()).toBe(true);
13
+ KT_SlidesFreeze.unfreeze();
14
+ expect(KT_SlidesFreeze.checkFrozen()).toBe(false);
11
15
  // KT_ForproTools.Cleanup();
12
16
  // KT_ForproTools.utils.cleanNamePrecomp();
13
17
  // KT_ForproTools.utils.sendCleanupToMediaEncoder(["esp", "cat"]);
14
18
  // KT_ForproTools.utils.sendLanguagesToMediaEncoder();
15
- KT_ForproTools.utils.sendCleanupToMediaEncoder();
19
+ // KT_ForproTools.utils.sendCleanupToMediaEncoder();
16
20
  // KT_ForproTools.utils.autoPrecompAndKeyOut();
17
21
  // KT_ForproTools.utils.copyMarkersToComp(app.project.activeItem as CompItem);
18
22
  // KT_ForproTools.utils.copyMasksFromMasterToLayer();
@@ -21,14 +25,14 @@ describe("KtForproTools Tests", () => {
21
25
  // KT_ForproTools.utils.precompAndKeyOut("cat");
22
26
  // KT_ForproTools.utils.createCleanupStructure();
23
27
 
24
- const slides = new KT_Slides({
25
- name: "Test Slides",
26
- duration: duration,
27
- width: width,
28
- height: height,
29
- comp: app.project.activeItem as CompItem,
30
- slideMultiplier: slideMultiplier,
31
- });
28
+ // const slides = new KT_Slides({
29
+ // name: "Test Slides",
30
+ // duration: duration,
31
+ // width: width,
32
+ // height: height,
33
+ // comp: app.project.activeItem as CompItem,
34
+ // slideMultiplier: slideMultiplier,
35
+ // });
32
36
 
33
37
  // slides.cleanUp();
34
38
  // slides.import();