------------------------------------------------------------------------------------------------
| 186 | |
| 187 | // ------------------------------------------------------------------------------------------------ |
| 188 | AnimationCurveNodeList AnimationLayer::Nodes(const char *const *target_prop_whitelist /*= nullptr*/, |
| 189 | size_t whitelist_size /*= 0*/) const { |
| 190 | AnimationCurveNodeList nodes; |
| 191 | |
| 192 | // resolve attached animation nodes |
| 193 | const std::vector<const Connection *> &conns = doc.GetConnectionsByDestinationSequenced(ID(), "AnimationCurveNode"); |
| 194 | nodes.reserve(conns.size()); |
| 195 | |
| 196 | for (const Connection *con : conns) { |
| 197 | |
| 198 | // link should not go to a property |
| 199 | if (con->PropertyName().length()) { |
| 200 | continue; |
| 201 | } |
| 202 | |
| 203 | const Object *const ob = con->SourceObject(); |
| 204 | if (!ob) { |
| 205 | DOMWarning("failed to read source object for AnimationCurveNode->AnimationLayer link, ignoring", &element); |
| 206 | continue; |
| 207 | } |
| 208 | |
| 209 | const AnimationCurveNode *const anim = dynamic_cast<const AnimationCurveNode *>(ob); |
| 210 | if (!anim) { |
| 211 | DOMWarning("source object for ->AnimationLayer link is not an AnimationCurveNode", &element); |
| 212 | continue; |
| 213 | } |
| 214 | |
| 215 | if (target_prop_whitelist) { |
| 216 | const char *s = anim->TargetProperty().c_str(); |
| 217 | bool ok = false; |
| 218 | for (size_t i = 0; i < whitelist_size; ++i) { |
| 219 | if (!strcmp(s, target_prop_whitelist[i])) { |
| 220 | ok = true; |
| 221 | break; |
| 222 | } |
| 223 | } |
| 224 | if (!ok) { |
| 225 | continue; |
| 226 | } |
| 227 | } |
| 228 | nodes.push_back(anim); |
| 229 | } |
| 230 | |
| 231 | return nodes; // pray for NRVO |
| 232 | } |
| 233 | |
| 234 | // ------------------------------------------------------------------------------------------------ |
| 235 | AnimationStack::AnimationStack(uint64_t id, const Element &element, const std::string &name, const Document &doc) : |
no test coverage detected