Bounding Box Query with Hierarchy Flag in Maya: Clarifying Inclusion of Child Shapes
0 reputation · 15 Sept 2023, 15:12 UTC
0 reputation · 15 Sept 2023, 15:12 UTC
Goal: Determine whether the -hi flag on the xform -q -ws -bb command causes the returned bounding box to encompass the geometry of all descendant shapes or only the transforms themselves.
Uncertainty: The Maya documentation for versions 2022 and 2024 differs on this behavior, with some releases stating that the flag includes the full hierarchy and others implying it only affects the selection of transforms, leaving the exact scope ambiguous.
Does the -hi flag include child shape extents in the bounding box calculation? Does the behavior remain consistent across Maya 2022 through 2024, or does it change between releases?
31775 reputation · 16 Sept 2023, 01:15 UTC
The -hierarchy (or -hi) flag on xform -q -ws -bb forces Maya to compute the bounding box from every shape that descends from the queried transform. In practice, this means the returned min/max coordinates encompass all geometry in the hierarchy, not just the transform node itself.
Older documentation (2022) sometimes described the flag as “affecting the selection of transforms”, while newer docs (2024) state that it “includes all descendant shapes”. The underlying implementation has not changed; the flag always aggregates geometry. The discrepancy stems from wording rather than behavior.
-all to force inclusion.Follow these steps in Maya 2022–2024 to confirm the behavior:
parent1 = group -n "parent1";pCube -n "childA"; parent1.childA; and pSphere -n "childB"; parent1.childB;xform -q -ws -bb -hierarchy parent1;
min and max vectors.-hierarchy:
xform -q -ws -bb parent1;
polyBoundingBox -q -bbox parent1; – the values should match the hierarchy query.To include them, add the -all flag:
xform -q -ws -bb -hierarchy -all parent1;
This forces Maya to consider every descendant shape, regardless of visibility.
Across Maya 2022, 2023, and 2024, the -hierarchy flag on xform -bb always aggregates child shape geometry. The command’s output is the combined world‑space bounding box of the entire hierarchy.
Use comments to ask for clarification. Post a solution as an answer.
31,775 reputation · 15 Sept 2023, 18:41 UTC
One trap in that verification recipe: if the parent's own bounds already enclose the child geometry, xform returns the same box with and without -hi, and the comparison proves nothing. Offset a child mesh clearly past the parent pivot on at least one axis before drawing conclusions from the numbers.
Force an evaluation before querying, too—world-space extents can be stale after edits—and keep scale, rotation, and deformer state identical between the two calls. The hidden-geometry claim is worth verifying on the specific build as well, since visibility and intermediate-object handling can depend on node state.
On the 2022-vs-2024 question, "the implementation never changed" is a hypothesis that documentation wording cannot settle either way. The reliable check is the same minimal scene run in each target build, recording the observed min/max per version.