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

    How to use NewObj for arrays

    SDK Help
    0
    2
    400
    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

      On 08/12/2017 at 02:49, xxxxxxxx wrote:

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

      ---------
      Hi everyone.

      In cinema R19's documentation is suggested to always use cinema memory model
      (NewObj(), DeleteObj(), etc )
      https://developers.maxon.net/docs/Cinema4DCPPSDK/html/page_advice_for_developers.html
      but is not expecified how to instanciate arrays using cinema memory model, 
      i.e. instanciate a plain objet in the heap in the standard way is

      MyClass * obj = new MyClass();
      

      and using cinema memory model will be in this way

      MyClass * obj = NewObj(MyClass); 
      

      Instanciate an array in the heap in C++ standard way is

      MyClass * arrayOfMyClass = new MyClass[100]; 
      

      (just to give a quick example)
      but I can't figure out how to instanciate an array in the heap using NewObj()

      thanks in advance

      --Julio Angulo

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

        On 08/12/2017 at 08:20, xxxxxxxx wrote:

        Hello and welcome to the PluginCafe forums,

        for an array of elements you should not use NewObj(). For an array of elements always use the BaseArray template class. You find some example code in arraytutorial.cpp.

        best wishes,
        Sebastian

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