BLEN-351: Test/fix Hydra addon with different blender scenes #13

Merged
Bogdan Nagirniak merged 4 commits from BLEN-351 into hydra-render 2023-03-10 17:16:57 +01:00
4 changed files with 13 additions and 7 deletions

View File

@ -9,6 +9,7 @@
#include "blenderSceneDelegate.h" #include "blenderSceneDelegate.h"
using namespace pxr; using namespace pxr;
using namespace std;
namespace blender::render::hydra { 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 */ /* Export of new visible objects which were not exported before */
std::set<SdfPath> available_objects; set<SdfPath> available_objects;
SdfPath id; SdfPath id;
DEGObjectIterSettings settings = {0}; DEGObjectIterSettings settings = {0};
@ -164,12 +165,13 @@ void BlenderSceneDelegate::update_collection(bool remove, bool visibility)
DEG_iterator_objects_next, DEG_iterator_objects_next,
DEG_iterator_objects_end, DEG_iterator_objects_end,
&data, Object *, object) { &data, Object *, object) {
if (data.dupli_object_current != nullptr) {
add_update_instance(data.dupli_object_current); if (!ObjectData::supported(object)) {
continue; continue;
} }
if (!ObjectData::supported(object)) { if (data.dupli_object_current != nullptr) {
add_update_instance(data.dupli_object_current);
continue; continue;
} }
@ -196,7 +198,7 @@ void BlenderSceneDelegate::update_collection(bool remove, bool visibility)
} }
/* remove unused materials */ /* remove unused materials */
std::set<SdfPath> available_materials; set<SdfPath> available_materials;
for (auto &obj : objects) { for (auto &obj : objects) {
MeshData *m_data = dynamic_cast<MeshData *>(obj.second.get()); MeshData *m_data = dynamic_cast<MeshData *>(obj.second.get());
if (m_data && !m_data->material_id.IsEmpty()) { if (m_data && !m_data->material_id.IsEmpty()) {

View File

@ -28,7 +28,9 @@ MeshData::MeshData(BlenderSceneDelegate *scene_delegate, Object *object)
} }
else { else {
Mesh *mesh = BKE_object_to_mesh(nullptr, object, false); Mesh *mesh = BKE_object_to_mesh(nullptr, object, false);
if (mesh) {
set_mesh(mesh); set_mesh(mesh);
}
BKE_object_to_mesh_clear(object); BKE_object_to_mesh_clear(object);
} }
} }

View File

@ -19,7 +19,6 @@ bool ObjectData::supported(Object *object)
case OB_MESH: case OB_MESH:
case OB_SURF: case OB_SURF:
case OB_FONT: case OB_FONT:
case OB_CURVES:
case OB_CURVES_LEGACY: case OB_CURVES_LEGACY:
case OB_MBALL: case OB_MBALL:
case OB_LAMP: case OB_LAMP:

View File

@ -59,6 +59,9 @@ WorldData::WorldData(BlenderSceneDelegate *scene_delegate, World *world, bContex
} }
bNode *input_node = link->fromnode; bNode *input_node = link->fromnode;
if (input_node->type != SH_NODE_BACKGROUND) {
return;
}
bNodeSocket color_input = input_node->input_by_identifier("Color"); bNodeSocket color_input = input_node->input_by_identifier("Color");
bNodeSocket strength_input = input_node->input_by_identifier("Strength"); bNodeSocket strength_input = input_node->input_by_identifier("Strength");