Generating new object and tag

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

On 18/10/2006 at 03:35, xxxxxxxx wrote:

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

---------
Hello,

I have a Menu-Plugin that is supposed to create a new object and then insert my own tag to that object. But when I run it, it closes C4D without any message whatsoever. Here's my code for the Menu-Plugin Execute:

  
Bool GenStation::Execute(BaseDocument *doc)  
{  
BaseObject *op = BaseObject::Alloc(Onull);            
op->SetName("S/C");  
doc->InsertObject(op,doc->GetActiveObject(),NULL,TRUE);  
BaseTag *StationTag = (BaseTag* )TagStation::Alloc();  
op->InsertTag(StationTag);  
EventAdd();  
return TRUE;  
} 

If I take out the line

op->InsertTag(StationTag)

, then everything works fine, but obviously I don't have the tag on my object then ... any ideas?

cheers, Juergen

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

On 18/10/2006 at 04:46, xxxxxxxx wrote:

If the tag is one of yours, you'll need to call it like this:

BaseTag* StationTag = PluginTag::Alloc(YOUR_UNIQUE_ID);

It is also always a good idea to check for NULL (in this case 'op' and 'StationTag' after the Alloc()).

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

On 23/10/2006 at 01:27, xxxxxxxx wrote:

Thanks Robert, that solved the problem! I also included the checks for NULL ...