From 28ca9781e93205f0f4cc06189ec0320007cc50fd Mon Sep 17 00:00:00 2001 From: "georgiy.m.markelov@gmail.com" Date: Tue, 7 Mar 2023 19:36:37 +0300 Subject: [PATCH 1/4] removed OB_CURVES from list of supported objects fixed check for supported objects --- .../render/hydra/sceneDelegate/blenderSceneDelegate.cc | 7 ++++--- source/blender/render/hydra/sceneDelegate/object.cc | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/render/hydra/sceneDelegate/blenderSceneDelegate.cc b/source/blender/render/hydra/sceneDelegate/blenderSceneDelegate.cc index 7ef68e84bf90..878874f6955b 100644 --- a/source/blender/render/hydra/sceneDelegate/blenderSceneDelegate.cc +++ b/source/blender/render/hydra/sceneDelegate/blenderSceneDelegate.cc @@ -164,12 +164,13 @@ void BlenderSceneDelegate::update_collection(bool remove, bool visibility) DEG_iterator_objects_next, DEG_iterator_objects_end, &data, Object *, object) { - if (data.dupli_object_current != nullptr) { - add_update_instance(data.dupli_object_current); + + if (!ObjectData::supported(object)) { continue; } - if (!ObjectData::supported(object)) { + if (data.dupli_object_current != nullptr) { + add_update_instance(data.dupli_object_current); continue; } diff --git a/source/blender/render/hydra/sceneDelegate/object.cc b/source/blender/render/hydra/sceneDelegate/object.cc index bc6012f6f51b..65067e983492 100644 --- a/source/blender/render/hydra/sceneDelegate/object.cc +++ b/source/blender/render/hydra/sceneDelegate/object.cc @@ -19,7 +19,6 @@ bool ObjectData::supported(Object *object) case OB_MESH: case OB_SURF: case OB_FONT: - case OB_CURVES: case OB_CURVES_LEGACY: case OB_MBALL: case OB_LAMP: -- 2.30.2 From e387195bc6e6d9612d6ae87fba9ab3346e2ad2c9 Mon Sep 17 00:00:00 2001 From: "georgiy.m.markelov@gmail.com" Date: Thu, 9 Mar 2023 12:57:41 +0300 Subject: [PATCH 2/4] added check for world input node --- source/blender/render/hydra/sceneDelegate/world.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/render/hydra/sceneDelegate/world.cc b/source/blender/render/hydra/sceneDelegate/world.cc index 43bdbafaa129..26d1b3e82d13 100644 --- a/source/blender/render/hydra/sceneDelegate/world.cc +++ b/source/blender/render/hydra/sceneDelegate/world.cc @@ -59,6 +59,9 @@ WorldData::WorldData(BlenderSceneDelegate *scene_delegate, World *world, bContex } bNode *input_node = link->fromnode; + if (input_node->type != SH_NODE_BACKGROUND) { + return; + } bNodeSocket color_input = input_node->input_by_identifier("Color"); bNodeSocket strength_input = input_node->input_by_identifier("Strength"); -- 2.30.2 From 74d14951bd1c43f732531ec2962653c7b89f15ef Mon Sep 17 00:00:00 2001 From: "georgiy.m.markelov@gmail.com" Date: Thu, 9 Mar 2023 15:36:53 +0300 Subject: [PATCH 3/4] added check for empty mesh returned by object.to_mesh() function --- .../hydra/sceneDelegate/blenderSceneDelegate.cc | 17 +++++++++++++---- .../blender/render/hydra/sceneDelegate/mesh.cc | 3 +++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/source/blender/render/hydra/sceneDelegate/blenderSceneDelegate.cc b/source/blender/render/hydra/sceneDelegate/blenderSceneDelegate.cc index 878874f6955b..8fa259534250 100644 --- a/source/blender/render/hydra/sceneDelegate/blenderSceneDelegate.cc +++ b/source/blender/render/hydra/sceneDelegate/blenderSceneDelegate.cc @@ -9,6 +9,7 @@ #include "blenderSceneDelegate.h" using namespace pxr; +using namespace std; namespace blender::render::hydra { @@ -149,7 +150,7 @@ void BlenderSceneDelegate::update_collection(bool remove, bool visibility) } /* Export of new visible objects which were not exported before */ - std::set available_objects; + set available_objects; SdfPath id; DEGObjectIterSettings settings = {0}; @@ -197,7 +198,7 @@ void BlenderSceneDelegate::update_collection(bool remove, bool visibility) } /* remove unused materials */ - std::set available_materials; + set available_materials; for (auto &obj : objects) { MeshData *m_data = dynamic_cast(obj.second.get()); if (m_data && !m_data->material_id.IsEmpty()) { @@ -220,7 +221,11 @@ void BlenderSceneDelegate::add_update_object(Object *object, bool geometry, bool SdfPath id = ObjectData::prim_id(this, object); ObjectData *obj_data = object_data(id); if (!obj_data) { - objects[id] = ObjectData::init(this, object); + unique_ptr new_object = ObjectData::init(this, object); + if (!new_object) { + return; + } + objects[id] = move(new_object); obj_data = object_data(id); obj_data->update_visibility(view3d); obj_data->insert_prim(); @@ -232,7 +237,11 @@ void BlenderSceneDelegate::add_update_object(Object *object, bool geometry, bool } if (geometry) { - objects[id] = ObjectData::init(this, object); + unique_ptr new_object = ObjectData::init(this, object); + if (!new_object) { + return; + } + objects[id] = move(new_object); obj_data = object_data(id); obj_data->update_visibility(view3d); MeshData *m_data = dynamic_cast(obj_data); diff --git a/source/blender/render/hydra/sceneDelegate/mesh.cc b/source/blender/render/hydra/sceneDelegate/mesh.cc index 945cad857ff1..f9d609c6e491 100644 --- a/source/blender/render/hydra/sceneDelegate/mesh.cc +++ b/source/blender/render/hydra/sceneDelegate/mesh.cc @@ -28,6 +28,9 @@ MeshData::MeshData(BlenderSceneDelegate *scene_delegate, Object *object) } else { Mesh *mesh = BKE_object_to_mesh(nullptr, object, false); + if (!mesh) { + return; + } set_mesh(mesh); BKE_object_to_mesh_clear(object); } -- 2.30.2 From 5458c070cf6f3377441ca052773fefed8d274a7f Mon Sep 17 00:00:00 2001 From: "georgiy.m.markelov@gmail.com" Date: Fri, 10 Mar 2023 18:20:00 +0300 Subject: [PATCH 4/4] fix review comments --- .../hydra/sceneDelegate/blenderSceneDelegate.cc | 12 ++---------- source/blender/render/hydra/sceneDelegate/mesh.cc | 5 ++--- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/source/blender/render/hydra/sceneDelegate/blenderSceneDelegate.cc b/source/blender/render/hydra/sceneDelegate/blenderSceneDelegate.cc index 8fa259534250..c2140bd389fb 100644 --- a/source/blender/render/hydra/sceneDelegate/blenderSceneDelegate.cc +++ b/source/blender/render/hydra/sceneDelegate/blenderSceneDelegate.cc @@ -221,11 +221,7 @@ void BlenderSceneDelegate::add_update_object(Object *object, bool geometry, bool SdfPath id = ObjectData::prim_id(this, object); ObjectData *obj_data = object_data(id); if (!obj_data) { - unique_ptr new_object = ObjectData::init(this, object); - if (!new_object) { - return; - } - objects[id] = move(new_object); + objects[id] = ObjectData::init(this, object); obj_data = object_data(id); obj_data->update_visibility(view3d); obj_data->insert_prim(); @@ -237,11 +233,7 @@ void BlenderSceneDelegate::add_update_object(Object *object, bool geometry, bool } if (geometry) { - unique_ptr new_object = ObjectData::init(this, object); - if (!new_object) { - return; - } - objects[id] = move(new_object); + objects[id] = ObjectData::init(this, object); obj_data = object_data(id); obj_data->update_visibility(view3d); MeshData *m_data = dynamic_cast(obj_data); diff --git a/source/blender/render/hydra/sceneDelegate/mesh.cc b/source/blender/render/hydra/sceneDelegate/mesh.cc index f9d609c6e491..6d2c5ec754f4 100644 --- a/source/blender/render/hydra/sceneDelegate/mesh.cc +++ b/source/blender/render/hydra/sceneDelegate/mesh.cc @@ -28,10 +28,9 @@ MeshData::MeshData(BlenderSceneDelegate *scene_delegate, Object *object) } else { Mesh *mesh = BKE_object_to_mesh(nullptr, object, false); - if (!mesh) { - return; + if (mesh) { + set_mesh(mesh); } - set_mesh(mesh); BKE_object_to_mesh_clear(object); } } -- 2.30.2