diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 2ab4588cace..4b5b164540c 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -1460,12 +1460,15 @@ macro(find_python_module_file ) if(${out_var_abs}) set(_${out_var_abs}_DEPS "${_python_mod_file_deps_test}" CACHE STRING "") - string(LENGTH "${_python_root}" _python_root_len) - string(SUBSTRING ${${out_var_abs}} ${_python_root_len} -1 ${out_var_rel}) - unset(_python_root_len) endif() endif() + if(${out_var_abs}) + string(LENGTH "${_python_root}" _python_root_len) + string(SUBSTRING ${${out_var_abs}} ${_python_root_len} -1 ${out_var_rel}) + unset(_python_root_len) + endif() + unset(_python_mod_file_deps_test) unset(_python_base) unset(_python_root) diff --git a/scripts/modules/rna_manual_reference.py b/scripts/modules/rna_manual_reference.py index 1b8c408efe7..a45793f9529 100644 --- a/scripts/modules/rna_manual_reference.py +++ b/scripts/modules/rna_manual_reference.py @@ -1335,6 +1335,7 @@ url_manual_mapping = ( ("bpy.types.geometrynodeindexofnearest*", "modeling/geometry_nodes/geometry/sample/index_of_nearest.html#bpy-types-geometrynodeindexofnearest"), ("bpy.types.geometrynodeinputcurvetilt*", "modeling/geometry_nodes/curve/read/curve_tilt.html#bpy-types-geometrynodeinputcurvetilt"), ("bpy.types.geometrynodeinputscenetime*", "modeling/geometry_nodes/input/scene/scene_time.html#bpy-types-geometrynodeinputscenetime"), + ("bpy.types.geometrynodepointstocurves*", "modeling/geometry_nodes/point/points_to_curves.html#bpy-types-geometrynodepointstocurves"), ("bpy.types.geometrynodepointstovolume*", "modeling/geometry_nodes/point/points_to_volume.html#bpy-types-geometrynodepointstovolume"), ("bpy.types.geometrynodescaleinstances*", "modeling/geometry_nodes/instances/scale_instances.html#bpy-types-geometrynodescaleinstances"), ("bpy.types.geometrynodesetcurvenormal*", "modeling/geometry_nodes/curve/write/set_curve_normal.html#bpy-types-geometrynodesetcurvenormal"), diff --git a/source/blender/io/usd/hydra/hydra_scene_delegate.cc b/source/blender/io/usd/hydra/hydra_scene_delegate.cc index 524529c9267..6ccb6511f45 100644 --- a/source/blender/io/usd/hydra/hydra_scene_delegate.cc +++ b/source/blender/io/usd/hydra/hydra_scene_delegate.cc @@ -35,6 +35,7 @@ HydraSceneDelegate::HydraSceneDelegate(pxr::HdRenderIndex *parent_index, : HdSceneDelegate(parent_index, delegate_id) { instancer_data_ = std::make_unique(this, instancer_prim_id()); + world_data_ = std::make_unique(this, world_prim_id()); } pxr::HdMeshTopology HydraSceneDelegate::GetMeshTopology(pxr::SdfPath const &id) @@ -214,7 +215,7 @@ void HydraSceneDelegate::populate(Depsgraph *deps, View3D *v3d) set_light_shading_settings(); set_world_shading_settings(); update_collection(); - update_world(); + world_data_->update(); } } @@ -338,26 +339,6 @@ InstancerData *HydraSceneDelegate::instancer_data(pxr::SdfPath const &id, bool c return nullptr; } -void HydraSceneDelegate::update_world() -{ - if (!world_data_) { - if (!shading_settings.use_scene_world || (shading_settings.use_scene_world && scene->world)) { - world_data_ = std::make_unique(this, world_prim_id()); - world_data_->init(); - world_data_->insert(); - } - } - else { - if (!shading_settings.use_scene_world || (shading_settings.use_scene_world && scene->world)) { - world_data_->update(); - } - else { - world_data_->remove(); - world_data_ = nullptr; - } - } -} - void HydraSceneDelegate::check_updates() { bool do_update_collection = false; @@ -406,9 +387,7 @@ void HydraSceneDelegate::check_updates() { do_update_collection = true; } - if (id->recalc & ID_RECALC_AUDIO_VOLUME && - ((scene->world && !world_data_) || (!scene->world && world_data_))) - { + if (id->recalc & ID_RECALC_AUDIO_VOLUME) { do_update_world = true; } break; @@ -421,7 +400,7 @@ void HydraSceneDelegate::check_updates() ITER_END; if (do_update_world) { - update_world(); + world_data_->update(); } if (do_update_collection) { update_collection(); diff --git a/source/blender/io/usd/hydra/hydra_scene_delegate.h b/source/blender/io/usd/hydra/hydra_scene_delegate.h index 47d9781163c..b4de2fbbe98 100644 --- a/source/blender/io/usd/hydra/hydra_scene_delegate.h +++ b/source/blender/io/usd/hydra/hydra_scene_delegate.h @@ -105,7 +105,6 @@ class HydraSceneDelegate : public pxr::HdSceneDelegate { MaterialData *material_data(pxr::SdfPath const &id) const; InstancerData *instancer_data(pxr::SdfPath const &id, bool child_id = false) const; - void update_world(); void check_updates(); void update_collection(); bool set_light_shading_settings(); diff --git a/source/blender/io/usd/hydra/world.cc b/source/blender/io/usd/hydra/world.cc index 2845332d902..f40cce70100 100644 --- a/source/blender/io/usd/hydra/world.cc +++ b/source/blender/io/usd/hydra/world.cc @@ -42,7 +42,6 @@ WorldData::WorldData(HydraSceneDelegate *scene_delegate, pxr::SdfPath const &pri void WorldData::init() { data_.clear(); - data_[pxr::UsdLuxTokens->orientToStageUpAxis] = true; float intensity = 1.0f; float exposure = 1.0f; @@ -58,6 +57,9 @@ void WorldData::init() /* TODO: Create nodes parsing system */ bNode *output_node = ntreeShaderOutputNode(world->nodetree, SHD_OUTPUT_ALL); + if (!output_node) { + return; + } const Span input_sockets = output_node->input_sockets(); bNodeSocket *input_socket = nullptr; @@ -127,6 +129,7 @@ void WorldData::init() } } + data_[pxr::UsdLuxTokens->orientToStageUpAxis] = true; data_[pxr::HdLightTokens->intensity] = intensity; data_[pxr::HdLightTokens->exposure] = exposure; data_[pxr::HdLightTokens->color] = color; @@ -138,9 +141,22 @@ void WorldData::init() void WorldData::update() { ID_LOG(1, ""); - init(); - scene_delegate_->GetRenderIndex().GetChangeTracker().MarkSprimDirty(prim_id, - pxr::HdLight::AllDirty); + + if (!scene_delegate_->shading_settings.use_scene_world || + (scene_delegate_->shading_settings.use_scene_world && scene_delegate_->scene->world)) + { + init(); + if (data_.empty()) { + remove(); + return; + } + insert(); + scene_delegate_->GetRenderIndex().GetChangeTracker().MarkSprimDirty(prim_id, + pxr::HdLight::AllDirty); + } + else { + remove(); + } } void WorldData::write_transform()