I am starting to question if I am fundamentally misunderstanding this.
I'm working on a script to generate thumbnails. The script must be plugin-agnostic, so I cannot rely on the host. So, I'd like to use the the scene bounds to calculate the distance of the camera so that the size of the subject remains somewhat constant relative to the frame.
I assumed that AiUniverseGetSceneBounds() would be what I was wanting. But even when the scene bounds are writen to the .ass header, or when including an .asstoc file, AiUniverseGetSceneBounds() returns an AtBbox object with ({0,0,0},{0,0,0}).
Here is the code that I'm using:
AiBegin() AiASSLoad(myass, AI_NODE_ALL) bounds = AiUniverseGetSceneBounds() AiEnd()
bounds.max.y (or any other axis) always returns zero.
The header is as follows:
### exported: Fri Apr 12 12:00:58 2019 ### from: Arnold 5.1.0.1 [8698598b] darwin clang-5.0.0 oiio-1.7.17 osl-1.9.0 vdb-4.0.0 clm-1.0.3.513 rlm-12.2.2 2018/04/17 17:32:11 ### host app: C4DtoA 2.3.0.1 | Cinema4D 19068 ### bounds: -1.000000 -1.000000 -1.000000 1.000000 1.000000 1.000000 ### user: REDACTED ### fps: 30.000000 ### frame: 0.000000 ### scene: Untitled 3
It's not a huge deal. I can just read the .ass file's header and extract the bounds, but it'd sure be nice to avoid that. What exactly am I doing wrong?
Solved! Go to Solution.
Solved by Stephen.Blair. Go to Solution.
I suspect you'll have to call AiRender(AI_RENDER_MODE_FREE) to force the calculation of the scene bounds.
FINALLY! Thank you! My guess is then I won't actually need the bounds pre-defined, either.