Volume Builder GetInputObject returns something different?
-
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 -
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.
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 -
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:
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
-
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):
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 -
-
Thanks for the info!
Dan