// *************************************************************************** void UTransform::parent(UTransform newFather) { CTransform *object = getObjectPtr(); if (object->getForceClipRoot()) { nlwarning("Transform has been flagged to be glued to the root, can't change parent. See UTransform::setForceClipRoot(bool)."); return; } if(!newFather.empty()) { // link me to other. CTransform *other= newFather.getObjectPtr(); if(other->getOwnerScene()!=object->getOwnerScene()) nlerror("Try to parent 2 object from 2 differnet scenes!!"); other->hrcLinkSon( object ); } else { // link me to Root. object->getOwnerScene()->getRoot()->hrcLinkSon( object ); } }
// *************************************************************************** void UTransform::getLastParentClusters(std::vector<CCluster*> &clusters) const { CTransform *object = getObjectPtr(); CScene *scene = object->getOwnerScene(); // look in the list of parent of the transform object and extract the CCluster parents if (scene == NULL) return; CClipTrav &clipTrav= scene->getClipTrav(); uint num= object->clipGetNumParents(); for(uint i=0;i<num;i++) { CCluster *pcluster = dynamic_cast<CCluster*>(object->clipGetParent(i)); if (pcluster != NULL) clusters.push_back(pcluster); } // If the object is link to a QuadCluster, add the RootCluster to the list CTransformShape *trShp= dynamic_cast<CTransformShape*>( object ); if( trShp && trShp->isLinkToQuadCluster() ) clusters.push_back(clipTrav.RootCluster); }