Recreate PreviewEngine when render_delegate_name is changed #36

Merged
Bogdan Nagirniak merged 6 commits from BLEN-404 into hydra-render 2023-05-05 14:49:30 +02:00
3 changed files with 5 additions and 3 deletions
Showing only changes of commit 1fa080660b - Show all commits

View File

@ -25,7 +25,7 @@ Engine::Engine(RenderEngine *bl_engine, const std::string &render_delegate_name)
pxr::TF_PY_ALLOW_THREADS_IN_SCOPE();
render_delegate_ = registry.CreateRenderDelegate(pxr::TfToken(render_delegate_name_));
/* Current USD (23.02) has limited support for Vulkan. To make it works USD should be built
/* USD has limited support for Vulkan. To make it works USD should be built
* with PXR_ENABLE_VULKAN_SUPPORT=TRUE which is not possible now */
if (GPU_backend_get_type() == GPU_BACKEND_VULKAN) {
BLI_setenv("HGI_ENABLE_VULKAN", "1");

View File

@ -15,7 +15,7 @@ CLG_LOGREF_DECLARE_GLOBAL(LOG_RENDER_HYDRA_SCENE, "render.hydra.scene");
BlenderSceneDelegate::BlenderSceneDelegate(pxr::HdRenderIndex *parent_index,
pxr::SdfPath const &delegate_id,
BlenderSceneDelegate::EngineType engine_type,
std::string render_delegate_name)
const std::string &render_delegate_name)
: HdSceneDelegate(parent_index, delegate_id),
engine_type(engine_type),
render_delegate_name(render_delegate_name)
@ -258,6 +258,8 @@ InstancerData *BlenderSceneDelegate::instancer_data(pxr::SdfPath const &id, bool
{
pxr::SdfPath p_id;
if (child_id) {
/* Getting instancer path id from child Mesh instance (consist with 3 path elements) and
* Light instance (consist with 4 path elements) */
int n = id.GetPathElementCount();
if (n == 3) {
p_id = id.GetParentPath();

View File

@ -30,7 +30,7 @@ class BlenderSceneDelegate : public pxr::HdSceneDelegate {
BlenderSceneDelegate(pxr::HdRenderIndex *parent_index,
pxr::SdfPath const &delegate_id,
BlenderSceneDelegate::EngineType engine_type,
std::string render_delegate_name);
const std::string &render_delegate_name);
~BlenderSceneDelegate() override = default;
/* Delegate methods */