From 2fb7dbd60c4d031e9a79ef7e8f731e7615443b32 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Mon, 18 Jul 2011 19:32:51 +0000 Subject: Material Specular Hardness Animation import (ongoing) --- source/blender/collada/AnimationImporter.cpp | 14 ++++++++++++++ source/blender/collada/AnimationImporter.h | 3 +++ source/blender/collada/DocumentImporter.cpp | 4 ++-- 3 files changed, 19 insertions(+), 2 deletions(-) (limited to 'source/blender/collada') diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 3faad447e9a..129f3192ce2 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -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; } diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index c11ded7fb3a..b27fba18954 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -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" diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index a5946b4aa88..2ff791eb91d 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -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 is supported COLLADAFW::EffectCommon *ef = common_efs[0]; write_profile_COMMON(ef, ma); - + this->FW_object_map[effect->getUniqueId()] = effect; return true; } -- cgit v1.2.3