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

    Get render modes for cached polygons

    SDK Help
    0
    5
    436
    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 31/12/2015 at 04:55, xxxxxxxx wrote:

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

      ---------
      Hello.

      I have an array with a cube as a child and i use the cache recursion:
      https://developers.maxon.net/docs/Cinema4DCPPSDK/html/class_base_object.html#aceb4039aaf9b2235d1f43f1e060a4d6d
       to access the cached polygons.

      The problem is that i need the render mode of the produced cached objects.
      For the array, which has a null as cached object, i simply use GetRenderMode of the cache parent.
      But for the polygons produced by the cube control object, the GetRenderMode returns the same as the array, instead of the actual control object.

      So my question is: How do i get the correct Render mode of the produced cached objects ?

      Thank you.

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

        On 04/01/2016 at 04:58, xxxxxxxx wrote:

        Hi,

        can you elaborate a bit more, why you are looking for the Render Mode of caches?
        In general it should work, just like with every other object. If Render mode is set to default, you will need to consider the Render Mode of parent objects as well.
        A piece of code could help to understand your problem better as well.

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

          On 04/01/2016 at 05:24, xxxxxxxx wrote:

          Hello dear Andreas.

          Here is how i get the top cached parent:

          BaseObject* parent = cached_object;
          while(parent->GetCacheParent())
          parent = parent->GetCacheParent();
          

          and here is how i get the render mode:

          LONG render_mode = parent->GetRenderMode();
          

          Consider an array with a cube as a child and 2 as count.
          Now, if you use the GetCache recursion code to retrieve the array's cache,
          you will get a Null object with 4 children. One of them will be the cube control object :

          object->GetBit(BIT_CONTROLOBJECT) == TRUE
          

          The other 3 objects will be the ones produced by the array. Lets call them A , B and C.

          Now, in C4D's object hierarchy, I set the render mode of the cube child to off.
          What render mode should A, B and C have ? (they have the same as array instead of the control object)

          Thank you.

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

            On 04/01/2016 at 05:36, xxxxxxxx wrote:

            Hi,

            do you know the Active Object Dialog (gui/activeobject.cpp) from the cinema4dsdk examples?
            This can be a very nice tool in situations like yours, since it can visualize the cache structure.
            I strongly suggest to have a look at it.
            When I use it here, with your array/cube scenario, I see that the cloned cubes have the same Render Mode as the input cube. Their caches have default Render Mode and thus inherit from their cloned parent. That's about what I would expect as well.
            Always remember, if Render Mode is set to default, you need to check the parents (until one has set a definitive value, like on or off) in order to determine the actual value.

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

              On 10/01/2016 at 13:37, xxxxxxxx wrote:

              there are 2 solutions "1 is ugly, 1 is smarter "
              ugly 1:

                
              while(object)  
              {  
              if(object->GetCacheParent())
              	object = object->GetCacheParent();
              else if (object->GetUp())
              	object = object->GetUp();
              else
              	break;
              }
              

              the smarter solution:
              pass render state of the current object "that you have the cache from when you do cache recursion" to child.

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