bitmap button madness
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/03/2008 at 12:04, xxxxxxxx wrote:
If using the example:
Did you change the file names? Did you change the plugin ID? Did you change 'Tlookatcameraexp'?
SUPER can't be changed. It tells the method to call the base class's original method when you are deriving from it.
So, you should have something like this (where 'Tmyplugintag', MyPluginTag, the plugin ID, etc. should be replaced with your own) :
Tmyplugintag.res
>
CONTAINER Tmyplugintag \> { \> NAME Tmyplugintag; \> INCLUDE Texpression; \> \> GROUP ID_TAGPROPERTIES \> { \> BITMAPBUTTON IMAGINARY_PREVIEW { } \> } \> }
Tmyplugintag.h
>
#ifndef \_Tmyplugintag_H\_ \> #define \_Tmyplugintag_H\_ \> \> enum \> { \> IMAGINARY_PREVIEW = 1000 \> }; \> \> #endif
Tmyplugintag.str
>
STRINGTABLE Tmyplugintag \> { \> Tmyplugintag "My Plugin Tag"; \> IMAGINARY_PREVIEW "test button"; \> }
MyPluginTag.cpp
>
#include "c4d.h" \> #include "c4d_symbols.h" \> #include "tmyplugintag.h" \> #include "customgui_bitmapbutton.h" \> \> class MyPluginTag : public TagData \> { \> INSTANCEOF(MyPluginTag,TagData) \> \> public: \> virtual LONG Execute(PluginTag \*tag, BaseDocument \*doc, BaseObject \*op, BaseThread \*bt, LONG priority, LONG flags); \> virtual Bool GetDParameter(GeListNode \*node, const DescID &id;, GeData &t;\_data, LONG &flags;); \> virtual Bool SetDParameter(GeListNode \*node, const DescID &id;, const GeData &t;\_data, LONG &flags;); \> virtual Bool Message(GeListNode \*node, LONG type, void \*data); \> \> static NodeData \*Alloc(void) { return gNew MyPluginTag; } \> }; \> \> LONG MyPluginTag::Execute(PluginTag \*tag, BaseDocument \*doc, BaseObject \*op, BaseThread \*bt, LONG priority, LONG flags) \> { \> return EXECUTION_RESULT_OK; \> } \> \> Bool MyPluginTag::GetDParameter(GeListNode \*node, const DescID &id;, GeData &t;\_data, LONG &flags;) \> { \> switch(id[0].id) \> { \> case IMAGINARY_PREVIEW: \> { \> LONG dirty = 0; \> BitmapButtonStruct bbs(static_cast<PluginObject\*>(node), id, dirty); \> t_data = GeData(CUSTOMDATATYPE_BITMAPBUTTON, bbs); \> flags |= DESCFLAGS_PARAM_GET; \> break; \> } \> } \> return SUPER::GetDParameter(node, id, t_data, flags); \> } \> \> Bool MyPluginTag::SetDParameter(GeListNode \*node, const DescID &id;, const GeData &t;\_data, LONG &flags;) \> { \> switch(id[0].id) \> { \> case IMAGINARY_PREVIEW: \> flags |= DESCFLAGS_PARAM_SET; \> break; \> } \> return SUPER::SetDParameter(node, id, t_data, flags); \> } \> \> Bool MyPluginTag::Message(GeListNode \*node, LONG type, void \*data) \> { \> if (type == MSG_DESCRIPTION_GETBITMAP) \> { \> DescriptionGetBitmap\* dgb = static_cast<DescriptionGetBitmap\*>(data); \> if(dgb->id[0] == IMAGINARY_PREVIEW) \> { \> AutoAlloc<BaseBitmap> bm; \> Filename bg = GeGetPluginPath()+Filename("res")+Filename("imaginary.tif"); \> bm->Init(bg); \> dgb->bmp = bm.Release(); \> } \> } \> return TRUE; \> } \> \> // be sure to use a unique ID obtained from www.plugincafe.com \> #define ID_MYPLUGINTAG //PUT UNIQUE PLUGIN ID HERE! \> \> Bool RegisterMyPluginTag(void) \> { \> return RegisterTagPlugin(ID_MYPLUGINTAG,"My Plugin Tag",TAG_EXPRESSION|TAG_VISIBLE,MyPluginTag::Alloc,"Tmyplugintag","myplugintag.tif",0L); \> }
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/03/2008 at 12:39, xxxxxxxx wrote:
hi robert.
thank you for your reply. just to clearify what i did by now:
i have a tag plugin built from the lookatcamera example.
i changed all res and header files, the icon and the whole code. it is compiling, running and working quite fine(except for some of the usual bugs to be fixed). it has descriptions in the AM like a button, working fine, a filename description, also working, a bool/checkbox which is workin as well and a bitmapbutton without bitmap, only the name is shown. i implemented the above code and changed all names/references according to my plugin. it compiles without errors nor warnings - just that damn bitmap won't show up
changing SUPER to TagData was just a wild guess, it also compiles without trouble but i changed it back to SUPER now. so in fact i think its all like shown above except for my additional functions and the code in the execute function and an additional case in the message function to catch the standard button. i am out of ideas...
thanks again, Robert and Matthias for standing my noob questionsYakuza
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/03/2008 at 13:33, xxxxxxxx wrote:
Try this in the str file and see if it helps:
STRINGTABLE Tmyplugintag
{
Tmyplugintag "My Plugin Tag";
}That is, remove the text associated with the bitmap button.
See if SetDParameter() and GetDParameter() ever get called with IMAGINARY_PREVIEW id (doing a GePrint() is simple enough here). Also check that the code is executed in Message() and that the filename actually exists - you can do this:
Filename bg = GeGetPluginPath()+Filename("res")+Filename("imaginary.tif");
if (!GeFExist(bg)) GePrint("File Not Found!");I have to admit that I've never tried displaying a bitmap button in the AM before (except via a Tool plugin which uses a SubDialog to display AM elements) - mainly because there hasn't been a need for it.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/03/2008 at 13:58, xxxxxxxx wrote:
ok, after debugging my brain it works now. even though i KNOW i changed the filename to "imaginary.tif" it somehow changed back to "lookatcamera.tif". i guess programming at 5am is not the best approach
so here i stand a bit embarrassed and deeply thankful for your time. at least i am sure of this: it won't be my last question
thanks again and now to something completely different:
trying to get a dropdown/cycle description to work....
cu later,Yakuza
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/03/2008 at 15:05, xxxxxxxx wrote:
dropdown/cycle is easy:
1. Set the type as LONG.
2. In the res file, add a CYCLE section inside the LONG description (for example) :// Rotation Order
LONG IPP_RORDER
{
ANIM OFF;
CYCLE
{
IPP_RORDER_NONE;
IPP_RORDER_XYZ;
IPP_RORDER_XZY;
IPP_RORDER_YXZ;
IPP_RORDER_YZX;
IPP_RORDER_ZXY;
IPP_RORDER_ZYX;
}
}The cycle values should be enumerated in the Tmyplugintag.h file and numbered from 0 to N-1 (where N is the number of choices). The text in the Tmyplugintag.str file.
If you need 'dynamic' dropdown elements (names and/or counts will change), you'll need to do this in GetDDescription() and omit the CYCLE section from the res file.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/03/2008 at 16:21, xxxxxxxx wrote:
oh, thanks, that was not actually a question, but now that you answered it works fine ;D
anyway, i'm still having some troubles updating the bitmapbutton. i am trying to load a movie frame from the movie given in the filename description. unfortunately its not showing up using:
Bool bool_p= TRUE;
if(bm->Init(bg, 1, &bool;_p) == IMAGE_OK)
GePrint("IMAGE_OK " + LongToString(bool_p));it prints IMAGE_OK and confirms its a movie when it is one. also having issues resizing it.
i will try some stuff and ask again tomorrow slightly more detailed if i can't get this right too.Yakuza
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/03/2008 at 17:50, xxxxxxxx wrote:
yeah, i got it, just don't get how i did it ;D
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/03/2008 at 07:45, xxxxxxxx wrote:
well, next question. my problem is to update the bitmapbutton. it should show the file in the filename description but only does that when the button is pressed. how to fake pushing the button when the filename is changed? with a message? i tried but no success.
thank you for your ideas.Yakuza
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/03/2008 at 06:42, xxxxxxxx wrote:
The dirty parameter of the BitmapButtonStruct should be increased for every update.
Btw. there are lots of old threads about BitmapButtons on the forum where you can find most of this stuff explained.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/04/2008 at 10:47, xxxxxxxx wrote:
hi matthias,
if these threads or the sdk documentation would have helped i certainly would not post my questions here
the hint with the incrementation of the dirty parameter was indeed very helpful, my bitmapbutton finally works as intended. thank you very much again.
Yakuza
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/07/2009 at 12:45, xxxxxxxx wrote:
Hey guys...
I must be missing something... I got the above example type code to work and my buttons display fine now. I also added the "BUTTON" attribute in the .res file so I can see it push in and pop back out as I click on it, but...
The problem is that I'm not getting any MSG_DESCRIPTION_COMMAND message when I click on one of these (I do get notified for some regular text-based buttons in the same description).
Any ideas?
Thanks. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/07/2009 at 12:57, xxxxxxxx wrote:
Ignore the above... the answer is in this thread.