MaterialX: make caching image in MaterialX independent from bf_usd project #31

Merged
Bogdan Nagirniak merged 4 commits from matx-cache-texture_2 into matx-export-material 2023-09-22 18:12:52 +02:00
2 changed files with 12 additions and 10 deletions
Showing only changes of commit e2939967a1 - Show all commits

View File

@ -140,12 +140,13 @@ NODE_SHADER_MATERIALX_BEGIN
} }
NodeTexEnvironment *tex_env = static_cast<NodeTexEnvironment *>(node_->storage); NodeTexEnvironment *tex_env = static_cast<NodeTexEnvironment *>(node_->storage);
std::string image_path = image->id.name;
if (export_image_fn_) {
Scene *scene = DEG_get_input_scene(depsgraph_); Scene *scene = DEG_get_input_scene(depsgraph_);
Main *bmain = DEG_get_bmain(depsgraph_); Main *bmain = DEG_get_bmain(depsgraph_);
image_path = export_image_fn_(bmain, scene, image, &tex_env->iuser);
std::string image_path = export_image_fn_ ? }
export_image_fn_(bmain, scene, image, &tex_env->iuser) :
image->id.name;
NodeItem vector = get_input_link("Vector", NodeItem::Type::Vector2); NodeItem vector = get_input_link("Vector", NodeItem::Type::Vector2);
if (!vector) { if (!vector) {

View File

@ -189,12 +189,13 @@ NODE_SHADER_MATERIALX_BEGIN
Image *image = (Image *)node_->id; Image *image = (Image *)node_->id;
if (image) { if (image) {
NodeTexImage *tex_image = static_cast<NodeTexImage *>(node_->storage); NodeTexImage *tex_image = static_cast<NodeTexImage *>(node_->storage);
std::string image_path = image->id.name;
if (export_image_fn_) {
Scene *scene = DEG_get_input_scene(depsgraph_); Scene *scene = DEG_get_input_scene(depsgraph_);
Main *bmain = DEG_get_bmain(depsgraph_); Main *bmain = DEG_get_bmain(depsgraph_);
image_path = export_image_fn_(bmain, scene, image, &tex_image->iuser);
std::string image_path = export_image_fn_ ? }
export_image_fn_(bmain, scene, image, &tex_image->iuser) :
image->id.name;
NodeItem vector = get_input_link("Vector", NodeItem::Type::Vector2); NodeItem vector = get_input_link("Vector", NodeItem::Type::Vector2);
if (!vector) { if (!vector) {