On 08/06/2014 at 19:32, xxxxxxxx wrote:
Now I have this:
#include "c4d.h"
#include "c4d_symbols.h"
#define ID_POLYPAINTEDITOR 1234567
class polypainteditor : public SceneHookData
{
public:
virtual Bool DisplayControl(BaseDocument* doc, BaseObject* op, BaseObject* chainstart, BaseDraw* bd, BaseDrawHelp* bh, ControlDisplayStruct& cds);
virtual Bool InitDisplayControl(BaseDocument *doc, BaseContainer &data;, BaseDraw *bd, const AtomArray *active);
virtual void FreeDisplayControl();
static NodeData* Alloc(void) { return gNew polypainteditor; }
};
Bool polypainteditor::InitDisplayControl(BaseDocument *doc, BaseContainer &data;, BaseDraw *bd, const AtomArray *active)
{
return true;
}
void polypainteditor::FreeDisplayControl()
{
}
Bool polypainteditor::DisplayControl(BaseDocument *doc, BaseObject *op, BaseObject *chainstart, BaseDraw *bd, BaseDrawHelp *bh, ControlDisplayStruct &cds;)
{
if (!op || !op->IsInstanceOf(Opolygon)) return true;
LONG pcnt = ToPoint(op)->GetPointCount();
cds.vertex_color = GeAllocTypeNC(SVector,pcnt);
if (!cds.vertex_color) return false;
LONG i;
Random rnd;
rnd.Init(45346);
for (i=0; i<pcnt; i++)
{
cds.vertex_color _= SVector(rnd.Get01(), rnd.Get01(), rnd.Get01());
}
return true;
}
// ***************************************************************
// register the plugin
// be sure to use a unique ID obtained from www.plugincafe.com
Bool Registerpolypainteditor(void)
{
return RegisterSceneHookPlugin(ID_POLYPAINTEDITOR, "PolyPaintEditor",PLUGINFLAG_SCENEHOOK_NOTDRAGGABLE,polypainteditor::Alloc,EXECUTIONPRIORITY_EXPRESSION,0,NULL);
}
It builds fine and loads in Cinema4D (I know it loads... the main.cpp is calling the registration and prints a message if a true value is returned)
But nothing is happening.
Shouldn't it paint with random colors all the faces of polygonal objects?