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
    • Recent
    • Tags
    • Users
    • Login

    Changing object icon [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    7 Posts 0 Posters 605 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

      On 14/12/2014 at 11:11, xxxxxxxx wrote:

      I have a few object and tag plugins. Is it possible to change the icon through python?

      similar to how the annotation tag has the option "Color Icon".

      Thanks,
      Joe

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

        On 15/12/2014 at 03:39, xxxxxxxx wrote:

        Hello,

        to change the icon of an object dynamically you have to react to the MSG_GETCUSTOMICON[URL-REMOVED] message in Message()[URL-REMOVED]. The data is a dictionary:

          
             if type == c4d.MSG_GETCUSTOMICON:  
                   
                  data['bmp'] = c4d.bitmaps.InitResourceBitmap(c4d.IDM_SELECTALL)  
                  data['w'] = data['bmp'].GetBw()  
                  data['h'] = data['bmp'].GetBh()  
                  data['filled'] = True  
        

        best wishes,
        Sebastian


        [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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

          On 16/12/2014 at 21:00, xxxxxxxx wrote:

          Ahh okay. I see the data. Now i tried:

          data['bmp'] = myCustomBitmap
          

          It doesn't update it. But if I do a test and write:

          c4d.bitmaps.ShowBitmap(data['bmp'])
          

          it shows what i drawn. How can I update the objects icon after i assign it?

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

            On 17/12/2014 at 04:39, xxxxxxxx wrote:

            Hello,

            don't forget to set 'filled' to true. Also make sure your bitmap "exists" after you assign it and is not destroyed by the garbage collection.

            Best wishes,
            Sebastian

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

              On 27/12/2014 at 06:42, xxxxxxxx wrote:

              Hello Joe,

              was your question answered?

              best wishes,
              Sebastian

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

                On 30/12/2014 at 18:29, xxxxxxxx wrote:

                It was answered.

                One more thing. Where would the ideal location for the bitmap be so it isn't 'garbage collected'? Would the icon location best be suited in the init?

                Basically, I have an image icon with Alpha. I want to draw a color layer behind it and have it only show on the alpha of the main icon. I've seen some multi-layer bitmap in the API. Is that the way to go?

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

                  On 31/12/2014 at 08:46, xxxxxxxx wrote:

                  Hello,

                  if the icon is different for each object or tag you could store the bitmap as a member variable of your plugin class.

                  Best wishes,
                  Sebastian

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