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

    hud depth buffer?

    Cinema 4D SDK
    r19 2023 python
    2
    6
    1.0k
    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.
    • ymoonY
      ymoon
      last edited by

      What is the correct code "HUD depth buffer" in R19 and R2023?
      As shown, in R2023 the HUD is not obscured by objects. (R19 is inverted)
      Thank You.

      bd.SetDepth(False)
      bd.DrawMultipleHUDText(data)
      bd.SetDepth(True)
      

      Depth.png

      1 Reply Last reply Reply Quote 0
      • i_mazlovI
        i_mazlov
        last edited by

        Hi @ymoon,

        Could you please provide minimal working code snippet that highlights the problem?

        There were quite some changes since R19, so it's now hard to say if it was broken or fixed on it's way.

        Cheers,
        Ilia

        MAXON SDK Specialist
        developers.maxon.net

        ymoonY 1 Reply Last reply Reply Quote 0
        • ymoonY
          ymoon @i_mazlov
          last edited by

          @i_mazlov
          Here is code. Thank You.

          def draw(bd: c4d.BaseDraw) -> bool:
              obj=op.GetObject()
              points = obj.GetAllPoints()
              objMg = obj.GetMg()
              newpointpos = []
              for o in points:
                  newmg = objMg * o
                  newpointpos.append(newmg)
              scrpos = []
              for p in points:
                  newpos = bd.WS(p)
                  scrpos.append(newpos)
              textval = []
              for i, pos in enumerate(zip(newpointpos, scrpos)):
                  data = {"_txt":str(i), "_position":pos[1]}
                  textval.append(data)
              bd.SetDepth(False)
              bd.DrawMultipleHUDText(textval)
              bd.SetDepth(True)
              return True
          
          1 Reply Last reply Reply Quote 0
          • i_mazlovI
            i_mazlov
            last edited by

            Hi @ymoon,

            Sorry for the delayed answer.

            Drawing HUD functions are not intended to be using depth buffer, so managing z offset functions (e.g. BaseDraw.LineZOffset(), BaseDraw.SetMatrix_Screen(), BaseDraw.SetMatrix_Matrix()) would not make any effect.

            As a workaround you might consider only drawing HUDs for those points that are exposed to the editor camera.

            Let me know if you have any further questions.

            Cheers,
            Ilia

            MAXON SDK Specialist
            developers.maxon.net

            ymoonY 1 Reply Last reply Reply Quote 0
            • ymoonY
              ymoon @i_mazlov
              last edited by

              @i_mazlov said in hud depth buffer?:

              As a workaround you might consider only drawing HUDs for those points that are exposed to the editor camera.

              Thanks for your answer. The code above is my limit.
              would you give me a hint? thank you.

              1 Reply Last reply Reply Quote 0
              • ymoonY
                ymoon
                last edited by

                Added one more for... zip to remove the invisible points.

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