GeUserArea in Description resource?



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

    On 22/04/2004 at 07:25, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.5 
    Platform:   Windows  ;   Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    I would like to display a static image in the attribute manager - think of it as a logo badge.

    First I thought that a Userarea should solve that problem. However, it looks like there's no way to define a Userarea in the ressource description.

    Do I really have to construct my own class from CustomGuiData, or is there an easier way to display a static *.tif in the AM?

    Thanks again!

    Kabe



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

    On 22/04/2004 at 09:42, xxxxxxxx wrote:

    Hi,
    use the Bitmapbutton class for this. Search this forum. Mikael once posted code how to implement a bitmapbutton for the AM.



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

    On 22/04/2004 at 11:21, xxxxxxxx wrote:

    Do you mean this one?
    Mikael Sterneron Nov 10th 2002

    I saw this earlier but was a bit reluctant because it seemed so old, and it doesn't look very elegant for such a simple task either.

    I don't understand the line:

      static NodeData *Alloc(void) { return gNew AtomObject; }   
    }; 
    

    This is a copy & paste error - correct?

    I'm also insecure about the messages: I guess I don't have to care for MSG_DESCRIPTION_VALIDATE(?), but do I have to handle MSG_DESCRIPTION_GETBITMAP? I'm not updating anything anyway... so could I omit the message method altogether for this purpose?

    Do I actually have to implement these methods for all the shaders that should display a bitmap?
    An own Bitmap class that would just take the file name as a parameter would make this quite a bit easier IMO. What would be the right way to do this?

    Thanks

    Kabe



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

    On 22/04/2004 at 12:05, xxxxxxxx wrote:

    Ok, I've to support MSG_DESCRIPTION_GETBITMAP, because otherwise Cinema doesn't know where to look for the bismap...

    K



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

    On 22/04/2004 at 13:29, xxxxxxxx wrote:

    I guess I'm overlooking something very obvious here. The myshader.res file has the line:

    BUTTON { CUSTOMGUI KILIBEE_LOGO; } 
    

    KILIBEE_LOGO is defined in myshader.h, and the string for it in myshader.str is "KILIBEE_LOGO". [I've tested putting it in c4d_symbols.h/c4d_strings.str, doesn't make a difference]

    However, I still get an error on loading the ressource file :-(

    I've setup all the methods (I even handle all examples), though I have the impression that the error is in the *.res file.

    What am I doing wrong?

    Kabe



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

    On 22/04/2004 at 17:30, xxxxxxxx wrote:

    That should be:

        
        
        BITMAPBUTTON KILIBEE_LOGO { BORDER; }
    

    (And yes, those two lines shouldn't have been there.)



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

    On 22/04/2004 at 17:31, xxxxxxxx wrote:

    The reason for the message system is to let objects use dynamic images, for example the light preview.



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

    On 22/04/2004 at 23:06, xxxxxxxx wrote:

    Mh, first thanks for the answers! Btw: Is that documented somewhere in the SDK? A working example would be tremendous here.

    I completely understand that the message system should support the use of dynamic images, but you don't suggest that a light preview should be constructed as BITMAPBUTTON, do you?

    However, I still have that error. Message is called once on invocing AM, but not with MSG_DESCRIPTION_GETBITMAP or MSG_DESCRIPTION_VALIDATE.

    SetDParameter & GetDParameter isn't called at all.

    Plugin & Interface work flawlessy without the inflicting *.res line.

    So here's the relevant code, any Idea anyone what's going wrong?
    Thanks!

    Kabe

    XmyShader.h

    #ifndef _XMYSHADER_H_  
    #define _XMYSHADER_H_  
      
    enum  
    {  
         MYSHADERSHADER_GROUP     = 2006,  
         MYSHADERSHADER_RDIST     = 2007,  
         MYSHADERSHADER_GDIST     = 2008,  
         MYSHADERSHADER_BDIST     = 2009,  
         MYSHADERSHADER_LIMITC     = 2010,  
         KILIBEE_LOGO     = 3000,  
      
         dummy  
    };  
      
    #endif  
    

    XmyShader.res

          BITMAPBUTTON KILIBEE_LOGO { BORDER; }
    

    XmyShader.str

          KILIBEE_LOGO     "KILIBEE_LOGO";
    

    XmyShader.cpp

      
    #include "c4d.h"  
    #include "c4d_symbols.h"  
    #include "XmyShader.h"  
      
    .......  
      
    class myShader : public ShaderData  
    {  
         public:  
              myShaderData gdata;  
         public:  
              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 *t_data);  
      
              virtual Bool Init(GeListNode *node);  
              virtual     Vector Output(PluginShader *sh, ChannelData *cd);  
              virtual     LONG InitRender(PluginShader *sh, InitRenderStruct *irs);  
              virtual     void FreeRender(PluginShader *sh);  
      
              virtual     LONG GetRenderInfo(PluginShader *sh);  
      
              static NodeData *Alloc(void) { return gNew myShader; }  
    };  
      
      
      
    .......  
      
      
    Bool myShader::GetDParameter(GeListNode *node, const DescID &id;,GeData &t;_data,LONG &flags;)   
    {  
    GePrint ("GetDParameter called");  
    switch(id[0].id)   
         {   
         case KILIBEE_LOGO:   
              {  
              LONG dirty = 0;  
                 //Bitmapbutton Struct bbs(static_cast<PluginObject*>(node), id, dirty);   
                 //changed to:  
              BitmapButtonStruct bbs = BitmapButtonStruct(static_cast<PluginObject*>(node), id, dirty);   
              t_data = GeData(CUSTOMDATATYPE_BITMAPBUTTON,bbs);   
              flags |= DESCFLAGS_PARAM_GET;   
              break;   
              }  
         }  
         return ShaderData::GetDParameter(node, id, t_data, flags);   
    }  
      
    Bool myShader::SetDParameter(GeListNode *node, const DescID &id;, const GeData &t;_data, LONG &flags;)   
    {  
         GePrint ("SetDParameter called");  
      
         switch(id[0].id)      {   
              case KILIBEE_LOGO:   
                   flags |= DESCFLAGS_PARAM_SET;   
                   break;   
              }   
         return ShaderData::SetDParameter(node, id, t_data, flags);  
    }  
      
      
    Bool myShader::Message(GeListNode *node, LONG type, void *t_data)   
    {  
         GePrint ("Message called");  
      
         if (type == MSG_DESCRIPTION_GETBITMAP)     {  
              GePrint ("Message called: MSG_DESCRIPTION_GETBITMAP");  
              DescriptionGetBitmap* dgb = static_cast<DescriptionGetBitmap*>(t_data);   
              if (dgb->id[0] == KILIBEE_LOGO)     {  
                   AutoAlloc<BaseBitmap> bm;   
                   bm->Init(50, 50);   
                   bm->SetPen(12, 34, 56);   
                   bm->Line(0, 0, 49, 49);   
                   dgb->bmp = bm.Release();   
                   }  
              }  
      
         if (type==MSG_DESCRIPTION_VALIDATE)     {   
              GePrint ("Message called: VALIDATE");  
              }   
      
         return TRUE;   
    }  
    


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

    On 25/04/2004 at 06:00, xxxxxxxx wrote:

    Nobody has any idea? Maybe someone has a working example or knows a plugin that is using this?

    I really find it strange that it's much easier to use the internal raytracer than to place a simple image in the attribute manager. I lost hours over the latter, which is in a way to much time for just a simple GUI element IMO.

    Again, thanks for any insight!

    Kabe



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

    On 27/04/2004 at 17:57, xxxxxxxx wrote:

    Sorry for not getting back to you earlier. But I still cannot understand why it doesn't work. I just tried modifying the SDK project by doing this:

        
        
         _Msimplematerial.res:_
        
        
        
        
        **BITMAPBUTTON** SIMPLEMATERIAL_COLOR {} // Hijacked the color value
        
        
        
        
        _SimpleMaterial.cpp:_
        
        
        
        
         Bool SimpleMaterial::Message(GeListNode* node, LONG type, void* data)  
        {  
         **  if (type == MSG_DE SCRIPTION_GETBITMAP)     {  
                  GePrint ("Message called: MSG_DESCRIPTION_GETBITMAP");  
                  DescriptionGetBitmap* dgb = static_cast<DescriptionGetBitmap*>(data);   
                  if (dgb->id[0] == SIMPLEMATERIAL_COLOR)     {  
                       AutoAlloc<BaseBitmap> bm;   
                       bm->Init(50, 50);   
                       bm->SetPen(12, 34, 56);   
                       bm->Line(0, 0, 49, 49);   
                       dgb->bmp = bm.Release();   
                       }  
                  }**  
        ...
        
        
        
        
        Bool SimpleMaterial::GetDParameter(GeListNode *node, const DescID &id,GeData &t_data,LONG &flags)  
        {  
          BaseContainer *data = ((PluginShader* )node)->GetDataInstance();  
          
          switch (id[0].id)  
         {  
            case SIMPLEMATERIAL_MAT_PREVIEW:  
           return GetDParameterPreview(data,(GeData* )&t_data,flags,SIMPLEMATERIAL_MAT_PREVIEW,updatecount,(BaseMaterial* )node);  
              break;
        
        
        
        
              **case SIMPLEMATERIAL_COLOR:  
                   {  
                  LONG dirty = 0;  
                     //Bitmapbutton Struct bbs(static_cast<PluginObject*>(node), id, dirty);   
                     //changed to:  
                  BitmapButtonStruct bbs = BitmapButtonStruct(static_cast<PluginObject*>(node), id, dirty);   
                  t_data = GeData(CUSTOMDATATYPE_BITMAPBUTTON,bbs);   
                  flags |= DESCFLAGS_PARAM_GET;   
                  break;**   
                  }  
         }
    

    Admittedly not the most surgically precise cut-n-paste hack (all the code is from your post), but it works. The AM displays the little black square with diagonal line where the color selector used to be. Both the Message() and the GetDParameter() functions are called.
    Do you have any ideas?



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

    On 27/04/2004 at 23:47, xxxxxxxx wrote:

    Well, as I already said:

    _Message is called once on invocing AM, but not with MSG_DE SCRIPTION_GETBITMAP or MSG_DESCRIPTION_VALIDATE.

    SetDParameter & GetDParameter isn't called at all._

    So, thanks for your code, but I guess the problem is the *.res or *.h file...

    Kabe



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

    On 27/04/2004 at 23:57, xxxxxxxx wrote:

    I only did the one change to the res file above, nothing to the h file. So, if you can successfullly reproduce the SimpleMaterial test, I would review any differences between the SimpleMaterial plugin and yours to see if they are significant. If the SimpleMaterial test fails then we're in trouble...
    You might try removing the entry from the str file. It's not used, though I can't see how it could hurt.


Log in to reply