Getting/Converting Color Values From Lights?

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
User avatar
Atomic
Posts: 157
Joined: April 30th, 2007, 5:55 am
Location: United States, Ohio

I am working with the AE3DExport script written by the urbanspaceman.

I am adding Blender functionality to the export section and have run into a snag on lights.

It seems there is no way to tell what kind of light an After Effects light is? Does anyone know of a way to detect the light type?

Also, working with the color of the light I am stuck. I know how to get the color

Code: Select all

G.LIGHT_COLOR = layer.property("Color")
But how do I get access to the RGB elements of the color?

Here is my attempted Blender python output that fails.

Code: Select all

"localLamp.R = " + G.LIGHT_COLOR[0]+G.RET+
"localLamp.G = " + G.LIGHT_COLOR[1]+G.RET+
"localLamp.B = " + G.LIGHT_COLOR[2]+G.RET+
I assumed the color value was an array, but I get undefined from the above code.

Thanks!
"Up And Atom

No...No

Up And At Them!"
User avatar
Atomic
Posts: 157
Joined: April 30th, 2007, 5:55 am
Location: United States, Ohio

I think I figured it out.

Code: Select all

G.LIGHT_COLOR = layer.property("Color").value
I have to add .value to my initial color fetch.
"Up And Atom

No...No

Up And At Them!"
benroll

Atomic wrote:I think I figured it out.

Code: Select all

G.LIGHT_COLOR = layer.property("Color").value
I have to add .value to my initial color fetch.
Hi Atomic,

Did you ever solve the light type issue. If not, try this...

Code: Select all

function getLightType(aLightLayer) {
				
				//check it's a light layer
				if(aLightLayer.lightOption) {
					if(!aLightLayer.lightOption("Shadow Darkness").canSetExpression) {
						//ambient light
						return("AMBIENT");
					} else if(!aLightLayer.lightOption("Shadow Diffusion").canSetExpression){
						//parallel light
						return("PARALLEL");
					} else if(!aLightLayer.lightOption("Cone Angle").canSetExpression) {
						return("POINT");
					} else {
						return("SPOT");
					}
						
				} else {
					return("NOT_A_LIGHT");
				}
			
			
		}
I'd be very interested if you get further with your AE to Blender script. It could not only prove useful as AE to Blender, but also as an intermediary for C4D to Blender, since I can't seem to get animating scenes from one package into the other.

Best,

Ben.
Post Reply