Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Set light intensity from Python [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 542 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            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..

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              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

              1 Reply Last reply Reply Quote 0
              • First post
                Last post