On 12/01/2015 at 15:49, xxxxxxxx wrote:
Cinema 4D Version: 14
Platform: Mac ;
Language(s) : C++ ;
Hello, I've been working with some GeDialog plugins and was trying to come up with a way to load a series of images from a folder and display them as buttons that can be clicked to merge an associated C4D file into the scene.
I've been using this code, inside of a loop, to load the images as BitmapButtonCustomGui, and then code in Command() for when they're pressed.
BitmapButtonCustomGui* myButton; BaseContainer bc; LONG bordertouse =0; bc.SetLong(BITMAPBUTTON_BORDER, bordertouse); bc.SetBool(BITMAPBUTTON_BUTTON, TRUE); bc.SetLong(BITMAPBUTTON_TOGGLE, TRUE); myButton = (BitmapButtonCustomGui* )AddCustomGui(currentlocation,CUSTOMGUI_BITMAPBUTTON,"MY BUTTON", 0L,0,0,bc); AutoAlloc<BaseBitmap> bb; Filename bg; bg = previewfolder+Filename("preview1.tif"); if (bb->Init(bg) != IMAGERESULT_OK) return TRUE; myButton->SetImage(bb, FALSE);
This doesn't seem the best way to do this though. It scales up pretty poorly with more buttons and doesn't seem overly clean. Is there a better way to load a series of images into buttons dynamically and faster?
Thanks for any help,