mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Merge branch 'hotfix_ui_update' into 'master'
Fix Lua UI updates See merge request OpenMW/openmw!3936
This commit is contained in:
commit
b5b6744321
4 changed files with 15 additions and 7 deletions
|
@ -54,7 +54,7 @@ namespace LuaUi
|
|||
if (!ext->isRoot())
|
||||
destroyWidget(ext);
|
||||
else
|
||||
ext->widget()->detachFromWidget();
|
||||
ext->detachFromParent();
|
||||
}
|
||||
|
||||
void detachElements(WidgetExtension* ext)
|
||||
|
@ -62,14 +62,14 @@ namespace LuaUi
|
|||
for (auto* child : ext->children())
|
||||
{
|
||||
if (child->isRoot())
|
||||
child->widget()->detachFromWidget();
|
||||
child->detachFromParent();
|
||||
else
|
||||
detachElements(child);
|
||||
}
|
||||
for (auto* child : ext->templateChildren())
|
||||
{
|
||||
if (child->isRoot())
|
||||
child->widget()->detachFromWidget();
|
||||
child->detachFromParent();
|
||||
else
|
||||
detachElements(child);
|
||||
}
|
||||
|
@ -272,12 +272,13 @@ namespace LuaUi
|
|||
|
||||
void Element::create(uint64_t depth)
|
||||
{
|
||||
assert(!mRoot);
|
||||
if (mState == New)
|
||||
{
|
||||
assert(!mRoot);
|
||||
mRoot = createWidget(layout(), true, depth);
|
||||
mLayer = setLayer(mRoot, layout());
|
||||
updateRootCoord(mRoot);
|
||||
mState = Created;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -304,9 +305,9 @@ namespace LuaUi
|
|||
}
|
||||
mLayer = setLayer(mRoot, layout());
|
||||
updateRootCoord(mRoot);
|
||||
}
|
||||
mState = Created;
|
||||
}
|
||||
}
|
||||
|
||||
void Element::destroy()
|
||||
{
|
||||
|
|
|
@ -112,6 +112,12 @@ namespace LuaUi
|
|||
ext->widget()->attachToWidget(widget());
|
||||
}
|
||||
|
||||
void WidgetExtension::detachFromParent()
|
||||
{
|
||||
mParent = nullptr;
|
||||
widget()->detachFromWidget();
|
||||
}
|
||||
|
||||
WidgetExtension* WidgetExtension::findDeep(std::string_view flagName)
|
||||
{
|
||||
for (WidgetExtension* w : mChildren)
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace LuaUi
|
|||
|
||||
bool isRoot() const { return mElementRoot; }
|
||||
WidgetExtension* getParent() const { return mParent; }
|
||||
void detachFromParent();
|
||||
|
||||
void reset();
|
||||
|
||||
|
|
|
@ -378,7 +378,7 @@ local function onSettingChanged(global)
|
|||
local value = common.getSection(global, group.key):get(settingKey)
|
||||
local settingsContent = groupElement.layout.content.settings.content
|
||||
auxUi.deepDestroy(settingsContent[settingKey]) -- support setting renderers which return UI elements
|
||||
settingsContent[settingKey] = renderSetting(group, group.settings[settingKey], value)
|
||||
settingsContent[settingKey] = renderSetting(group, group.settings[settingKey], value, global)
|
||||
groupElement:update()
|
||||
end)
|
||||
end
|
||||
|
@ -408,7 +408,7 @@ local function onGroupRegistered(global, key)
|
|||
|
||||
local element = groupElements[group.page][group.key]
|
||||
local settingsContent = element.layout.content.settings.content
|
||||
settingsContent[settingKey] = renderSetting(group, group.settings[settingKey], value)
|
||||
settingsContent[settingKey] = renderSetting(group, group.settings[settingKey], value, global)
|
||||
element:update()
|
||||
end))
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue