Move modified properties to editor-settings and rename

This commit is contained in:
Manuel Martin 2021-10-18 18:28:33 +02:00
Родитель a7a5dbe4a8
Коммит c5e3d1e7e4
5 изменённых файлов: 38 добавлений и 162 удалений

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

@ -36,7 +36,7 @@ export default function AudioParamsNode(Type) {
set overrideAudioSettings(overriden) {
this._overrideAudioSettings = overriden;
if (!overriden) {
this.enabledProperties = {};
this.modifiedProperties = {};
}
}

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

@ -64,12 +64,7 @@ export default function EditorNodeMixin(Object3DClass) {
if (editorSettingsComponent) {
node.enabled = editorSettingsComponent.props.enabled;
}
const enabledProperties = json.components.find(c => c.name === "enabled-properties");
if (enabledProperties) {
node.enabledProperties = enabledProperties.props.enabled;
node.modifiedProperties = editorSettingsComponent.props.modifiedProperties;
}
}
@ -95,7 +90,7 @@ export default function EditorNodeMixin(Object3DClass) {
this.loadingCube = null;
this.errorIcon = null;
this.issues = [];
this._enabledProperties = {};
this._modifiedProperties = {};
}
clone(recursive) {
@ -127,7 +122,7 @@ export default function EditorNodeMixin(Object3DClass) {
this.issues = source.issues.slice();
this._visible = source._visible;
this.enabled = source.enabled;
this._enabledProperties = source.enabledProperties;
this._modifiedProperties = source.modifiedProperties;
return this;
}
@ -195,13 +190,8 @@ export default function EditorNodeMixin(Object3DClass) {
{
name: "editor-settings",
props: {
enabled: this.enabled
}
},
{
name: "enabled-properties",
props: {
enabled: this.enabledProperties
enabled: this.enabled,
modifiedProperties: this.modifiedProperties
}
}
]
@ -473,15 +463,15 @@ export default function EditorNodeMixin(Object3DClass) {
}
optionalPropertyExportValue(propName) {
return this.enabledProperties[propName] ? this[propName] : undefined;
return this.modifiedProperties[propName] ? this[propName] : undefined;
}
set enabledProperties(object) {
this._enabledProperties = { ...this._enabledProperties, ...object };
set modifiedProperties(object) {
this._modifiedProperties = { ...this._modifiedProperties, ...object };
}
get enabledProperties() {
return this._enabledProperties;
get modifiedProperties() {
return this._modifiedProperties;
}
};
}

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

@ -568,9 +568,10 @@ export default class SceneNode extends EditorNodeMixin(Scene) {
}
},
{
name: "enabled-properties",
name: "editor-settings",
props: {
enabled: this.enabledProperties
enabled: true,
modifiedProperties: this.modifiedProperties
}
}
]

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

@ -5,11 +5,11 @@ export default function useAudioParams(node, editor, sourceType, propName, scene
const targetPropName = (scenePropName && scenePropName) || propName;
return {
onChange: useCallback(value => editor.setPropertySelected(targetPropName, value), [editor, targetPropName]),
onEnable: useCallback(value => editor.setPropertySelected("enabledProperties", { [targetPropName]: value }), [
onEnable: useCallback(value => editor.setPropertySelected("modifiedProperties", { [targetPropName]: value }), [
editor,
targetPropName
]),
enabled: node.enabledProperties[targetPropName],
enabled: node.modifiedProperties[targetPropName],
onReset: useCallback(() => editor.setPropertySelected(targetPropName, Defaults[sourceType][propName]), [
editor,
targetPropName,

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

@ -42,13 +42,9 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
modifiedProperties: {},
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
},
},
{
name: 'box-collider',
@ -91,12 +87,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -148,12 +139,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -200,12 +186,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -249,12 +230,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -319,12 +295,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -374,12 +345,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -445,12 +411,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -497,12 +458,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -546,12 +502,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -621,12 +572,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -681,12 +627,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -740,12 +681,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -802,12 +738,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -864,12 +795,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -919,12 +845,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -970,12 +891,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -1028,12 +944,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -1089,12 +1000,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -1159,12 +1065,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -1208,12 +1109,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -1261,12 +1157,7 @@ Generated by [AVA](https://avajs.dev).
name: 'editor-settings',
props: {
enabled: true,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
modifiedProperties: {},
},
},
{
@ -1314,12 +1205,6 @@ Generated by [AVA](https://avajs.dev).
overrideAudioSettings: false,
},
},
{
name: 'enabled-properties',
props: {
enabled: {},
},
},
],
name: 'V1TestScene',
},