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

    MSG_DESCRIPTION_GETBITMAP

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 595 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 01/05/2017 at 15:05, xxxxxxxx wrote:

      Hello!

      Another question translate C++-Code to Python... 😉

      I want to display a Bitmap in the Attribute Manager from a Tag-Plugin.
      In C++ Message() was called with type==MSG_DESCRIPTION_GETBITMAP and the BITMAPBUTTON-id, but in Python it isn't? And what is the equivalent from GeData in GetDParameter() in Python?

      Anyone have a Code-snippet how it works for me?
      I would be glad,
      Cheers,
      Mark.

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

        On 02/05/2017 at 09:44, xxxxxxxx wrote:

        I guess it's like you do in C++ use BitmapButtonStruct.
        https://developers.maxon.net/docs/py/2023_2/modules/c4d/CustomDataType/BitmapButtonStruct/index.html#c4d.BitmapButtonStruct
        (btw there are some errors in the python sdk, then take a look at the c++ one)
        https://developers.maxon.net/docs/cpp/2023_2/class_bitmap_button_struct.html

        And just follow this thread https://developers.maxon.net/forum/topic/2006/1355_customdata-and-gui-messaging&PID=4936#4936

        In python we don't have GeData since a variable is not type dependant.
        So you can do

        a = int()
        b = "hey"
        a = b #now a will be a string with value "hey"
        

        Hope it's help

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

          On 03/05/2017 at 02:08, xxxxxxxx wrote:

          Hi Mark,

          I'm afraid MSG_DESCRIPTION_GETBITMAP can't be handled inside NodeData.Message() currently.

          With the Python API, the implementation of NodeData.GetDParameter() can return a c4d.BitmapButtonStruct object for the second item in the tuple. See NodeData.GetDParameter() documentation.
          Unfortunately this is useless as a node can't respond to MSG_DESCRIPTION_GETBITMAP currently.

          gr4ph0s: The errors in c4d.BitmapButtonStruct docs will be fixed.

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

            On 03/05/2017 at 07:18, xxxxxxxx wrote:

            Hello!

            Thank you, Adam!

            Sadly only now i read your answer, Yannick, after trying half a day 😉
            My attempt was:

              
                def Message(self, node, type, data) :   
                    if type==c4d.MSG_DESCRIPTION_GETBITMAP:   
                        if data['id'][0].id==c4d.ID_BITMAP:   
                                dir, file = os.path.split(__file__)   
                                path = os.path.join(dir, "res", "test.tif")   
                                bm = bitmaps.BaseBitmap()   
                                bm.InitWith(path)   
                                data['bmp'] = bm   
                                return True   
                      return False   
              
                def GetDParameter(self, node, id, flags) :   
                    if id[0].id == c4d.ID_BITMAP:   
                           #BitmapButtonStruct bbs     = BitmapButtonStruct(static_cast<PluginObject*>(node), id, dirty);   
                           #t_data          = GeData(CUSTOMDATATYPE_BITMAPBUTTON, bbs);   
                        bbs = c4d.BitmapButtonStruct(node, id, 0)   
                        return (True, bbs, flags | c4d.DESCFLAGS_DESC_LOADED)   
                    return False   
                    
                def SetDParameter(self, node, id, t_data, flags) :   
                    if id[0].id == c4d.ID_BITMAP:   
                        flags = flags | c4d.DESCFLAGS_DESC_LOADED   
                    return True   
            

            But data in Message was always None...

            Nevertheless thank you for your help 🙂
            Cheers,
            Mark.

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

              On 03/05/2017 at 07:33, xxxxxxxx wrote:

              Note we'll add support for MSG_DESCRIPTION_GETBITMAP inside NodeData::Message() in a future release of Cinema 4D.

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