------------------------------------------------------------------------------------------------
| 88 | |
| 89 | // ------------------------------------------------------------------------------------------------ |
| 90 | AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element &element, const std::string &name, |
| 91 | const Document &doc, const char *const *target_prop_whitelist /*= nullptr*/, |
| 92 | size_t whitelist_size /*= 0*/) : |
| 93 | Object(id, element, name), target(), doc(doc) { |
| 94 | const Scope &sc = GetRequiredScope(element); |
| 95 | |
| 96 | // find target node |
| 97 | const char *whitelist[] = { "Model", "NodeAttribute", "Deformer" }; |
| 98 | const std::vector<const Connection *> &conns = doc.GetConnectionsBySourceSequenced(ID(), whitelist, 3); |
| 99 | |
| 100 | for (const Connection *con : conns) { |
| 101 | |
| 102 | // link should go for a property |
| 103 | if (!con->PropertyName().length()) { |
| 104 | continue; |
| 105 | } |
| 106 | |
| 107 | if (target_prop_whitelist) { |
| 108 | const char *const s = con->PropertyName().c_str(); |
| 109 | bool ok = false; |
| 110 | for (size_t i = 0; i < whitelist_size; ++i) { |
| 111 | if (!strcmp(s, target_prop_whitelist[i])) { |
| 112 | ok = true; |
| 113 | break; |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | if (!ok) { |
| 118 | throw std::range_error("AnimationCurveNode target property is not in whitelist"); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | const Object *const ob = con->DestinationObject(); |
| 123 | if (!ob) { |
| 124 | DOMWarning("failed to read destination object for AnimationCurveNode->Model link, ignoring", &element); |
| 125 | continue; |
| 126 | } |
| 127 | |
| 128 | target = ob; |
| 129 | if (!target) { |
| 130 | continue; |
| 131 | } |
| 132 | |
| 133 | prop = con->PropertyName(); |
| 134 | break; |
| 135 | } |
| 136 | |
| 137 | if (!target) { |
| 138 | DOMWarning("failed to resolve target Model/NodeAttribute/Constraint for AnimationCurveNode", &element); |
| 139 | } |
| 140 | |
| 141 | props = GetPropertyTable(doc, "AnimationCurveNode.FbxAnimCurveNode", element, sc, false); |
| 142 | } |
| 143 | |
| 144 | // ------------------------------------------------------------------------------------------------ |
| 145 | const AnimationCurveMap &AnimationCurveNode::Curves() const { |
nothing calls this directly
no test coverage detected