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
    • Register
    • Login

    DrawHUDText issue with viewport camera navigation

    Bugs
    2024 python
    2
    5
    766
    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.
    • FlavioDinizF
      FlavioDiniz
      last edited by

      Hi!

      I made an script back in C4D 2023 to draw some information on the viewport (filename, camera lens, frame number, etc). It was working perfectly in C4D 2023, but in 2024 it is glitching the viewport camera navigation.

      It's like the drawn text is in front of everything and when you click to orbit the camera, you click on the drawn text instead of the object.

      Let me try to explain with some GIFs.
      2023: I click on the corner of the cube to orbit the camera around it and it works.
      Cinema_4D_ocPCAax3qM.gif

      2024: I click on the corner of the cube to orbit the camera and the orbit pivot insn't on the cube, but on the center of the screen.
      Cinema_4D_HsHckRZN05.mp4_1024px_24fps.gif

      It's not about the navigation mode, I already made sure I'm on the "mouse" mode.
      bb6d1516-d622-4351-8780-ee9bc7318b0a-image.png

      When I delete the script on 2024, everything goes back to the normal, so I know the problem is the script.

      and here it is, it's on a python tag:

      # Playblast Overlay by Flavio Diniz
      import c4d
      
      def main() -> None:
          pass
      
      def draw(bd: c4d.BaseDraw) -> bool:
          bd = doc.GetActiveBaseDraw()
      
          frame = bd.GetFrame()
          right = frame["cr"]
          bottom = frame["cb"]
      
          camera = "Camera: "+ bd.GetSceneCamera(doc).GetName()
          filename =  doc[c4d.DOCUMENT_FILEPATH].split("\\",-1)[-1]
          focal = str(bd.GetSceneCamera(doc)[c4d.RSCAMERAOBJECT_FOCAL_LENGTH]) +" mm"
          frame = "Frame: "+ str(doc[c4d.DOCUMENT_TIME].GetFrame(doc.GetFps()))
      
          bd.DrawHUDText(int(right /2)-300, int(bottom)-20, "{0}   |   {1} - {2}   |   {3}".format(filename, camera, focal, frame))
      
          return c4d.DRAWRESULT_OK
      

      Does anyone have any idea of what could be happening ?
      Thanks!

      Flavio Diniz

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

        Hi Flavio,

        Thanks for reaching out to us. Please excuse the delay.

        I've created a ticket in our internal bug tracking system for this issue.

        Cheers,
        Ilia

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • FlavioDinizF
          FlavioDiniz
          last edited by

          I think it must be a bug ! and I'm surprised I haven't heard anyone talking about this so far, since the "DrawHUDText" is so common for people to use 🤔
          I also noticed the same problem happening with "DrawMultipleHUDText".

          Thanks!
          Flavio Diniz

          i_mazlovI 1 Reply Last reply Reply Quote 0
          • ferdinandF ferdinand moved this topic from Cinema 4D SDK on
          • i_mazlovI
            i_mazlov @FlavioDiniz
            last edited by i_mazlov

            Hi Flavio Diniz,

            The ticket has been fixed and closed. The C4D side fix is present at least in Cinema 4D 2025.2.0.

            Let me also share the developer's comment from the ticket:

            2 things are broken: C4D and the python tag. Once C4D is fixed, try again after changing the code in the python tag:

            import c4d
            def main() -> None:
                pass
            def draw(bd: c4d.BaseDraw) -> bool:
                if bd.GetDrawPass() != c4d.DRAWPASS_OBJECT or bd.GetDrawParam(c4d.BASEDRAW_IS_PICK_OBJECT):
                    return True
            
                frame = bd.GetFrame()
                right = frame["cr"]
                bottom = frame["cb"]
                bd.DrawHUDText(int(right / 2) - 100, int(bottom) - 20, "Hello World!")
                return True
            

            The important thing is to draw only in the drawpasses in which it makes sense to draw.

            Cheers,
            Ilia

            MAXON SDK Specialist
            developers.maxon.net

            1 Reply Last reply Reply Quote 1
            • FlavioDinizF
              FlavioDiniz
              last edited by

              Thanks a lot @i_mazlov !
              The issue is solved !

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