Anybody know how to set the Light type?
addLight adds a spot light and i want a point light.
Thanks
Set Light Type
Moderator: Paul Tuersley
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
Hey Lloyd,
you can't do that directly with scripting.
The possible workarounds are:
you can't do that directly with scripting.
The possible workarounds are:
- 1. attach to your script a project with a single comp that contains each type of light (layer 1: parallel light, layer 2: spot light, etc), and import that project into the current project. I think this has been discussed in the forum (do a search for more details). You would use a script like this:
Code: Select all
// Import the "light" project var lightProjName = "light.aep"; var impOpt = new ImportOptions(File(lightProjName)); // same folder as the script var proj = app.project; proj.importFile(impOpt); // Retrieve the comp that contains the light layers var i, lightComp; for (i = 1; i <= proj.numItems; i++) { if (proj.item(i).name == lightProjName) { lightComp = proj.item(i).item(1); // assuming the comp is the first item break; } } if (lightComp) { // Retrieve light layers var parallelLight = lightComp.layer(1); var spotLight = lightComp.layer(2); var pointLight = lightComp.layer(3); var ambientLight = lightComp.layer(4); // Add point light to the active comp var activeComp = proj.activeItem; pointLight.copyToComp(activeComp); // Delete imported stuff proj.item(i).remove(); }
- 2. write a little plug-in that creates a light and sets its type using AEGP_SetLightType(). I can give you the full source code since I wrote this plug-in last year (you would have to compile a version for Mac, or ask Dale to do it for you
).
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
Thanks for the great reply nab! And I would love to take a look at that plugin code if you don't mind.. might as well.. scripting has certainly proved to be my gateway drug into programming 
if you want to email it you can send it to my name at aescripts dat com

if you want to email it you can send it to my name at aescripts dat com
I sent the files via PM because I received an error with the other address 
