Page 1 of 1

Getting/Converting Color Values From Lights?

Posted: February 12th, 2009, 1:56 pm
by Atomic
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!

Re: Getting/Converting Color Values From Lights?

Posted: February 13th, 2009, 7:26 am
by Atomic
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.

Re: Getting/Converting Color Values From Lights?

Posted: April 29th, 2010, 5:26 am
by 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.