~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/blender/collada/ArmatureExporter.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

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