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

    BaseDraw::DrawHUDText() - setting color ?

    Cinema 4D SDK
    r23 sdk
    2
    3
    606
    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.
    • WTools3DW
      WTools3D
      last edited by

      I am trying to draw colored text with BaseDraw::DrawHUDText().
      Using BaseDraw::SetPen() before, has no effect.

      Is there any way to draw text with custom color using DrawHUDText funcrtion ?

      Thanks!

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by Manuel

        hi,

        there's no direct function for that but you can retrieve the color parameter of BaseDraw using GetParameter

        An example of a python tag that could display the text: It will work the same with C++.
        here I'm not using GetParameter but you get the idea 🙂

        import c4d
        
        def draw(bd):
            savedColor = bd[c4d.BASEDRAW_HUD_TEXTCOLOR]
            savedBG = bd[c4d.BASEDRAW_HUD_BACKCOLOR]
            savedOpacity = bd[c4d.BASEDRAW_HUD_BACKOPACITY]
        
            bd[c4d.BASEDRAW_HUD_TEXTCOLOR]= c4d.Vector(1,0,0)
            bd[c4d.BASEDRAW_HUD_BACKCOLOR]= c4d.Vector(0,1,0)
            bd[c4d.BASEDRAW_HUD_BACKOPACITY] = 0.1
          
            bd.DrawHUDText(50, 50, "my text")
            bd[c4d.BASEDRAW_HUD_TEXTCOLOR]= savedColor
            bd[c4d.BASEDRAW_HUD_BACKCOLOR]= savedBG
            bd[c4d.BASEDRAW_HUD_BACKOPACITY] = savedOpacity
        
            
        def main():
            pass  #put in your code here
        

        you can also have a look at this thread where you will find some useful informations on how to display a texture on the viewport (and some text on it)

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • WTools3DW
          WTools3D
          last edited by

          Works like a charm!
          It's much more flexible than I hoped;)

          Thanks a lot!

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