Create editor settings if undefined during migration

This commit is contained in:
Manuel Martin 2021-10-19 15:36:06 +02:00
Родитель 3292bcced9
Коммит b3e584862f
3 изменённых файлов: 83 добавлений и 19 удалений

Просмотреть файл

@ -269,22 +269,29 @@ function migrateV6ToV7(json) {
if (audioParamsComponent) {
// Prior to V6 we didn't have dirty params so we need to enable all properties
// to make sure that the old settings are applied config is enabled.
const editorSettingsComponent = entity.components.find(c => c.name === "editor-settings");
if (editorSettingsComponent) {
editorSettingsComponent.props["modifiedProperties"] = {
"audio-params": {
audioType: true,
gain: true,
distanceModel: true,
rolloffFactor: true,
refDistance: true,
maxDistance: true,
coneInnerAngle: true,
coneOuterAngle: true,
coneOuterGain: true
let editorSettingsComponent = entity.components.find(c => c.name === "editor-settings");
if (!editorSettingsComponent) {
editorSettingsComponent = {
name: "editor-settings",
props: {
enabled: true
}
};
entity.components.push(editorSettingsComponent);
}
editorSettingsComponent.props["modifiedProperties"] = {
"audio-params": {
audioType: true,
gain: true,
distanceModel: true,
rolloffFactor: true,
refDistance: true,
maxDistance: true,
coneInnerAngle: true,
coneOuterAngle: true,
coneOuterGain: true
}
};
}
const audioSettingsComponent = entity.components.find(c => c.name === "audio-settings");
@ -292,8 +299,17 @@ function migrateV6ToV7(json) {
const overriden = audioSettingsComponent.props && audioSettingsComponent.props.overrideAudioSettings;
// Prior to V6 we didn't have dirty params so we need to enable all properties
// to make sure that the old settings are applied config is enabled.
const editorSettingsComponent = entity.components.find(c => c.name === "editor-settings");
if (editorSettingsComponent && overriden) {
if (overriden) {
let editorSettingsComponent = entity.components.find(c => c.name === "editor-settings");
if (!editorSettingsComponent) {
editorSettingsComponent = {
name: "editor-settings",
props: {
enabled: true
}
};
entity.components.push(editorSettingsComponent);
}
editorSettingsComponent.props["modifiedProperties"] = {
scene: {
avatarDistanceModel: true,

Просмотреть файл

@ -229,7 +229,19 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
modifiedProperties: {},
modifiedProperties: {
'audio-params': {
audioType: true,
coneInnerAngle: true,
coneOuterAngle: true,
coneOuterGain: true,
distanceModel: true,
gain: true,
maxDistance: true,
refDistance: true,
rolloffFactor: true,
},
},
},
},
{
@ -999,7 +1011,19 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
modifiedProperties: {},
modifiedProperties: {
'audio-params': {
audioType: true,
coneInnerAngle: true,
coneOuterAngle: true,
coneOuterGain: true,
distanceModel: true,
gain: true,
maxDistance: true,
refDistance: true,
rolloffFactor: true,
},
},
},
},
{
@ -2053,7 +2077,19 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
modifiedProperties: {},
modifiedProperties: {
'audio-params': {
audioType: true,
coneInnerAngle: true,
coneOuterAngle: true,
coneOuterGain: true,
distanceModel: true,
gain: true,
maxDistance: true,
refDistance: true,
rolloffFactor: true,
},
},
},
},
{
@ -2255,7 +2291,19 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
modifiedProperties: {},
modifiedProperties: {
'audio-params': {
audioType: true,
coneInnerAngle: true,
coneOuterAngle: true,
coneOuterGain: true,
distanceModel: true,
gain: true,
maxDistance: true,
refDistance: true,
rolloffFactor: true,
},
},
},
},
{

Двоичные данные
test/integration/snapshots/Editor.test.js.snap

Двоичный файл не отображается.