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

    Delete Third-Party-Tags?

    Cinema 4D SDK
    5
    7
    1.2k
    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.
    • lasselauchL
      lasselauch
      last edited by

      Hi there,

      I created this script where I delete every third-party-tag from the current document.

      However I was wondering if it's not even simpler to just delete tags with a certain "id-threshold".

      What's the first/smallest ID that third-party-tags or plugin-ids can have?

      So one can basically: Delete Tag if tag-id is bigger than threshold

      Thanks,
      Lasse

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

        Hi,

        plugin ids should start at ID 1E6. The problem is, I am not quite sure that MAXON has never used any of these for their native tags, so you might filter out native stuff. To investigate that you could either check the tag types in the Python docs or, alternatively, grep the resource folder.

        A less risky, but also less future proof approach would be to compile a list of all native tag IDs, again, the tag types in the Python docs and greping the resource folder would probably proof useful for that. I am not sure though, if the tag types list is complete (these id lists have a tendency to be a bit spotty). This would obviously have to updated once MAXON adds new tags, hence the lack of future proofness.

        Cheers,
        zipit

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • kbarK
          kbar
          last edited by kbar

          There are lots of internal plugins that use the numbers generated from the plugincafe.

          A better solution would be to find the tags in the document and then check what plugin it belongs to and if it is not located in the modules folder in the installation folder of C4D then it is a 3rd party one.

          Not sure why you want to remove the tags though.

          https://www.gamelogicdesign.com
          https://www.plugins4d.com

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

            hi,

            we have some IDs there so it's not a good idea to based your choice on that.

            Thanks @kbar for the solution, that's probably the best for now.
            There's one issue, python plugins. We have some (for team render) but there's no Tag. For python plugins, GetFilename return only the name of the plugin.
            We are going to have a look at it to fix that. So for the futur it should be ok.

            import c4d
            from c4d import gui
            # Welcome to the world of Python
            
            # Main function
            def main():
                tags = op.GetTags()
                removeTag = []
                for tag in tags:
                    tagID = tag.GetType()
                    plugin =  c4d.plugins.FindPlugin(tagID)
                    if plugin is None:
                        tag.Remove()
                    # python plugin doesn't return any filepath, just the name, so there's no corelibs in the path
                    # We have some python plugins (teamrender) but none are tags. (ATM ??)
                    elif 'corelibs' in plugin.GetFilename():
                        print "corelibs"
                    else:
                        
                        tag.Remove()
                c4d.EventAdd()
            
            # Execute main()
            if __name__=='__main__':
                main()
            

            Cheers,
            Manuel

            MAXON SDK Specialist

            MAXON Registered Developer

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

              Hi,

              There's one issue, python plugins.

              shouldn't the native Python plugins have their file path attached to them via their __file__ attribute of the module? At least that is the case with normal Python modules, never bothered to check if Cinema's Python, which can be weird sometimes, deviates here from the default behaviour with its pyp files.

              So the plan would be to use Cinema's internal method, test the returned value for path validity and then optionally fall back to the attribute. I cannot test it, because I have no Cinema atm.

              Cheers,
              zipit

              MAXON SDK Specialist
              developers.maxon.net

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

                hi,

                I didn't tested it, but that's probably the result of the c++ function. So fixing it for the c++ function will fix it for python.
                I don't know if you can access easily __file__ from c++ and python's object.

                Cheers,
                Manuel

                MAXON SDK Specialist

                MAXON Registered Developer

                1 Reply Last reply Reply Quote 0
                • M
                  m_adam
                  last edited by m_adam

                  Hi with the latest update of Cinema 4D (R24 SP1), BasePlugin.GetFilename now also return the file extension in Python.

                  Cheers,
                  Maxime.

                  MAXON SDK Specialist

                  Development Blog, MAXON Registered Developer

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