Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaia Clary <gaia.clary@machinimatrix.org>2013-02-25 20:02:40 +0400
committerGaia Clary <gaia.clary@machinimatrix.org>2013-02-25 20:02:40 +0400
commit8291a4fe08919be115f0d9a6ab68e2823c492495 (patch)
tree500d3430bae0bd1f6c9f138ab83afca4bfc30ecb /source/blender/collada
parentbe8bda5abc59324e8e4c15edbbf3c4f72926dfbd (diff)
fix: #34427: Collada export crash with armature
Diffstat (limited to 'source/blender/collada')
-rw-r--r--source/blender/collada/ControllerExporter.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp
index 41693d4d680..a31a1e728f6 100644
--- a/source/blender/collada/ControllerExporter.cpp
+++ b/source/blender/collada/ControllerExporter.cpp
@@ -239,6 +239,7 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
joint_index_by_def_index.push_back(-1);
}
+ int oob_counter = 0;
for (i = 0; i < me->totvert; i++) {
MDeformVert *vert = &me->dvert[i];
std::map<int, float> jw;
@@ -248,11 +249,18 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
for (j = 0; j < vert->totweight; j++) {
int idx = vert->dw[j].def_nr;
- if (idx >= 0) {
- int joint_index = joint_index_by_def_index[idx];
- if (joint_index != -1 && vert->dw[j].weight > 0.0f) {
- jw[joint_index] += vert->dw[j].weight;
- sumw += vert->dw[j].weight;
+ if (idx >= joint_index_by_def_index.size()) {
+ // XXX: Maybe better find out where and
+ // why the Out Of Bound indexes get created ?
+ oob_counter += 1;
+ }
+ else {
+ if (idx >= 0) {
+ int joint_index = joint_index_by_def_index[idx];
+ if (joint_index != -1 && vert->dw[j].weight > 0.0f) {
+ jw[joint_index] += vert->dw[j].weight;
+ sumw += vert->dw[j].weight;
+ }
}
}
}
@@ -274,6 +282,10 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
#endif
}
}
+
+ if (oob_counter > 0) {
+ fprintf(stderr, "Ignored %d Vertex weigths which use index to non existing VGroup.\n", oob_counter, joint_index_by_def_index.size());
+ }
}
std::string weights_source_id = add_weights_source(me, controller_id, weights);