diff options
Diffstat (limited to 'source/blender/io/collada/DocumentImporter.cpp')
-rw-r--r-- | source/blender/io/collada/DocumentImporter.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp index f7f9bf3f2f9..b85a96d89de 100644 --- a/source/blender/io/collada/DocumentImporter.cpp +++ b/source/blender/io/collada/DocumentImporter.cpp @@ -224,7 +224,7 @@ void DocumentImporter::finish() fprintf(stderr, "+-- Import Scene --------\n"); const COLLADAFW::NodePointerArray &roots = (*sit)->getRootNodes(); for (unsigned int i = 0; i < roots.getCount(); i++) { - std::vector<Object *> *objects_done = write_node(roots[i], NULL, sce, NULL, false); + std::vector<Object *> *objects_done = write_node(roots[i], nullptr, sce, nullptr, false); objects_to_scale->insert( objects_to_scale->end(), objects_done->begin(), objects_done->end()); delete objects_done; @@ -247,7 +247,7 @@ void DocumentImporter::finish() const COLLADAFW::NodePointerArray &roots = (*vsit)->getRootNodes(); for (unsigned int i = 0; i < roots.getCount(); i++) { - translate_anim_recursive(roots[i], NULL, NULL); + translate_anim_recursive(roots[i], nullptr, nullptr); } } @@ -270,12 +270,12 @@ void DocumentImporter::finish() /* update scene */ DEG_id_tag_update(&sce->id, ID_RECALC_COPY_ON_WRITE); DEG_relations_tag_update(bmain); - WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, NULL); + WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, nullptr); } void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, - COLLADAFW::Node *par = NULL, - Object *parob = NULL) + COLLADAFW::Node *par = nullptr, + Object *parob = nullptr) { /* The split in T29246, rootmap must point at actual root when * calculating bones in apply_curves_as_matrix. - actual root is the root node. @@ -306,7 +306,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, #endif unsigned int i; - if (node->getType() == COLLADAFW::Node::JOINT && par == NULL) { + if (node->getType() == COLLADAFW::Node::JOINT && par == nullptr) { /* For Skeletons without root node we have to simulate the * root node here and recursively enter the same function * XXX: maybe this can be made more elegant. */ @@ -317,7 +317,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, node, root_map, object_map, FW_object_map, uid_material_map); COLLADAFW::NodePointerArray &children = node->getChildNodes(); for (i = 0; i < children.getCount(); i++) { - translate_anim_recursive(children[i], node, NULL); + translate_anim_recursive(children[i], node, nullptr); } } } @@ -375,11 +375,11 @@ Object *DocumentImporter::create_camera_object(COLLADAFW::InstanceCamera *camera const COLLADAFW::UniqueId &cam_uid = camera->getInstanciatedObjectId(); if (uid_camera_map.find(cam_uid) == uid_camera_map.end()) { // fprintf(stderr, "Couldn't find camera by UID.\n"); - return NULL; + return nullptr; } Main *bmain = CTX_data_main(mContext); - Object *ob = bc_add_object(bmain, sce, view_layer, OB_CAMERA, NULL); + Object *ob = bc_add_object(bmain, sce, view_layer, OB_CAMERA, nullptr); Camera *cam = uid_camera_map[cam_uid]; Camera *old_cam = (Camera *)ob->data; ob->data = cam; @@ -392,11 +392,11 @@ Object *DocumentImporter::create_light_object(COLLADAFW::InstanceLight *lamp, Sc const COLLADAFW::UniqueId &lamp_uid = lamp->getInstanciatedObjectId(); if (uid_light_map.find(lamp_uid) == uid_light_map.end()) { fprintf(stderr, "Couldn't find light by UID.\n"); - return NULL; + return nullptr; } Main *bmain = CTX_data_main(mContext); - Object *ob = bc_add_object(bmain, sce, view_layer, OB_LAMP, NULL); + Object *ob = bc_add_object(bmain, sce, view_layer, OB_LAMP, nullptr); Light *la = uid_light_map[lamp_uid]; Light *old_light = (Light *)ob->data; ob->data = la; @@ -456,7 +456,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, continue; } COLLADAFW::InstanceNodePointerArray &inodes = child_node->getInstanceNodes(); - Object *new_child = NULL; + Object *new_child = nullptr; if (inodes.getCount()) { /* \todo loop through instance nodes */ const COLLADAFW::UniqueId &id = inodes[0]->getInstanciatedObjectId(); fprintf(stderr, "Doing %d child nodes\n", (int)node_map.count(id)); @@ -465,7 +465,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, } else { new_child = create_instance_node( - object_map.find(child_id)->second, child_node, NULL, sce, is_library_node); + object_map.find(child_id)->second, child_node, nullptr, sce, is_library_node); } bc_set_parent(new_child, obn, mContext, true); @@ -509,7 +509,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, bool is_library_node) { Main *bmain = CTX_data_main(mContext); - Object *ob = NULL; + Object *ob = nullptr; bool is_joint = node->getType() == COLLADAFW::Node::JOINT; bool read_transform = true; std::string id = node->getOriginalId(); @@ -525,7 +525,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, stderr, "| %s id='%s', name='%s'\n", is_joint ? "JOINT" : "NODE ", id.c_str(), name.c_str()); if (is_joint) { - if (parent_node == NULL && !is_library_node) { + if (parent_node == nullptr && !is_library_node) { /* A Joint on root level is a skeleton without root node. * Here we add the armature "on the fly": */ par = bc_add_object(bmain, sce, view_layer, OB_ARMATURE, std::string("Armature").c_str()); @@ -534,11 +534,11 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, object_map.insert(std::pair<COLLADAFW::UniqueId, Object *>(node->getUniqueId(), par)); node_map[node->getUniqueId()] = node; } - if (parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT) { + if (parent_node == nullptr || parent_node->getType() != COLLADAFW::Node::JOINT) { armature_importer.add_root_joint(node, par); } - if (parent_node == NULL) { + if (parent_node == nullptr) { /* for skeletons without root node all has been done above. * Skeletons with root node are handled further down. */ goto finally; @@ -561,12 +561,12 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, * sure... <instance_geometry> */ while (geom_done < geom.getCount()) { ob = mesh_importer.create_mesh_object(node, geom[geom_done], false, uid_material_map); - if (ob == NULL) { + if (ob == nullptr) { report_unknown_reference(*node, "instance_mesh"); } else { objects_done->push_back(ob); - if (parent_node == NULL) { + if (parent_node == nullptr) { root_objects->push_back(ob); } } @@ -574,12 +574,12 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, } while (camera_done < camera.getCount()) { ob = create_camera_object(camera[camera_done], sce); - if (ob == NULL) { + if (ob == nullptr) { report_unknown_reference(*node, "instance_camera"); } else { objects_done->push_back(ob); - if (parent_node == NULL) { + if (parent_node == nullptr) { root_objects->push_back(ob); } } @@ -587,12 +587,12 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, } while (lamp_done < lamp.getCount()) { ob = create_light_object(lamp[lamp_done], sce); - if (ob == NULL) { + if (ob == nullptr) { report_unknown_reference(*node, "instance_light"); } else { objects_done->push_back(ob); - if (parent_node == NULL) { + if (parent_node == nullptr) { root_objects->push_back(ob); } } @@ -602,12 +602,12 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::InstanceGeometry *geometry = (COLLADAFW::InstanceGeometry *) controller[controller_done]; ob = mesh_importer.create_mesh_object(node, geometry, true, uid_material_map); - if (ob == NULL) { + if (ob == nullptr) { report_unknown_reference(*node, "instance_controller"); } else { objects_done->push_back(ob); - if (parent_node == NULL) { + if (parent_node == nullptr) { root_objects->push_back(ob); } } @@ -620,7 +620,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, fprintf(stderr, "Cannot find object for node referenced by <instance_node name=\"%s\">.\n", inst_node[inst_done]->getName().c_str()); - ob = NULL; + ob = nullptr; } else { std::pair<std::multimap<COLLADAFW::UniqueId, Object *>::iterator, @@ -633,7 +633,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *source_node = node_map[node_id]; ob = create_instance_node(source_ob, source_node, node, sce, is_library_node); objects_done->push_back(ob); - if (parent_node == NULL) { + if (parent_node == nullptr) { root_objects->push_back(ob); } } @@ -651,10 +651,10 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, ob = bc_add_object(bmain, sce, view_layer, OB_ARMATURE, name.c_str()); } else { - ob = bc_add_object(bmain, sce, view_layer, OB_EMPTY, NULL); + ob = bc_add_object(bmain, sce, view_layer, OB_EMPTY, nullptr); } objects_done->push_back(ob); - if (parent_node == NULL) { + if (parent_node == nullptr) { root_objects->push_back(ob); } } @@ -701,7 +701,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, } if (objects_done->empty()) { - ob = NULL; + ob = nullptr; } else { ob = *objects_done->begin(); @@ -763,7 +763,7 @@ bool DocumentImporter::writeLibraryNodes(const COLLADAFW::LibraryNodes *libraryN fprintf(stderr, "+-- Read Library nodes ----------\n"); for (unsigned int i = 0; i < nodes.getCount(); i++) { std::vector<Object *> *child_objects; - child_objects = write_node(nodes[i], NULL, sce, NULL, true); + child_objects = write_node(nodes[i], nullptr, sce, nullptr, true); delete child_objects; } return true; @@ -876,7 +876,7 @@ bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera) } Main *bmain = CTX_data_main(mContext); - Camera *cam = NULL; + Camera *cam = nullptr; std::string cam_id, cam_name; ExtraTags *et = getExtraTags(camera->getUniqueId()); @@ -1029,7 +1029,7 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light) } Main *bmain = CTX_data_main(mContext); - Light *lamp = NULL; + Light *lamp = nullptr; std::string la_id, la_name; ExtraTags *et = getExtraTags(light->getUniqueId()); @@ -1237,7 +1237,7 @@ bool DocumentImporter::writeKinematicsScene(const COLLADAFW::KinematicsScene *ki ExtraTags *DocumentImporter::getExtraTags(const COLLADAFW::UniqueId &uid) { if (uid_tags_map.find(uid.toAscii()) == uid_tags_map.end()) { - return NULL; + return nullptr; } return uid_tags_map[uid.toAscii()]; } |