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

    Is there any information about the script that makes ghosting mode available for bind characters?

    Cinema 4D SDK
    python
    3
    6
    842
    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
      seora
      last edited by

      When I was doing character animation, it was always hard because I couldn't see the mesh for the previous and later frames. I tried to create a script, but I can't find any relevant information. I'm a beginner. Can I get the necessary code or relevant information? I don't know if I used a translator to get the words across correctly. Sorry

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

        Hello @seora,

        Welcome to the Maxon developers forum and its 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 procedures. You did not do anything wrong, we point all new users to these rules.

        • Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment.
        • Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support.
        • Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads.

        It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: Asking Questions.

        About your First Question

        Without a more concrete description of what you want to do, it will be hard to help you. We also cannot write solutions for you. For all further support requests, you will have to show us the code you wrote.

        With that being said, and with a bit reading between the lines, here is a script which:

        • Adds a display tag to the currently active object when there is none.
        • Enables both ghosting in the tag and the currently active viewport when it is disabled, or disables it when it is enabled.

        I.e., you could use this to toggle ghosting for the currently selected object.

        Cheers,
        Ferdinand

        """Demonstrates how to toggle the ghosting state of an object in Cinema 4D.
        
        The script will toggle the ghosting state of the primary selected object in the currently active
        document. If the object has no display tag, a new one will be created. If the object already has a
        display tag, the script will toggle the ghosting state of the tag.
        
        Must be run as a Script Manager script.
        """
        
        import c4d
        import mxutils
        
        doc: c4d.documents.BaseDocument  # The currently active document.
        op: c4d.BaseObject | None  # The primary selected object in `doc`. Can be `None`.
        
        def main() -> None:
            """Called by Cinema 4D when the script is being executed.
            """
            if op is None:
                c4d.StatusSetText("No object selected.")
                return
            
            # Get all display tags on the object.
            tags: list[c4d.BaseTag] = [tag for tag in op.GetTags() if tag.CheckType(c4d.Tdisplay)]
        
            # Select the first display tag or create a new one when there is none.
            displayTag: c4d.BaseTag = tags[0] if tags else mxutils.CheckType(op.MakeTag(c4d.Tdisplay))
        
            # Get the ghosting state of the display tag.
            isGhosting: bool = displayTag[c4d.ONION_USE]
        
            # Toggle ghosting off.
            if isGhosting:
                # Turn off ghosting by setting the `c4d.ONION_USE` parameter to `False`.
                displayTag[c4d.ONION_USE] = False
        
                # Alternatively, you can also remove the display tag from the object. This will be a bit 
                # cleaner as we will not leave back dormant display tags on objects. But it without further 
                # checks, we would also delete manually created display tags which might have other important
                # settings.
                # displayTag.Remove()
            # Toggle ghosting on.
            else:
                displayTag[c4d.ONION_USE] = True
                # Make sure that ghosting is also enabled in the currently active viewport.
                viewport: c4d.BaseDraw = doc.GetActiveBaseDraw()
                viewport[c4d.BASEDRAW_DISPLAYFILTER_ONION] = True
            
            c4d.EventAdd()
                
        if __name__ == '__main__':
            main()
        

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • S
          seora
          last edited by seora

          Yes, first of all, I'm sorry to confuse you with the question. and please understand that there is no written code. I'll ask you a detailed question again! Ghost mode only reacts when the key animation value is in it as shown in the picture. But what I want is the ghost mode of the waiting polygon. When I looked it up, I found that I had to script and implement it separately for this part. But I don't know how to write complicated code. Can you help me again?

          image.png

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

            Hello @seora,

            I still have problems to understand what you want to do. This also sounds more and more like an end user problem to me. If you think ghosting is not working for a particular setup (you seem to hint at the fact that it does not work for Character Animation) you should contact end user support via our Support Center. SDK support is purely meant for our APIs.

            Cheers,
            Ferdinand

            MAXON SDK Specialist
            developers.maxon.net

            1 Reply Last reply Reply Quote 0
            • S
              sueora
              last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • S
                seora
                last edited by

                Okay. I'll ask the support center

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