THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/03/2010 at 05:40, xxxxxxxx wrote:
It's really easy to do for descrition based plugins.
Check the example code, it's a modifed tag plugin from the SDK examples. I added a LONG element displaying the noise types in GetDDescription(). The CYCLE strings are filled with C4DNoise::CreateMenuContainer().
/////////////////////////////////////////////////////////////
// CINEMA 4D SDK //
/////////////////////////////////////////////////////////////
// (c) 1989-2004 MAXON Computer GmbH, all rights reserved //
/////////////////////////////////////////////////////////////
// "look at editor camera" expression example
#include "c4d.h"
#include "c4d_symbols.h"
#include "tlookatcameraexp.h"
#include "lib_noise.h"
// be sure to use a unique ID obtained from www.plugincafe.com
#define ID_LOOKATCAMERATAG 1001165
enum
{
MY_NOISE = 6000
};
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->SetLong(MY_NOISE, NOISE_BOX_NOISE);
return TRUE;
}
Bool LookAtCamera::GetDDescription(GeListNode *node, Description *description,LONG &flags)
{
if (!description->LoadDescription(ID_LOOKATCAMERATAG)) return FALSE;
const DescID *singleid = description->GetSingleDescID();
DescID cid = DescLevel(MY_NOISE,DTYPE_LONG,0);
if (!singleid || cid.IsPartOf(*singleid,NULL)) // important to check for speedup c4d!
{
BaseContainer bc = GetCustomDataTypeDefault(DTYPE_LONG);
bc.SetContainer(DESC_CYCLE,C4DNoise::CreateMenuContainer(FALSE));
bc.SetLong(DESC_ANIMATE,DESC_ANIMATE_ON);
bc.SetBool(DESC_REMOVEABLE,FALSE);
bc.SetString(DESC_NAME,"Noises");
bc.SetString(DESC_SHORT_NAME,"Noises");
if (!description->SetParameter(cid,bc,DescLevel(ID_TAGPROPERTIES))) return TRUE;
}
flags |= DESCFLAGS_DESC_LOADED;
return TRUE;
}
LONG LookAtCamera::Execute(PluginTag *tag, BaseDocument *doc, BaseObject *op, BaseThread *bt, LONG priority, LONG flags)
{
return EXECUTION_RESULT_OK;
}
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_VISIBLE,LookAtCamera::Alloc,"Tlookatcameraexp","lookatcamera.tif",0);
}
cheers,
Matthias