kt-forpro-tools 1.0.8 → 1.0.10

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.8",
3
+ "version": "1.0.10",
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);
@@ -34,11 +36,23 @@ export function createCleanupStructure(name: string = "Project"): FolderItem {
34
36
  }
35
37
 
36
38
  class __KT_FP_Utils {
37
- cleanNamePrecomp = () => {
38
- const selectedItems = app.project.selection;
39
+ createCleanupStructure = (): FolderItem => {
40
+ return generateProjectStructure({
41
+ src: {
42
+ esp: {},
43
+ cat: {},
44
+ },
45
+ outputs: {
46
+ esp: {},
47
+ cat: {},
48
+ },
49
+ });
50
+ };
51
+ cleanNamePrecomp = (items: _ItemClasses[] | _ItemClasses = app.project.selection) => {
52
+ items = items instanceof Array ? items : [items];
39
53
  const createdComps: CompItem[] = [];
40
- for (let i = 0; i < selectedItems.length; i++) {
41
- const item = selectedItems[i];
54
+ for (let i = 0; i < items.length; i++) {
55
+ const item = items[i];
42
56
  const itemName = item.name.split("/")[0];
43
57
  const parentFolder = item.parentFolder;
44
58
  const comp = KT_Project.add.compFromFootage(item, { name: itemName, parentFolder: parentFolder });
@@ -46,8 +60,37 @@ class __KT_FP_Utils {
46
60
  createdComps.push(comp);
47
61
  }
48
62
  }
63
+ for (const item of items) {
64
+ item.selected = false;
65
+ }
66
+
67
+ for (const comp of createdComps) {
68
+ comp.selected = true;
69
+ }
49
70
  return createdComps;
50
71
  };
72
+
73
+ precompAndKeyOut = (lang: string = "esp") => {
74
+ const footagePaths = [KT_Project.path.join("//src", lang)];
75
+ const footageItems = KT_Project.find.footage({ relativePath: footagePaths });
76
+ const parenFolderPath = KT_Project.path.join("//outputs", lang);
77
+ const parentFolder = KT_Project.find.folders(parenFolderPath)[0] || app.project.rootFolder;
78
+ const createdComps = this.cleanNamePrecomp(footageItems);
79
+ KT_Project.move.move(createdComps, parentFolder);
80
+ const presetsPath = IO.path.sanitize(
81
+ "C:/Users/orson/Documents/Adobe/After Effects 2025/User Presets/IEF_Chroma.ffx"
82
+ );
83
+ const presetFile = new File(presetsPath);
84
+ if (!presetFile.exists) {
85
+ return;
86
+ }
87
+ for (const comp of createdComps) {
88
+ const layer = comp.layers[1];
89
+ layer.selected = true;
90
+ layer.applyPreset(presetFile);
91
+ layer.selected = false;
92
+ }
93
+ };
51
94
  }
52
95
 
53
96
  const KT_FP_Utils = new __KT_FP_Utils();