Differences
This shows you the differences between two versions of the page.
— | graphic:javascript:afterfx [2021/08/22 19:45] (current) – created ying | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Pass Javascript to AE ====== | ||
+ | |||
+ | * method: | ||
+ | - File > Scripts Menu, to display scripts from scripts folder | ||
+ | - File > Scripts > Run Script File | ||
+ | - Window > Script with UI + Dockable inside ScriptUI folder | ||
+ | - during command line: | ||
+ | - afterfx -r script_file_path.jsx | ||
+ | - afterfx -s " | ||
+ | - configure file script in Scripts Folder / Startup Folder (after UI open) + Shutdown Folder (before UI close), auto run all in order | ||
+ | |||
+ | * stop script by press Esc or Cmd+. | ||
+ | |||
+ | ====== ScriptUI Script Structure ====== | ||
+ | |||
+ | I mean: those from Window Menu > Script Window ones | ||
+ | |||
+ | * for UI + dockable script, the AE will refer the panel as " | ||
+ | var myPanel = this; | ||
+ | myPanel.add(" | ||
+ | </ | ||
+ | * if UI creation is inside a function, it will require passing this as reference in function parameter <code javascript> | ||
+ | function createUI(parent){ | ||
+ | var curPanel = parent; | ||
+ | curPanel.add(" | ||
+ | return curPanel; | ||
+ | } | ||
+ | var myPanel = createUI(this); | ||
+ | </ | ||
+ | |||
+ | ====== Normal UI Script Structure ====== | ||
+ | |||
+ | I mean: File menu > Scripts > Script Window ones | ||
+ | |||
+ | * note " | ||
+ | * detection code as <code javascript> | ||
+ | function createUI(parent){ | ||
+ | var curPanel = (parent instanceof Panel) ? parent : new Window(" | ||
+ | curPanel.add(" | ||
+ | return curPanel; | ||
+ | } | ||
+ | var myPanel = createUI(this); | ||
+ | </ | ||
+ | ====== Develop AE in Javascript ====== | ||
+ | |||
+ | ** to do** | ||
+ | |||
+ | ^ file brower | like Piper | | ||
+ | ^ parent Zero | parentConstraint, | ||
+ | ^ instance spacer | instance and push back a step | | ||
+ | |||
+ | ====== AE Object Model ====== | ||
+ | |||
+ | - system | ||
+ | - file | ||
+ | - folder | ||
+ | - socket | ||
+ | - application | ||
+ | - settings | ||
+ | - project | ||
+ | |||
+ | **Project** | ||
+ | |||
+ | * renderQueue | ||
+ | * renderQueueItem(s) > outputModule(s) | ||
+ | * item(s) | ||
+ | * folderItem | ||
+ | * compItem | ||
+ | * layer(s) > properties | ||
+ | * proxySource | ||
+ | * footageItem | ||
+ | * mainSource / proxySource | ||
+ | |||
+ | **Source** | ||
+ | * solidSource > color | ||
+ | * placeHolderSource | ||
+ | * fileSource > file | ||
+ | |||
+ | ====== Read AE Info ====== | ||
+ | |||
+ | **Project Info** | ||
+ | * project detail <code javascript> | ||
+ | projFilePath = app.project.file; | ||
+ | projFileName = File.decode(app.project.file.name); | ||
+ | |||
+ | projBitDepth = app.project.bitsPerChannel; | ||
+ | |||
+ | projItemTotal = app.project.numItems; | ||
+ | </ | ||
+ | * project panel item <code javascript> | ||
+ | // note: the app.project.item(index) use index from 1 | ||
+ | cur_item = app.project.item(1); | ||
+ | alert(cur_item.selected); | ||
+ | alert(cur_itemName.name); | ||
+ | alert(cur_itemName.comment); | ||
+ | alert(cur_itemName.id); | ||
+ | alert(cur_itemName.typeName); | ||
+ | cur_item.remove(); | ||
+ | </ | ||
+ | * project panel creation <code javascript> | ||
+ | var compFolder = app.project.items.addFolder(" | ||
+ | </ | ||
+ | |||
+ | **Layer Info** | ||
+ | * get current layer <code javascript> | ||
+ | var result=''; | ||
+ | if(app.project.activeItem.selectedLayers.length != 0) { | ||
+ | result = app.project.activeItem.selectedLayers[0].name; | ||
+ | } | ||
+ | alert(result); | ||
+ | </ | ||
+ | |||
+ | **Text Layer Info** | ||
+ | |||
+ | <code javascript> | ||
+ | var result=''; | ||
+ | if(app.project.activeItem.selectedLayers.length != 0) { | ||
+ | layerName = app.project.activeItem.selectedLayers[0].name; | ||
+ | textProp = app.project.activeItem.selectedLayers[0].property(" | ||
+ | textDocument = textProp.value; | ||
+ | result =textDocument.font; | ||
+ | // | ||
+ | // | ||
+ | // | ||
+ | } | ||
+ | alert(result ); | ||
+ | // ref: https:// | ||
+ | </ | ||
+ | |||
+ | * Layer property link expression <code javascript> | ||
+ | myComp = app.project.activeItem; | ||
+ | myLayers = myComp.selectedLayers; | ||
+ | myLayers[0].property(" | ||
+ | </ | ||
+ | ====== 3D Space Calculation ====== | ||
+ | |||
+ | * 2D_null layer' | ||