MSG_DESCRIPTION_GETBITMAP



  • 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.



  • 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/Cinema4DPythonSDK/html/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/Cinema4DCPPSDK/html/class_bitmap_button_struct.html

    And just follow this thread https://plugincafe.maxon.net/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



  • 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.



  • 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.



  • 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.


Log in to reply