Blender  V3.3
io_obj.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #ifdef WITH_IO_WAVEFRONT_OBJ
8 
9 # include "DNA_space_types.h"
10 
11 # include "BKE_context.h"
12 # include "BKE_main.h"
13 # include "BKE_report.h"
14 
15 # include "BLI_path_util.h"
16 # include "BLI_string.h"
17 # include "BLI_utildefines.h"
18 
19 # include "BLT_translation.h"
20 
21 # include "ED_outliner.h"
22 
23 # include "MEM_guardedalloc.h"
24 
25 # include "RNA_access.h"
26 # include "RNA_define.h"
27 
28 # include "UI_interface.h"
29 # include "UI_resources.h"
30 
31 # include "WM_api.h"
32 # include "WM_types.h"
33 
34 # include "DEG_depsgraph.h"
35 
36 # include "IO_orientation.h"
37 # include "IO_path_util_types.h"
38 # include "IO_wavefront_obj.h"
39 # include "io_obj.h"
40 
41 static const EnumPropertyItem io_obj_export_evaluation_mode[] = {
42  {DAG_EVAL_RENDER, "DAG_EVAL_RENDER", 0, "Render", "Export objects as they appear in render"},
44  "DAG_EVAL_VIEWPORT",
45  0,
46  "Viewport",
47  "Export objects as they appear in the viewport"},
48  {0, NULL, 0, NULL, NULL}};
49 
50 static const EnumPropertyItem io_obj_path_mode[] = {
51  {PATH_REFERENCE_AUTO, "AUTO", 0, "Auto", "Use Relative paths with subdirectories only"},
52  {PATH_REFERENCE_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Always write absolute paths"},
53  {PATH_REFERENCE_RELATIVE, "RELATIVE", 0, "Relative", "Write relative paths where possible"},
54  {PATH_REFERENCE_MATCH, "MATCH", 0, "Match", "Match Absolute/Relative setting with input path"},
55  {PATH_REFERENCE_STRIP, "STRIP", 0, "Strip", "Write filename only"},
56  {PATH_REFERENCE_COPY, "COPY", 0, "Copy", "Copy the file to the destination path"},
57  {0, NULL, 0, NULL, NULL}};
58 
59 static int wm_obj_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
60 {
61  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
62  Main *bmain = CTX_data_main(C);
63  char filepath[FILE_MAX];
64 
65  if (BKE_main_blendfile_path(bmain)[0] == '\0') {
66  BLI_strncpy(filepath, "untitled", sizeof(filepath));
67  }
68  else {
69  BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
70  }
71 
72  BLI_path_extension_replace(filepath, sizeof(filepath), ".obj");
73  RNA_string_set(op->ptr, "filepath", filepath);
74  }
75 
78 }
79 
80 static int wm_obj_export_exec(bContext *C, wmOperator *op)
81 {
82  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
83  BKE_report(op->reports, RPT_ERROR, "No filename given");
84  return OPERATOR_CANCELLED;
85  }
86  struct OBJExportParams export_params;
87  export_params.file_base_for_tests[0] = '\0';
88  RNA_string_get(op->ptr, "filepath", export_params.filepath);
89  export_params.blen_filepath = CTX_data_main(C)->filepath;
90  export_params.export_animation = RNA_boolean_get(op->ptr, "export_animation");
91  export_params.start_frame = RNA_int_get(op->ptr, "start_frame");
92  export_params.end_frame = RNA_int_get(op->ptr, "end_frame");
93 
94  export_params.forward_axis = RNA_enum_get(op->ptr, "forward_axis");
95  export_params.up_axis = RNA_enum_get(op->ptr, "up_axis");
96  export_params.scaling_factor = RNA_float_get(op->ptr, "scaling_factor");
97  export_params.apply_modifiers = RNA_boolean_get(op->ptr, "apply_modifiers");
98  export_params.export_eval_mode = RNA_enum_get(op->ptr, "export_eval_mode");
99 
100  export_params.export_selected_objects = RNA_boolean_get(op->ptr, "export_selected_objects");
101  export_params.export_uv = RNA_boolean_get(op->ptr, "export_uv");
102  export_params.export_normals = RNA_boolean_get(op->ptr, "export_normals");
103  export_params.export_colors = RNA_boolean_get(op->ptr, "export_colors");
104  export_params.export_materials = RNA_boolean_get(op->ptr, "export_materials");
105  export_params.path_mode = RNA_enum_get(op->ptr, "path_mode");
106  export_params.export_triangulated_mesh = RNA_boolean_get(op->ptr, "export_triangulated_mesh");
107  export_params.export_curves_as_nurbs = RNA_boolean_get(op->ptr, "export_curves_as_nurbs");
108 
109  export_params.export_object_groups = RNA_boolean_get(op->ptr, "export_object_groups");
110  export_params.export_material_groups = RNA_boolean_get(op->ptr, "export_material_groups");
111  export_params.export_vertex_groups = RNA_boolean_get(op->ptr, "export_vertex_groups");
112  export_params.export_smooth_groups = RNA_boolean_get(op->ptr, "export_smooth_groups");
113  export_params.smooth_groups_bitflags = RNA_boolean_get(op->ptr, "smooth_group_bitflags");
114 
115  OBJ_export(C, &export_params);
116 
117  return OPERATOR_FINISHED;
118 }
119 
120 static void ui_obj_export_settings(uiLayout *layout, PointerRNA *imfptr)
121 {
122  const bool export_animation = RNA_boolean_get(imfptr, "export_animation");
123  const bool export_smooth_groups = RNA_boolean_get(imfptr, "export_smooth_groups");
124  const bool export_materials = RNA_boolean_get(imfptr, "export_materials");
125 
126  uiLayoutSetPropSep(layout, true);
127  uiLayoutSetPropDecorate(layout, false);
128 
129  uiLayout *box, *col, *sub, *row;
130 
131  /* Object Transform options. */
132  box = uiLayoutBox(layout);
133  uiItemL(box, IFACE_("Object Properties"), ICON_OBJECT_DATA);
134  col = uiLayoutColumn(box, false);
135  sub = uiLayoutColumnWithHeading(col, false, IFACE_("Limit to"));
136  uiItemR(sub, imfptr, "export_selected_objects", 0, IFACE_("Selected Only"), ICON_NONE);
137  uiItemR(sub, imfptr, "scaling_factor", 0, NULL, ICON_NONE);
138 
139  row = uiLayoutRow(box, false);
140  uiItemR(row, imfptr, "forward_axis", UI_ITEM_R_EXPAND, IFACE_("Foward Axis"), ICON_NONE);
141  row = uiLayoutRow(box, false);
142  uiItemR(row, imfptr, "up_axis", UI_ITEM_R_EXPAND, IFACE_("Up Axis"), ICON_NONE);
143 
144  col = uiLayoutColumn(box, false);
145  sub = uiLayoutColumn(col, false);
146  sub = uiLayoutColumnWithHeading(col, false, IFACE_("Objects"));
147  uiItemR(sub, imfptr, "apply_modifiers", 0, IFACE_("Apply Modifiers"), ICON_NONE);
148  uiItemR(sub, imfptr, "export_eval_mode", 0, IFACE_("Properties"), ICON_NONE);
149  sub = uiLayoutColumn(sub, false);
151  uiItemR(sub, imfptr, "path_mode", 0, IFACE_("Path Mode"), ICON_NONE);
152 
153  /* Options for what to write. */
154  box = uiLayoutBox(layout);
155  uiItemL(box, IFACE_("Geometry"), ICON_EXPORT);
156  col = uiLayoutColumn(box, false);
157  sub = uiLayoutColumnWithHeading(col, false, IFACE_("Export"));
158  uiItemR(sub, imfptr, "export_uv", 0, IFACE_("UV Coordinates"), ICON_NONE);
159  uiItemR(sub, imfptr, "export_normals", 0, IFACE_("Normals"), ICON_NONE);
160  uiItemR(sub, imfptr, "export_colors", 0, IFACE_("Colors"), ICON_NONE);
161  uiItemR(sub, imfptr, "export_materials", 0, IFACE_("Materials"), ICON_NONE);
162  uiItemR(sub, imfptr, "export_triangulated_mesh", 0, IFACE_("Triangulated Mesh"), ICON_NONE);
163  uiItemR(sub, imfptr, "export_curves_as_nurbs", 0, IFACE_("Curves as NURBS"), ICON_NONE);
164 
165  /* Grouping options. */
166  box = uiLayoutBox(layout);
167  uiItemL(box, IFACE_("Grouping"), ICON_GROUP);
168  col = uiLayoutColumn(box, false);
169  sub = uiLayoutColumnWithHeading(col, false, IFACE_("Export"));
170  uiItemR(sub, imfptr, "export_object_groups", 0, IFACE_("Object Groups"), ICON_NONE);
171  uiItemR(sub, imfptr, "export_material_groups", 0, IFACE_("Material Groups"), ICON_NONE);
172  uiItemR(sub, imfptr, "export_vertex_groups", 0, IFACE_("Vertex Groups"), ICON_NONE);
173  uiItemR(sub, imfptr, "export_smooth_groups", 0, IFACE_("Smooth Groups"), ICON_NONE);
174  sub = uiLayoutColumn(sub, false);
176  uiItemR(sub, imfptr, "smooth_group_bitflags", 0, IFACE_("Smooth Group Bitflags"), ICON_NONE);
177 
178  /* Animation options. */
179  box = uiLayoutBox(layout);
180  uiItemL(box, IFACE_("Animation"), ICON_ANIM);
181  col = uiLayoutColumn(box, false);
182  sub = uiLayoutColumn(col, false);
183  uiItemR(sub, imfptr, "export_animation", 0, NULL, ICON_NONE);
184  sub = uiLayoutColumn(sub, true);
185  uiItemR(sub, imfptr, "start_frame", 0, IFACE_("Frame Start"), ICON_NONE);
186  uiItemR(sub, imfptr, "end_frame", 0, IFACE_("End"), ICON_NONE);
188 }
189 
190 static void wm_obj_export_draw(bContext *UNUSED(C), wmOperator *op)
191 {
192  PointerRNA ptr;
194  ui_obj_export_settings(op->layout, &ptr);
195 }
196 
200 static bool wm_obj_export_check(bContext *C, wmOperator *op)
201 {
202  char filepath[FILE_MAX];
204  bool changed = false;
205  RNA_string_get(op->ptr, "filepath", filepath);
206 
207  if (!BLI_path_extension_check(filepath, ".obj")) {
209  RNA_string_set(op->ptr, "filepath", filepath);
210  changed = true;
211  }
212 
213  {
214  int start = RNA_int_get(op->ptr, "start_frame");
215  int end = RNA_int_get(op->ptr, "end_frame");
216  /* Set the defaults. */
217  if (start == INT_MIN) {
218  start = scene->r.sfra;
219  changed = true;
220  }
221  if (end == INT_MAX) {
222  end = scene->r.efra;
223  changed = true;
224  }
225  /* Fix user errors. */
226  if (end < start) {
227  end = start;
228  changed = true;
229  }
230  RNA_int_set(op->ptr, "start_frame", start);
231  RNA_int_set(op->ptr, "end_frame", end);
232  }
233  return changed;
234 }
235 
236 /* Both forward and up axes cannot be along the same direction. */
237 static void forward_axis_update(struct Main *UNUSED(main),
238  struct Scene *UNUSED(scene),
239  struct PointerRNA *ptr)
240 {
241  int forward = RNA_enum_get(ptr, "forward_axis");
242  int up = RNA_enum_get(ptr, "up_axis");
243  if ((forward % 3) == (up % 3)) {
244  RNA_enum_set(ptr, "up_axis", (up + 1) % 6);
245  }
246 }
247 
248 static void up_axis_update(struct Main *UNUSED(main),
249  struct Scene *UNUSED(scene),
250  struct PointerRNA *ptr)
251 {
252  int forward = RNA_enum_get(ptr, "forward_axis");
253  int up = RNA_enum_get(ptr, "up_axis");
254  if ((forward % 3) == (up % 3)) {
255  RNA_enum_set(ptr, "forward_axis", (forward + 1) % 6);
256  }
257 }
258 
259 void WM_OT_obj_export(struct wmOperatorType *ot)
260 {
261  PropertyRNA *prop;
262 
263  ot->name = "Export Wavefront OBJ";
264  ot->description = "Save the scene to a Wavefront OBJ file";
265  ot->idname = "WM_OT_obj_export";
266 
267  ot->invoke = wm_obj_export_invoke;
268  ot->exec = wm_obj_export_exec;
270  ot->ui = wm_obj_export_draw;
271  ot->check = wm_obj_export_check;
272 
273  ot->flag = OPTYPE_PRESET;
274 
277  FILE_BLENDER,
278  FILE_SAVE,
282 
283  /* Animation options. */
285  "export_animation",
286  false,
287  "Export Animation",
288  "Export multiple frames instead of the current frame only");
290  "start_frame",
291  INT_MIN, /* wm_obj_export_check uses this to set scene->r.sfra. */
292  INT_MIN,
293  INT_MAX,
294  "Start Frame",
295  "The first frame to be exported",
296  INT_MIN,
297  INT_MAX);
299  "end_frame",
300  INT_MAX, /* wm_obj_export_check uses this to set scene->r.efra. */
301  INT_MIN,
302  INT_MAX,
303  "End Frame",
304  "The last frame to be exported",
305  INT_MIN,
306  INT_MAX);
307  /* Object transform options. */
308  prop = RNA_def_enum(
309  ot->srna, "forward_axis", io_transform_axis, IO_AXIS_NEGATIVE_Z, "Forward Axis", "");
310  RNA_def_property_update_runtime(prop, (void *)forward_axis_update);
311  prop = RNA_def_enum(ot->srna, "up_axis", io_transform_axis, IO_AXIS_Y, "Up Axis", "");
312  RNA_def_property_update_runtime(prop, (void *)up_axis_update);
314  "scaling_factor",
315  1.0f,
316  0.001f,
317  10000.0f,
318  "Scale",
319  "Upscale the object by this factor",
320  0.01,
321  1000.0f);
322  /* File Writer options. */
324  ot->srna, "apply_modifiers", true, "Apply Modifiers", "Apply modifiers to exported meshes");
326  "export_eval_mode",
327  io_obj_export_evaluation_mode,
329  "Object Properties",
330  "Determines properties like object visibility, modifiers etc., where they differ "
331  "for Render and Viewport");
333  "export_selected_objects",
334  false,
335  "Export Selected Objects",
336  "Export only selected objects instead of all supported objects");
337  RNA_def_boolean(ot->srna, "export_uv", true, "Export UVs", "");
339  "export_normals",
340  true,
341  "Export Normals",
342  "Export per-face normals if the face is flat-shaded, per-face-per-loop "
343  "normals if smooth-shaded");
344  RNA_def_boolean(ot->srna, "export_colors", false, "Export Colors", "Export per-vertex colors");
346  "export_materials",
347  true,
348  "Export Materials",
349  "Export MTL library. There must be a Principled-BSDF node for image textures to "
350  "be exported to the MTL file");
352  "path_mode",
353  io_obj_path_mode,
355  "Path Mode",
356  "Method used to reference paths");
358  "export_triangulated_mesh",
359  false,
360  "Export Triangulated Mesh",
361  "All ngons with four or more vertices will be triangulated. Meshes in "
362  "the scene will not be affected. Behaves like Triangulate Modifier with "
363  "ngon-method: \"Beauty\", quad-method: \"Shortest Diagonal\", min vertices: 4");
365  "export_curves_as_nurbs",
366  false,
367  "Export Curves as NURBS",
368  "Export curves in parametric form instead of exporting as mesh");
369 
371  "export_object_groups",
372  false,
373  "Export Object Groups",
374  "Append mesh name to object name, separated by a '_'");
376  "export_material_groups",
377  false,
378  "Export Material Groups",
379  "Generate an OBJ group for each part of a geometry using a different material");
381  ot->srna,
382  "export_vertex_groups",
383  false,
384  "Export Vertex Groups",
385  "Export the name of the vertex group of a face. It is approximated "
386  "by choosing the vertex group with the most members among the vertices of a face");
388  ot->srna,
389  "export_smooth_groups",
390  false,
391  "Export Smooth Groups",
392  "Every smooth-shaded face is assigned group \"1\" and every flat-shaded face \"off\"");
394  ot->srna, "smooth_group_bitflags", false, "Generate Bitflags for Smooth Groups", "");
395 
396  /* Only show .obj or .mtl files by default. */
397  prop = RNA_def_string(ot->srna, "filter_glob", "*.obj;*.mtl", 0, "Extension Filter", "");
399 }
400 
401 static int wm_obj_import_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
402 {
404  return OPERATOR_RUNNING_MODAL;
405 }
406 
407 static int wm_obj_import_exec(bContext *C, wmOperator *op)
408 {
409  struct OBJImportParams import_params;
410  RNA_string_get(op->ptr, "filepath", import_params.filepath);
411  import_params.clamp_size = RNA_float_get(op->ptr, "clamp_size");
412  import_params.forward_axis = RNA_enum_get(op->ptr, "forward_axis");
413  import_params.up_axis = RNA_enum_get(op->ptr, "up_axis");
414  import_params.import_vertex_groups = RNA_boolean_get(op->ptr, "import_vertex_groups");
415  import_params.validate_meshes = RNA_boolean_get(op->ptr, "validate_meshes");
416  import_params.relative_paths = ((U.flag & USER_RELPATHS) != 0);
417  import_params.clear_selection = true;
418 
419  int files_len = RNA_collection_length(op->ptr, "files");
420  if (files_len) {
421  /* Importing multiple files: loop over them and import one by one. */
422  PointerRNA fileptr;
423  PropertyRNA *prop;
424  char dir_only[FILE_MAX], file_only[FILE_MAX];
425 
426  RNA_string_get(op->ptr, "directory", dir_only);
427  prop = RNA_struct_find_property(op->ptr, "files");
428  for (int i = 0; i < files_len; i++) {
429  RNA_property_collection_lookup_int(op->ptr, prop, i, &fileptr);
430  RNA_string_get(&fileptr, "name", file_only);
432  import_params.filepath, sizeof(import_params.filepath), dir_only, file_only);
433  import_params.clear_selection = (i == 0);
434  OBJ_import(C, &import_params);
435  }
436  }
437  else if (RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
438  /* Importing one file. */
439  RNA_string_get(op->ptr, "filepath", import_params.filepath);
440  OBJ_import(C, &import_params);
441  }
442  else {
443  BKE_report(op->reports, RPT_ERROR, "No filename given");
444  return OPERATOR_CANCELLED;
445  }
446 
452 
453  return OPERATOR_FINISHED;
454 }
455 
456 static void ui_obj_import_settings(uiLayout *layout, PointerRNA *imfptr)
457 {
458  uiLayoutSetPropSep(layout, true);
459  uiLayoutSetPropDecorate(layout, false);
460 
461  uiLayout *box = uiLayoutBox(layout);
462  uiItemL(box, IFACE_("Transform"), ICON_OBJECT_DATA);
463  uiLayout *col = uiLayoutColumn(box, false);
464  uiLayout *sub = uiLayoutColumn(col, false);
465  uiItemR(sub, imfptr, "clamp_size", 0, NULL, ICON_NONE);
466  sub = uiLayoutColumn(col, false);
467 
468  uiLayout *row = uiLayoutRow(box, false);
469  uiItemR(row, imfptr, "forward_axis", UI_ITEM_R_EXPAND, IFACE_("Forward Axis"), ICON_NONE);
470  row = uiLayoutRow(box, false);
471  uiItemR(row, imfptr, "up_axis", UI_ITEM_R_EXPAND, IFACE_("Up Axis"), ICON_NONE);
472 
473  box = uiLayoutBox(layout);
474  uiItemL(box, IFACE_("Options"), ICON_EXPORT);
475  col = uiLayoutColumn(box, false);
476  uiItemR(col, imfptr, "import_vertex_groups", 0, NULL, ICON_NONE);
477  uiItemR(col, imfptr, "validate_meshes", 0, NULL, ICON_NONE);
478 }
479 
480 static void wm_obj_import_draw(bContext *C, wmOperator *op)
481 {
482  PointerRNA ptr;
484  RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
485  ui_obj_import_settings(op->layout, &ptr);
486 }
487 
488 void WM_OT_obj_import(struct wmOperatorType *ot)
489 {
490  PropertyRNA *prop;
491 
492  ot->name = "Import Wavefront OBJ";
493  ot->description = "Load a Wavefront OBJ scene";
494  ot->idname = "WM_OT_obj_import";
496 
497  ot->invoke = wm_obj_import_invoke;
498  ot->exec = wm_obj_import_exec;
500  ot->ui = wm_obj_import_draw;
501 
504  FILE_BLENDER,
511  ot->srna,
512  "clamp_size",
513  0.0f,
514  0.0f,
515  1000.0f,
516  "Clamp Bounding Box",
517  "Resize the objects to keep bounding box under this value. Value 0 disables clamping",
518  0.0f,
519  1000.0f);
520  prop = RNA_def_enum(
521  ot->srna, "forward_axis", io_transform_axis, IO_AXIS_NEGATIVE_Z, "Forward Axis", "");
522  RNA_def_property_update_runtime(prop, (void *)forward_axis_update);
523  prop = RNA_def_enum(ot->srna, "up_axis", io_transform_axis, IO_AXIS_Y, "Up Axis", "");
524  RNA_def_property_update_runtime(prop, (void *)up_axis_update);
526  "import_vertex_groups",
527  false,
528  "Vertex Groups",
529  "Import OBJ groups as vertex groups");
531  "validate_meshes",
532  false,
533  "Validate Meshes",
534  "Check imported mesh objects for invalid data (slow)");
535 
536  /* Only show .obj or .mtl files by default. */
537  prop = RNA_def_string(ot->srna, "filter_glob", "*.obj;*.mtl", 0, "Extension Filter", "");
539 }
540 
541 #endif /* WITH_IO_WAVEFRONT_OBJ */
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:713
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
const char * BKE_main_blendfile_path(const struct Main *bmain) ATTR_NONNULL()
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition: report.c:83
#define FILE_MAX
bool BLI_path_extension_ensure(char *path, size_t maxlen, const char *ext) ATTR_NONNULL()
Definition: path_util.c:1420
bool BLI_path_extension_replace(char *path, size_t maxlen, const char *ext) ATTR_NONNULL()
Definition: path_util.c:1393
bool BLI_path_extension_check(const char *str, const char *ext) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
Definition: path_util.c:1299
void BLI_join_dirfile(char *__restrict dst, size_t maxlen, const char *__restrict dir, const char *__restrict file) ATTR_NONNULL()
Definition: path_util.c:1531
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
#define UNUSED(x)
#define IFACE_(msgid)
@ DAG_EVAL_RENDER
Definition: DEG_depsgraph.h:46
@ DAG_EVAL_VIEWPORT
Definition: DEG_depsgraph.h:45
@ FILE_SORT_DEFAULT
@ FILE_BLENDER
@ FILE_TYPE_FOLDER
@ FILE_DEFAULTDISPLAY
@ USER_RELPATHS
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
void ED_outliner_select_sync_from_object_tag(struct bContext *C)
@ IO_AXIS_Y
Definition: IO_orientation.h:9
@ IO_AXIS_NEGATIVE_Z
@ PATH_REFERENCE_AUTO
@ PATH_REFERENCE_RELATIVE
@ PATH_REFERENCE_COPY
@ PATH_REFERENCE_MATCH
@ PATH_REFERENCE_ABSOLUTE
@ PATH_REFERENCE_STRIP
void OBJ_import(bContext *C, const OBJImportParams *import_params)
void OBJ_export(bContext *C, const OBJExportParams *export_params)
Read Guarded memory(de)allocation.
@ PROP_HIDDEN
Definition: RNA_types.h:216
#define C
Definition: RandGen.cpp:25
uiLayout * uiLayoutColumnWithHeading(uiLayout *layout, bool align, const char *heading)
void uiLayoutSetEnabled(uiLayout *layout, bool enabled)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiItemL(uiLayout *layout, const char *name, int icon)
uiLayout * uiLayoutBox(uiLayout *layout)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
@ UI_ITEM_R_EXPAND
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
@ WM_FILESEL_FILES
Definition: WM_api.h:756
@ WM_FILESEL_DIRECTORY
Definition: WM_api.h:753
@ WM_FILESEL_SHOW_PROPS
Definition: WM_api.h:758
@ WM_FILESEL_FILEPATH
Definition: WM_api.h:755
@ FILE_OPENFILE
Definition: WM_api.h:764
@ FILE_SAVE
Definition: WM_api.h:765
@ OPTYPE_PRESET
Definition: WM_types.h:161
@ OPTYPE_UNDO
Definition: WM_types.h:148
@ OPTYPE_REGISTER
Definition: WM_types.h:146
#define ND_OB_ACTIVE
Definition: WM_types.h:388
#define ND_OB_SELECT
Definition: WM_types.h:390
#define NC_SCENE
Definition: WM_types.h:328
#define ND_LAYER_CONTENT
Definition: WM_types.h:402
int main(int argc, char *argv[])
unsigned int U
Definition: btGjkEpa3.h:78
Scene scene
uint col
void WM_OT_obj_import(struct wmOperatorType *ot)
void WM_OT_obj_export(struct wmOperatorType *ot)
const EnumPropertyItem io_transform_axis[]
Definition: orientation.c:7
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
Definition: rna_access.c:5155
int RNA_collection_length(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5239
bool RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, bool use_ghost)
Definition: rna_access.c:5289
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:4921
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:717
int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr)
Definition: rna_access.c:4097
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
Definition: rna_access.c:5116
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4910
float RNA_float_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4957
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4863
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:5015
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3836
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3493
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3687
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
void RNA_def_property_update_runtime(PropertyRNA *prop, const void *func)
Definition: rna_define.c:2911
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3597
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3783
Definition: BKE_main.h:121
char filepath[1024]
Definition: BKE_main.h:124
char file_base_for_tests[FILE_MAX]
char filepath[FILE_MAX]
struct RenderData r
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:919
const char * name
Definition: WM_types.h:888
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
struct StructRNA * srna
Definition: WM_types.h:969
const char * description
Definition: WM_types.h:893
void(* ui)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:954
bool(* check)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:911
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
struct ReportList * reports
IDProperty * properties
struct uiLayout * layout
struct wmOperatorType * type
struct PointerRNA * ptr
void WM_event_add_fileselect(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480
wmOperatorType * ot
Definition: wm_files.c:3479
void WM_operator_properties_filesel(wmOperatorType *ot, const int filter, const short type, const eFileSel_Action action, const eFileSel_Flag flag, const short display, const short sort)
bool WM_operator_winactive(bContext *C)