Solved Annotation tag without bubble

I tried to create something similar to annotation tag, but so that it had neither color nor bubble - only text. But all attempts and efforts are unsuccessful. Can you tell me the way to solve the problem?

I need a text that will be attached to the object, look at the camera all the time and regardless of the camera position it should be the same size.
(This is how Google maps signatures work - house numbers, street names, for example)
Yes, this can be implemented using xpresso and look at camera tag, but when I work with it, the viewport does not draw everything in real time, I need a mouse click in the graph with objects, and I need everything to happen in realtime.

Thank you in advance!

@ferdinand many thanks, I think that the topic is closed! You're amazing!

Hello @Sinnerkot,

Welcome to the Plugin Café forum and the Cinema 4D development community, it is great to have you with us!

Getting Started

Before creating your next postings, we would recommend making yourself accustomed with our Forum and Support Guidelines, as they line out details about the Maxon SDK Group support procedures. Of special importance are:

About your First Question

First of all, please share code in the future so that we can see that you tried on your own and more importantly what you tried to do. Drawing text can be achieved with BaseDraw.DrawHUDText. This will draw text in the HUD style, you can also draw it manually using a bitmap and then having full control over the outcome, but that can also get complicated when you then must make sure that your text looks sharp.

I provided a brief example for BaseDraw.DrawHUDText below. Using a Python programming tag is not the only option, you can use everything that has a .Draw method.

Cheers,
Ferdinand

File: hud_text.c4d
Result:Screenshot 2023-07-04 at 10.06.40.png

Code:

"""Demonstrates how to draw hud text with a `BaseDraw`.
"""

import c4d

doc: c4d.documents.BaseDocument # The document evaluating this tag
op: c4d.BaseTag # The Python scripting tag

def main() -> None:
    pass

def draw(bd: c4d.BaseDraw) -> bool:
    """Draws the string located at (c4d.ID_USERDATA, 1) onto the origin of the object holding this
    tag.
    """
    # Bail if we are not in the object drawing pass.
    if bd.GetDrawPass() != c4d.DRAWPASS_OBJECT:
        pass

    # Get the object the tag is attached to and its location in screen space.
    obj: c4d.BaseObject = op.GetObject()
    mg: c4d.Matrix = obj.GetMg()
    p: c4d.Vector = bd.WS(mg.off)

    # Get the string to draw and set the drawing operations to be carried out in camera space.
    msg: str = op[c4d.ID_USERDATA, 1]
    bd.SetMatrix_Camera()

    # DRaw the hud text at the origin of the object.
    bd.DrawHUDText(int(p.x), int(p.y), msg)

    return True

MAXON SDK Specialist
developers.maxon.net

@ferdinand Thank you very much for your answer, I am insanely grateful!
Unfortunately, I couldn't attach the code, because I didn't get any result, that is, literally I have nothing to attach. According to which solution you gave me, it is almost perfect, it does everything you need, except that it has some background around it, and I needed only text. This is really my first time trying to work with python and solve a similar problem, sorry if it's hard with me.
Thank you again!

Hey @Sinnerkot,

As indicated before, it is recommended to use this method, as things otherwise can get complicated. You must render your text as a bitmap yourself when you do not want to use DrawHudText and draw that bitmap then with BaseDraw.DrawTexture . Aliasing can become a problem here, so you should render your bitmap at at least twice its display size.

But even in that case the bitmap background will be a problem. I thought you meant "without bubble" the speech bubble arm of the annotation tag, but you seem to want to draw without any background, i.e., text with a transparent background. The subject has been discussed before here for C++ and is even more tricky then the whole "draw your own text with GeClipMap routine" alone.

Cheers,
Ferdinand

MAXON SDK Specialist
developers.maxon.net

@ferdinand many thanks, I think that the topic is closed! You're amazing!