Blender  V2.93
ExportSettings.h
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 
21 #pragma once
22 
23 #include "BLI_linklist.h"
24 #include "BlenderContext.h"
25 
26 #ifdef __cplusplus
27 # include "BCMath.h"
28 # include <vector>
29 
30 extern "C" {
31 #endif
32 
33 typedef enum BC_export_mesh_type {
37 
42 
47 
48 typedef enum BC_ui_export_section {
55 
56 typedef struct ExportSettings {
61 
63 
64  bool selected;
75 
79 
86 
87  bool open_sim;
90 
91  char *filepath;
94 
95 #ifdef __cplusplus
96 }
97 
98 void bc_get_children(std::vector<Object *> &child_set, Object *ob, ViewLayer *view_layer);
99 
100 class BCExportSettings {
101 
102  private:
103  const ExportSettings &export_settings;
104  BlenderContext &blender_context;
105  const BCMatrix global_transform;
106 
107  public:
108  BCExportSettings(ExportSettings *exportSettings, BlenderContext &blenderContext)
109  : export_settings(*exportSettings),
110  blender_context(blenderContext),
111  global_transform(BCMatrix(exportSettings->global_forward, exportSettings->global_up))
112 
113  {
114  }
115 
116  const BCMatrix &get_global_transform()
117  {
118  return global_transform;
119  }
120 
121  bool get_apply_modifiers()
122  {
123  return export_settings.apply_modifiers;
124  }
125 
126  BC_global_forward_axis get_global_forward()
127  {
128  return export_settings.global_forward;
129  }
130 
131  BC_global_up_axis get_global_up()
132  {
133  return export_settings.global_up;
134  }
135 
136  bool get_apply_global_orientation()
137  {
138  return export_settings.apply_global_orientation;
139  }
140 
141  BC_export_mesh_type get_export_mesh_type()
142  {
143  return export_settings.export_mesh_type;
144  }
145 
146  bool get_selected()
147  {
148  return export_settings.selected;
149  }
150 
151  bool get_include_children()
152  {
153  return export_settings.include_children;
154  }
155 
156  bool get_include_armatures()
157  {
158  return export_settings.include_armatures;
159  }
160 
161  bool get_include_shapekeys()
162  {
163  return export_settings.include_shapekeys;
164  }
165 
166  bool get_deform_bones_only()
167  {
168  return export_settings.deform_bones_only;
169  }
170 
171  bool get_include_animations()
172  {
173  return export_settings.include_animations;
174  }
175 
176  bool get_include_all_actions()
177  {
178  return export_settings.include_all_actions;
179  }
180 
181  int get_sampling_rate()
182  {
183  return export_settings.sampling_rate;
184  }
185 
186  bool get_keep_smooth_curves()
187  {
188  return export_settings.keep_smooth_curves;
189  }
190 
191  bool get_keep_keyframes()
192  {
193  return export_settings.keep_keyframes;
194  }
195 
196  bool get_keep_flat_curves()
197  {
198  return export_settings.keep_flat_curves;
199  }
200 
201  bool get_active_uv_only()
202  {
203  return export_settings.active_uv_only;
204  }
205 
206  BC_export_animation_type get_export_animation_type()
207  {
208  return export_settings.export_animation_type;
209  }
210 
211  bool get_use_texture_copies()
212  {
213  return export_settings.use_texture_copies;
214  }
215 
216  bool get_triangulate()
217  {
218  return export_settings.triangulate;
219  }
220 
221  bool get_use_object_instantiation()
222  {
223  return export_settings.use_object_instantiation;
224  }
225 
226  bool get_use_blender_profile()
227  {
228  return export_settings.use_blender_profile;
229  }
230 
231  bool get_sort_by_name()
232  {
233  return export_settings.sort_by_name;
234  }
235 
236  BC_export_transformation_type get_object_transformation_type()
237  {
238  return export_settings.object_transformation_type;
239  }
240 
241  BC_export_transformation_type get_animation_transformation_type()
242  {
243  return export_settings.animation_transformation_type;
244  }
245 
246  bool get_open_sim()
247  {
248  return export_settings.open_sim;
249  }
250 
251  bool get_limit_precision()
252  {
253  return export_settings.limit_precision;
254  }
255 
256  bool get_keep_bind_info()
257  {
258  return export_settings.keep_bind_info;
259  }
260 
261  char *get_filepath()
262  {
263  return export_settings.filepath;
264  }
265 
266  LinkNode *get_export_set()
267  {
268  return export_settings.export_set;
269  }
270 
271  BlenderContext &get_blender_context()
272  {
273  return blender_context;
274  }
275 
276  Scene *get_scene()
277  {
278  return blender_context.get_scene();
279  }
280 
281  ViewLayer *get_view_layer()
282  {
283  return blender_context.get_view_layer();
284  }
285 
286  bool is_export_root(Object *ob)
287  {
288  return bc_is_base_node(get_export_set(), ob, get_view_layer());
289  }
290 };
291 
292 #endif
void bc_get_children(std::vector< Object * > &child_set, Object *ob, ViewLayer *view_layer)
bool bc_is_base_node(LinkNode *export_set, Object *ob, ViewLayer *view_layer)
BC_global_up_axis
Definition: BlenderTypes.h:38
BC_global_forward_axis
Definition: BlenderTypes.h:29
BC_export_animation_type
@ BC_ANIMATION_EXPORT_KEYS
@ BC_ANIMATION_EXPORT_SAMPLES
BC_export_mesh_type
@ BC_MESH_TYPE_RENDER
@ BC_MESH_TYPE_VIEW
BC_ui_export_section
@ BC_UI_SECTION_ANIMATION
@ BC_UI_SECTION_MAIN
@ BC_UI_SECTION_ARMATURE
@ BC_UI_SECTION_GEOMETRY
@ BC_UI_SECTION_COLLADA
struct ExportSettings ExportSettings
BC_export_transformation_type
@ BC_TRANSFORMATION_TYPE_MATRIX
@ BC_TRANSFORMATION_TYPE_DECOMPOSED
bool use_object_instantiation
BC_export_animation_type export_animation_type
bool apply_global_orientation
BC_global_forward_axis global_forward
BC_export_transformation_type animation_transformation_type
BC_export_transformation_type object_transformation_type
bool include_all_actions
LinkNode * export_set
bool use_blender_profile
BC_export_mesh_type export_mesh_type
BC_global_up_axis global_up