Toggle button in Attributes Manager?



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

    On 09/01/2008 at 21:15, xxxxxxxx wrote:

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

    ---------
    Is there any way to do this? I realize that BOOL can be used as a checkbox but that is a bit misleading representation of the functionality (a temporary preview toggle). Another choice might be a LONG with "Preview Off" and "Preview On" as options.

    Thanks,



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

    On 09/01/2008 at 21:21, xxxxxxxx wrote:

    Have you tried the BitmapButton custom decription element?

    cheers,
    Matthias



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

    On 09/01/2008 at 21:33, xxxxxxxx wrote:

    I read the post where this was hinted at by Samir, but couldn't find any references back to where it may have been delineated. There don't appear to be any examples in the cinema4dsdk and no help in the docs. Do I want to go that far for a single button? :)

    I see that there is a BITMAPBUTTON description. How would one then set it up to be a toggle button? Could text be added to it (instead of a bitmap)? Etc. ;)



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

    On 09/01/2008 at 21:42, xxxxxxxx wrote:

    I will see that I can provide you with an example. From what I remember it wasn't that complicated. As for examples in general, it's simply not possible to have an example for each and every function/class of the SDK.

    cheers,
    Matthias



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

    On 10/01/2008 at 01:11, xxxxxxxx wrote:

    Ok, here an example. I defined a standard BUTTON as Bool in GetDDescription. This seems to work perfectly fine.

    > _
    > #include "c4d.h"
    > #include "c4d_symbols.h"
    > #include "tlookatcameraexp.h"
    >
    > #include "customgui_bitmapbutton.h"
    >
    >
    > class LookAtCamera : public TagData
    > {
    >      public:
    >           virtual Bool Init(GeListNode *node);
    >           virtual LONG Execute(PluginTag *tag, BaseDocument *doc, BaseObject *op, BaseThread *bt, LONG priority, LONG flags);
    >           virtual Bool GetDDescription(GeListNode *node, Description *description,LONG &flags;);
    >
    >           static NodeData *Alloc(void) { return gNew LookAtCamera; }
    > };
    >
    > Bool LookAtCamera::Init(GeListNode *node)
    > {
    >      BaseTag                    *tag = (BaseTag* )node;
    >      BaseContainer *data = tag->GetDataInstance();
    >
    >      data->SetBool(MYTESTBUTTON,FALSE);
    >
    >      return TRUE;
    > }
    >
    >
    > Bool LookAtCamera::GetDDescription(GeListNode *node, Description *description,LONG &flags;)
    > {
    >      if (!description->LoadDescription(node->GetType())) return FALSE;
    >
    >      BaseContainer bc2 = GetCustomDataTypeDefault(DTYPE_BOOL);
    >
    >      BaseTag     *tag = (BaseTag* )node;
    >      BaseContainer *data = tag->GetDataInstance();
    >
    >
    >      if(data->GetBool(MYTESTBUTTON))
    >      {
    >           bc2.SetString(DESC_NAME,"TRUE");
    >           bc2.SetString(DESC_SHORT_NAME,"TRUE");
    >      }
    >      else
    >      {
    >           bc2.SetString(DESC_NAME,"FALSE");
    >           bc2.SetString(DESC_SHORT_NAME,"FALSE");
    >      }
    >
    >      bc2.SetLong(DESC_CUSTOMGUI,CUSTOMGUI_BUTTON);
    >
    > //     bc2.SetLong(DESC_ANIMATE,DESC_ANIMATE_ON);
    > //     bc2.SetBool(DESC_REMOVEABLE,FALSE);
    >
    >      if (!description->SetParameter(DescLevel(MYTESTBUTTON,DTYPE_BOOL,0),bc2,DescLevel(ID_TAGPROPERTIES))) return FALSE;
    >
    >      flags |= DESCFLAGS_DESC_LOADED;
    >
    >      return TRUE;
    > }
    >
    > LONG LookAtCamera::Execute(PluginTag *tag, BaseDocument *doc, BaseObject *op, BaseThread *bt, LONG priority, LONG flags)
    > {
    >      BaseContainer *data = tag->GetDataInstance();
    >
    >      if(data->GetBool(MYTESTBUTTON, FALSE)) GePrint("TRUE");
    >      else GePrint("FALSE");
    >
    >      return EXECUTION_RESULT_OK;
    > }
    >
    > // be sure to use a unique ID obtained from www.plugincafe.com
    > #define ID_LOOKATCAMERATAG     1001165
    >
    > Bool RegisterLookAtCamera(void)
    > {
    >      // decide by name if the plugin shall be registered - just for user convenience
    >      String name=GeLoadString(IDS_LOOKATCAMERA); if (!name.Content()) return TRUE;
    >      return RegisterTagPlugin(ID_LOOKATCAMERATAG,name,TAG_EXPRESSION|TAG_VISIBLE,LookAtCamera::Alloc,"Tlookatcameraexp","lookatcamera.tif",0);
    > }
    > _

    cheers,
    Matthias


Log in to reply