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:
authorDaniel Stokes <kupomail@gmail.com>2012-04-29 04:33:24 +0400
committerDaniel Stokes <kupomail@gmail.com>2012-04-29 04:33:24 +0400
commitafb8fffb1827a4fffc8e6b3d620a02f59b62e3a9 (patch)
tree328e3c204210d68392805f371ef4d296175b6b6e /source/blender/collada/ArmatureExporter.cpp
parentf306b50700b05707f44b5472ac0b38d58fb01b0d (diff)
parent72ec4c813a2c544341d0c4ae83369cea60e52c9e (diff)
Merged revisions 45967-46052 from trunk/blendersoc-2011-cucumber
Diffstat (limited to 'source/blender/collada/ArmatureExporter.cpp')
-rw-r--r--source/blender/collada/ArmatureExporter.cpp38
1 files changed, 13 insertions, 25 deletions
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index 743d3c2a158..0d45df37796 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -127,7 +127,7 @@ void ArmatureExporter::find_objects_using_armature(Object *ob_arm, std::vector<O
objects.clear();
Base *base= (Base*) sce->base.first;
- while(base) {
+ while (base) {
Object *ob = base->object;
if (ob->type == OB_MESH && get_assigned_armature(ob) == ob_arm) {
@@ -191,10 +191,8 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce,
// Write nodes of childobjects, remove written objects from list
std::list<Object*>::iterator i = child_objects.begin();
- while( i != child_objects.end() )
- {
- if ((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name)))
- {
+ while (i != child_objects.end()) {
+ if ((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name))) {
float backup_parinv[4][4];
copy_m4_m4(backup_parinv, (*i)->parentinv);
@@ -210,8 +208,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce,
// TODO: when such objects are animated as
// single matrix the tweak must be applied
// to the result.
- if (export_settings->second_life)
- {
+ if (export_settings->second_life) {
// tweak objects parentinverse to match compatibility
float temp[4][4];
@@ -274,8 +271,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW:
}
// SECOND_LIFE_COMPATIBILITY
- if (export_settings->second_life)
- {
+ if (export_settings->second_life) {
// Remove rotations vs armature from transform
// parent_rest_rot * mat * irest_rot
float temp[4][4];
@@ -285,8 +281,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW:
mult_m4_m4m4(mat, mat, temp);
- if (bone->parent)
- {
+ if (bone->parent) {
copy_m4_m4(temp, bone->parent->arm_mat);
temp[3][0] = temp[3][1] = temp[3][2] = 0.0f;
@@ -370,25 +365,21 @@ void ArmatureExporter::export_controller(Object* ob, Object *ob_arm)
for (j = 0; j < vert->totweight; j++) {
int joint_index = joint_index_by_def_index[vert->dw[j].def_nr];
- if (joint_index != -1 && vert->dw[j].weight > 0.0f)
- {
+ if (joint_index != -1 && vert->dw[j].weight > 0.0f) {
jw[joint_index] += vert->dw[j].weight;
sumw += vert->dw[j].weight;
}
}
- if (sumw > 0.0f)
- {
+ if (sumw > 0.0f) {
float invsumw = 1.0f/sumw;
vcounts.push_back(jw.size());
- for (std::map<int, float>::iterator m = jw.begin(); m != jw.end(); ++m)
- {
+ for (std::map<int, float>::iterator m = jw.begin(); m != jw.end(); ++m) {
joints.push_back((*m).first);
weights.push_back(invsumw*(*m).second);
}
}
- else
- {
+ else {
vcounts.push_back(0);
/*vcounts.push_back(1);
joints.push_back(-1);
@@ -502,16 +493,14 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase
float inv_bind_mat[4][4];
// SECOND_LIFE_COMPATIBILITY
- if (export_settings->second_life)
- {
+ if (export_settings->second_life) {
// Only translations, no rotation vs armature
float temp[4][4];
unit_m4(temp);
copy_v3_v3(temp[3], pchan->bone->arm_mat[3]);
mult_m4_m4m4(world, ob_arm->obmat, temp);
}
- else
- {
+ else {
// make world-space matrix, arm_mat is armature-space
mult_m4_m4m4(world, ob_arm->obmat, pchan->bone->arm_mat);
}
@@ -597,8 +586,7 @@ void ArmatureExporter::add_vertex_weights_element(const std::string& weights_sou
// write deformer index - weight index pairs
int weight_index = 0;
- for (std::list<int>::const_iterator i = joints.begin(); i != joints.end(); ++i)
- {
+ for (std::list<int>::const_iterator i = joints.begin(); i != joints.end(); ++i) {
weightselem.appendValues(*i, weight_index++);
}