Animated gif



  • On 11/11/2017 at 06:44, xxxxxxxx wrote:

    Is it possible to use an animated gif as a user data icon?



  • On 13/11/2017 at 02:42, xxxxxxxx wrote:

    Hi,

    I guess you are talking about using an animated GIF in a BitmapButton or as a registered icon for a plugin? No, that is not possible.



  • On 13/11/2017 at 04:56, xxxxxxxx wrote:

    Okay. Thanks. That would be a cool feature.



  • On 13/11/2017 at 05:13, xxxxxxxx wrote:

    Actually you can do it. But it wouldn't be a Maxon recommended way. And I also do not recommend to do it, for some perormance reason and also as c4d user I will hate to have a GIF as an icon. Since you can easily screw up all the UI very easily with those scripts.

    1. First step is to convert your GIF to a suite of PNG file. (1 png per frame) https://stackoverflow.com/questions/4904940/python-converting-gif-frames-to-png Which use Pillow (an externa python library)
    2. Then when you have your png you can load it as a list of PNG, make a list of baseBitmap (in order to optimize a bit and avoid loading at each frame)
    3. Then with the following script you can swap any picture inside any icon. https://plugincafe.maxon.net/topic/7462/9284_change-icon-based-on-state-in-commanddata&PID=36785#36785
    4. Finally you have to register a plugin (MessagePlugin?) in order to set a timer and redraw the next PNG of your list of PNG. And you got your animated GIF inside Cinema4D.


  • On 13/11/2017 at 05:37, xxxxxxxx wrote:

    Yeow! Excellent! Thanks for providing this. I will test it out.



  • On 13/11/2017 at 05:40, xxxxxxxx wrote:

    gr4ph0s, are you available for freelance work?



  • On 13/11/2017 at 06:01, xxxxxxxx wrote:

    I sent you a pm about freelancing. 
    Another point I didn't mention, the trick used in the post of Niklas is only possible because c4d.gui.Geticon() return a reference to the actual c4d.BaseBitmap of the icon and not a copy. This behavior may be changed in future, or not. Its in the hand of Maxon. 
    Otherwise you would have to Unregister(c4d.gui.UnregisterIcon) old icon then Register back the new icon(c4d.gui.RegisterIcon), then refresh the UI.


Log in to reply