| 126 | }; |
| 127 | |
| 128 | CopyInfo<size_t> handleLocation( const SceneInterface *src, SceneInterface *dst, double time, unsigned int flags ) |
| 129 | { |
| 130 | SceneInterface::Path path; |
| 131 | src->path( path ); |
| 132 | bool isRoot = path.empty(); |
| 133 | CopyInfo<size_t> copyInfo; |
| 134 | |
| 135 | if( flags & SceneAlgo::Bounds ) |
| 136 | { |
| 137 | auto bound = src->readBound( time ); |
| 138 | if( dst ) |
| 139 | { |
| 140 | dst->writeBound( bound, time ); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | if( flags & SceneAlgo::Transforms ) |
| 145 | { |
| 146 | IECore::ConstDataPtr transform = src->readTransform( time ); |
| 147 | if( dst && !isRoot ) |
| 148 | { |
| 149 | dst->writeTransform( transform.get(), time ); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | if( flags & SceneAlgo::Attributes ) |
| 154 | { |
| 155 | SceneInterface::NameList attributeNames; |
| 156 | src->attributeNames( attributeNames ); |
| 157 | |
| 158 | copyInfo.attributeCount += attributeNames.size(); |
| 159 | for( const auto &attributeName : attributeNames ) |
| 160 | { |
| 161 | IECore::ConstObjectPtr attr = src->readAttribute( attributeName, time ); |
| 162 | if( dst ) |
| 163 | { |
| 164 | dst->writeAttribute( attributeName, attr.get(), time ); |
| 165 | } |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | if( flags & SceneAlgo::Tags ) |
| 170 | { |
| 171 | SceneInterface::NameList tags; |
| 172 | src->readTags( tags ); |
| 173 | copyInfo.tagCount += tags.size(); |
| 174 | if( dst ) |
| 175 | { |
| 176 | dst->writeTags( tags ); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | if( flags & SceneAlgo::Sets && isRoot ) |
| 181 | { |
| 182 | SceneInterface::NameList setNames = src->setNames(); |
| 183 | copyInfo.setCount += setNames.size(); |
| 184 | for( const auto &setName : setNames ) |
| 185 | { |
no test coverage detected