Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Dynamic BaseObject-Array

    SDK Help
    0
    5
    422
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

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

      On 10/06/2004 at 04:25, xxxxxxxx wrote:

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

      ---------
      Hello all!

      I want to do something similar to

      BaseTag *p = new BaseTag[num];
      

      in "normal" Cpp.

      I think, the/a (?) solution is to use GeAlloc:

      BaseTag *p = (BaseTag* )GeAlloc(sizeof(BaseTag) * num);
      

      But how can I tell these BaseTag-Objects now that they are of tag-type Trestriction? Do I have to use BaseTag::Alloc()?

      Thanks in advance!

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        On 10/06/2004 at 05:15, xxxxxxxx wrote:

        It isn't possible to get a continuous block of BaseTags, since C4D has to do the allocation. The closest you can get is an array of pointers to BaseTags, which you then have to initialize one by one:

            
            
            const LONG NUM = 2;  
            BaseTag** tags = new BaseTag*[NUM];  
            for (LONG i = 0; i < NUM; ++i)  
            {  
              tags[i] = BaseTag::Alloc(Trestriction);  
            }
        
        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

          On 10/06/2004 at 05:43, xxxxxxxx wrote:

          isn't that method very slow (due to the for-loop)?
          I'm just interessted - I don't have another possibilty anyway 🙂

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

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

            On 10/06/2004 at 06:04, xxxxxxxx wrote:

            No. It is inconceivable that the extra indirection would be even remotely noticable, unless you're creating a billion tags or so. And the for loop would have to be done anyway; there's no magic way for the C++ array to create the tags without looping, even if it's done behind the screen.
            Please also keep in mind the words of wisdom: "Premature optimization is the root of all evil in programming." 😉

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

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

              On 10/06/2004 at 06:09, xxxxxxxx wrote:

              hehe, ok, thanks 🙂

              1 Reply Last reply Reply Quote 0
              • First post
                Last post