Blender  V2.93
AnimationClipExporter.cpp
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #include "AnimationClipExporter.h"
18 #include "GeometryExporter.h"
19 #include "MaterialExporter.h"
20 
22 {
23  openLibrary();
24  std::map<std::string, COLLADASW::ColladaAnimationClip *> clips;
25 
26  std::vector<std::vector<std::string>>::iterator anim_meta_entry;
27  for (anim_meta_entry = anim_meta.begin(); anim_meta_entry != anim_meta.end();
28  ++anim_meta_entry) {
29  std::vector<std::string> entry = *anim_meta_entry;
30  std::string action_id = entry[0];
31  std::string action_name = entry[1];
32 
33  std::map<std::string, COLLADASW::ColladaAnimationClip *>::iterator it = clips.find(
34  action_name);
35  if (it == clips.end()) {
36  COLLADASW::ColladaAnimationClip *clip = new COLLADASW::ColladaAnimationClip(action_name);
37  clips[action_name] = clip;
38  }
39  COLLADASW::ColladaAnimationClip *clip = clips[action_name];
40  clip->setInstancedAnimation(action_id);
41  }
42 
43  std::map<std::string, COLLADASW::ColladaAnimationClip *>::iterator clips_it;
44  for (clips_it = clips.begin(); clips_it != clips.end(); clips_it++) {
45  COLLADASW::ColladaAnimationClip *clip = (COLLADASW::ColladaAnimationClip *)clips_it->second;
46  addAnimationClip(*clip);
47  }
48 
49  closeLibrary();
50 }
void exportAnimationClips(Scene *sce)