Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Adding python tag to interface

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 506 Views
    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.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 14/06/2012 at 07:22, xxxxxxxx wrote:

      I have create my own Python tag, not a plugin but a tag.

      How can I add this tag into Cinema 4d's interface?

      - Pim

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 14/06/2012 at 13:40, xxxxxxxx wrote:

        Ok, I now see my tag in the object manager.
        However, I cannot add it to an object.

        Here the code (all it should do, is print "hello world" when frame =0) :

        import c4d
        import os
        import sys
        from c4d import gui, plugins, bitmaps

        PLUGIN_ID = 1234567880 #test id

        class SayHello(plugins.ToolData) :
          pass  #put in your code here

        def Execute(self, tag, doc, op, bt, priority, flags) :

        frame = doc.GetTime().GetFrame(doc.GetFps())
         
              if (frame == 0) :
                  print "Hello World."
             
              return c4d.EXECUTIONRESULT_OK

        if __name__ == "__main__":
          bmp = bitmaps.BaseBitmap()
          dir, file = os.path.split("D:\Program Files\MAXON\CINEMA 4D R13\plugins\hello.pyp")
          fn = os.path.join(dir, "res", "Icon.tif")
          print dir, file
          bmp.InitWith(fn)
         
          #c4d.plugins.RegisterTagPlugin(id, str, info, g, description, icon[, disklevel=0][, res])
          okyn = plugins.RegisterTagPlugin(id=PLUGIN_ID, str="Hello", info=c4d.TAG_VISIBLE, g=SayHello, description=None,  icon=None)
          print "SayHello initialized: ", okyn

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 14/06/2012 at 14:27, xxxxxxxx wrote:

          I changed class SayHello(plugins.ToolData) :
          to class SayHello(plugins.TagData) :
          and now I can add it to an object.

          However, the Icon is not displayed ok, I get aquestion mark (?).
          Also the tag does not seem to get executed.
          On frame == 0, nothing is printed.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 14/06/2012 at 16:05, xxxxxxxx wrote:

            Hi, you pass icon = None so you don't get an icon.
            The tag must be registered as an expression tag. Pass info = c4d.TAG_VISIBLE | c4d.TAG_EXPRESSION to the register function. Hope that helps.

            Cheers, Sebastian

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 15/06/2012 at 03:54, xxxxxxxx wrote:

              Thanks, it is now working.

              So, 3 issues:
              - c4d.TAG_EXPRESSION needs to be set
              - description directory must be there, although I do not use a user interface
              - reload Python plugins command do not always seem to work (or it might be my messing with directories, etc.)

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