Using a wrapper class, it's possible to calculate the total bounds of all sub-objects in a somewhat efficient manner.
(Now there probably are better methods, but this is the best I could think of)
When the sub-objects are added to the root object, wrap their vertex proxies with this class and store them locally:
class VProxy (object):
"""Make vertex proxies a little more usable."""
__slots__ = ['owner', 'mesh', 'proxy', 'XYZ', '__eq__', ]
def __init__(this, owner, mesh, matid, vertid ):
this.owner = owner # mesh object can't be accessed from the mesh proxy.
this.mesh = mesh # mesh proxy
this.proxy = proxy = mesh.getVertex( matid, vertid )
# now for some hackery
this.XYZ = proxy.XYZ # direct access to the updated Vector object.
this.__eq__ = proxy.__eq__ # compared as the vertex proxy it holds. (speedy)
# more magic can be added if needed.
getXYZ = lambda this: this.owner.worldTransform * this.XYZ
getXYZ.__doc__ = "Gets the position of this vertex in world coordinates."
And in the frame, simply retrieve that local store and calculate the bounds:
x,X, y,Y, z,Z = sum(map( minmax, zip(*(itrans*subProxy.getXYZ() for subProxy in subVerts)) ))
minmax = lambda axis: [min(axis), max(axis)]
subVerts is of course the collection for a particular sub-object, and
itrans is the inverse of the world transform matrix for our root object.
Now as for performance, since getXYZ is a lambda, it's faster than a basic function, but overall still slow...
The only speed we get comes from the optimised Vector and Matrix classes.