kt-forpro-tools 1.0.9 → 1.0.11

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.9",
3
+ "version": "1.0.11",
4
4
  "description": "",
5
5
  "author": "Miguel de Mendoza",
6
6
  "main": "src/index.ts",
@@ -9,7 +9,11 @@ describe("KtForproTools Tests", () => {
9
9
  const height = 2160;
10
10
 
11
11
  // KT_ForproTools.Cleanup();
12
- KT_ForproTools.utils.cleanNamePrecomp();
12
+ // KT_ForproTools.utils.cleanNamePrecomp();
13
+ KT_ForproTools.utils.precompAndKeyOut("esp");
14
+ KT_ForproTools.utils.precompAndKeyOut("cat");
15
+ // KT_ForproTools.utils.createCleanupStructure();
16
+
13
17
  // const slides = new KT_Slides({
14
18
  // name: "Test Slides",
15
19
  // duration: duration,
package/src/utils.ts CHANGED
@@ -1,12 +1,14 @@
1
- import { KT_AeIs } from "kt-ae-is-checkers";
2
- import { KT_Project } from "kt-ae-tools-project";
1
+ import { KT_AeIs as is } from "kt-ae-is-checkers";
3
2
 
3
+ import { KT_Project } from "kt-ae-tools-project";
4
+ import { IO } from "kt-io";
4
5
  function generateProjectStructure(
5
6
  template: any = {},
6
- name: string = "Template Project",
7
+ name?: string,
7
8
  parentFolder: FolderItem = app.project.rootFolder
8
9
  ): FolderItem {
9
- const newFolder = KT_Project.add.folder({ name, parentFolder });
10
+ const newFolder = typeof name === "string" ? KT_Project.add.folder({ name, parentFolder }) : parentFolder;
11
+
10
12
  for (const key in template) {
11
13
  if (key === "calback") {
12
14
  template[key](newFolder);
@@ -17,9 +19,22 @@ function generateProjectStructure(
17
19
  return newFolder;
18
20
  }
19
21
 
20
- export function createCleanupStructure(name: string = "Project"): FolderItem {
21
- return generateProjectStructure(
22
- {
22
+ export function createCleanupStructure(name: string): FolderItem {
23
+ return generateProjectStructure({
24
+ src: {
25
+ esp: {},
26
+ cat: {},
27
+ },
28
+ outputs: {
29
+ esp: {},
30
+ cat: {},
31
+ },
32
+ });
33
+ }
34
+
35
+ class __KT_FP_Utils {
36
+ createCleanupStructure = (): FolderItem => {
37
+ return generateProjectStructure({
23
38
  src: {
24
39
  esp: {},
25
40
  cat: {},
@@ -28,17 +43,13 @@ export function createCleanupStructure(name: string = "Project"): FolderItem {
28
43
  esp: {},
29
44
  cat: {},
30
45
  },
31
- },
32
- name + " Cleanup"
33
- );
34
- }
35
-
36
- class __KT_FP_Utils {
37
- cleanNamePrecomp = () => {
38
- const selectedItems = app.project.selection;
46
+ });
47
+ };
48
+ cleanNamePrecomp = (items: _ItemClasses[] | _ItemClasses = app.project.selection) => {
49
+ items = items instanceof Array ? items : [items];
39
50
  const createdComps: CompItem[] = [];
40
- for (let i = 0; i < selectedItems.length; i++) {
41
- const item = selectedItems[i];
51
+ for (let i = 0; i < items.length; i++) {
52
+ const item = items[i];
42
53
  const itemName = item.name.split("/")[0];
43
54
  const parentFolder = item.parentFolder;
44
55
  const comp = KT_Project.add.compFromFootage(item, { name: itemName, parentFolder: parentFolder });
@@ -46,7 +57,7 @@ class __KT_FP_Utils {
46
57
  createdComps.push(comp);
47
58
  }
48
59
  }
49
- for (const item of selectedItems) {
60
+ for (const item of items) {
50
61
  item.selected = false;
51
62
  }
52
63
 
@@ -55,6 +66,32 @@ class __KT_FP_Utils {
55
66
  }
56
67
  return createdComps;
57
68
  };
69
+
70
+ precompAndKeyOut = (lang: string = "esp") => {
71
+ const footagePaths = [KT_Project.path.join("//src", lang)];
72
+ const footageItems = KT_Project.find.footage({ relativePath: footagePaths });
73
+ if (footageItems.length === 0) {
74
+ return;
75
+ }
76
+ const createdComps = this.cleanNamePrecomp(footageItems);
77
+
78
+ const outputFolderPath = KT_Project.path.join("//outputs", lang);
79
+ const parentFolder = KT_Project.find.folders(outputFolderPath)[0] || app.project.rootFolder;
80
+ KT_Project.move.move(createdComps, parentFolder);
81
+ const presetsPath = IO.path.sanitize(
82
+ "C:/Users/orson/Documents/Adobe/After Effects 2025/User Presets/IEF_Chroma.ffx"
83
+ );
84
+ const presetFile = new File(presetsPath);
85
+ if (!presetFile.exists) {
86
+ return;
87
+ }
88
+ for (const comp of createdComps) {
89
+ const layer = comp.layers[1];
90
+ layer.selected = true;
91
+ layer.applyPreset(presetFile);
92
+ layer.selected = false;
93
+ }
94
+ };
58
95
  }
59
96
 
60
97
  const KT_FP_Utils = new __KT_FP_Utils();