Changeset View
Changeset View
Standalone View
Standalone View
source/blender/collada/DocumentImporter.cpp
| Show First 20 Lines • Show All 320 Lines • ▼ Show 20 Lines | else { | ||||
| anim_importer.translate_Animations(node, root_map, object_map, FW_object_map); | anim_importer.translate_Animations(node, root_map, object_map, FW_object_map); | ||||
| COLLADAFW::NodePointerArray &children = node->getChildNodes(); | COLLADAFW::NodePointerArray &children = node->getChildNodes(); | ||||
| for (i = 0; i < children.getCount(); i++) { | for (i = 0; i < children.getCount(); i++) { | ||||
| translate_anim_recursive(children[i], node, NULL); | translate_anim_recursive(children[i], node, NULL); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * If the imported file was made with Blender, return the Blender version used, | |||||
| * otherwise return an empty std::string | |||||
| */ | |||||
| std::string DocumentImporter::get_import_version(const COLLADAFW::FileInfo *asset) | |||||
| { | |||||
| const char AUTORING_TOOL[] = "authoring_tool"; | |||||
| const std::string BLENDER("Blender "); | |||||
| const COLLADAFW::FileInfo::ValuePairPointerArray &valuePairs = asset->getValuePairArray(); | |||||
| for ( size_t i = 0, count = valuePairs.getCount(); i < count; ++i) | |||||
| { | |||||
| const COLLADAFW::FileInfo::ValuePair* valuePair = valuePairs[i]; | |||||
| const COLLADAFW::String& key = valuePair->first; | |||||
| const COLLADAFW::String& value = valuePair->second; | |||||
| if ( key == AUTORING_TOOL ) | |||||
| { | |||||
| if (value.compare(0, BLENDER.length(), BLENDER) == 0) | |||||
| { | |||||
| // Was made with Blender, now get version string | |||||
| std::string v = value.substr(BLENDER.length()); | |||||
| std::string::size_type n = v.find(" "); | |||||
| if (n > 0) { | |||||
| return v.substr(0,n); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| return ""; | |||||
| } | |||||
| /** When this method is called, the writer must write the global document asset. | /** When this method is called, the writer must write the global document asset. | ||||
| * \return The writer should return true, if writing succeeded, false otherwise.*/ | * \return The writer should return true, if writing succeeded, false otherwise.*/ | ||||
| bool DocumentImporter::writeGlobalAsset(const COLLADAFW::FileInfo *asset) | bool DocumentImporter::writeGlobalAsset(const COLLADAFW::FileInfo *asset) | ||||
| { | { | ||||
| unit_converter.read_asset(asset); | unit_converter.read_asset(asset); | ||||
| import_from_version = get_import_version(asset); | |||||
| anim_importer.set_import_from_version(import_from_version); | |||||
| return true; | return true; | ||||
| } | } | ||||
| /** When this method is called, the writer must write the scene. | /** When this method is called, the writer must write the scene. | ||||
| * \return The writer should return true, if writing succeeded, false otherwise.*/ | * \return The writer should return true, if writing succeeded, false otherwise.*/ | ||||
| bool DocumentImporter::writeScene(const COLLADAFW::Scene *scene) | bool DocumentImporter::writeScene(const COLLADAFW::Scene *scene) | ||||
| { | { | ||||
| // XXX could store the scene id, but do nothing for now | // XXX could store the scene id, but do nothing for now | ||||
| ▲ Show 20 Lines • Show All 995 Lines • Show Last 20 Lines | |||||