Q: GeDynamicArray



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

    On 11/12/2006 at 21:03, xxxxxxxx wrote:

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

    ---------
    I'm having difficulties understanding exactly how the GeDynamicArray template class works.
    I need to create null objects for each particle being born into the scene. Once they are born I then need to record their positon througout the scene's time. GeDynamicArray seems like a perfect candidate for this. I'm not sure if I am allocating the dynamic array correctly, being that my plugin now crashes after adding this in there. Any examples on how to allocate the array and place the null object in there would be very helpful.
    As always thanks in advance for any help.
    Josh



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

    On 12/12/2006 at 02:42, xxxxxxxx wrote:

    You basically just tell the GeDynamicArray what type it will be and then use some of the functions to fill it or use the overloaded operators. Here a modifed Execute function to create a dummy Null and store the pointer in the GeDynamicArray and the read the first index in the GeDynamicArray to print the name of the object.

      
    Bool MenuTest::Execute(BaseDocument *doc)  
    {  
         GeDynamicArray<BaseObject*>myarray;  
         AutoAlloc<BaseObject> mynull(Onull);  
         if(!mynull) return FALSE;  
      
         mynull->SetName("mynull");  
      
         myarray.Push(mynull);  
      
         GePrint(myarray[0]->GetName());  
      
         return TRUE;  
    }  
    

    cheers,
    Matthias



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

    On 07/01/2009 at 06:42, xxxxxxxx wrote:

    Just a tad late to the party here. ;)

    In your example, Matthias, you AutoAlloc 'mynull' and Push it into the GeDynamicArray. I take it that it works similarly to the way one can create a local class instance in a function and Push it into a std::vector? That is, mynull is copied and appended, right?

    You guys really need an example of GeDynamicArray. I thought one had been added, but there is nothing in cinema4dsdk. C++ is a mess - I'm almost ready to go back to Java. :D



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

    On 07/01/2009 at 11:21, xxxxxxxx wrote:

    Nevermind. I see that if you don't gNew the class and then Push(), bye-bye. It's working though. :)


Log in to reply