USD export: prototype invoking Python chasers #108823
|
@ -102,9 +102,7 @@ struct USDSceneExportContext {
|
|||
struct USDMaterialExportContext {
|
||||
USDMaterialExportContext() {}
|
||||
|
||||
USDMaterialExportContext(pxr::UsdStageRefPtr in_stage) : stage(in_stage)
|
||||
{
|
||||
}
|
||||
USDMaterialExportContext(pxr::UsdStageRefPtr in_stage) : stage(in_stage) {}
|
||||
|
||||
pxr::UsdStageRefPtr get_stage()
|
||||
{
|
||||
|
@ -181,10 +179,8 @@ static void handle_python_error(USDHook *hook)
|
|||
python::object formatted = python::str("\n").join(formatted_list);
|
||||
std::string err_msg = python::extract<std::string>(formatted);
|
||||
|
||||
makowalski marked this conversation as resolved
Outdated
|
||||
WM_reportf(RPT_ERROR,
|
||||
"An exception occurred invoking USD hook '%s':\n%s",
|
||||
hook->name,
|
||||
err_msg.c_str());
|
||||
WM_reportf(
|
||||
RPT_ERROR, "An exception occurred invoking USD hook '%s':\n%s", hook->name, err_msg.c_str());
|
||||
}
|
||||
|
||||
class USDHookCall {
|
||||
|
|
Loading…
Reference in New Issue
I'm unsure why there is custom code to print exceptions, I feel like this should either be trivial with the Python C API already, or there is some code to share with the rest of Blender.
Can you use
PyC_Err_PrintWithFunc
or perhaps directlyPyErr_Print()
to print the exception? For other cases we print the stacktrace to the console, I think we can do the same here.Hi Brecht. I appreciate the comment. I was using
PyErr_Print()
originally, but was concerned the user might not notice the error in the console. The work here is to display the full exception error message text as a Blender error, so it would be more obvious. But I certainly see your point that this might be excessive. Perhaps a compromise might be to usePyErr_Print()
to print the exception details and report a short, high level message in Blender. So, maybe line 183 can be:WM_reportf( RPT_ERROR, "An exception occurred invoking USD hook '%s'. Please see the console for details", hook->name);
Would this be acceptable?
Yes, that's fine and consistent with other Python error reporting I think.