fix Collada: wrong usage of pointer and hidden redeclaration

* Suspicious usage of pointer:

  short *type = 0; // this creates a null pointer

When this is later used for anything then blender would crash.
After following the code and check what happens i strongly believe
the author wanted to use a short and not a pointer to a short here.

* local variable where reused later in same function
While this did no harm, i still felt it was better to use a different
name here to make things more separated:

- moved variable declaraiotns into loop (for int a=0; ...)
- renamed uv_images to uv_image_set
- renamed index variable from i to j in inner loop that
  reused same index name from outer loop
This commit is contained in:
2018-03-11 20:32:47 +01:00
parent 49a7cd1ba4
commit 2c9c22df26
4 changed files with 14 additions and 14 deletions

View File

@@ -474,9 +474,9 @@ void DocumentImporter::create_constraints(ExtraTags *et, Object *ob)
{
if (et && et->isProfile("blender")) {
std::string name;
short* type = 0;
et->setData("type", type);
BKE_constraint_add_for_object(ob, "Test_con", *type);
short type = 0;
et->setData("type", &type);
BKE_constraint_add_for_object(ob, "Test_con", type);
}
}
@@ -587,8 +587,8 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA
++lamp_done;
}
while (controller_done < controller.getCount()) {
COLLADAFW::InstanceGeometry *geom = (COLLADAFW::InstanceGeometry *)controller[controller_done];
ob = mesh_importer.create_mesh_object(node, geom, true, uid_material_map, material_texture_mapping_map);
COLLADAFW::InstanceGeometry *geometry = (COLLADAFW::InstanceGeometry *)controller[controller_done];
ob = mesh_importer.create_mesh_object(node, geometry, true, uid_material_map, material_texture_mapping_map);
if (ob == NULL) {
report_unknown_reference(*node, "instance_controller");
}