1
$\begingroup$

In my VRML file, I have lights switched off. But when I render it in blender (by using the import tool), the lights are switched on.

I looked at the code:

def importLamp_PointLight(node, ancestry):
    ....
    # is_on = node.getFieldAsBool('on', True, ancestry) # TODO
    ....

As I can see in the code, lamp's is_on has not been implemented. But I need this to work. How can I contribute to the code and make this work?

I see the this is implemented in bpy.data.lamps, but it uses C code _bpy imports types.

Thanks.

$\endgroup$

1 Answer 1

1
$\begingroup$

You could try uncommenting the is_on line and add something like

bpylamp.hide = not is_on
bpylamp.hide_render = not is_on

Another option could be

if is_on:
    bpylamp.energy = intensity
else:
    bpylamp.energy = 0

The X3D/VRML2 import script was written by Campbell and Bart so you might want to contact them and ask what they planned to do with the lights and whether they want some help. It's possible they left it like that because there is no on/off light switch in blender (maybe adding one is a TODO somewhere).

$\endgroup$
2
  • $\begingroup$ I think you are correct. The camera button is hide_render one. I used your bpylamp.hide_render = not is_on solution, however not exactly. Because hide_render is an attribute of bpy.data.objectand not of bpylamp. $\endgroup$
    – iamkhush
    Commented Aug 8, 2014 at 10:35
  • $\begingroup$ hide will hide the lamp in the viewport - this also applies to preview rendering in the viewport, hide_render will only hide it while rendering - as in final image rendering. There isn't a switch that turns off both at the same time. $\endgroup$
    – sambler
    Commented Aug 8, 2014 at 18:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .