Controlling Lights with Animation Nodes 2.0

I know how I control emissive objects materials with Animation Nodes, but I dont find a way to hook up the emissive strength from a light source - eg. Area Light etc - and i dont get the correct data path for an Attribute Output…

any help would great

deHeavy

and i dont get the correct data path for an Attribute Output…

You do, just not all of it…

Having said that, you do it like this:

So, the expression is this:

bpy.data.lamps[‘Lamp’].node_tree.nodes[“Emission”].inputs[1].default_value = y

Where “Lamp” is the name of the lamp (not the lamp object) and “y” is the value you want for it.

Copying the data path gives you:

nodes[“Emission”].inputs[1].default_value

But you need to know what it is derived from and there the Python For Blender manuals comes in handy… Just putting an Object into this will not work because a Lamp is not an Object, it is a Lamp, so you must find the data structure for Lamps. I guess you already know that “[Object].nodes[“Emission”].inputs[1].default_value” doesn’t work. I could write a node to give you the lamps in your project, it would take me 5 minutes, but there is no real need and I would end up writing little nodes for everything!

Cheers, Clock. :beers:

EDIT:

And you do the Colour like this:

Or like this:

So you know which is which. :grinning:

And, of course, you can also do this:

In fact there is very little you cannot do with an Expression Node, if you know the bpy.data classes…

55

Enough said I think!

1 Like

Of course you can replace all that Python with one simple new node:

This lets you set a fixed colour, or animate the RGB values as you like.

Talk to me if you want the code!

Cheers, Clock.

thanx Clock :smiley:
that is a really helpful answer.
using expressions will be a great time saver for me - I have to digg deeper into this.

the second one is above my horizon. how do you write your own node ?
Cheerz
de Heavy