5
$\begingroup$

I am trying to animate changing brightness of a point lamp using input data that I have. However, when I try to access the lamp's strength using

bpy.data.node_groups["Shader Nodetree"].nodes["Emission"].inputs[1].default_value

I get the error message:

Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
KeyError: 'bpy_prop_collection[key]: key "Shader Nodetree" not found

Is there another way I can/should access and change the lamp's strength via Python?

$\endgroup$
1
  • $\begingroup$ you can find the answer here $\endgroup$ – João Cartucho May 24 '19 at 7:47
2
$\begingroup$

Yes, reach node_tree through lamp object bpy.data.lamps['lamp name'].node_tree.nodes.

$\endgroup$
2
  • $\begingroup$ This works great! I'm now trying to add keyframes for the changing lamp strength, what should go in the data_path parameter? $\endgroup$ – wjkaufman Oct 4 '15 at 22:17
  • $\begingroup$ My guess is 'default_value', since you keyframing a node input. $\endgroup$ – kilbee Oct 4 '15 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.