1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
* Nathan Letwory, Sukhitha Jayathilake
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file ControllerExporter.h
* \ingroup collada
*/
#ifndef __CONTROLLEREXPORTER_H__
#define __CONTROLLEREXPORTER_H__
#include <list>
#include <string>
//#include <vector>
#include "COLLADASWStreamWriter.h"
#include "COLLADASWLibraryControllers.h"
#include "COLLADASWInstanceController.h"
#include "COLLADASWInputList.h"
#include "COLLADASWNode.h"
#include "COLLADASWExtraTechnique.h"
#include "DNA_armature_types.h"
#include "DNA_listBase.h"
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "DNA_constraint_types.h"
#include "DNA_scene_types.h"
#include "DNA_key_types.h"
#include "TransformWriter.h"
#include "InstanceWriter.h"
#include "ExportSettings.h"
#include "BKE_key.h"
class SceneExporter;
class ControllerExporter : public COLLADASW::LibraryControllers, protected TransformWriter, protected InstanceWriter
{
public:
ControllerExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
bool is_skinned_mesh(Object *ob);
bool add_instance_controller(Object *ob);
void export_controllers(Scene *sce);
void operator()(Object *ob);
private:
Scene *scene;
UnitConverter converter;
const ExportSettings *export_settings;
#if 0
std::vector<Object *> written_armatures;
bool already_written(Object *ob_arm);
void wrote(Object *ob_arm);
void find_objects_using_armature(Object *ob_arm, std::vector<Object *>& objects, Scene *sce);
#endif
std::string get_joint_sid(Bone *bone, Object *ob_arm);
std::string get_controller_id(Object *ob_arm, Object *ob);
std::string get_controller_id(Key *key, Object *ob);
// ob should be of type OB_MESH
// both args are required
void export_skin_controller(Object *ob, Object *ob_arm);
void export_morph_controller(Object *ob, Key *key);
void add_joints_element(ListBase *defbase,
const std::string& joints_source_id, const std::string& inv_bind_mat_source_id);
void add_bind_shape_mat(Object *ob);
std::string add_morph_targets(Key *key, Object *ob);
std::string add_morph_weights(Key *key, Object *ob);
void add_weight_extras(Key *key);
std::string add_joints_source(Object *ob_arm, ListBase *defbase, const std::string& controller_id);
std::string add_inv_bind_mats_source(Object *ob_arm, ListBase *defbase, const std::string& controller_id);
Bone *get_bone_from_defgroup(Object *ob_arm, bDeformGroup *def);
bool is_bone_defgroup(Object *ob_arm, bDeformGroup *def);
std::string add_weights_source(Mesh *me, const std::string& controller_id,
const std::list<float>& weights);
void add_vertex_weights_element(const std::string& weights_source_id, const std::string& joints_source_id,
const std::list<int>& vcount, const std::list<int>& joints);
void write_bone_URLs(COLLADASW::InstanceController &ins, Object *ob_arm, Bone *bone);
};
#endif
|