forked from blender/blender
BLEN-335: Export environment light #1
@ -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
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
Bogdan Nagirniak
commented
`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
|
||||
|
@ -82,4 +82,5 @@ string cache_image(Main *bmain,
|
||||
BKE_image_save_options_free(opts);
|
||||
return "";
|
||||
}
|
||||
|
||||
} // namespace blender::render::hydra
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user
return GetDelegateID().AppendElementString("World");