Set light intensity from Python [SOLVED]



  • On 11/09/2015 at 15:36, xxxxxxxx wrote:

    Hi all,

    I'm trying to do a basic task. Set the intensity of a light from python. I know it can be done via subscripting.

    Light[c4d.LIGHT_BRIGHTNESS] = 0.5

    But i want to do it from the data instance. I tried:

    def main() :
        ins = op.GetDataInstance()
        ins.SetData(c4d.LIGHT_BRIGHTNESS, 0.5)
        c4d.EventAdd()

    That function sets the data instance, but that isn't changing the light. Also, if I make a new light and run:

    def main() :
        ins = op.GetDataInstance()
        for a,b in ins:
            print a,b

    It doesn't print a value for the light intensity. Any ideas?



  • On 12/09/2015 at 11:38, xxxxxxxx wrote:

    Hi
    You can modify the intensity like this:

      
    def main() :   
        op[c4d.LIGHT_BRIGHTNESS] = 0.5   
        c4d.EventAdd()
    

    -b



  • On 14/09/2015 at 02:25, xxxxxxxx wrote:

    Hello,

    most parameters of the light object are not stored in the BaseContainer so you have to use the way bonsak showed.

    Best wishes,
    Sebastian



  • On 17/09/2015 at 18:41, xxxxxxxx wrote:

    Right.. but that must have to be changing data of a base container..  Why is it that some lighting data exists in the base container, but others don't?

    bonsak, it's not really appreciated to post an answer that exists in the question..



  • On 18/09/2015 at 02:32, xxxxxxxx wrote:

    Hello,

    I guess it has historic reasons why the light object stores most of its parameters not in the BaseContainer. Because exceptions like this one should use SetParameter() and GetParameter() to access parameters.

    Best wishes,
    Sebastian


Log in to reply