Page 1 of 1
setLightParameters doesn't work as in documentation
Posted: 07 Apr 2022, 05:49
by ask4jubad
I would like to change the diffuse and specular components of one of the default lights in my simulation using the following:
Code: Select all
sim.setLightParameters(lightHandleA, 1, None, [difA1, difA2, difA3], [0,0,0])
but it returns the following error:
Exception: b"42: Incorrect table size. (in function 'sim.setLightParameters')"
Mind you, difA1 - difA3 are all float numbers between 0 and 1.
In specific terms, how can I get this done?
Please support with this.
Re: setLightParameters doesn't work as in documentation
Posted: 07 Apr 2022, 13:54
by coppelia
Hello,
you are right. The Python version needs a bit different handling. Try by replacing None with [0,0,0].
Cheers
Re: setLightParameters doesn't work as in documentation
Posted: 11 Apr 2022, 08:59
by ask4jubad
Thanks Coppelia.
Can you tell me about how to do the handling in python then please? I mean to be able to change the diffuse and specular components across the range and not just turn on/of the light.
Thanks
Re: setLightParameters doesn't work as in documentation
Posted: 13 Apr 2022, 08:12
by coppelia
What about:
Code: Select all
sim.setLightParameters(lightHandle,1,[0,0,0],[1,1,1],[0,0,0]) # light is white
sim.setLightParameters(lightHandle,1,[0,0,0],[1,0,0],[0,0,0]) # light is red
sim.setLightParameters(lightHandle,0,[0,0,0],[1,0,0],[0,0,0]) # light is off
etc.
cheers
Re: setLightParameters doesn't work as in documentation
Posted: 14 Apr 2022, 09:37
by ask4jubad
Thanks it worked.
I think updating the documentation a bit would save a lot of time.
I see that it is currently written as:
Python synopsis Code: Select all
sim.setLightParameters(int objectHandle,int state,None,list diffusePart,list specularPart)
The setToNULL parameter does not work with
None (at least for me and I have reproduced this three times) rather [0, 0, 0] worked.
My recommendation is to update it thus:
Code: Select all
sim.setLightParameters(int objectHandle,int state,[0,0,0],list(3)diffusePart,list(3)specularPart)
The clarity will be helpful.