forked from blender/blender
Fixed rendering for MacOS #82
@ -7,6 +7,7 @@ USD Hydra Based Renderer
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
class CustomHydraRenderEngine(bpy.types.HydraRenderEngine):
|
||||
# Identifier and name in the user interface.
|
||||
bl_idname = "CUSTOM_HYDRA_RENDERER"
|
||||
@ -53,8 +54,10 @@ class CustomHydraRenderEngine(bpy.types.HydraRenderEngine):
|
||||
def register():
|
||||
bpy.utils.register_class(CustomHydraRenderEngine)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_class(CustomHydraRenderEngine)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
@ -4,6 +4,7 @@ __all__ = (
|
||||
"export_mtlx",
|
||||
)
|
||||
|
||||
|
||||
def export_mtlx(material):
|
||||
""" Exports material to .mtlx file. It is called from Blender source code. """
|
||||
try:
|
||||
|
@ -55,11 +55,7 @@ Engine::Engine(RenderEngine *bl_engine, const std::string &render_delegate_name)
|
||||
free_camera_delegate_ = std::make_unique<pxr::HdxFreeCameraSceneDelegate>(
|
||||
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("freeCamera"));
|
||||
|
||||
#ifdef __APPLE__
|
||||
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) {
|
||||
if (bl_engine->type->flag & RE_USE_GPU_CONTEXT && GPU_backend_get_type() == GPU_BACKEND_OPENGL) {
|
||||
render_task_delegate_ = std::make_unique<GPURenderTaskDelegate>(
|
||||
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_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("renderTask"));
|
||||
}
|
||||
#endif
|
||||
render_task_delegate_->set_camera(free_camera_delegate_->GetCameraId());
|
||||
|
||||
if (render_delegate_name_ == "HdStormRendererPlugin") {
|
||||
|
@ -36,7 +36,7 @@ static PyObject *engine_create_func(PyObject * /*self*/, PyObject *args)
|
||||
}
|
||||
|
||||
RenderEngine *bl_engine = pyrna_to_pointer<RenderEngine>(pyengine, &RNA_RenderEngine);
|
||||
|
||||
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Engine %s", engine_type);
|
||||
Engine *engine = nullptr;
|
||||
try {
|
||||
@ -53,7 +53,7 @@ static PyObject *engine_create_func(PyObject * /*self*/, PyObject *args)
|
||||
catch (std::runtime_error &e) {
|
||||
CLOG_ERROR(LOG_RENDER_HYDRA, "%s", e.what());
|
||||
}
|
||||
|
||||
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Engine %p", engine);
|
||||
return PyLong_FromVoidPtr(engine);
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ void RenderTaskDelegate::read_aov(pxr::TfToken const &aov_key, float *data)
|
||||
if (!buffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
pxr::HdFormat format = buffer->GetFormat();
|
||||
size_t len = buffer->GetWidth() * buffer->GetHeight() * pxr::HdGetComponentCount(format);
|
||||
if (pxr::HdGetComponentFormat(format) == pxr::HdFormatFloat32) {
|
||||
|
Loading…
Reference in New Issue
Block a user