How to Alloc FFD Object?

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

On 26/09/2010 at 04:45, xxxxxxxx wrote:

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

---------
Hi,

I can't figure out how to alloc a FFD object. It could successfully be created by BaseObject::Alloc(Offd), but C4D crashes afterwards. I assume, that the point array also has to be created, but I can't find any appropriate allocation function like e.g. PolygonObject::Alloc(points, surfaces).

Any help?

Thanks.

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

On 26/09/2010 at 07:52, xxxxxxxx wrote:

Howdy,

Are you sending ffdOp->Message(MSG_MENUPREPARE); after inserting the ffd into the document? It may be that the ffd allocates it's own default points array after receiving that message.

Adios,
Cactus Dan

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

On 26/09/2010 at 08:21, xxxxxxxx wrote:

Hi,

good idea, but no effect. I tried to get the point count just after creating the object and it's 27 corresponding to the default subdivions of 3 when you create it in C4D, so the basic allocation seems to be done at creation time.

I also tried to set the new point count using ToPoint(op)->ResizeObject(pcnt). This seems at least to avoid c4d crashing.

But I think that there is s.th. basically going wrong, because the bounding box isn't updated too, although I send an MSG_UPDATE message.
This is also the case, if I leave the default subdivisions.

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

On 26/09/2010 at 08:40, xxxxxxxx wrote:

Howdy,

Hmmmm, I just tried this in R10.1:

  
Bool TestCommand::Execute(BaseDocument* doc)   
{   
     BaseObject *ffdOp = BaseObject::Alloc(Offd);   
     if(!ffdOp) return FALSE;   
        
     doc->InsertObject(ffdOp,NULL,NULL,FALSE);   
     doc->AddUndo(UNDO_NEW,ffdOp);   
     ffdOp->Message(MSG_MENUPREPARE);   
        
     EventAdd(EVENT_FORCEREDRAW);   
        
     return TRUE;   
}   

... and it seems fine; no crashing and the bounding box is correct.

Adios,
Cactus Dan

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

On 26/09/2010 at 08:50, xxxxxxxx wrote:

ok, but you don't change any parameter of the FFD. Try to insert a change of the size vector and see the bounding box when selecting the FFD. The grid is looking fine, but the bounding brackets are still on the default size of 3 m (resp. 300 units).

BaseContainer *bc = ffdOp->GetDataInstance();
bc->SetVector(FFDOBJECT_SIZE, Vector(100, 200, 400));

...

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

On 26/09/2010 at 09:13, xxxxxxxx wrote:

Howdy,

OH, in R10.1, the grid doesn't change even though the parameters are set correctly, the grid and the bounding box are still at the default.

Adios,
Cactus Dan

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

On 29/09/2010 at 16:27, xxxxxxxx wrote:

may be Matthias can say a word?

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

On 30/09/2010 at 07:01, xxxxxxxx wrote:

I checked it and can confirm the strange behaviour. I have to ask the developers what's going on.

cheers,
Matthias