On 11/06/2014 at 07:45, xxxxxxxx wrote:
Well...I'm doing something very wrong then.
If I save the object and doc into class variables then C4D locks up and hangs!! :astonished:
It does the same thing whether I do it in the Draw() or the Message() methods.
Exaple:
class SimpleTag : public TagData
{
INSTANCEOF(SimpleTag,TagData)
public:
BaseDocument *mydocument; //<--- Saved variables
BaseObject *myobject;
virtual Bool Message(GeListNode *node, LONG type, void *t_data);
virtual Bool Init(GeListNode *node);
virtual Bool GetDDescription(GeListNode *node, Description *description,DESCFLAGS_DESC &flags);
virtual Bool GetDParameter(GeListNode *node, const DescID &id,GeData &t_data,DESCFLAGS_GET &flags);
virtual Bool SetDParameter(GeListNode *node, const DescID &id,const GeData &t_data,DESCFLAGS_SET &flags);
virtual Bool Draw(BaseTag* tag, BaseObject* op, BaseDraw* bd, BaseDrawHelp* bh);
virtual EXECUTIONRESULT Execute(BaseTag *tag, BaseDocument *doc, BaseObject *op, BaseThread *bt, LONG priority, EXECUTIONFLAGS flags);
virtual void Free(GeListNode *node);
static NodeData *Alloc(void) { return gNew SimpleTag; }
};
Bool SimpleTag::Draw(BaseTag *tag, BaseObject *op, BaseDraw *bd, BaseDrawHelp *bh)
{
mydocument = GetActiveDocument();
myobject = tag->GetObject();
//...other code here
return TRUE;
}
void SimpleTag::Free(GeListNode *node)
{
GePrint(myobject->GetName()); //<--This prints the name of the object...But it also makes C4D hang!
return;
}
I thought we weren't allowed to grab the object from the tag while the tag is being freed. But you guys seem to have found a way to do it.
Can you please explain how you're doing that?
-ScottA