SOLVED BaseDraw::DrawHUDText() - setting color ?

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!

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

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

Thanks a lot!