mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-20 15:40:32 +00:00
Toggable day night switch (#5928)
This commit is contained in:
parent
8ee8f81619
commit
8ec0a52605
@ -38,6 +38,7 @@
|
||||
Bug #5842: GetDisposition adds temporary disposition change from different actors
|
||||
Bug #5863: GetEffect should return true after the player has teleported
|
||||
Bug #5913: Failed assertion during Ritual of Trees quest
|
||||
Bug #5928: Glow in the Dahrk functionality used without mod installed
|
||||
Bug #5937: Lights always need to be rotated by 90 degrees
|
||||
Bug #6037: Morrowind Content Language Cannot be Set to English in OpenMW Launcher
|
||||
Bug #6051: NaN water height in ESM file is not handled gracefully
|
||||
|
@ -143,6 +143,8 @@ bool Launcher::AdvancedPage::loadSettings()
|
||||
loadSettingBool(activeGridObjectPagingCheckBox, "object paging active grid", "Terrain");
|
||||
viewingDistanceComboBox->setValue(convertToCells(Settings::Manager::getInt("viewing distance", "Camera")));
|
||||
objectPagingMinSizeComboBox->setValue(Settings::Manager::getDouble("object paging min size", "Terrain"));
|
||||
|
||||
loadSettingBool(nightDaySwitchesCheckBox, "day night switches", "Game");
|
||||
}
|
||||
|
||||
// Audio
|
||||
@ -298,6 +300,8 @@ void Launcher::AdvancedPage::saveSettings()
|
||||
double objectPagingMinSize = objectPagingMinSizeComboBox->value();
|
||||
if (objectPagingMinSize != Settings::Manager::getDouble("object paging min size", "Terrain"))
|
||||
Settings::Manager::setDouble("object paging min size", "Terrain", objectPagingMinSize);
|
||||
|
||||
saveSettingBool(nightDaySwitchesCheckBox, "day night switches", "Game");
|
||||
}
|
||||
|
||||
// Audio
|
||||
|
@ -223,6 +223,7 @@ void CSMPrefs::State::declare()
|
||||
declareColour ("scene-night-gradient-colour", "Scene Night Gradient Colour", QColor (47, 51, 51, 255)).
|
||||
setTooltip("Sets the gradient color to use in conjunction with the night background color. Ignored if "
|
||||
"the gradient option is disabled.");
|
||||
declareBool("scene-day-night-switch-nodes", "Use Day/Night Switch Nodes", true);
|
||||
|
||||
declareCategory ("Tooltips");
|
||||
declareBool ("scene", "Show Tooltips in 3D scenes", true);
|
||||
|
@ -3,9 +3,12 @@
|
||||
#include <osg/LightSource>
|
||||
#include <osg/NodeVisitor>
|
||||
#include <osg/Switch>
|
||||
#include <osg/ValueObject>
|
||||
|
||||
#include <components/misc/constants.hpp>
|
||||
|
||||
#include "../../model/prefs/state.hpp"
|
||||
|
||||
class DayNightSwitchVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
@ -16,8 +19,33 @@ public:
|
||||
|
||||
void apply(osg::Switch &switchNode) override
|
||||
{
|
||||
if (switchNode.getName() == Constants::NightDayLabel)
|
||||
switchNode.setSingleChildOn(mIndex);
|
||||
constexpr int NoIndex = -1;
|
||||
|
||||
int initialIndex = NoIndex;
|
||||
if (!switchNode.getUserValue("initialIndex", initialIndex))
|
||||
{
|
||||
for (size_t i = 0; i < switchNode.getValueList().size(); ++i)
|
||||
{
|
||||
if (switchNode.getValueList()[i])
|
||||
{
|
||||
initialIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (initialIndex != NoIndex)
|
||||
switchNode.setUserValue("initialIndex", initialIndex);
|
||||
}
|
||||
|
||||
if (CSMPrefs::get()["Rendering"]["scene-day-night-switch-nodes"].isTrue())
|
||||
{
|
||||
if (switchNode.getName() == Constants::NightDayLabel)
|
||||
switchNode.setSingleChildOn(mIndex);
|
||||
}
|
||||
else if (initialIndex != NoIndex)
|
||||
{
|
||||
switchNode.setSingleChildOn(initialIndex);
|
||||
}
|
||||
|
||||
traverse(switchNode);
|
||||
}
|
||||
|
@ -550,6 +550,11 @@ void SceneWidget::settingChanged (const CSMPrefs::Setting *setting)
|
||||
{
|
||||
updateCameraParameters();
|
||||
}
|
||||
else if (*setting == "Rendering/scene-day-night-switch-nodes")
|
||||
{
|
||||
if (mLighting)
|
||||
setLighting(mLighting);
|
||||
}
|
||||
}
|
||||
|
||||
void RenderWidget::updateCameraParameters(double overrideAspect)
|
||||
|
@ -25,6 +25,8 @@ CSVWorld::PreviewSubView::PreviewSubView (const CSMWorld::UniversalId& id, CSMDo
|
||||
else
|
||||
mScene = new CSVRender::PreviewWidget (document.getData(), id.getId(), true, this);
|
||||
|
||||
mScene->setExterior(true);
|
||||
|
||||
CSVWidget::SceneToolbar *toolbar = new CSVWidget::SceneToolbar (48+6, this);
|
||||
|
||||
CSVWidget::SceneToolMode *lightingTool = mScene->makeLightingSelector (toolbar);
|
||||
|
@ -1831,7 +1831,7 @@ namespace MWRender
|
||||
visitor.remove();
|
||||
}
|
||||
|
||||
if (SceneUtil::hasUserDescription(mObjectRoot, Constants::NightDayLabel))
|
||||
if (Settings::Manager::getBool("day night switches", "Game") && SceneUtil::hasUserDescription(mObjectRoot, Constants::NightDayLabel))
|
||||
{
|
||||
AddSwitchCallbacksVisitor visitor;
|
||||
mObjectRoot->accept(visitor);
|
||||
|
@ -465,3 +465,12 @@ default actor pathfind half extents
|
||||
|
||||
Actor half extents used for exterior cells to generate navmesh.
|
||||
Changing the value will invalidate navmesh disk cache.
|
||||
|
||||
day night switches
|
||||
------------------
|
||||
|
||||
:Type: boolean
|
||||
:Range: True/False
|
||||
:Default: True
|
||||
|
||||
Some mods add models which change visuals based on time of day. When this setting is enabled, supporting models will automatically make use of Day/night state.
|
||||
|
@ -373,6 +373,9 @@ allow actors to follow over water surface = true
|
||||
# Default size of actor for navmesh generation
|
||||
default actor pathfind half extents = 29.27999496459961 28.479997634887695 66.5
|
||||
|
||||
# Enables use of day/night switch nodes
|
||||
day night switches = true
|
||||
|
||||
[General]
|
||||
|
||||
# Anisotropy reduces distortion in textures at low angles (e.g. 0 to 16).
|
||||
|
@ -557,6 +557,25 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="miscGroup">
|
||||
<property name="title">
|
||||
<string>Models</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="miscLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="nightDaySwitchesCheckBox">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>If this setting is true, supporting models will make use of day night switch nodes.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Day night switch nodes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
Loading…
x
Reference in New Issue
Block a user