forked from blender/blender
BLEN-335: Export environment light #1
No reviewers
Labels
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: BogdanNagirniak/blender#1
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "BLEN-335"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Purpose
Add initial implementation of export environment light to hydra. Both color and images supported.
Technical steps
Added caching images.
Added new class
WorldData
.How it works:
color
linked with image - cache image on disk;Use with https://github.com/bnagirniak/RPRHydraRenderBlenderAddon/pull/6
@ -210,0 +238,4 @@
* W_000002074e812088 */
char str[32];
snprintf(str, 32, "W_%016llx", (uint64_t)b_context);
return GetDelegateID().AppendElementString(str);
return GetDelegateID().AppendElementString("World");
@ -400,0 +454,4 @@
if (world_data.has_data(UsdLuxTokens->orientToStageUpAxis)) {
transform *= GfMatrix4d(GfRotation(GfVec3d(1.0, 0.0, 0.0), -90), GfVec3d());
}
if (index.GetRenderDelegate()->GetRendererDisplayName() == "RPR") {
add TODO comment like: implement this check via render settings
@ -400,0 +458,4 @@
transform *= GfMatrix4d(GfRotation(GfVec3d(1.0, 0.0, 0.0), -180), GfVec3d());
transform *= GfMatrix4d(GfRotation(GfVec3d(0.0, 0.0, 1.0), 90.0), GfVec3d());
}
return transform;
move this to WorldData::transform()
@ -411,0 +471,4 @@
HdRenderIndex &index = GetRenderIndex();
if (index.GetSprim(HdPrimTypeTokens->domeLight, id)) {
else if (id == world_id()) {....}
@ -56,3 +60,4 @@
bool is_populated;
ObjectDataMap objects;
MaterialDataMap materials;
WorldData world_data;
make is as unique_ptr, implement add/remove world
@ -0,0 +35,4 @@
{
}
WorldData::WorldData(View3DShading *shading, World *world, BL::Context *b_context)
(World *world, bContext *context)
@ -0,0 +85,4 @@
}
void WorldData::set_as_world()
{
move to constructor
@ -0,0 +31,4 @@
template<class T>
const T &get_data(pxr::TfToken const &key);
bool has_data(pxr::TfToken const &key);
void update_world();
no need update_world() just recreate it in scene delegate
@ -0,0 +43,4 @@
void set_as_world();
void set_as_shading();
};
remove unused methods
@ -404,16 +461,27 @@ VtValue BlenderSceneDelegate::GetLightParamValue(SdfPath const& id, TfToken cons
{
LOG(INFO) << "GetLightParamValue: " << id.GetAsString() << " [" << key.GetString() << "]";
VtValue ret;
ObjectData *obj_data = object_data(id);
revert this block
@ -53,0 +61,4 @@
LOG(INFO) << "Add world: " << world_light_id;
if (!world) {
world_data.reset();
world_data = nullptr;
@ -53,0 +62,4 @@
if (!world) {
world_data.reset();
GetRenderIndex().RemoveSprim(HdPrimTypeTokens->domeLight, world_light_id);
if (world_data) ...
@ -53,0 +67,4 @@
return;
}
world_data = make_unique<WorldData>(world, (bContext *)b_context->ptr.data);
@ -0,0 +91,4 @@
}
}
GfMatrix4d WorldData::transform(string renderer_name)
string const &
@ -7,3 +15,4 @@
#include "utils.h"
using namespace pxr;
remove this
@ -33,3 +42,3 @@
millisecs -= s;
if (neg)
ss << "-";
ss << "-";
add {...}
@ -49,0 +86,4 @@
BLI_path_join(tempfile, sizeof(tempfile), BKE_tempdir_session(), image_name.c_str());
STRNCPY(opts->filepath, tempfile);
if (BKE_image_save(reports, bmain, image, iuser, opts)) {
change to
if (!BKE_image_save(...))