Material Specular Hardness Animation import (ongoing)
authorSukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com>
Mon, 18 Jul 2011 19:32:51 +0000 (19:32 +0000)
committerSukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com>
Mon, 18 Jul 2011 19:32:51 +0000 (19:32 +0000)
source/blender/collada/AnimationImporter.cpp
source/blender/collada/AnimationImporter.h
source/blender/collada/DocumentImporter.cpp

index 3faad447e9afdb7c7047324dd43ba32a0f404134..129f3192ce2b2208c55c2549f81224429e01cb09 100644 (file)
@@ -965,6 +965,20 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
                //if ( type != 0) break;
                if ( types->camera != 0) break;
 
+       }
+
+       const COLLADAFW::InstanceGeometryPointerArray& nodeGeoms = node->getInstanceGeometries();
+       for (unsigned int i = 0; i < nodeGeoms.getCount(); i++) {
+               const COLLADAFW::MaterialBindingArray& matBinds = nodeGeoms[i]->getMaterialBindings();
+               for (unsigned int j = 0; i < matBinds.getCount(); i++) {
+                       const COLLADAFW::Material *mat = (COLLADAFW::Material *) FW_object_map[matBinds[i].getReferencedMaterial()];
+                       const COLLADAFW::Effect *ef = (COLLADAFW::Effect *) FW_object_map[mat->getInstantiatedEffect()];
+                       const COLLADAFW::CommonEffectPointerArray& commonEffects  =  ef->getCommonEffects();
+                       for (unsigned int k = 0; i < commonEffects.getCount(); i++) {
+                               types->material =  setAnimType(&(commonEffects[i]->getShininess()),(types->material), MATERIAL_SHININESS);
+                       }
+               }
+               
        }
        return types;
 }
index c11ded7fb3aacfb7a3b6b7ec80ba87dafe30c6ca..b27fba189547003c14079670ede20ff4fbb3c10a 100644 (file)
@@ -39,6 +39,9 @@
 #include "COLLADAFWUniqueId.h"
 #include "COLLADAFWLight.h"
 #include "COLLADAFWCamera.h"
+#include "COLLADAFWMaterial.h"
+#include "COLLADAFWEffect.h"
+#include "COLLADAFWInstanceGeometry.h"
 
 #include "DNA_anim_types.h"
 #include "DNA_object_types.h"
index a5946b4aa889b153a45a7288f5d0216c3326f638..2ff791eb91d506afce1e733d02d2f7506f80d2ec 100644 (file)
@@ -537,7 +537,7 @@ bool DocumentImporter::writeMaterial( const COLLADAFW::Material* cmat )
        
        this->uid_effect_map[cmat->getInstantiatedEffect()] = ma;
        this->uid_material_map[cmat->getUniqueId()] = ma;
-       
+       this->FW_object_map[cmat->getUniqueId()] = cmat;
        return true;
 }
 
@@ -738,7 +738,7 @@ bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect )
        // Currently only first <profile_common> is supported
        COLLADAFW::EffectCommon *ef = common_efs[0];
        write_profile_COMMON(ef, ma);
-       
+       this->FW_object_map[effect->getUniqueId()] = effect;
        return true;
 }