Blender  V3.3
ArmatureExporter.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #pragma once
8 
9 #include <list>
10 #include <string>
11 // #include <vector>
12 
13 #include "COLLADASWInputList.h"
14 #include "COLLADASWLibraryControllers.h"
15 #include "COLLADASWNode.h"
16 #include "COLLADASWStreamWriter.h"
17 
18 #include "DNA_armature_types.h"
19 #include "DNA_constraint_types.h"
20 #include "DNA_listBase.h"
21 #include "DNA_mesh_types.h"
22 #include "DNA_object_types.h"
23 #include "DNA_scene_types.h"
24 
25 #include "InstanceWriter.h"
26 #include "TransformWriter.h"
27 
28 #include "ExportSettings.h"
29 
30 class SceneExporter;
31 
32 /* XXX exporter writes wrong data for shared armatures. A separate
33  * controller should be written for each armature-mesh binding how do
34  * we make controller ids then? */
35 class ArmatureExporter : public COLLADASW::LibraryControllers,
36  protected TransformWriter,
37  protected InstanceWriter {
38  public:
39  /* XXX exporter writes wrong data for shared armatures. A separate
40  * controller should be written for each armature-mesh binding how do
41  * we make controller ids then? */
42  ArmatureExporter(BlenderContext &blender_context,
43  COLLADASW::StreamWriter *sw,
44  BCExportSettings &export_settings)
45  : COLLADASW::LibraryControllers(sw),
46  blender_context(blender_context),
47  export_settings(export_settings)
48  {
49  }
50 
51  /* write bone nodes */
52  void add_armature_bones(Object *ob_arm,
53  ViewLayer *view_layer,
54  SceneExporter *se,
55  std::vector<Object *> &child_objects);
56 
58 
59  private:
60  BlenderContext &blender_context;
61  BCExportSettings &export_settings;
62 
63 #if 0
64  std::vector<Object *> written_armatures;
65 
66  bool already_written(Object *ob_arm);
67 
68  void wrote(Object *ob_arm);
69 
70  void find_objects_using_armature(Object *ob_arm, std::vector<Object *> &objects, Scene *sce);
71 #endif
72 
78  void add_bone_node(Bone *bone,
79  Object *ob_arm,
80  SceneExporter *se,
81  std::vector<Object *> &child_objects);
82 
83  inline bool can_export(Bone *bone)
84  {
85  return !(export_settings.get_deform_bones_only() && bone->flag & BONE_NO_DEFORM);
86  }
87 
88  bool is_export_root(Bone *bone);
89  void add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node &node);
90 
91  std::string get_controller_id(Object *ob_arm, Object *ob);
92 
93  void write_bone_URLs(COLLADASW::InstanceController &ins, Object *ob_arm, Bone *bone);
94 };
@ BONE_NO_DEFORM
These structs are the foundation for all linked lists in the library system.
Object is a sort of wrapper for general info.
ArmatureExporter(BlenderContext &blender_context, COLLADASW::StreamWriter *sw, BCExportSettings &export_settings)
bool add_instance_controller(Object *ob)
void add_armature_bones(Object *ob_arm, ViewLayer *view_layer, SceneExporter *se, std::vector< Object * > &child_objects)
OperationNode * node
ccl_gpu_kernel_postfix ccl_global float int int int sw