Storing Objects in Containers



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

    On 26/10/2005 at 14:40, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.503 
    Platform:      Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
         Hello again all.

    One of the objects in my plugin needs to store an array of other objects of a certain type in its container. I was looking at the sdk documentation and did not see any way of storing a BaseObject in a container. Is there some easy way to do this or do I need to do something like store the names of all the objects and search for them each time I need them?

    Thanks.

    Aaron M



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

    On 26/10/2005 at 14:57, xxxxxxxx wrote:

    Use BaseContainer::SetLink to store a BaseLink.



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

    On 26/10/2005 at 22:15, xxxxxxxx wrote:

    I was thinking that might be I would need to try, but I didn't quite understand the documentation. Do I have to declare a variable of the type BaseLink such as this:

    BaseLink* o1=op.GetLink();

    op being a BaseObject. The BaseLink can be an array also, correct? I haven't been able to understand much about Alloc() either. Does this apply here too?

    Thanks.

    Aaron M



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

    On 26/10/2005 at 23:26, xxxxxxxx wrote:

    The link is returned as a base-level BaseList2D class. It can store anything derived from this class (BaseObject, BaseTag, and so forth). There is also a GetObjectLink() variation which will return the pointed link as a BaseObject*. Otherwise, cast the returned pointer to the type being set:

    BaseTag* t1 = static_cast<BaseTag*>(op->GetDataInstance()->GetLink(ID_TAGLINK, baseDocument));

    BaseObject doesn't have a GetLink() method (either declared or inherited). Most of the time, you get and set your BaseLinks through the object's BaseContainer (GetDataInstance() is one way to get to it) and requires a generic LONG ID value.

    No, the link is to a single instance of one of the classes mentioned above. One link per ID only. To store multiple objects, you will need multiple IDs.



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

    On 27/10/2005 at 08:21, xxxxxxxx wrote:

    Thankyou Robert.  This will clear up a lot, and now I'll go do some experimentation and see what I can accomplish.
                        Aaron M



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

    On 27/10/2005 at 15:41, xxxxxxxx wrote:

    A question regarding this matter.

    If you use the BaseContainer->SetLink(), does the BaseObject need to be in the document as a requirement?

    The reason I ask is that I created a BaseObject, and only using it as a reference object, so I don't add it into the document.

    Would this be saved too with SetLink?



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

    On 27/10/2005 at 16:18, xxxxxxxx wrote:

    The only thing that leads me to believe that the BaseObject must be in the document is that whenever GetLink() or a variation is called, there is a BaseDocument* argument. And there is no mention that it can be NULL.


Log in to reply