Add bl_use_materialx property #3

Merged
Bogdan Nagirniak merged 2 commits from add-bl_use_materialx into matx-export-material 2023-08-24 15:51:44 +02:00
3 changed files with 8 additions and 0 deletions

View File

@ -1007,6 +1007,11 @@ static void rna_def_render_engine(BlenderRNA *brna)
RNA_def_property_ui_text( RNA_def_property_ui_text(
prop, "Use Alembic Procedural", "Support loading Alembic data at render time"); prop, "Use Alembic Procedural", "Support loading Alembic data at render time");
prop = RNA_def_property(srna, "bl_use_materialx", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "type->flag", RE_USE_MATERIALX);
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
RNA_def_property_ui_text(prop, "Use Material", "Use MaterialX for exporting materials to Hydra");
RNA_define_verify_sdna(true); RNA_define_verify_sdna(true);
} }

View File

@ -29,6 +29,8 @@ MaterialX::NodePtr MaterialXTexImageNode::convert()
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);
std::string image_path; std::string image_path;
/* TODO: What if Blender built without Hydra? Also io::hydra::cache_or_get_image_file contain
* pretty general code, so could be moved from bf_usd project. */
#ifdef WITH_HYDRA #ifdef WITH_HYDRA
image_path = io::hydra::cache_or_get_image_file(bmain, scene, image, &tex->iuser); image_path = io::hydra::cache_or_get_image_file(bmain, scene, image, &tex->iuser);
#endif #endif

View File

@ -55,6 +55,7 @@ enum RenderEngineTypeFlag {
RE_USE_CUSTOM_FREESTYLE = (1 << 8), RE_USE_CUSTOM_FREESTYLE = (1 << 8),
RE_USE_NO_IMAGE_SAVE = (1 << 9), RE_USE_NO_IMAGE_SAVE = (1 << 9),
RE_USE_ALEMBIC_PROCEDURAL = (1 << 10), RE_USE_ALEMBIC_PROCEDURAL = (1 << 10),
RE_USE_MATERIALX = (1 << 11),
}; };
/** #RenderEngine.flag */ /** #RenderEngine.flag */