Revision: 39569
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39569
Author:   phabtar
Date:     2011-08-20 16:48:53 +0000 (Sat, 20 Aug 2011)
Log Message:
-----------
small fixes and refactoring.

Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp
    branches/soc-2011-pepper/source/blender/collada/ArmatureExporter.cpp
    branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.cpp

Modified: branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp       
2011-08-20 14:23:43 UTC (rev 39568)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp       
2011-08-20 16:48:53 UTC (rev 39569)
@@ -454,15 +454,15 @@
                for (iter = curves->begin(); iter != curves->end(); iter++) {
                        FCurve *fcu = *iter;
         
-               for (unsigned int k = 0; k < fcu->totvert; k++) {
-                       //get frame value from bezTriple
-                       float fra = fcu->bezt[k].vec[1][0];
-                       //if frame already not added add frame to frames
-                       if (std::find(frames->begin(), frames->end(), fra) == 
frames->end())
-                               frames->push_back(fra);
-                                                       
+                       for (unsigned int k = 0; k < fcu->totvert; k++) {
+                               //get frame value from bezTriple
+                               float fra = fcu->bezt[k].vec[1][0];
+                               //if frame already not added add frame to frames
+                               if (std::find(frames->begin(), frames->end(), 
fra) == frames->end())
+                                       frames->push_back(fra);
+                                                               
+                       }
                }
-               }
 }
 
 //creates the rna_paths and array indices of fcurves from animations using 
transformation and bound animation class of each animation.
@@ -1568,10 +1568,13 @@
                                                i++;
                                                j = 0;
                                        }
+                                       
unused_curves.erase(std::remove(unused_curves.begin(), unused_curves.end(), 
*it), unused_curves.end());
                                }
 
                                COLLADAFW::Matrix tm(matrix);
                                dae_matrix_to_mat4(&tm, mat);
+                
+                               std::vector<FCurve*>::iterator it;
 
                                return true;
                        }

Modified: branches/soc-2011-pepper/source/blender/collada/ArmatureExporter.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/ArmatureExporter.cpp        
2011-08-20 14:23:43 UTC (rev 39568)
+++ branches/soc-2011-pepper/source/blender/collada/ArmatureExporter.cpp        
2011-08-20 16:48:53 UTC (rev 39569)
@@ -39,6 +39,7 @@
 
 #include "BKE_action.h"
 #include "BKE_armature.h"
+#include "ED_armature.h"
 
 #include "BLI_listbase.h"
 
@@ -177,9 +178,9 @@
        node.setNodeName(node_name);
        node.setNodeSid(node_sid);
 
-       if ( bone->childbase.first == NULL || 
BLI_countlist(&(bone->childbase))>=2)
+       /*if ( bone->childbase.first == NULL || 
BLI_countlist(&(bone->childbase))>=2)
                add_blender_leaf_bone( bone, ob_arm , node );
-       else{
+       else{*/
        node.start();
 
        add_bone_transform(ob_arm, bone, node);
@@ -189,15 +190,15 @@
        }
 
        node.end();
-       }
+       //}
 }
 
 void ArmatureExporter::add_blender_leaf_bone(Bone *bone, Object *ob_arm, 
COLLADASW::Node& node)
 {
        node.start();
-    
+       
        add_bone_transform(ob_arm, bone, node);
-    
+       
        node.addExtraTechniqueParameter("blender", "tip_x", bone->tail[0] );
        node.addExtraTechniqueParameter("blender", "tip_y", bone->tail[1] );
        node.addExtraTechniqueParameter("blender", "tip_z", bone->tail[2] );

Modified: branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.cpp        
2011-08-20 14:23:43 UTC (rev 39568)
+++ branches/soc-2011-pepper/source/blender/collada/ArmatureImporter.cpp        
2011-08-20 16:48:53 UTC (rev 39569)
@@ -183,10 +183,10 @@
                else
                        copy_m4_m4(mat, obmat);
 
-               float loc[3], size[3], rot[3][3] , angle;
+               /*float loc[3], size[3], rot[3][3] , angle;
                mat4_to_loc_rot_size( loc, rot, size, obmat);
                mat3_to_vec_roll(rot, NULL, &angle );
-               bone->roll=angle;
+               bone->roll=angle;*/
        }
 
        
@@ -267,21 +267,25 @@
        copy_m4_m4(leaf.mat, mat);
        BLI_strncpy(leaf.name, bone->name, sizeof(leaf.name));
        
+       float vec[3];
+
        TagsMap::iterator etit;
        ExtraTags *et = 0;
        etit = uid_tags_map.find(node->getUniqueId().toAscii());
        if(etit !=  uid_tags_map.end())
-       et = etit->second;
-       else return;
+       {
+               et = etit->second;
+               //else return;
 
-       float x,y,z;
-       et->setData("tip_x",&x);
-       et->setData("tip_y",&y);
-       et->setData("tip_z",&z);
-       float vec[3] = {x,y,z};
-       copy_v3_v3(leaf.bone->tail, leaf.bone->head);
-       add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec);
-       leaf_bones.push_back(leaf);
+               float x,y,z;
+               et->setData("tip_x",&x);
+               et->setData("tip_y",&y);
+               et->setData("tip_z",&z);
+               float vec[3] = {x,y,z};
+               copy_v3_v3(leaf.bone->tail, leaf.bone->head);
+           add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec);
+       }else
+               leaf_bones.push_back(leaf);
 }
 
 void ArmatureImporter::fix_leaf_bones( )
@@ -295,7 +299,7 @@
                // pointing up
                float vec[3] = {0.0f, 0.0f, 1.0f};
                
-               mul_v3_fl(vec, leaf_bone_length);
+               //mul_v3_fl(vec, leaf_bone_length);
 
                copy_v3_v3(leaf.bone->tail, leaf.bone->head);
                add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec);
@@ -418,7 +422,7 @@
         leaf_bone_length = FLT_MAX;
                create_unskinned_bone(*ri, NULL, 
(*ri)->getChildNodes().getCount(), NULL, ob_arm);
 
-               //fix_leaf_bones();
+               fix_leaf_bones();
 
        // exit armature edit mode
        

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to