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

    Annotation tag without bubble

    Cinema 4D SDK
    sdk
    2
    5
    758
    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.
    • S
      Sinnerkot
      last edited by

      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!

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @Sinnerkot
        last edited by ferdinand

        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:

        • Support Procedures: Scope of Support: Lines out the things we will do and what we will not do.
        • Support Procedures: Confidential Data: Most questions should be accompanied by code but code cannot always be shared publicly. This section explains how to share code confidentially with Maxon.
        • Forum Structure and Features: Lines out how the forum works.
        • Structure of a Question: Lines out how to ask a good technical question. It is not mandatory to follow this exactly, but you should follow the idea of keeping things short and mentioning your primary question in a clear manner.

        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

        S 1 Reply Last reply Reply Quote 1
        • S
          Sinnerkot @ferdinand
          last edited by

          @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!

          ferdinandF 1 Reply Last reply Reply Quote 0
          • ferdinandF
            ferdinand @Sinnerkot
            last edited by ferdinand

            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

            S 1 Reply Last reply Reply Quote 1
            • S
              Sinnerkot @ferdinand
              last edited by

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

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