BLEN-335: Export environment light #1

Merged
Bogdan Nagirniak merged 13 commits from BLEN-335 into hydra-render 2023-02-17 14:46:46 +01:00
5 changed files with 12 additions and 9 deletions
Showing only changes of commit 4bb870a306 - Show all commits

View File

@ -54,7 +54,7 @@ void BlenderSceneDelegate::update_material(Material *material)
void BlenderSceneDelegate::add_world(View3DShading *view3DShading, World *world)
{
SdfPath world_light_id = world_id(view3DShading);
SdfPath world_light_id = world_id(b_context);
LOG(INFO) << "Add world: " << world_light_id;
@ -232,12 +232,12 @@ SdfPath BlenderSceneDelegate::material_id(Material *material)
return GetDelegateID().AppendElementString(str);
}
SdfPath BlenderSceneDelegate::world_id(View3DShading *view3DShading)
SdfPath BlenderSceneDelegate::world_id(BL::Context *b_context)
{
/* Making id of material in form like M_<pointer in 16 hex digits format>. Example:
* W_000002074e812088 */
char str[32];
snprintf(str, 32, "W_%016llx", (uint64_t)view3DShading);
snprintf(str, 32, "W_%016llx", (uint64_t)b_context);
return GetDelegateID().AppendElementString(str);
BogdanNagirniak marked this conversation as resolved
Review

return GetDelegateID().AppendElementString("World");

return GetDelegateID().AppendElementString("World");
}
@ -265,7 +265,6 @@ void BlenderSceneDelegate::Populate(BL::Depsgraph &b_deps, BL::Context &b_cont)
update_collection();
World *world = (World *)b_depsgraph->scene().world().ptr.data;
add_world(&view3d->shading, world);
is_populated = true;

View File

@ -43,15 +43,15 @@ private:
MaterialData *material_data(SdfPath const &id);
SdfPath object_id(Object *object);
SdfPath material_id(Material *material);
SdfPath world_id(BL::Context *b_context);
bool supported_object(Object *object);
void add_update_object(Object *object, bool geometry, bool transform, bool shading);
void set_material(ObjectData &obj_data);
void update_material(Material *material);
void add_world(View3DShading *view3DShading, World *world);
void update_collection();
void update_visibility();
void add_world(View3DShading *view3DShading, World *world);
SdfPath world_id(View3DShading *view3DShading);
private:
BL::Depsgraph *b_depsgraph;

View File

@ -1,7 +1,6 @@
/* SPDX-License-Identifier: Apache-2.0
* Copyright 2011-2022 Blender Foundation */
#include <filesystem>
#include <pxr/base/vt/array.h>
@ -95,6 +94,10 @@ void WorldData::set_as_world()
bNode *output_node = ntreeShaderOutputNode(world->nodetree, SHD_OUTPUT_ALL);
DagerD marked this conversation as resolved
Review

string const &

`string const &`
bNodeSocket input_socket = output_node->input_by_identifier("Surface");
bNodeLink const *link = input_socket.directly_linked_links()[0];
if (!link) {
return;
}
bNode *input_node = link->fromnode;
bNodeSocket color_input = input_node->input_by_identifier("Color");
@ -149,4 +152,5 @@ void WorldData::set_as_shading()
shading->single_color[2]
);
}
} // namespace blender::render::hydra

View File

@ -81,5 +81,6 @@ string cache_image(Main *bmain,
BKE_image_save_options_free(opts);
return "";
}
}
} // namespace blender::render::hydra

View File

@ -544,7 +544,6 @@ void ViewportEngine::sync(BL::Depsgraph &b_depsgraph, BL::Context &b_context, px
sceneDelegate = std::make_unique<BlenderSceneDelegate>(renderIndex.get(),
SdfPath::AbsoluteRootPath().AppendElementString("scene"));
}
View3D *view3d = (View3D *)b_context.space_data().ptr.data;
sceneDelegate->Populate(b_depsgraph, b_context);
for (auto const& setting : renderSettings) {