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

    script not working in r10

    Scheduled Pinned Locked Moved SDK Help
    9 Posts 0 Posters 678 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 06/11/2006 at 08:58, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   10 
      Platform:   Windows  ;   
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      I have a question regarding a script:
      I am still using C4d 9.6,
      and I use this script to toggle color for the Grids and Viewport background at once, when I switch between dark and light layouts. For some reason it does not seem to work anymore with r10 (demo).
      Can anyone help me as to why that is?

      the script:

      var bgcolor = GetWorldContainer();
      var rgb = 256.0;
      var R = 170;
      var G = 170;
      var B = 170;
      var B1 = vector(R/rgb,G/rgb,B/rgb);
      var r = 70;
      var g = 70;
      var b = 70;
      var B2 = vector(r/rgb,g/rgb,b/rgb);
      if (bgcolor->GetData(WPREF_BACKGROUND_COL) == B1)
      bgcolor->SetData(WPREF_BACKGROUND_COL , B2);
      else
      bgcolor->SetData(WPREF_BACKGROUND_COL , B1);
      SetWorldContainer(bgcolor);

      var Gcolor = GetWorldContainer();
      var rgb = 256.0;
      var R = 120;
      var G = 120;
      var B = 120;
      var G1 = vector(R/rgb,G/rgb,B/rgb);
      var r = 135;
      var g = 135;
      var b = 135;
      var G2 = vector(r/rgb,g/rgb,b/rgb);
      if (bgcolor->GetData(WPREF_GRID_MAJOR_COL) == G1)
      bgcolor->SetData(WPREF_GRID_MAJOR_COL , G2);
      else
      bgcolor->SetData(WPREF_GRID_MAJOR_COL , G1);
      SetWorldContainer(bgcolor);

      var Gcolor = GetWorldContainer();
      var rgb = 256.0;
      var R = 150;
      var G = 150;
      var B = 150;
      var M1 = vector(R/rgb,G/rgb,B/rgb);
      var r = 95;
      var g = 95;
      var b = 95;
      var M2 = vector(r/rgb,g/rgb,b/rgb);
      if (bgcolor->GetData(WPREF_GRID_MINOR_COL) == M1)
      bgcolor->SetData(WPREF_GRID_MINOR_COL , M2);
      else
      bgcolor->SetData(WPREF_GRID_MINOR_COL , M1);
      SetWorldContainer(bgcolor);

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 07/11/2006 at 16:21, xxxxxxxx wrote:

        Using a very similar script and would also like to see what to do to get it running in R10 🙂

        Cheers
        Lennart

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 08/11/2006 at 02:34, xxxxxxxx wrote:

          The WPREF_XXX_COL identifiers are not declared anymore in R10. I have to look how you can set the colors in COFFEE now.

          cheers,
          Matthias

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 07/04/2010 at 16:37, xxxxxxxx wrote:

            Did this make it back?
            Or how would we control the background color now?

            Cheers
            Lennart

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 08/04/2010 at 00:07, xxxxxxxx wrote:

              Have a look at coffeesymbols.h in the resource folder: All symbols are defined there. By a quick glance, I would say that VIEWCOLOR_C4DBACKGROUND is a hot candidate.

              Hope it helps

              Kabe

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 08/04/2010 at 03:43, xxxxxxxx wrote:

                Yup I did find and tried all of those, but that one return a 1,1,1 vector (full white instead of the grey used)
                and the others nil. So still wonder what/how to do.

                Thanks
                Lennart

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

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 10/04/2010 at 19:32, xxxxxxxx wrote:

                  Ok, testing with Python it works visa"GetViewColor()".
                  But that one seems to be undefined by COFFEE.

                  I'm a still missing something or what is it that is changed?

                  Python test:

                    
                  import c4d   
                  from c4d import symbols as sy   
                    
                  dark = c4d.Vector(0.2,0.2,0.2)   
                  light = c4d.Vector(0.8,0.8,0.8)   
                    
                  def main() :   
                      col = c4d.GetViewColor(sy.VIEWCOLOR_C4DBACKGROUND)   
                      print col   
                      if col == dark:   
                              c4d.SetViewColor(sy.VIEWCOLOR_C4DBACKGROUND,light)   
                    
                      elif col == light:   
                              c4d.SetViewColor(sy.VIEWCOLOR_C4DBACKGROUND,dark)   
                  

                  Cheers
                  Lennart

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

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 12/04/2010 at 02:18, xxxxxxxx wrote:

                    It's currently not possible in COFFEE.

                    cheers,
                    Matthias

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

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 12/04/2010 at 05:28, xxxxxxxx wrote:

                      Good to see that Python is starting to become a real alternative 🙂 
                      Cheers,
                      Jack

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