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:
authorMichael Kowalski <makowalski>2022-01-27 17:43:14 +0300
committerSybren A. Stüvel <sybren@blender.org>2022-01-27 17:51:50 +0300
commitc85c52f2ce478ab0e30c5e93fd5a5cb812db232f (patch)
treecb4f2e120cbcfa9a9ff65244d209d40868a5865e /source/blender/blenkernel/intern/customdata.cc
parentd518550c46d7811ea98fb549cc29961621d66b07 (diff)
USD Preview Surface material export.
Add `USD Preview Surface From Nodes` export option, to convert a Principled BSDF material node network to an approximate USD Preview Surface shader representation. If this option is disabled, the original material export behavior is maintained, where viewport setting are saved to the Preview Surface shader. Also added the following options for texture export. - `Export Textures`: If converting Preview Surface, export textures referenced by shader nodes to a 'textures' directory which is a sibling of the USD file. - `Overwrite Textures`: Allow overwriting existing texture files when exporting textures (this option is off by default). - `Relative Texture Paths`: Make texture asset paths relative to the USD. The entry point for the new functionality is `create_usd_preview_surface_material()`, called from `USDAbstractWriter::ensure_usd_material()`. The material conversion currently handles a small subset of Blender shading nodes, `BSDF_DIFFUSE`, `BSDF_PRINCIPLED`, `TEX_IMAGE` and `UVMAP`. Texture export is handled by copying texture files from their original location to a `textures` folder in the same directory as the USD. In-memory and packed textures are saved directly to the textures folder. This patch is based, in part, on code in Tangent Animation's USD exporter branch. Reviewed By: sybren, HooglyBoogly Differential Revision: https://developer.blender.org/D13647
Diffstat (limited to 'source/blender/blenkernel/intern/customdata.cc')
-rw-r--r--source/blender/blenkernel/intern/customdata.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc
index 5e3beab9b72..02b50027ef9 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -2427,6 +2427,13 @@ int CustomData_get_stencil_layer(const CustomData *data, int type)
return (layer_index != -1) ? data->layers[layer_index].active_mask : -1;
}
+const char *CustomData_get_active_layer_name(const struct CustomData *data, const int type)
+{
+ /* Get the layer index of the active layer of this type. */
+ const int layer_index = CustomData_get_active_layer_index(data, type);
+ return layer_index < 0 ? NULL : data->layers[layer_index].name;
+}
+
void CustomData_set_layer_active(CustomData *data, int type, int n)
{
for (int i = 0; i < data->totlayer; i++) {