Assign a standard icon to a script automatically



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

    On 11/09/2012 at 03:25, xxxxxxxx wrote:

    C4D Ver. 13
    Lang: python

    Hi Everyone, 
    this is probably a noob question but I can't figure it out. I created some (very basic) scripts that simply add a c4d tag to an object. I made it for xpresso tag, target, and some other tags I use frequently, to have them docked in the interface. The code is this simple:

    import c4d
    from c4d import gui
    #Welcome to the world of Python
      
      
    def main() :
       obj = doc.GetActiveObject()
       if obj is None :
          gui.MessageDialog('Nessun oggetto selezionato')
          return
       doc.StartUndo()
       xtag = c4d.BaseTag(c4d.Texpresso)
       obj.InsertTag(xtag)
       c4d.EventAdd()
       doc.AddUndo(c4d.UNDOTYPE_NEW, xtag)
       doc.EndUndo()      
       
      
    if __name__=='__main__':
        main()
    

    The script by default has the generic python icon, is possible to have it assigned one of the standard C4D icons that represent the tag is going to be created ?

    Thank for any advice !
    Max



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

    On 11/09/2012 at 05:32, xxxxxxxx wrote:

    Hi, create an icon file (*.tif) and put it with the same name as the script in the same folder.

    test.py
    test.tif

    Cheers, Seb



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

    On 11/09/2012 at 06:12, xxxxxxxx wrote:

    Hi, and thanks for your reply !
    I kinda knew this method, but still it requires me to generate an icon file each time/script. 
    What I would like to do is to fetch an icon from (already registered) standard c4d icons in the script, and assign it to the script itself. For standard icons I mean this: http://chicagoc4d.com/C4DPythonSDK/modules/c4d.bitmaps/


Log in to reply