------------------------------------------------------------------------------------------------
| 2798 | |
| 2799 | // ------------------------------------------------------------------------------------------------ |
| 2800 | void FBXConverter::ProcessMorphAnimDatas(std::map<std::string, morphAnimData *> *morphAnimDatas, const BlendShapeChannel *bsc, const AnimationCurveNode *node) { |
| 2801 | std::vector<const Connection *> bscConnections = doc.GetConnectionsBySourceSequenced(bsc->ID(), "Deformer"); |
| 2802 | for (const Connection *bscConnection : bscConnections) { |
| 2803 | auto bs = dynamic_cast<const BlendShape *>(bscConnection->DestinationObject()); |
| 2804 | if (bs) { |
| 2805 | auto channelIt = std::find(bs->BlendShapeChannels().begin(), bs->BlendShapeChannels().end(), bsc); |
| 2806 | if (channelIt != bs->BlendShapeChannels().end()) { |
| 2807 | auto channelIndex = static_cast<unsigned int>(std::distance(bs->BlendShapeChannels().begin(), channelIt)); |
| 2808 | std::vector<const Connection *> bsConnections = doc.GetConnectionsBySourceSequenced(bs->ID(), "Geometry"); |
| 2809 | for (const Connection *bsConnection : bsConnections) { |
| 2810 | auto geo = dynamic_cast<const Geometry *>(bsConnection->DestinationObject()); |
| 2811 | if (geo) { |
| 2812 | std::vector<const Connection *> geoConnections = doc.GetConnectionsBySourceSequenced(geo->ID(), "Model"); |
| 2813 | for (const Connection *geoConnection : geoConnections) { |
| 2814 | auto model = dynamic_cast<const Model *>(geoConnection->DestinationObject()); |
| 2815 | if (model) { |
| 2816 | auto geoIt = std::find(model->GetGeometry().begin(), model->GetGeometry().end(), geo); |
| 2817 | auto geoIndex = static_cast<unsigned int>(std::distance(model->GetGeometry().begin(), geoIt)); |
| 2818 | auto name = aiString(FixNodeName(model->Name() + "*")); |
| 2819 | name.length = 1 + ASSIMP_itoa10(name.data + name.length, AI_MAXLEN - 1, geoIndex); |
| 2820 | morphAnimData *animData; |
| 2821 | auto animIt = morphAnimDatas->find(name.C_Str()); |
| 2822 | if (animIt == morphAnimDatas->end()) { |
| 2823 | animData = new morphAnimData(); |
| 2824 | morphAnimDatas->insert(std::make_pair(name.C_Str(), animData)); |
| 2825 | } else { |
| 2826 | animData = animIt->second; |
| 2827 | } |
| 2828 | for (std::pair<std::string, const AnimationCurve *> curvesIt : node->Curves()) { |
| 2829 | if (curvesIt.first == "d|DeformPercent") { |
| 2830 | const AnimationCurve *animationCurve = curvesIt.second; |
| 2831 | const KeyTimeList &keys = animationCurve->GetKeys(); |
| 2832 | const KeyValueList &values = animationCurve->GetValues(); |
| 2833 | unsigned int k = 0; |
| 2834 | for (auto key : keys) { |
| 2835 | morphKeyData *keyData; |
| 2836 | auto keyIt = animData->find(key); |
| 2837 | if (keyIt == animData->end()) { |
| 2838 | keyData = new morphKeyData(); |
| 2839 | animData->insert(std::make_pair(key, keyData)); |
| 2840 | } else { |
| 2841 | keyData = keyIt->second; |
| 2842 | } |
| 2843 | keyData->values.push_back(channelIndex); |
| 2844 | keyData->weights.push_back(values.at(k) / 100.0f); |
| 2845 | k++; |
| 2846 | } |
| 2847 | } |
| 2848 | } |
| 2849 | } |
| 2850 | } |
| 2851 | } |
| 2852 | } |
| 2853 | } |
| 2854 | } |
| 2855 | } |
| 2856 | } |
| 2857 |
nothing calls this directly
no test coverage detected