Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    How to get the current viewport shading modes using python

    Cinema 4D SDK
    python sdk
    3
    5
    711
    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.
    • mfersaouiM
      mfersaoui
      last edited by mfersaoui

      Hi,
      Is it possible to get the current shading modes with python ( the shading mode selected in the menu Display : Gouraud Shading, Gouraud Shading (Lines) or Quick Shading...)
      Thanks!

      1 Reply Last reply Reply Quote 0
      • S
        s_bach
        last edited by s_bach

        Hello,

        as always, please add tags to your post and mark it as a question (How to Post Questions). Thanks.

        best wishes,
        Sebastian

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • S
          s_bach
          last edited by

          Hello,

          the display mode of a given viewport window (BaseView) is stored in its BASEDRAW_DATA_SDISPLAYACTIVE parameter.

          baseDraw = doc.GetActiveBaseDraw()
          if baseDraw is None:
             raise RuntimeError()
          
          display = baseDraw.GetParameter(c4d.BASEDRAW_DATA_SDISPLAYACTIVE, c4d.DESCFLAGS_GET_0)
          
          if display == c4d.BASEDRAW_SDISPLAY_GOURAUD:
              print("Gouraud Shading")
          if display == c4d.BASEDRAW_SDISPLAY_QUICK:
              print("Quick Shading")
          

          See also the BaseView / BaseDraw Manual.

          best wishes,
          Sebastian

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

          mfersaouiM 1 Reply Last reply Reply Quote 2
          • ferdinandF
            ferdinand
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • mfersaouiM
              mfersaoui @s_bach
              last edited by

              @s_bach
              Thank you. Sorry for tags, I added tags in my topic but were not included. I don't know why.

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