mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 20:53:52 +00:00
Merge branch 'toggable_daynightswitch' into 'master'
Toggable day night switch (#5928) Closes #5928 See merge request OpenMW/openmw!1549
This commit is contained in:
commit
781b014183
10 changed files with 75 additions and 3 deletions
|
@ -38,6 +38,7 @@
|
||||||
Bug #5842: GetDisposition adds temporary disposition change from different actors
|
Bug #5842: GetDisposition adds temporary disposition change from different actors
|
||||||
Bug #5863: GetEffect should return true after the player has teleported
|
Bug #5863: GetEffect should return true after the player has teleported
|
||||||
Bug #5913: Failed assertion during Ritual of Trees quest
|
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 #5937: Lights always need to be rotated by 90 degrees
|
||||||
Bug #6037: Morrowind Content Language Cannot be Set to English in OpenMW Launcher
|
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
|
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");
|
loadSettingBool(activeGridObjectPagingCheckBox, "object paging active grid", "Terrain");
|
||||||
viewingDistanceComboBox->setValue(convertToCells(Settings::Manager::getInt("viewing distance", "Camera")));
|
viewingDistanceComboBox->setValue(convertToCells(Settings::Manager::getInt("viewing distance", "Camera")));
|
||||||
objectPagingMinSizeComboBox->setValue(Settings::Manager::getDouble("object paging min size", "Terrain"));
|
objectPagingMinSizeComboBox->setValue(Settings::Manager::getDouble("object paging min size", "Terrain"));
|
||||||
|
|
||||||
|
loadSettingBool(nightDaySwitchesCheckBox, "day night switches", "Game");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
|
@ -298,6 +300,8 @@ void Launcher::AdvancedPage::saveSettings()
|
||||||
double objectPagingMinSize = objectPagingMinSizeComboBox->value();
|
double objectPagingMinSize = objectPagingMinSizeComboBox->value();
|
||||||
if (objectPagingMinSize != Settings::Manager::getDouble("object paging min size", "Terrain"))
|
if (objectPagingMinSize != Settings::Manager::getDouble("object paging min size", "Terrain"))
|
||||||
Settings::Manager::setDouble("object paging min size", "Terrain", objectPagingMinSize);
|
Settings::Manager::setDouble("object paging min size", "Terrain", objectPagingMinSize);
|
||||||
|
|
||||||
|
saveSettingBool(nightDaySwitchesCheckBox, "day night switches", "Game");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
|
|
|
@ -223,6 +223,7 @@ void CSMPrefs::State::declare()
|
||||||
declareColour ("scene-night-gradient-colour", "Scene Night Gradient Colour", QColor (47, 51, 51, 255)).
|
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 "
|
setTooltip("Sets the gradient color to use in conjunction with the night background color. Ignored if "
|
||||||
"the gradient option is disabled.");
|
"the gradient option is disabled.");
|
||||||
|
declareBool("scene-day-night-switch-nodes", "Use Day/Night Switch Nodes", true);
|
||||||
|
|
||||||
declareCategory ("Tooltips");
|
declareCategory ("Tooltips");
|
||||||
declareBool ("scene", "Show Tooltips in 3D scenes", true);
|
declareBool ("scene", "Show Tooltips in 3D scenes", true);
|
||||||
|
|
|
@ -3,9 +3,12 @@
|
||||||
#include <osg/LightSource>
|
#include <osg/LightSource>
|
||||||
#include <osg/NodeVisitor>
|
#include <osg/NodeVisitor>
|
||||||
#include <osg/Switch>
|
#include <osg/Switch>
|
||||||
|
#include <osg/ValueObject>
|
||||||
|
|
||||||
#include <components/misc/constants.hpp>
|
#include <components/misc/constants.hpp>
|
||||||
|
|
||||||
|
#include "../../model/prefs/state.hpp"
|
||||||
|
|
||||||
class DayNightSwitchVisitor : public osg::NodeVisitor
|
class DayNightSwitchVisitor : public osg::NodeVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -16,8 +19,33 @@ public:
|
||||||
|
|
||||||
void apply(osg::Switch &switchNode) override
|
void apply(osg::Switch &switchNode) override
|
||||||
{
|
{
|
||||||
if (switchNode.getName() == Constants::NightDayLabel)
|
constexpr int NoIndex = -1;
|
||||||
switchNode.setSingleChildOn(mIndex);
|
|
||||||
|
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);
|
traverse(switchNode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -550,6 +550,11 @@ void SceneWidget::settingChanged (const CSMPrefs::Setting *setting)
|
||||||
{
|
{
|
||||||
updateCameraParameters();
|
updateCameraParameters();
|
||||||
}
|
}
|
||||||
|
else if (*setting == "Rendering/scene-day-night-switch-nodes")
|
||||||
|
{
|
||||||
|
if (mLighting)
|
||||||
|
setLighting(mLighting);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWidget::updateCameraParameters(double overrideAspect)
|
void RenderWidget::updateCameraParameters(double overrideAspect)
|
||||||
|
|
|
@ -25,6 +25,8 @@ CSVWorld::PreviewSubView::PreviewSubView (const CSMWorld::UniversalId& id, CSMDo
|
||||||
else
|
else
|
||||||
mScene = new CSVRender::PreviewWidget (document.getData(), id.getId(), true, this);
|
mScene = new CSVRender::PreviewWidget (document.getData(), id.getId(), true, this);
|
||||||
|
|
||||||
|
mScene->setExterior(true);
|
||||||
|
|
||||||
CSVWidget::SceneToolbar *toolbar = new CSVWidget::SceneToolbar (48+6, this);
|
CSVWidget::SceneToolbar *toolbar = new CSVWidget::SceneToolbar (48+6, this);
|
||||||
|
|
||||||
CSVWidget::SceneToolMode *lightingTool = mScene->makeLightingSelector (toolbar);
|
CSVWidget::SceneToolMode *lightingTool = mScene->makeLightingSelector (toolbar);
|
||||||
|
|
|
@ -1831,7 +1831,7 @@ namespace MWRender
|
||||||
visitor.remove();
|
visitor.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SceneUtil::hasUserDescription(mObjectRoot, Constants::NightDayLabel))
|
if (Settings::Manager::getBool("day night switches", "Game") && SceneUtil::hasUserDescription(mObjectRoot, Constants::NightDayLabel))
|
||||||
{
|
{
|
||||||
AddSwitchCallbacksVisitor visitor;
|
AddSwitchCallbacksVisitor visitor;
|
||||||
mObjectRoot->accept(visitor);
|
mObjectRoot->accept(visitor);
|
||||||
|
|
|
@ -465,3 +465,12 @@ default actor pathfind half extents
|
||||||
|
|
||||||
Actor half extents used for exterior cells to generate navmesh.
|
Actor half extents used for exterior cells to generate navmesh.
|
||||||
Changing the value will invalidate navmesh disk cache.
|
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 size of actor for navmesh generation
|
||||||
default actor pathfind half extents = 29.27999496459961 28.479997634887695 66.5
|
default actor pathfind half extents = 29.27999496459961 28.479997634887695 66.5
|
||||||
|
|
||||||
|
# Enables use of day/night switch nodes
|
||||||
|
day night switches = true
|
||||||
|
|
||||||
[General]
|
[General]
|
||||||
|
|
||||||
# Anisotropy reduces distortion in textures at low angles (e.g. 0 to 16).
|
# Anisotropy reduces distortion in textures at low angles (e.g. 0 to 16).
|
||||||
|
|
|
@ -557,6 +557,25 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
Loading…
Reference in a new issue