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

    Colorize plugin object icon

    Cinema 4D SDK
    python
    2
    4
    659
    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.
    • mfersaouiM
      mfersaoui
      last edited by

      Hello,

      I'm searching how can I dynamically colorize plugin icon like as the default C4D lights objects. I want to dynamically apply a color tint filter on my plugin object icon.

      def Message(self, node, type, data):
            if type == c4d.MSG_GETCUSTOMICON:
                color = node[c4d.MYOBJECT_COLOR]:
                icon = c4d.bitmaps.InitResourceBitmap(PLUGIN_ID)
      
                """width = icon.GetBw()
                height = icon.GetBh()
                
                for y in xrange(height) :
                  for x in xrange(width) :
                      r,g,b = icon.GetPixel(x, y)
                      #icon.SetPixel(x, y, r, g, b)"""
                            
                data['bmp'] = icon
                data["w"] = icon.GetBw()
                data["h"] = icon.GetBh()
      
                data['filled'] = True
      

      Thanks.

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

        Hi there is an example in Github - Plugins - Custom Icon.

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        mfersaouiM 1 Reply Last reply Reply Quote 0
        • mfersaouiM
          mfersaoui @m_adam
          last edited by

          Thank you @m_adam, is there examples for previous cinema 4d versions (r19, r20)?

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

            This functionality only exists since R21, for the previous versions, there is this hack that is very not recommended Plugins in plugin OR icons!!!!!.

            Cheers,
            Maxime.

            MAXON SDK Specialist

            Development Blog, MAXON Registered Developer

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