MCPcopy Create free account
hub / github.com/assimp/assimp / SetupNodeMetadata

Method SetupNodeMetadata

code/AssetLib/FBX/FBXConverter.cpp:926–964  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

924}
925
926void FBXConverter::SetupNodeMetadata(const Model &model, aiNode &nd) {
927 const PropertyTable &props = model.Props();
928 DirectPropertyMap unparsedProperties = props.GetUnparsedProperties();
929
930 // create metadata on node
931 const std::size_t numStaticMetaData = 2;
932 aiMetadata *data = aiMetadata::Alloc(static_cast<unsigned int>(unparsedProperties.size() + numStaticMetaData));
933 nd.mMetaData = data;
934 int index = 0;
935
936 // find user defined properties (3ds Max)
937 data->Set(index++, "UserProperties", aiString(PropertyGet<std::string>(props, "UDP3DSMAX", "")));
938 // preserve the info that a node was marked as Null node in the original file.
939 data->Set(index++, "IsNull", model.IsNull() ? true : false);
940
941 // add unparsed properties to the node's metadata
942 for (const DirectPropertyMap::value_type &prop : unparsedProperties) {
943 // Interpret the property as a concrete type
944 if (const TypedProperty<bool> *interpretedBool = prop.second->As<TypedProperty<bool>>()) {
945 data->Set(index++, prop.first, interpretedBool->Value());
946 } else if (const TypedProperty<int> *interpretedInt = prop.second->As<TypedProperty<int>>()) {
947 data->Set(index++, prop.first, interpretedInt->Value());
948 } else if (const TypedProperty<uint32_t> *interpretedUInt = prop.second->As<TypedProperty<uint32_t>>()) {
949 data->Set(index++, prop.first, interpretedUInt->Value());
950 } else if (const TypedProperty<uint64_t> *interpretedUint64 = prop.second->As<TypedProperty<uint64_t>>()) {
951 data->Set(index++, prop.first, interpretedUint64->Value());
952 } else if (const TypedProperty<int64_t> *interpretedint64 = prop.second->As<TypedProperty<int64_t>>()) {
953 data->Set(index++, prop.first, interpretedint64->Value());
954 } else if (const TypedProperty<float> *interpretedFloat = prop.second->As<TypedProperty<float>>()) {
955 data->Set(index++, prop.first, interpretedFloat->Value());
956 } else if (const TypedProperty<std::string> *interpretedString = prop.second->As<TypedProperty<std::string>>()) {
957 data->Set(index++, prop.first, aiString(interpretedString->Value()));
958 } else if (const TypedProperty<aiVector3D> *interpretedVec3 = prop.second->As<TypedProperty<aiVector3D>>()) {
959 data->Set(index++, prop.first, interpretedVec3->Value());
960 } else {
961 ai_assert(false);
962 }
963 }
964}
965
966void FBXConverter::ConvertModel(const Model &model, aiNode *parent, aiNode *root_node, const aiMatrix4x4 &absolute_transform) {
967 const std::vector<const Geometry *> &geos = model.GetGeometry();

Callers

nothing calls this directly

Calls 6

GetUnparsedPropertiesMethod · 0.80
aiStringClass · 0.50
sizeMethod · 0.45
SetMethod · 0.45
IsNullMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected