[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38579] branches/soc-2011-pepper/source/ blender/collada/AnimationImporter.cpp:
Sukhitha Jayathilake
pr.jayathilake at gmail.com
Thu Jul 21 20:31:01 CEST 2011
Revision: 38579
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38579
Author: phabtar
Date: 2011-07-21 18:31:01 +0000 (Thu, 21 Jul 2011)
Log Message:
-----------
Modified Paths:
--------------
branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp
Modified: branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp 2011-07-21 18:01:16 UTC (rev 38578)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp 2011-07-21 18:31:01 UTC (rev 38579)
@@ -50,6 +50,7 @@
#include "collada_utils.h"
#include "AnimationImporter.h"
#include "ArmatureImporter.h"
+#include "MaterialExporter.h"
#include <algorithm>
@@ -905,8 +906,35 @@
}
}
+ 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 @@
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);
}
}
More information about the Bf-blender-cvs
mailing list