Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonis Ryakiotakis <kalast@gmail.com>2022-02-07 21:37:15 +0300
committerAntonis Ryakiotakis <kalast@gmail.com>2022-02-07 21:37:15 +0300
commitd8c05502272990173381bfd2590884bbc95aa5f5 (patch)
tree8bd65efacbe6484b838d4550597d0f4a54ddddd9 /source/blender/editors/io/io_usd.c
parentb64d551f3b2fa409b4eeefb641fc581eb6cd0bd6 (diff)
parentfe1816f67fbc6aaf383ec77847d668367335d093 (diff)
Merge branch 'master' into KTX_supportKTX_support
Diffstat (limited to 'source/blender/editors/io/io_usd.c')
-rw-r--r--source/blender/editors/io/io_usd.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/source/blender/editors/io/io_usd.c b/source/blender/editors/io/io_usd.c
index 4e2ccea36ab..49d60ede277 100644
--- a/source/blender/editors/io/io_usd.c
+++ b/source/blender/editors/io/io_usd.c
@@ -131,6 +131,11 @@ static int wm_usd_export_exec(bContext *C, wmOperator *op)
const bool use_instancing = RNA_boolean_get(op->ptr, "use_instancing");
const bool evaluation_mode = RNA_enum_get(op->ptr, "evaluation_mode");
+ const bool generate_preview_surface = RNA_boolean_get(op->ptr, "generate_preview_surface");
+ const bool export_textures = RNA_boolean_get(op->ptr, "export_textures");
+ const bool overwrite_textures = RNA_boolean_get(op->ptr, "overwrite_textures");
+ const bool relative_texture_paths = RNA_boolean_get(op->ptr, "relative_texture_paths");
+
struct USDExportParams params = {
export_animation,
export_hair,
@@ -141,6 +146,10 @@ static int wm_usd_export_exec(bContext *C, wmOperator *op)
visible_objects_only,
use_instancing,
evaluation_mode,
+ generate_preview_surface,
+ export_textures,
+ overwrite_textures,
+ relative_texture_paths,
};
bool ok = USD_export(C, filename, &params, as_background_job);
@@ -173,6 +182,26 @@ static void wm_usd_export_draw(bContext *UNUSED(C), wmOperator *op)
uiItemR(col, ptr, "evaluation_mode", 0, NULL, ICON_NONE);
box = uiLayoutBox(layout);
+ col = uiLayoutColumnWithHeading(box, true, IFACE_("Materials"));
+ uiItemR(col, ptr, "generate_preview_surface", 0, NULL, ICON_NONE);
+ const bool export_mtl = RNA_boolean_get(ptr, "export_materials");
+ uiLayoutSetActive(col, export_mtl);
+
+ uiLayout *row = uiLayoutRow(col, true);
+ uiItemR(row, ptr, "export_textures", 0, NULL, ICON_NONE);
+ const bool preview = RNA_boolean_get(ptr, "generate_preview_surface");
+ uiLayoutSetActive(row, export_mtl && preview);
+
+ row = uiLayoutRow(col, true);
+ uiItemR(row, ptr, "overwrite_textures", 0, NULL, ICON_NONE);
+ const bool export_tex = RNA_boolean_get(ptr, "export_textures");
+ uiLayoutSetActive(row, export_mtl && preview && export_tex);
+
+ row = uiLayoutRow(col, true);
+ uiItemR(row, ptr, "relative_texture_paths", 0, NULL, ICON_NONE);
+ uiLayoutSetActive(row, export_mtl && preview);
+
+ box = uiLayoutBox(layout);
uiItemL(box, IFACE_("Experimental"), ICON_NONE);
uiItemR(box, ptr, "use_instancing", 0, NULL, ICON_NONE);
}
@@ -249,6 +278,32 @@ void WM_OT_usd_export(struct wmOperatorType *ot)
"Use Settings for",
"Determines visibility of objects, modifier settings, and other areas where there "
"are different settings for viewport and rendering");
+
+ RNA_def_boolean(ot->srna,
+ "generate_preview_surface",
+ true,
+ "To USD Preview Surface",
+ "Generate an approximate USD Preview Surface shader "
+ "representation of a Principled BSDF node network");
+
+ RNA_def_boolean(ot->srna,
+ "export_textures",
+ true,
+ "Export Textures",
+ "If exporting materials, export textures referenced by material nodes "
+ "to a 'textures' directory in the same directory as the USD file");
+
+ RNA_def_boolean(ot->srna,
+ "overwrite_textures",
+ false,
+ "Overwrite Textures",
+ "Allow overwriting existing texture files when exporting textures");
+
+ RNA_def_boolean(ot->srna,
+ "relative_texture_paths",
+ true,
+ "Relative Texture Paths",
+ "Make texture asset paths relative to the USD file");
}
/* ====== USD Import ====== */