forked from blender/blender
Implement Viewport render with material preview #56
No reviewers
Labels
No Label
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: BogdanNagirniak/blender#56
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "BLEN-421"
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
Implement Viewport render with material preview
Technical steps
std::string
usage which leads to incorrect behavior;@ -99,2 +99,4 @@
InstancerDataMap instancers_;
std::unique_ptr<WorldData> world_data_;
short shading_flag_;
Move this new settings to internal
struct ShadingSettings
@ -78,3 +78,2 @@
Main *main = CTX_data_main(context);
file_path.reserve(FILE_MAX);
BKE_image_user_file_path_ex(main, iuser, image, file_path.data(), false, true);
BKE_image_user_file_path_ex(main, iuser, image, file_path, false, true);
Revert changes in this function and add
@ -32,2 +32,4 @@
pxr::GfMatrix4d transform;
float rotation;
float intensity;
move this to
BlenderSceneDelegate::ShadingSettings
@ -642,0 +683,4 @@
{
bool ret = false;
if (view3d) {
if (shading_settings.shading_flag != view3d->shading.flag ||
simplify by using add
operator==()
and copy constructor to ShadingSettings@ -40,0 +42,4 @@
short shading_flag;
std::string lookdev_light;
float rotation;
float intensity;
@ -94,2 +103,4 @@
void remove_unused_objects();
void update_visibility();
bool set_light_shading_settings(View3D const *view3d);
bool set_world_shading_settings(View3D const *view3d);
remove parameter
view3d
@ -100,4 +111,10 @@ class BlenderSceneDelegate : public pxr::HdSceneDelegate {
std::unique_ptr<WorldData> world_data_;
};
#define LOOK_DEV_STUDIO_LIGHT_ENABLED(v3d) \
should be removed
@ -272,6 +272,11 @@ void InstancerData::check_remove(Set<std::string> &available_objects)
light_instances_.remove_if([&](auto item) {
bool res = !available_objects.contains(item.key.GetName());
if (!V3D_USES_SCENE_LIGHTS(scene_delegate_->view3d) &&
use
scene_delegate_->shading_settings.use_scene_lights
@ -354,2 +359,4 @@
LISTBASE_FOREACH (DupliObject *, dupli, lb) {
Object *ob = dupli->ob;
if (scene_delegate_->view3d && !V3D_USES_SCENE_LIGHTS(scene_delegate_->view3d) &&
ob->type == OB_LAMP)
if (ob->type == OB_LAMP && !scene_delegate_->shading_settings.use_scene_lights)
@ -12,10 +12,13 @@
#include <pxr/usd/usdLux/tokens.h>
#include "BKE_context.h"
#include "DEG_depsgraph_query.h"
shouldn't be needed
@ -47,3 +52,2 @@
data_[pxr::UsdLuxTokens->orientToStageUpAxis] = true;
if (world->use_nodes) {
eEvaluationMode deg_mode = DEG_get_mode(scene_delegate_->depsgraph);
@ -520,3 +537,2 @@
std::bitset<3>(BKE_object_visibility(object, deg_mode)).to_string().c_str());
update_objects(object);
update_instancers(object);
if (only_lights) {
simplify:
only_lights can be removed
@ -566,6 +591,9 @@ void BlenderSceneDelegate::remove_unused_objects()
/* Remove unused objects */
objects_.remove_if([&](auto item) {
bool ret = !available_objects.contains(item.key.GetName());
if (!shading_settings.use_scene_lights && ((Object *)item.value->id)->type == OB_LAMP) {
move this check to L573
@ -642,0 +681,4 @@
bool BlenderSceneDelegate::set_world_shading_settings()
{
bool ret = false;
@ -40,0 +44,4 @@
float studiolight_rotation;
float studiolight_intensity;
bool operator==(const ShadingSettings &other)
move implementation to blender_scene_delegate.cc
@ -272,6 +272,11 @@ void InstancerData::check_remove(Set<std::string> &available_objects)
light_instances_.remove_if([&](auto item) {
bool res = !available_objects.contains(item.key.GetName());
if (!scene_delegate_->shading_settings.use_scene_lights &&
lights shouldn't be in available_objects, this can be reverted
@ -100,3 +120,1 @@
data_[pxr::HdLightTokens->intensity] = 1.0f;
data_[pxr::HdLightTokens->exposure] = world->exposure;
data_[pxr::HdLightTokens->color] = pxr::GfVec3f(world->horr, world->horg, world->horb);
if (scene_delegate_->view3d && !scene_delegate_->shading_settings.use_scene_world) {
thif
if
can be removedAdded fix when scene->world is empty + improved WorldData.
Tested - works good.
Works good.