Fixed rendering for MacOS #82

Merged
Bogdan Nagirniak merged 10 commits from BLEN-473 into hydra-render 2023-08-02 09:37:25 +02:00
5 changed files with 8 additions and 9 deletions
Showing only changes of commit 9c225e097a - Show all commits

View File

@ -7,6 +7,7 @@ USD Hydra Based Renderer
import bpy import bpy
class CustomHydraRenderEngine(bpy.types.HydraRenderEngine): class CustomHydraRenderEngine(bpy.types.HydraRenderEngine):
# Identifier and name in the user interface. # Identifier and name in the user interface.
bl_idname = "CUSTOM_HYDRA_RENDERER" bl_idname = "CUSTOM_HYDRA_RENDERER"
@ -53,8 +54,10 @@ class CustomHydraRenderEngine(bpy.types.HydraRenderEngine):
def register(): def register():
bpy.utils.register_class(CustomHydraRenderEngine) bpy.utils.register_class(CustomHydraRenderEngine)
def unregister(): def unregister():
bpy.utils.unregister_class(CustomHydraRenderEngine) bpy.utils.unregister_class(CustomHydraRenderEngine)
if __name__ == "__main__": if __name__ == "__main__":
register() register()

View File

@ -4,6 +4,7 @@ __all__ = (
"export_mtlx", "export_mtlx",
) )
def export_mtlx(material): def export_mtlx(material):
""" Exports material to .mtlx file. It is called from Blender source code. """ """ Exports material to .mtlx file. It is called from Blender source code. """
try: try:

View File

@ -55,11 +55,7 @@ Engine::Engine(RenderEngine *bl_engine, const std::string &render_delegate_name)
free_camera_delegate_ = std::make_unique<pxr::HdxFreeCameraSceneDelegate>( free_camera_delegate_ = std::make_unique<pxr::HdxFreeCameraSceneDelegate>(
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("freeCamera")); render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("freeCamera"));
#ifdef __APPLE__ if (bl_engine->type->flag & RE_USE_GPU_CONTEXT && GPU_backend_get_type() == GPU_BACKEND_OPENGL) {
render_task_delegate_ = std::make_unique<RenderTaskDelegate>(
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
#else
if (bl_engine->type->flag & RE_USE_GPU_CONTEXT) {
render_task_delegate_ = std::make_unique<GPURenderTaskDelegate>( render_task_delegate_ = std::make_unique<GPURenderTaskDelegate>(
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask")); render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
} }
@ -67,7 +63,6 @@ Engine::Engine(RenderEngine *bl_engine, const std::string &render_delegate_name)
render_task_delegate_ = std::make_unique<RenderTaskDelegate>( render_task_delegate_ = std::make_unique<RenderTaskDelegate>(
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask")); render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
} }
#endif
render_task_delegate_->set_camera(free_camera_delegate_->GetCameraId()); render_task_delegate_->set_camera(free_camera_delegate_->GetCameraId());
if (render_delegate_name_ == "HdStormRendererPlugin") { if (render_delegate_name_ == "HdStormRendererPlugin") {