Accessing TP Group

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

On 14/10/2007 at 08:29, xxxxxxxx wrote:

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

---------
I want to link a particle group in the attribute manager, but c4d crashes while accessing it. It looks like that the cast from BaseList2D* to TP_PGroup* doesnt work like i expect it.

> _
> BaseObject *ParticleGeometrie::GetVirtualObjects(PluginObject *op, HierarchyHelp *hh)
> {
>      BaseDocument *doc = hh->GetDocument();
>      if (!doc) return NULL;
>
>      BaseContainer *data = op->GetDataInstance();
>      if (!data) return NULL;
>
>      TP_PGroup *tpGroup = (TP_PGroup* )data->GetLink( PARTICLE_GROUP, doc, ID_TP_PGROUP);
>      if (!tpGroup) return NULL;
>
>      tpGroup->GetName();        // this works
>      tpGroup->NumParticles();    // C4D crashes while accessing members of TP_PGroup
>      return NULL;
> }
> _

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

On 14/10/2007 at 09:17, xxxxxxxx wrote:

I found the answer myself, had to call
> InitThinkingParticles();
before ;)