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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Layer Color other than given RGB

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 361 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 23/02/2017 at 00:31, xxxxxxxx wrote:

      Hi there,

      I tried to set a Layer Color via

      > layer_data = layer.GetLayerData(doc)
      >
      > layer_data['color'] = c4d.Vector(200,100,50)
      >
      > layer.SetLayerData(doc,layer_data)

      If I take 255,0,0 as RGB-Values, it's a red one so this works basically.
      But the result of 200,100,50 is a white layer instead of a brown one.

      why?

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

        On 23/02/2017 at 04:59, xxxxxxxx wrote:

        Hi,

        in Vectors colors do usually get stored in floating point values ranging from 0.0 to 1.0 instead of integer values from 0 to 255.

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

          On 24/02/2017 at 00:56, xxxxxxxx wrote:

          k. are there other - maybe simpler than calculating from 0-255 to 0-1 - possibilities since the RGB-Values in the ColorChoosers are also from 0-255?

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

            On 24/02/2017 at 09:01, xxxxxxxx wrote:

            Converting 0-255 to 0-1.0 is only a matter of dividing the value by 255. Can't get much simpler than that

            Steve

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