Implement Viewport render with material preview #56

Merged
Bogdan Nagirniak merged 22 commits from BLEN-421 into hydra-render 2023-06-30 09:03:28 +02:00
2 changed files with 9 additions and 6 deletions
Showing only changes of commit 3af45f013f - Show all commits

View File

@ -205,8 +205,9 @@ void BlenderSceneDelegate::populate(Depsgraph *deps, bContext *cont)
check_updates(); check_updates();
} }
else { else {
use_scene_lights = V3D_USES_SCENE_LIGHTS(view3d); use_scene_lights_ = V3D_USES_SCENE_LIGHTS(view3d);
shading_flag_ = view3d->shading.flag; shading_flag_ = view3d->shading.flag;
lookdev_light_ = view3d->shading.lookdev_light;
add_new_objects(); add_new_objects();
update_world(); update_world();
} }
@ -426,19 +427,20 @@ void BlenderSceneDelegate::check_updates()
bool do_update_visibility = false; bool do_update_visibility = false;
bool do_update_world = false; bool do_update_world = false;
if (shading_flag_ != view3d->shading.flag) { if (shading_flag_ != view3d->shading.flag || lookdev_light_ != view3d->shading.lookdev_light) {
shading_flag_ = view3d->shading.flag; shading_flag_ = view3d->shading.flag;
lookdev_light_ = view3d->shading.lookdev_light;
do_update_world = true; do_update_world = true;
} }
bool use_scene_lights_changed = false; bool use_scene_lights_changed = false;
if (use_scene_lights != V3D_USES_SCENE_LIGHTS(view3d)) { if (use_scene_lights_ != V3D_USES_SCENE_LIGHTS(view3d)) {
use_scene_lights = V3D_USES_SCENE_LIGHTS(view3d); use_scene_lights_ = V3D_USES_SCENE_LIGHTS(view3d);
use_scene_lights_changed = true; use_scene_lights_changed = true;
} }
if (use_scene_lights_changed) { if (use_scene_lights_changed) {
if (use_scene_lights) { if (use_scene_lights_) {
add_new_objects(true); add_new_objects(true);
} }
else { else {

View File

@ -100,7 +100,8 @@ class BlenderSceneDelegate : public pxr::HdSceneDelegate {
std::unique_ptr<WorldData> world_data_; std::unique_ptr<WorldData> world_data_;
short shading_flag_; short shading_flag_;
bool use_scene_lights = false; std::string lookdev_light_;
bool use_scene_lights_ = false;
}; };
#define LOOK_DEV_STUDIO_LIGHT_ENABLED(v3d) \ #define LOOK_DEV_STUDIO_LIGHT_ENABLED(v3d) \