Blender  V3.3
io_usd.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2019 Blender Foundation. All rights reserved. */
3 
8 #ifdef WITH_USD
9 # include "DNA_modifier_types.h"
10 # include "DNA_space_types.h"
11 # include <string.h>
12 
13 # include "BKE_context.h"
14 # include "BKE_main.h"
15 # include "BKE_report.h"
16 
17 # include "BLI_blenlib.h"
18 # include "BLI_path_util.h"
19 # include "BLI_string.h"
20 # include "BLI_utildefines.h"
21 
22 # include "BLT_translation.h"
23 
24 # include "ED_object.h"
25 
26 # include "MEM_guardedalloc.h"
27 
28 # include "RNA_access.h"
29 # include "RNA_define.h"
30 
31 # include "RNA_enum_types.h"
32 
33 # include "UI_interface.h"
34 # include "UI_resources.h"
35 
36 # include "WM_api.h"
37 # include "WM_types.h"
38 
39 # include "DEG_depsgraph.h"
40 
41 # include "io_usd.h"
42 # include "usd.h"
43 
44 # include <stdio.h>
45 
46 const EnumPropertyItem rna_enum_usd_export_evaluation_mode_items[] = {
48  "RENDER",
49  0,
50  "Render",
51  "Use Render settings for object visibility, modifier settings, etc"},
53  "VIEWPORT",
54  0,
55  "Viewport",
56  "Use Viewport settings for object visibility, modifier settings, etc"},
57  {0, NULL, 0, NULL, NULL},
58 };
59 
60 const EnumPropertyItem rna_enum_usd_mtl_name_collision_mode_items[] = {
62  "MAKE_UNIQUE",
63  0,
64  "Make Unique",
65  "Import each USD material as a unique Blender material"},
67  "REFERENCE_EXISTING",
68  0,
69  "Reference Existing",
70  "If a material with the same name already exists, reference that instead of importing"},
71  {0, NULL, 0, NULL, NULL},
72 };
73 
74 /* Stored in the wmOperator's customdata field to indicate it should run as a background job.
75  * This is set when the operator is invoked, and not set when it is only executed. */
76 enum { AS_BACKGROUND_JOB = 1 };
77 typedef struct eUSDOperatorOptions {
78  bool as_background_job;
79 } eUSDOperatorOptions;
80 
81 static int wm_usd_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
82 {
83  eUSDOperatorOptions *options = MEM_callocN(sizeof(eUSDOperatorOptions), "eUSDOperatorOptions");
84  options->as_background_job = true;
85  op->customdata = options;
86 
87  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
88  Main *bmain = CTX_data_main(C);
89  char filepath[FILE_MAX];
90  const char *main_blendfile_path = BKE_main_blendfile_path(bmain);
91 
92  if (main_blendfile_path[0] == '\0') {
93  BLI_strncpy(filepath, "untitled", sizeof(filepath));
94  }
95  else {
96  BLI_strncpy(filepath, main_blendfile_path, sizeof(filepath));
97  }
98 
99  BLI_path_extension_replace(filepath, sizeof(filepath), ".usdc");
100  RNA_string_set(op->ptr, "filepath", filepath);
101  }
102 
104 
105  return OPERATOR_RUNNING_MODAL;
106 }
107 
108 static int wm_usd_export_exec(bContext *C, wmOperator *op)
109 {
110  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
111  BKE_report(op->reports, RPT_ERROR, "No filename given");
112  return OPERATOR_CANCELLED;
113  }
114 
115  char filename[FILE_MAX];
116  RNA_string_get(op->ptr, "filepath", filename);
117 
118  eUSDOperatorOptions *options = (eUSDOperatorOptions *)op->customdata;
119  const bool as_background_job = (options != NULL && options->as_background_job);
121 
122  const bool selected_objects_only = RNA_boolean_get(op->ptr, "selected_objects_only");
123  const bool visible_objects_only = RNA_boolean_get(op->ptr, "visible_objects_only");
124  const bool export_animation = RNA_boolean_get(op->ptr, "export_animation");
125  const bool export_hair = RNA_boolean_get(op->ptr, "export_hair");
126  const bool export_uvmaps = RNA_boolean_get(op->ptr, "export_uvmaps");
127  const bool export_normals = RNA_boolean_get(op->ptr, "export_normals");
128  const bool export_materials = RNA_boolean_get(op->ptr, "export_materials");
129  const bool use_instancing = RNA_boolean_get(op->ptr, "use_instancing");
130  const bool evaluation_mode = RNA_enum_get(op->ptr, "evaluation_mode");
131 
132  const bool generate_preview_surface = RNA_boolean_get(op->ptr, "generate_preview_surface");
133  const bool export_textures = RNA_boolean_get(op->ptr, "export_textures");
134  const bool overwrite_textures = RNA_boolean_get(op->ptr, "overwrite_textures");
135  const bool relative_paths = RNA_boolean_get(op->ptr, "relative_paths");
136 
137  struct USDExportParams params = {
139  export_hair,
151  };
152 
153  bool ok = USD_export(C, filename, &params, as_background_job);
154 
155  return as_background_job || ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
156 }
157 
158 static void wm_usd_export_draw(bContext *UNUSED(C), wmOperator *op)
159 {
160  uiLayout *layout = op->layout;
161  uiLayout *col;
162  struct PointerRNA *ptr = op->ptr;
163 
164  uiLayoutSetPropSep(layout, true);
165 
166  uiLayout *box = uiLayoutBox(layout);
167 
168  col = uiLayoutColumn(box, true);
169  uiItemR(col, ptr, "selected_objects_only", 0, NULL, ICON_NONE);
170  uiItemR(col, ptr, "visible_objects_only", 0, NULL, ICON_NONE);
171 
172  col = uiLayoutColumn(box, true);
173  uiItemR(col, ptr, "export_animation", 0, NULL, ICON_NONE);
174  uiItemR(col, ptr, "export_hair", 0, NULL, ICON_NONE);
175  uiItemR(col, ptr, "export_uvmaps", 0, NULL, ICON_NONE);
176  uiItemR(col, ptr, "export_normals", 0, NULL, ICON_NONE);
177  uiItemR(col, ptr, "export_materials", 0, NULL, ICON_NONE);
178 
179  col = uiLayoutColumn(box, true);
180  uiItemR(col, ptr, "evaluation_mode", 0, NULL, ICON_NONE);
181 
182  box = uiLayoutBox(layout);
183  col = uiLayoutColumnWithHeading(box, true, IFACE_("Materials"));
184  uiItemR(col, ptr, "generate_preview_surface", 0, NULL, ICON_NONE);
185  const bool export_mtl = RNA_boolean_get(ptr, "export_materials");
186  uiLayoutSetActive(col, export_mtl);
187 
188  uiLayout *row = uiLayoutRow(col, true);
189  uiItemR(row, ptr, "export_textures", 0, NULL, ICON_NONE);
190  const bool preview = RNA_boolean_get(ptr, "generate_preview_surface");
191  uiLayoutSetActive(row, export_mtl && preview);
192 
193  row = uiLayoutRow(col, true);
194  uiItemR(row, ptr, "overwrite_textures", 0, NULL, ICON_NONE);
195  const bool export_tex = RNA_boolean_get(ptr, "export_textures");
196  uiLayoutSetActive(row, export_mtl && preview && export_tex);
197 
198  box = uiLayoutBox(layout);
199  col = uiLayoutColumnWithHeading(box, true, IFACE_("File References"));
200  uiItemR(col, ptr, "relative_paths", 0, NULL, ICON_NONE);
201 
202  box = uiLayoutBox(layout);
203  uiItemL(box, IFACE_("Experimental"), ICON_NONE);
204  uiItemR(box, ptr, "use_instancing", 0, NULL, ICON_NONE);
205 }
206 
207 static bool wm_usd_export_check(bContext *UNUSED(C), wmOperator *op)
208 {
209  char filepath[FILE_MAX];
210  RNA_string_get(op->ptr, "filepath", filepath);
211 
212  if (!BLI_path_extension_check_n(filepath, ".usd", ".usda", ".usdc", NULL)) {
213  BLI_path_extension_ensure(filepath, FILE_MAX, ".usdc");
214  RNA_string_set(op->ptr, "filepath", filepath);
215  return true;
216  }
217 
218  return false;
219 }
220 
221 void WM_OT_usd_export(struct wmOperatorType *ot)
222 {
223  ot->name = "Export USD";
224  ot->description = "Export current scene in a USD archive";
225  ot->idname = "WM_OT_usd_export";
226 
227  ot->invoke = wm_usd_export_invoke;
228  ot->exec = wm_usd_export_exec;
230  ot->ui = wm_usd_export_draw;
231  ot->check = wm_usd_export_check;
232 
233  ot->flag = OPTYPE_REGISTER | OPTYPE_PRESET; /* No UNDO possible. */
234 
237  FILE_BLENDER,
238  FILE_SAVE,
242 
243  PropertyRNA *prop = RNA_def_string(ot->srna, "filter_glob", "*.usd", 0, "", "");
245 
247  "selected_objects_only",
248  false,
249  "Selection Only",
250  "Only export selected objects. Unselected parents of selected objects are "
251  "exported as empty transform");
252 
254  "visible_objects_only",
255  true,
256  "Visible Only",
257  "Only export visible objects. Invisible parents of exported objects are "
258  "exported as empty transforms");
259 
261  ot->srna,
262  "export_animation",
263  false,
264  "Animation",
265  "Export all frames in the render frame range, rather than only the current frame");
267  ot->srna, "export_hair", false, "Hair", "Export hair particle systems as USD curves");
269  ot->srna, "export_uvmaps", true, "UV Maps", "Include all mesh UV maps in the export");
271  "export_normals",
272  true,
273  "Normals",
274  "Include normals of exported meshes in the export");
276  "export_materials",
277  true,
278  "Materials",
279  "Export viewport settings of materials as USD preview materials, and export "
280  "material assignments as geometry subsets");
281 
283  "use_instancing",
284  false,
285  "Instancing",
286  "Export instanced objects as references in USD rather than real objects");
287 
289  "evaluation_mode",
290  rna_enum_usd_export_evaluation_mode_items,
292  "Use Settings for",
293  "Determines visibility of objects, modifier settings, and other areas where there "
294  "are different settings for viewport and rendering");
295 
297  "generate_preview_surface",
298  true,
299  "To USD Preview Surface",
300  "Generate an approximate USD Preview Surface shader "
301  "representation of a Principled BSDF node network");
302 
304  "export_textures",
305  true,
306  "Export Textures",
307  "If exporting materials, export textures referenced by material nodes "
308  "to a 'textures' directory in the same directory as the USD file");
309 
311  "overwrite_textures",
312  false,
313  "Overwrite Textures",
314  "Allow overwriting existing texture files when exporting textures");
315 
317  "relative_paths",
318  true,
319  "Relative Paths",
320  "Use relative paths to reference external files (i.e. textures, volumes) in "
321  "USD, otherwise use absolute paths");
322 }
323 
324 /* ====== USD Import ====== */
325 
326 static int wm_usd_import_invoke(bContext *C, wmOperator *op, const wmEvent *event)
327 {
328  eUSDOperatorOptions *options = MEM_callocN(sizeof(eUSDOperatorOptions), "eUSDOperatorOptions");
329  options->as_background_job = true;
330  op->customdata = options;
331 
332  return WM_operator_filesel(C, op, event);
333 }
334 
335 static int wm_usd_import_exec(bContext *C, wmOperator *op)
336 {
337  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
338  BKE_report(op->reports, RPT_ERROR, "No filename given");
339  return OPERATOR_CANCELLED;
340  }
341 
342  char filename[FILE_MAX];
343  RNA_string_get(op->ptr, "filepath", filename);
344 
345  eUSDOperatorOptions *options = (eUSDOperatorOptions *)op->customdata;
346  const bool as_background_job = (options != NULL && options->as_background_job);
348 
349  const float scale = RNA_float_get(op->ptr, "scale");
350 
351  const bool set_frame_range = RNA_boolean_get(op->ptr, "set_frame_range");
352 
353  const bool read_mesh_uvs = RNA_boolean_get(op->ptr, "read_mesh_uvs");
354  const bool read_mesh_colors = RNA_boolean_get(op->ptr, "read_mesh_colors");
355 
356  char mesh_read_flag = MOD_MESHSEQ_READ_VERT | MOD_MESHSEQ_READ_POLY;
357  if (read_mesh_uvs) {
358  mesh_read_flag |= MOD_MESHSEQ_READ_UV;
359  }
360  if (read_mesh_colors) {
361  mesh_read_flag |= MOD_MESHSEQ_READ_COLOR;
362  }
363 
364  const bool import_cameras = RNA_boolean_get(op->ptr, "import_cameras");
365  const bool import_curves = RNA_boolean_get(op->ptr, "import_curves");
366  const bool import_lights = RNA_boolean_get(op->ptr, "import_lights");
367  const bool import_materials = RNA_boolean_get(op->ptr, "import_materials");
368  const bool import_meshes = RNA_boolean_get(op->ptr, "import_meshes");
369  const bool import_volumes = RNA_boolean_get(op->ptr, "import_volumes");
370 
371  const bool import_subdiv = RNA_boolean_get(op->ptr, "import_subdiv");
372 
373  const bool import_instance_proxies = RNA_boolean_get(op->ptr, "import_instance_proxies");
374 
375  const bool import_visible_only = RNA_boolean_get(op->ptr, "import_visible_only");
376 
377  const bool create_collection = RNA_boolean_get(op->ptr, "create_collection");
378 
379  char *prim_path_mask = malloc(1024);
380  RNA_string_get(op->ptr, "prim_path_mask", prim_path_mask);
381 
382  const bool import_guide = RNA_boolean_get(op->ptr, "import_guide");
383  const bool import_proxy = RNA_boolean_get(op->ptr, "import_proxy");
384  const bool import_render = RNA_boolean_get(op->ptr, "import_render");
385 
386  const bool import_usd_preview = RNA_boolean_get(op->ptr, "import_usd_preview");
387  const bool set_material_blend = RNA_boolean_get(op->ptr, "set_material_blend");
388 
389  const float light_intensity_scale = RNA_float_get(op->ptr, "light_intensity_scale");
390 
391  const eUSDMtlNameCollisionMode mtl_name_collision_mode = RNA_enum_get(op->ptr,
392  "mtl_name_collision_mode");
393 
394  /* TODO(makowalski): Add support for sequences. */
395  const bool is_sequence = false;
396  int offset = 0;
397  int sequence_len = 1;
398 
399  /* Switch out of edit mode to avoid being stuck in it (T54326). */
400  Object *obedit = CTX_data_edit_object(C);
401  if (obedit) {
403  }
404 
405  const bool validate_meshes = false;
406  const bool use_instancing = false;
407 
408  struct USDImportParams params = {.scale = scale,
409  .is_sequence = is_sequence,
410  .set_frame_range = set_frame_range,
411  .sequence_len = sequence_len,
412  .offset = offset,
413  .validate_meshes = validate_meshes,
414  .mesh_read_flag = mesh_read_flag,
415  .import_cameras = import_cameras,
416  .import_curves = import_curves,
417  .import_lights = import_lights,
418  .import_materials = import_materials,
419  .import_meshes = import_meshes,
420  .import_volumes = import_volumes,
421  .prim_path_mask = prim_path_mask,
422  .import_subdiv = import_subdiv,
423  .import_instance_proxies = import_instance_proxies,
424  .create_collection = create_collection,
425  .import_guide = import_guide,
426  .import_proxy = import_proxy,
427  .import_render = import_render,
428  .import_visible_only = import_visible_only,
429  .use_instancing = use_instancing,
430  .import_usd_preview = import_usd_preview,
431  .set_material_blend = set_material_blend,
432  .light_intensity_scale = light_intensity_scale,
433  .mtl_name_collision_mode = mtl_name_collision_mode};
434 
435  const bool ok = USD_import(C, filename, &params, as_background_job);
436 
437  return as_background_job || ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
438 }
439 
440 static void wm_usd_import_draw(bContext *UNUSED(C), wmOperator *op)
441 {
442  uiLayout *layout = op->layout;
443  struct PointerRNA *ptr = op->ptr;
444 
445  uiLayoutSetPropSep(layout, true);
446  uiLayoutSetPropDecorate(layout, false);
447 
448  uiLayout *box = uiLayoutBox(layout);
449  uiLayout *col = uiLayoutColumnWithHeading(box, true, IFACE_("Data Types"));
450  uiItemR(col, ptr, "import_cameras", 0, NULL, ICON_NONE);
451  uiItemR(col, ptr, "import_curves", 0, NULL, ICON_NONE);
452  uiItemR(col, ptr, "import_lights", 0, NULL, ICON_NONE);
453  uiItemR(col, ptr, "import_materials", 0, NULL, ICON_NONE);
454  uiItemR(col, ptr, "import_meshes", 0, NULL, ICON_NONE);
455  uiItemR(col, ptr, "import_volumes", 0, NULL, ICON_NONE);
456  uiItemR(box, ptr, "prim_path_mask", 0, NULL, ICON_NONE);
457  uiItemR(box, ptr, "scale", 0, NULL, ICON_NONE);
458 
459  box = uiLayoutBox(layout);
460  col = uiLayoutColumnWithHeading(box, true, IFACE_("Mesh Data"));
461  uiItemR(col, ptr, "read_mesh_uvs", 0, NULL, ICON_NONE);
462  uiItemR(col, ptr, "read_mesh_colors", 0, NULL, ICON_NONE);
463  col = uiLayoutColumnWithHeading(box, true, IFACE_("Include"));
464  uiItemR(col, ptr, "import_subdiv", 0, IFACE_("Subdivision"), ICON_NONE);
465  uiItemR(col, ptr, "import_instance_proxies", 0, NULL, ICON_NONE);
466  uiItemR(col, ptr, "import_visible_only", 0, NULL, ICON_NONE);
467  uiItemR(col, ptr, "import_guide", 0, NULL, ICON_NONE);
468  uiItemR(col, ptr, "import_proxy", 0, NULL, ICON_NONE);
469  uiItemR(col, ptr, "import_render", 0, NULL, ICON_NONE);
470 
471  col = uiLayoutColumnWithHeading(box, true, IFACE_("Options"));
472  uiItemR(col, ptr, "set_frame_range", 0, NULL, ICON_NONE);
473  uiItemR(col, ptr, "relative_path", 0, NULL, ICON_NONE);
474  uiItemR(col, ptr, "create_collection", 0, NULL, ICON_NONE);
475  uiItemR(box, ptr, "light_intensity_scale", 0, NULL, ICON_NONE);
476  uiItemR(box, ptr, "mtl_name_collision_mode", 0, NULL, ICON_NONE);
477 
478  box = uiLayoutBox(layout);
479  col = uiLayoutColumnWithHeading(box, true, IFACE_("Experimental"));
480  uiItemR(col, ptr, "import_usd_preview", 0, NULL, ICON_NONE);
481  uiLayoutSetEnabled(col, RNA_boolean_get(ptr, "import_materials"));
482  uiLayout *row = uiLayoutRow(col, true);
483  uiItemR(row, ptr, "set_material_blend", 0, NULL, ICON_NONE);
484  uiLayoutSetEnabled(row, RNA_boolean_get(ptr, "import_usd_preview"));
485 }
486 
487 void WM_OT_usd_import(struct wmOperatorType *ot)
488 {
489  ot->name = "Import USD";
490  ot->description = "Import USD stage into current scene";
491  ot->idname = "WM_OT_usd_import";
492 
493  ot->invoke = wm_usd_import_invoke;
494  ot->exec = wm_usd_import_exec;
496  ot->ui = wm_usd_import_draw;
497 
499 
502  FILE_BLENDER,
507 
508  PropertyRNA *prop = RNA_def_string(ot->srna, "filter_glob", "*.usd", 0, "", "");
510 
512  ot->srna,
513  "scale",
514  1.0f,
515  0.0001f,
516  1000.0f,
517  "Scale",
518  "Value by which to enlarge or shrink the objects with respect to the world's origin",
519  0.0001f,
520  1000.0f);
521 
523  "set_frame_range",
524  true,
525  "Set Frame Range",
526  "Update the scene's start and end frame to match those of the USD archive");
527 
528  RNA_def_boolean(ot->srna, "import_cameras", true, "Cameras", "");
529  RNA_def_boolean(ot->srna, "import_curves", true, "Curves", "");
530  RNA_def_boolean(ot->srna, "import_lights", true, "Lights", "");
531  RNA_def_boolean(ot->srna, "import_materials", true, "Materials", "");
532  RNA_def_boolean(ot->srna, "import_meshes", true, "Meshes", "");
533  RNA_def_boolean(ot->srna, "import_volumes", true, "Volumes", "");
534 
536  "import_subdiv",
537  false,
538  "Import Subdivision Scheme",
539  "Create subdivision surface modifiers based on the USD "
540  "SubdivisionScheme attribute");
541 
543  "import_instance_proxies",
544  true,
545  "Import Instance Proxies",
546  "Create unique Blender objects for USD instances");
547 
549  "import_visible_only",
550  true,
551  "Visible Primitives Only",
552  "Do not import invisible USD primitives. "
553  "Only applies to primitives with a non-animated visibility attribute. "
554  "Primitives with animated visibility will always be imported");
555 
557  "create_collection",
558  false,
559  "Create Collection",
560  "Add all imported objects to a new collection");
561 
562  RNA_def_boolean(ot->srna, "read_mesh_uvs", true, "UV Coordinates", "Read mesh UV coordinates");
563 
565  ot->srna, "read_mesh_colors", false, "Color Attributes", "Read mesh color attributes");
566 
568  "prim_path_mask",
569  NULL,
570  1024,
571  "Path Mask",
572  "Import only the subset of the USD scene rooted at the given primitive");
573 
574  RNA_def_boolean(ot->srna, "import_guide", false, "Guide", "Import guide geometry");
575 
576  RNA_def_boolean(ot->srna, "import_proxy", true, "Proxy", "Import proxy geometry");
577 
578  RNA_def_boolean(ot->srna, "import_render", true, "Render", "Import final render geometry");
579 
581  "import_usd_preview",
582  false,
583  "Import USD Preview",
584  "Convert UsdPreviewSurface shaders to Principled BSDF shader networks");
585 
587  "set_material_blend",
588  true,
589  "Set Material Blend",
590  "If the Import USD Preview option is enabled, "
591  "the material blend method will automatically be set based on the "
592  "shader's opacity and opacityThreshold inputs");
593 
595  "light_intensity_scale",
596  1.0f,
597  0.0001f,
598  10000.0f,
599  "Light Intensity Scale",
600  "Scale for the intensity of imported lights",
601  0.0001f,
602  1000.0f);
603 
604  RNA_def_enum(
605  ot->srna,
606  "mtl_name_collision_mode",
607  rna_enum_usd_mtl_name_collision_mode_items,
609  "Material Name Collision",
610  "Behavior when the name of an imported material conflicts with an existing material");
611 }
612 
613 #endif /* WITH_USD */
struct Object * CTX_data_edit_object(const bContext *C)
Definition: context.c:1370
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_n(const char *str,...) ATTR_NONNULL(1) ATTR_SENTINEL(0)
Definition: path_util.c:1304
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
@ MOD_MESHSEQ_READ_COLOR
@ MOD_MESHSEQ_READ_VERT
@ MOD_MESHSEQ_READ_UV
@ MOD_MESHSEQ_READ_POLY
@ OB_MODE_EDIT
@ FILE_SORT_DEFAULT
@ FILE_BLENDER
@ FILE_TYPE_FOLDER
@ FILE_TYPE_USD
@ FILE_DEFAULTDISPLAY
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
bool ED_object_mode_set(struct bContext *C, eObjectMode mode)
Definition: object_modes.c:231
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
@ PROP_HIDDEN
Definition: RNA_types.h:216
#define C
Definition: RandGen.cpp:25
void uiLayoutSetActive(uiLayout *layout, bool active)
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)
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_RELPATH
Definition: WM_api.h:752
@ 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
CCL_NAMESPACE_BEGIN struct Options options
uint col
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void WM_OT_usd_import(struct wmOperatorType *ot)
void WM_OT_usd_export(struct wmOperatorType *ot)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
static const pxr::TfToken preview("preview", pxr::TfToken::Immortal)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
Definition: rna_access.c:5155
bool RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, bool use_ghost)
Definition: rna_access.c:5289
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
Definition: rna_access.c:5116
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
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
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
bool export_animation
Definition: usd.h:26
enum eEvaluationMode evaluation_mode
Definition: usd.h:34
bool export_materials
Definition: usd.h:30
bool selected_objects_only
Definition: usd.h:31
bool visible_objects_only
Definition: usd.h:32
bool generate_preview_surface
Definition: usd.h:35
bool relative_paths
Definition: usd.h:38
bool export_textures
Definition: usd.h:36
bool export_normals
Definition: usd.h:29
bool export_hair
Definition: usd.h:27
bool overwrite_textures
Definition: usd.h:37
bool use_instancing
Definition: usd.h:33
bool export_uvmaps
Definition: usd.h:28
bool import_subdiv
Definition: usd.h:56
bool create_collection
Definition: usd.h:58
bool set_frame_range
Definition: usd.h:44
char * prim_path_mask
Definition: usd.h:55
bool set_material_blend
Definition: usd.h:65
bool validate_meshes
Definition: usd.h:47
bool is_sequence
Definition: usd.h:43
float light_intensity_scale
Definition: usd.h:66
bool import_render
Definition: usd.h:61
bool import_usd_preview
Definition: usd.h:64
bool import_visible_only
Definition: usd.h:62
char mesh_read_flag
Definition: usd.h:48
bool import_volumes
Definition: usd.h:54
bool import_lights
Definition: usd.h:51
bool import_instance_proxies
Definition: usd.h:57
bool import_materials
Definition: usd.h:52
bool import_guide
Definition: usd.h:59
bool import_meshes
Definition: usd.h:53
bool use_instancing
Definition: usd.h:63
int sequence_len
Definition: usd.h:45
bool import_cameras
Definition: usd.h:49
bool import_proxy
Definition: usd.h:60
eUSDMtlNameCollisionMode mtl_name_collision_mode
Definition: usd.h:67
bool import_curves
Definition: usd.h:50
float scale
Definition: usd.h:42
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
struct uiLayout * layout
struct PointerRNA * ptr
eUSDMtlNameCollisionMode
Definition: usd.h:20
@ USD_MTL_NAME_COLLISION_REFERENCE_EXISTING
Definition: usd.h:22
@ USD_MTL_NAME_COLLISION_MAKE_UNIQUE
Definition: usd.h:21
bool USD_export(bContext *C, const char *filepath, const USDExportParams *params, bool as_background_job)
bool USD_import(struct bContext *C, const char *filepath, const USDImportParams *params, bool as_background_job)
void WM_event_add_fileselect(bContext *C, wmOperator *op)
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)
int WM_operator_filesel(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))