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
path: root/source
diff options
context:
space:
mode:
authorSukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com>2011-07-21 22:31:01 +0400
committerSukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com>2011-07-21 22:31:01 +0400
commitcf34f7509f4ea8c3f0c92045933f089c72de5313 (patch)
treeb841f9ebb165e1551b7b89042f28a29dde76569f /source
parent74111ac11c0da9f1c5279e80dd5e90c896ff2bac (diff)
Diffstat (limited to 'source')
-rw-r--r--source/blender/collada/AnimationImporter.cpp39
1 files changed, 34 insertions, 5 deletions
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index 129f3192ce2..e6c35b3ffb7 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -50,6 +50,7 @@
#include "collada_utils.h"
#include "AnimationImporter.h"
#include "ArmatureImporter.h"
+#include "MaterialExporter.h"
#include <algorithm>
@@ -905,8 +906,35 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node ,
}
}
+ if ( animType->material != 0){
+ Material *ma = give_current_material(ob, 1);
+ if (!ma->adt || !ma->adt->action) act = verify_adt_action((ID*)&ma->id, 1);
+ else act = ma->adt->action;
+
+ ListBase *AnimCurves = &(act->curves);
+
+ 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; j < matBinds.getCount(); j++) {
+ const COLLADAFW::Material *mat = (COLLADAFW::Material *) FW_object_map[matBinds[j].getReferencedMaterial()];
+ const COLLADAFW::Effect *ef = (COLLADAFW::Effect *) FW_object_map[mat->getInstantiatedEffect()];
+ COLLADAFW::CommonEffectPointerArray commonEffects = ef->getCommonEffects();
+ for (unsigned int k = 0; k < commonEffects.getCount(); k++) {
+ COLLADAFW::EffectCommon *efc = commonEffects[k];
+ if((animType->material & MATERIAL_SHININESS) != 0){
+ const COLLADAFW::FloatOrParam *shin = &(efc->getShininess());
+ const COLLADAFW::UniqueId& listid = shin->getAnimationList();
+ Assign_float_animations( listid, AnimCurves , "specular_hardness" );
+ }
+ }
+ }
+ }
+ }
+
}
+
//Check if object is animated by checking if animlist_map holds the animlist_id of node transforms
AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLADAFW::Node * node ,
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map)
@@ -970,12 +998,13 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
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()];
+ for (unsigned int j = 0; j < matBinds.getCount(); j++) {
+ const COLLADAFW::Material *mat = (COLLADAFW::Material *) FW_object_map[matBinds[j].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);
+ COLLADAFW::CommonEffectPointerArray commonEffects = ef->getCommonEffects();
+ for (unsigned int k = 0; k < commonEffects.getCount(); k++) {
+ COLLADAFW::EffectCommon *efc = commonEffects[k];
+ types->material = setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS);
}
}