[Bf-blender-cvs] [75af1395e1e] temp-usd-preview-surf-export: USD export format fixes.
Michael Kowalski
noreply at git.blender.org
Tue Dec 21 14:36:21 CET 2021
Commit: 75af1395e1ed3968875c8f916b4bfaa801a6a728
Author: Michael Kowalski
Date: Tue Dec 21 08:34:32 2021 -0500
Branches: temp-usd-preview-surf-export
https://developer.blender.org/rB75af1395e1ed3968875c8f916b4bfaa801a6a728
USD export format fixes.
===================================================================
M source/blender/editors/io/io_usd.c
M source/blender/io/usd/intern/usd_writer_abstract.cc
M source/blender/io/usd/intern/usd_writer_abstract.h
M source/blender/io/usd/intern/usd_writer_material.cc
===================================================================
diff --git a/source/blender/editors/io/io_usd.c b/source/blender/editors/io/io_usd.c
index 386b752887c..b084dc6b601 100644
--- a/source/blender/editors/io/io_usd.c
+++ b/source/blender/editors/io/io_usd.c
@@ -295,16 +295,17 @@ void WM_OT_usd_export(struct wmOperatorType *ot)
"to a 'textures' directory in the same directory as the USD");
RNA_def_boolean(ot->srna,
- "overwrite_textures",
- false,
- "Overwrite Textures",
- "Allow overwriting existing texture files when exporting textures");
+ "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",
- "When checked, material texture asset paths will be saved as relative paths in the USD");
+ RNA_def_boolean(
+ ot->srna,
+ "relative_texture_paths",
+ true,
+ "Relative Texture Paths",
+ "When checked, material texture asset paths will be saved as relative paths in the USD");
}
/* ====== USD Import ====== */
diff --git a/source/blender/io/usd/intern/usd_writer_abstract.cc b/source/blender/io/usd/intern/usd_writer_abstract.cc
index 99856c80ca4..e6021fa33fe 100644
--- a/source/blender/io/usd/intern/usd_writer_abstract.cc
+++ b/source/blender/io/usd/intern/usd_writer_abstract.cc
@@ -141,7 +141,7 @@ pxr::UsdShadeMaterial USDAbstractWriter::ensure_usd_material(Material *material,
if (material->use_nodes && this->usd_export_context_.export_params.generate_preview_surface) {
std::string active_uv_name = get_active_uvlayer_name(context.object);
create_usd_preview_surface_material(
- this->usd_export_context_, material, usd_material, active_uv_name);
+ this->usd_export_context_, material, usd_material, active_uv_name);
}
else {
create_usd_viewport_material(this->usd_export_context_, material, usd_material);
diff --git a/source/blender/io/usd/intern/usd_writer_abstract.h b/source/blender/io/usd/intern/usd_writer_abstract.h
index b87a04926f2..31a126d5a79 100644
--- a/source/blender/io/usd/intern/usd_writer_abstract.h
+++ b/source/blender/io/usd/intern/usd_writer_abstract.h
@@ -69,8 +69,7 @@ class USDAbstractWriter : public AbstractHierarchyWriter {
virtual void do_write(HierarchyContext &context) = 0;
pxr::UsdTimeCode get_export_time_code() const;
- pxr::UsdShadeMaterial ensure_usd_material(Material *material,
- const HierarchyContext &context);
+ pxr::UsdShadeMaterial ensure_usd_material(Material *material, const HierarchyContext &context);
void write_visibility(const HierarchyContext &context,
const pxr::UsdTimeCode timecode,
diff --git a/source/blender/io/usd/intern/usd_writer_material.cc b/source/blender/io/usd/intern/usd_writer_material.cc
index 18ecdac09c9..84b7192842f 100644
--- a/source/blender/io/usd/intern/usd_writer_material.cc
+++ b/source/blender/io/usd/intern/usd_writer_material.cc
@@ -176,7 +176,9 @@ static std::string get_in_memory_texture_filename(bNode *node)
return file_name;
}
-static void export_in_memory_texture(Image *ima, const std::string &export_dir, const bool allow_overwrite)
+static void export_in_memory_texture(Image *ima,
+ const std::string &export_dir,
+ const bool allow_overwrite)
{
if (!ima) {
return;
@@ -249,7 +251,9 @@ static void get_absolute_path(Image *ima, size_t path_len, char *r_path)
/* If the given image is tiled, copy the image tiles to the given
* destination directory. */
-static void copy_tiled_textures(Image *ima, const std::string &in_dest_dir, const bool allow_overwrite)
+static void copy_tiled_textures(Image *ima,
+ const std::string &in_dest_dir,
+ const bool allow_overwrite)
{
if (!ima || in_dest_dir.empty()) {
return;
@@ -346,7 +350,6 @@ static void copy_single_file(Image *ima, const std::string &dest_dir, const bool
}
}
-
/* Gets a NodeTexImage's filepath */
static std::string get_node_tex_image_filepath(bNode *node)
{
@@ -535,9 +538,11 @@ void create_usd_preview_surface_material(const USDExporterContext &usd_export_co
const std::string &default_uv)
{
/* Define a 'preview' scope beneath the material which will contain the preview shaders. */
- pxr::UsdGeomScope::Define(usd_export_context.stage, usd_material.GetPath().AppendChild(usdtokens::preview));
+ pxr::UsdGeomScope::Define(usd_export_context.stage,
+ usd_material.GetPath().AppendChild(usdtokens::preview));
- pxr::TfToken default_uv_sampler = default_uv.empty() ? cyclestokens::UVMap : pxr::TfToken(default_uv);
+ pxr::TfToken default_uv_sampler = default_uv.empty() ? cyclestokens::UVMap :
+ pxr::TfToken(default_uv);
/* We only handle the first instance of either principled or
* diffuse bsdf nodes in the material's node tree, because
@@ -701,7 +706,9 @@ void create_usd_preview_surface_material(const USDExporterContext &usd_export_co
if (created_shader && input_node && input_node->type == SH_NODE_TEX_IMAGE) {
if (usd_export_context.export_params.export_textures) {
- export_texture(input_node, usd_export_context.stage, usd_export_context.export_params.overwrite_textures);
+ export_texture(input_node,
+ usd_export_context.stage,
+ usd_export_context.export_params.overwrite_textures);
}
bool found_uv_node = false;
More information about the Bf-blender-cvs
mailing list