Images in the Attribute Manager
-
On 13/01/2014 at 09:26, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 14
Platform: Mac ;
Language(s) : C++ ;---------
Hello all,I've been trying to get an image in the attribute manager of a generator object. I know about bitmap buttons and was wondering if that's the best way to go about implementing it. I need to be able to change the image during run time, but it doesn't need to be clicked or anything. Would that be the best way to implement this or is there another way?
Thanks in advance,
Dan -
On 13/01/2014 at 19:12, xxxxxxxx wrote:
Hi, I don't know if this will help you, but here is how I do it in mt tags:
Bool MyTag::Message (GeListNode* node, LONG type, void* data) { switch(type) { case MSG_GETCUSTOMICON: { GetCustomIconData* icon = (GetCustomIconData* )data; Bool newCondition = GetNewCondition(..); if(newCondition) GetIcon(MY_ICON_FOR_CHANGED_CONDITION, icon->dat); else // Old condition GetIcon(MY_ICON_STANDARD_CONDITION, icon->dat); icon->filled = TRUE; return TRUE; } } }
-
On 13/01/2014 at 20:19, xxxxxxxx wrote:
You can use UserAreas to display the images.
But the general consensus here seems to be that using buttons without using the button options that make it "look" like a button is the simplest way to go for displaying images in the AM.-ScottA
-
On 14/01/2014 at 13:58, xxxxxxxx wrote:
Hi,
Thanks for the responses, guys.
I've got a bitmap button working right now. I have it using a bitmap that I keep saving over, so the picture is always changing, but the bitmap in the AM is not changing. I figured that would happen because the correct message wasn't being sent, but I set that up though and it still won't update. If I click the button or unselected the tag and then reselect it than it changes.
It seems like the message is correctly sending, MSG_DESCRIPTION_GETBITMAP. I've checked the other messages that are sent when the bitmap button is pressed and I don't think I'm missing one that would update it.
Any idea what I could be missing?
Dan
-
On 14/01/2014 at 14:32, xxxxxxxx wrote:
Hard to say without seeing the code.
I have an example of putting images on buttons in tags. And when you click a button it changes the image on that button.
Sounds exactly like what you're doing.Looking at my source code might help you figure it out.
It's called "Bitmap Buttons on Tags R13"
https://sites.google.com/site/scottayersmedia/plugins-ScottA
-
On 14/01/2014 at 15:13, xxxxxxxx wrote:
Yeah, I should have included some code, sorry about that. Thanks for the quick response and awesome code. I haven't gotten to look at your code extensively but I think I'm trying to do something slightly different than what you did.
//Message Function case MSG_DESCRIPTION_GETBITMAP: { DescriptionGetBitmap* dgb = static_cast<DescriptionGetBitmap*>(data); if(dgb->id[0] == idBitmapButton) { AutoAlloc<BaseBitmap> bm; Filename bg ; bg = "test.jpg"; bm->Init(bg); dgb->bmp = bm.Release(); } } Bool TestTag::GetDParameter(GeListNode *node, const DescID &id, GeData &t_data, DESCFLAGS_GET &flags) { switch(id[0].id) { case idBitmapButton: { BaseContainer bc= GetCustomDataTypeDefault(DTYPE_BUTTON); bc.SetBool(DESC_HIDE, buttonOn); LONG dirty = 0; BitmapButtonStruct bbs(static_cast<BaseObject*>(node), id, dirty); t_data = GeData(CUSTOMDATATYPE_BITMAPBUTTON, bbs); flags |= DESCFLAGS_GET_PARAM_GET; break; } } return SUPER::GetDParameter(node, id, t_data, flags); //Code from Execute BaseBitmap* basebitmap=BaseBitmap::Alloc() ; basebitmap->Init(100, 100, 24, INITBITMAPFLAGS_0); for (LONG X =0; X<100; X++) { for (LONG Y =0; Y<100; Y++) { basebitmap->SetPixel(X, Y,Mod(GeGetTimer(),200) , Mod(GeGetTimer(),210), Mod(GeGetTimer(),80)); } } BaseContainer* bctest; basebitmap->Save("test.jpg", FILTER_TIF, bctest, SAVEBIT_0); DescriptionGetBitmap bitmapdatatype; bitmapdatatype.id = DescID(idBitmapButton); bitmapdatatype.bmp = basebitmap; tag->Message(MSG_DESCRIPTION_GETBITMAP,&bitmapdatatype);
So I have a jpg being overridden all of the time and then I'm trying to have the button update to show what the image is currently. Instead it only updates when I hit the button or when I unselect the tag and then reselect it.
I thought
tag->Message(MSG_DESCRIPTION_GETBITMAP,&bitmapdatatype);
would do the trick but apparently not.
Dan
-
On 14/01/2014 at 15:25, xxxxxxxx wrote:
If it is indeed an update problem.
This code usually does the trick to force the tag's AM to update.myTag->SetDirty(DIRTYFLAGS_DATA); EventAdd();
-ScottA
-
On 15/01/2014 at 12:21, xxxxxxxx wrote:
Hi Scott, thanks for the quick response again.
I had considered doing that earlier, then I forgot about it, but you were right.
tag->SetDirty(DIRTYFLAGS_DESCRIPTION);
That makes it refresh. The only problem is it doesn't let parameters to be scrolled up and down. So I'll have to limit the calls to only when a parameter is done being changed somehow.
Thanks for all of the help!
DanEdit: I've been looking for a message that gets sent when a parameter is done being changed. I'm still looking though, does such a thing exist?