Traverses the parents of TransformGroupIdx counting number of levels, and sets levels array value for TransformGroupIdx and its parents if not yet initialized. If level is already set, retrieve stored level. Uninitialized level array should be correct size and defaulted to zeros.