Skip to content

Commit 11f53ed

Browse files
committed
initial commit
0 parents  commit 11f53ed

File tree

4 files changed

+279
-0
lines changed

4 files changed

+279
-0
lines changed

.gitignore

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# custom
2+
Thumbs.db
3+
_*.*
4+
*_.*
5+
*.*_
6+
*.afdesign
7+
* copy*
8+
*copy *
9+
*.vscode
10+
11+
# Compiled Lua sources
12+
luac.out
13+
14+
# luarocks build files
15+
*.src.rock
16+
*.zip
17+
*.tar.gz
18+
19+
# Object files
20+
*.o
21+
*.os
22+
*.ko
23+
*.obj
24+
*.elf
25+
26+
# Precompiled Headers
27+
*.gch
28+
*.pch
29+
30+
# Libraries
31+
*.lib
32+
*.a
33+
*.la
34+
*.lo
35+
*.def
36+
*.exp
37+
38+
# Shared objects (inc. Windows DLLs)
39+
*.dll
40+
*.so
41+
*.so.*
42+
*.dylib
43+
44+
# Executables
45+
*.exe
46+
*.out
47+
*.app
48+
*.i*86
49+
*.x86_64
50+
*.hex
51+

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# moho-ae-camera-export
2+
SimplSam's **AE Camera Export** is a Moho tool that allows you to export Camera property & keyframe data to the **clipboard**, ready for pasting directly to Adobe After Effects.
3+
4+
![img](https://i.ibb.co/L51hqW7/mh-camera-keyframes.png)
5+
6+
It was designed as an _upgrade_ / companion to the excellent earlier **DS Camera to AE** tool - created by David F. Sandberg (aka. ponysmasher) - https://www.dauid.com, and complements it with these new & alternate features:
7+
8+
- Instantly **Saves Camera data to the Clipboard** (instead of a file); ready for pasting
9+
- Can be run as a Button or Menu Tool
10+
- Reduces data size by eliminating redundant keyframes (does not bake multiple keyframes if the property only has a single value)
11+
- Has a modular code refactor
12+
13+
![img](https://i.ibb.co/wh3sdZ1/ae-cam-stats.png)
14+
15+
### So ... Why do you need AE Camera Export ? ###
16+
17+
The tool allows the efficient sharing of Camera configuration and keyframed positioning information from Moho to After Effects, which helps greatly when your animation workflow (finalizing, SFXing or compositing) includes one or more trips from Moho -> Ae. Thus allowing Camera movement & properties to be easily synchronized (_one-way_).
18+
19+
![img](https://i.ibb.co/PMLQ8Gd/ae-cam-config.png)
20+
21+
### Version ###
22+
23+
* version: 2.0 #520114 MH12+
24+
* release: v2.00
25+
* by Sam Cogheil (SimplSam)
26+
27+
### How do I get set up ? ###
28+
29+
* To install:
30+
31+
- Download latest release: [ss_ae_camera_export.zip](https://github.com/SimplSam/moho-ae-camera-export/releases/latest/download/ss_ae_camera_export.zip)
32+
- Save the 'ss_ae_camera_export.lua' and 'ss_ae_camera_export.png' files to your computer into your <custom>/scripts/tool folder (or under scripts/menu)
33+
- Reload Moho scripts (or Restart Moho)
34+
35+
* To use:
36+
37+
- Run the **AE Camera Export+** tool from the Tools palette or Menu location
38+
- If you need to view/amend the data before passing to AE, you can paste into a Excel/Spreadsheet or Text editor
39+
40+
41+
### Options & Features ###
42+
\*\* Currently there are no options.
43+
44+
45+
### Notes & Limitations ###
46+
47+
There appears to be a bug in AS11 which limits the size of text passed to the Clipboard to 4096 bytes. Thus AS11 is not fully compatible with this tool.
48+
49+
Because the 'DS Camera to AE' tool fully baked the Camera movement (_wrote every possible keyframe_), it would always overwrite all previous settings. This tool is keyframe data optimized and only writes required keyframes. So you may occasionally need to clear old-keyframes (deselect the stop-watches or delete keyframes) before use.
50+
51+
Additional Notes:
52+
53+
* Compatible/Tested with MH12+
54+
* Optimized for MH12+
55+
56+
 
57+
58+
59+
## Special Thanks to: ##
60+
61+
* David F. Sandberg (ponysmasher) -- https://www.dauid.com
62+
* Stan (and the team): MOHO Scripting -- https://mohoscripting.com
63+
* The friendly faces @ Lost Marble Moho forum -- https://www.lostmarble.com/forum/

ss_ae_camera_export.lua

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
2+
-- **************************************************
3+
-- Provide Moho with the name of this script object
4+
-- **************************************************
5+
6+
ScriptName = "SS_Ae_CameraExport"
7+
8+
--[[
9+
10+
Derived work based on: 'DS Camera to AE v1.1' by
11+
(C) 2013 David F. Sandberg (aka. ponysmasher)
12+
https://www.dauid.com - with thanks
13+
14+
Derived by: Sam Cogheil (SimplSam) 2022-Jan
15+
16+
Primary Changes:
17+
- Save to Clipboard instead of file
18+
- Run as Menu or Button Tool (w/ PNG)
19+
- Optimize/Minimize: Keyframe-less properties
20+
- Functionalise
21+
22+
]]--
23+
24+
-- **************************************************
25+
-- General information about this script
26+
-- **************************************************
27+
28+
SS_Ae_CameraExport = {}
29+
function SS_Ae_CameraExport:Name()
30+
return "SS/DS Camera to AE+"
31+
end
32+
33+
function SS_Ae_CameraExport:Version()
34+
return "2.0 #520114"
35+
end
36+
37+
function SS_Ae_CameraExport:Description()
38+
return "Export Camera data to Clipboard for After Effects"
39+
end
40+
41+
function SS_Ae_CameraExport:Creator()
42+
return "dauid.com / SimplSam"
43+
end
44+
45+
function SS_Ae_CameraExport:UILabel()
46+
return("Camera to AE+")
47+
end
48+
49+
50+
-- **************************************************
51+
-- The guts of this script
52+
-- **************************************************
53+
54+
function SS_Ae_CameraExport:Run(moho)
55+
56+
local mohodoc = moho.document
57+
local width = mohodoc:Width()
58+
local height = mohodoc:Height()
59+
local aspect = mohodoc:AspectRatio()
60+
local newX = mohodoc:Width()/2
61+
local newY = mohodoc:Height()/2
62+
local newZ = mohodoc:Height()/2
63+
local fps = mohodoc:Fps()
64+
local startframe = mohodoc:StartFrame()
65+
local endframe = mohodoc:EndFrame()
66+
local zoomFactor = (1/ math.tan(math.pi/(2 * 6)))/2 * newZ -- i.e. 3.7321 /2 *540 for 1080p
67+
local cliptext = {} --tabl
68+
69+
local function AddText(s)
70+
table.insert(cliptext, s .."\r\n")
71+
end
72+
73+
local function AddHead(s1, s2)
74+
AddText("\r\n" .. s1 .. "\r\n" .. s2)
75+
end
76+
77+
local function ssRound4(n)
78+
return (LM.Round(n * 10^4)/10^4)
79+
end
80+
81+
local function CallbackAngle(_val)
82+
return ssRound4(math.deg(_val))
83+
end
84+
85+
local function CallbackAngleX(_val)
86+
return CallbackAngle(_val.x)
87+
end
88+
89+
local function CallbackAngleY(_val)
90+
return CallbackAngle(_val.y)
91+
end
92+
93+
local function CallbackZoom(_val)
94+
return ssRound4(_val * zoomFactor)
95+
end
96+
97+
local function CallbackCamXYZ(_val, _zoffset)
98+
_zoffset = _zoffset or 0
99+
if (aspect >0) then
100+
_val.x = ((_val.x + 1) * newY) + newX -newY
101+
_val.y = (-_val.y + 1) * newY
102+
_val.z = (-_val.z * newZ) + _zoffset
103+
else
104+
_val.x = (_val.x + 1) * newX
105+
_val.y = ((-_val.y + 1) * newX) + newY -newX
106+
_val.z = (-_val.z * newX) + _zoffset
107+
end
108+
return ssRound4(_val.x) .."\t".. ssRound4(_val.y) .."\t".. ssRound4(_val.z)
109+
end
110+
111+
local function CallbackCamXYZee(_val)
112+
return CallbackCamXYZ(_val, 0.1)
113+
end
114+
115+
local function AddKeys(animChannel, Callback)
116+
local keyCount = animChannel:CountKeys()
117+
if (keyCount > 1) then
118+
local theend = math.min(animChannel:GetKeyWhen(keyCount -1), endframe)
119+
for i = startframe, theend do
120+
AddText("\t".. i .."\t".. Callback(animChannel:GetValue(i)) .."")
121+
end
122+
else
123+
AddText("\t\t".. Callback(animChannel:GetValue(0)) .."")
124+
end
125+
end
126+
127+
--= Header
128+
AddText("Adobe After Effects 8.0 Keyframe Data")
129+
130+
--= Doc props
131+
AddHead("\tUnits Per Second\t"..fps, "\tSource Width\t"..width)
132+
AddText("\tSource Height\t"..height)
133+
AddText("\tSource Pixel Aspect Ratio\t1")
134+
AddText("\tComp Pixel Aspect Ratio\t1")
135+
136+
--= Zoom
137+
AddHead("Camera Options\tZoom", "\tFrame\tpixels")
138+
AddKeys(mohodoc.fCameraZoom, CallbackZoom)
139+
140+
--= Point of interest (2 Node Cam)
141+
AddHead("Transform\tPoint of Interest", "\tFrame\tX pixels\tY pixels\tZ pixels")
142+
AddKeys(mohodoc.fCameraTrack, CallbackCamXYZee)
143+
144+
--= Position
145+
AddHead("Transform\tPosition", "\tFrame\tX pixels\tY pixels\tZ pixels")
146+
AddKeys(mohodoc.fCameraTrack, CallbackCamXYZ)
147+
148+
--= Z rotation
149+
AddHead("Transform\tRotation", "\tFrame\tdegrees")
150+
AddKeys(mohodoc.fCameraRoll, CallbackAngle)
151+
152+
--= X rotation
153+
AddHead("Transform\tX Rotation", "\tFrame\tdegrees")
154+
AddKeys(mohodoc.fCameraPanTilt, CallbackAngleX) -- SS: Todo Split Dims?
155+
156+
--= Y rotation
157+
AddHead("Transform\tY Rotation", "\tFrame\tdegrees")
158+
AddKeys(mohodoc.fCameraPanTilt, CallbackAngleY)
159+
160+
--= Footer
161+
AddHead("", "End of Keyframe Data")
162+
163+
--= Copy to Clipboard
164+
moho:CopyText(table.concat(cliptext))
165+
end

ss_ae_camera_export.png

2.32 KB
Loading

0 commit comments

Comments
 (0)