Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Volume Builder GetInputObject returns something different?

    Bugs
    2024 c++ macos
    2
    5
    1.3k
    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.
    • D
      d_schmidt
      last edited by

      Hello, I have a circumstance pretty far in my code where I'm using a VolumeBuilder.

      If I have a cube as a child of a VolumeBuilder when I use GetInputObject to retrieve that cube, I'm not able to get the cache from that cube sometimes with GetCache().

      In the same circumstance, if I use GetDown() from the VolumeBuilder, to retrieve that cube, I am able to get the cache from that cube same cube with GetCache().

      Do GetInputObject() and GetDown() behave differently in this circumstance?

      Thanks for the help!
      Dan

      i_mazlovI 1 Reply Last reply Reply Quote 0
      • i_mazlovI
        i_mazlov @d_schmidt
        last edited by

        Hi Dan,

        Please check out the "How to ask Questions" section of our Support Procedures. It's very difficult to reproduce the behavior you're talking about without any piece of code!

        The GetInputObject() function works in the domain of input objects of the volume builder (pink arrow). The GetDown() function operates on the object hierarchy (blue arrow). I personally would 'a priori' not expect them to behave the same way. I'd assume it's quite the opposite: there're some circumstances, when they behave the same way.

        8a547552-bc45-44a2-aa1d-569f086f79a9-image.png

        Regarding getting the cache issue it's hard to tell without seeing what's actually going on in your code. Did you compare that GetInputObject() and GetDown() functions actually return the exact same object, and then executing GetCache() on this object doesn't return you anything?

        Cheers,
        Ilia

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • D
          d_schmidt
          last edited by

          Hi @i_mazlov

          Sorry about the lack of clarity in my post, I managed to trim the case down to something pretty narrow:

          The hierarchy:
          b6f976e8-566f-4c91-a74e-e7b4f763a43f-image.png

          The code:

            BaseObject* firstChild = op->GetDown();
              if(firstChild != nullptr)
              {
                  if(firstChild->GetType() == Ovolumebuilder)
                  {
                      VolumeBuilder* volumeBuilder = static_cast<VolumeBuilder*>(firstChild);
                      if(volumeBuilder!=nullptr)
                      {
                          Int32 volumeBuilderInputCount = volumeBuilder->GetInputObjectCount(false);
                          BaseObject* volumeChildInput = volumeBuilder->GetDown();
                          
                          if(volumeBuilderInputCount > 0 && volumeChildInput != nullptr)
                          {
                              BaseObject* volumeInputObject = volumeBuilder->GetInputObject(0);
                              if(volumeChildInput == volumeInputObject)
                              {
                                  ApplicationOutput("The two inputs are the same.");
                              }
                              else
                              {
                                  ApplicationOutput("The two inputs are not the same.");
                              }
                              
                          }
                      }
                  }
              }
          

          In most cases it seems like the two objects equal each other, e.g. if the cube is moved. If an Undo is performed after moving the cube, so the Undo returns the cube's position back, then they do not equal each other.

          This is the same circumstance where I'm not able to retrieve the cache from the GetInputObject() object. Would this be expected behavior in this circumstance?

          Dan

          i_mazlovI 1 Reply Last reply Reply Quote 0
          • i_mazlovI
            i_mazlov @d_schmidt
            last edited by i_mazlov

            Hi Dan,

            There's something fishy going on with volume builder when using undo stack. There's no rocket science in the input list of the volume builder, namely it just contains a tree of BaseLinks, so whatever changes are performed in the original object should be reflected by the input list. However, executing undo operation is a little special in a way that it changes pointer to the baseobject (you can easily see that in the Active Object Dialog tool: when moving object, it's pointer is the same, however, when performing undo operation, it's address is changed and hence marked in red):
            eeee58bf-75aa-4718-8038-10d319615083-application_dbg_U1YDUAkl3X.gif

            It sounds to me like a bug in the build volume, namely improper undo event handling. I've created a bug report (ITEM#529307) in our internal bug tracking system.

            I think the best workaround for you is to use hierarchy access function GetDown() instead of GetInputObject().

            Cheers,
            Ilia

            MAXON SDK Specialist
            developers.maxon.net

            1 Reply Last reply Reply Quote 1
            • i_mazlovI i_mazlov moved this topic from Cinema 4D SDK on
            • D
              d_schmidt
              last edited by

              Thanks for the info!

              Dan

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