fix edit material cache editing data bug in inspector (#15550)

* optimize edit material in inspector

* update

* optimize multiple selections warning label style
This commit is contained in:
黄森斌
2023-06-29 10:59:55 +08:00
committed by GitHub
parent 66dca2415e
commit e7095340a4
10 changed files with 37 additions and 19 deletions
@@ -29,6 +29,7 @@ exports.style = /* css */`
display: none;
text-align: center;
color: var(--color-focus-contrast-weakest);
margin-top: 8px;
}
`;
@@ -40,6 +40,7 @@ exports.style = /* css */`
display: none;
text-align: center;
color: var(--color-focus-contrast-weakest);
margin-top: 8px;
}
.asset-animation-mask > .header {
+1
View File
@@ -35,6 +35,7 @@ exports.style = /* css */`
display: none;
text-align: center;
color: var(--color-focus-contrast-weakest);
margin-top: 8px;
}
.asset-effect-header > ui-code {
+1
View File
@@ -42,6 +42,7 @@ exports.style = /* css */`
display: none;
text-align: center;
color: var(--color-focus-contrast-weakest);
margin-top: 8px;
}
.asset-effect > .section > .description {
+1
View File
@@ -113,6 +113,7 @@ exports.style = /* css */`
display: none;
text-align: center;
color: var(--color-focus-contrast-weakest);
margin-top: 8px;
}
.container > .show-type-wrap {
text-align: center;
+1
View File
@@ -33,6 +33,7 @@ exports.style = /* css */`
display: none;
text-align: center;
color: var(--color-focus-contrast-weakest);
margin-top: 8px;
}
.asset-json > ui-code {
flex: 1;
+28 -19
View File
@@ -73,7 +73,7 @@ function renderGroupEffectOptions(effects) {
}
exports.style = `
.invalid { display: none; }
.invalid { display: none; text-align: center; margin-top: 8px; }
.invalid[active] { display: block; }
.invalid[active] ~ * { display: none; }
@@ -319,12 +319,13 @@ exports.methods = {
$container.$children[i].querySelectorAll('ui-prop').forEach(($prop) => {
const dump = $prop.dump;
if (dump && dump.childMap && dump.children.length) {
if (!$prop.$children) {
$prop.$children = document.createElement('section');
$prop.$children.setAttribute(
if (!$prop.$childMap) {
$prop.$childMap = document.createElement('section');
$prop.$childMap.setAttribute(
'style',
'margin-left: var(--ui-prop-margin-left, unset);',
);
$prop.$childMap.$props = {};
for (const childName in dump.childMap) {
if (dump.childMap[childName].value === undefined) {
@@ -335,29 +336,29 @@ exports.methods = {
loopSetAssetDumpDataReadonly(dump.childMap[childName]);
}
$prop.$children[childName] = document.createElement('ui-prop');
$prop.$children[childName].setAttribute('type', 'dump');
$prop.$children[childName].render(dump.childMap[childName]);
$prop.$children.appendChild($prop.$children[childName]);
$prop.$childMap.$props[childName] = document.createElement('ui-prop');
$prop.$childMap.$props[childName].setAttribute('type', 'dump');
$prop.$childMap.$props[childName].render(dump.childMap[childName]);
$prop.$childMap.appendChild($prop.$childMap.$props[childName]);
}
if (Array.from($prop.$children.children).length) {
$prop.after($prop.$children);
if (Array.from($prop.$childMap.children).length) {
$prop.after($prop.$childMap);
}
$prop.addEventListener('change-dump', (e) => {
if (e.target.dump.value) {
$prop.$children.removeAttribute('hidden');
$prop.$childMap.removeAttribute('hidden');
} else {
$prop.$children.setAttribute('hidden', '');
$prop.$childMap.setAttribute('hidden', '');
}
});
}
if (dump.value) {
$prop.$children.removeAttribute('hidden');
$prop.$childMap.removeAttribute('hidden');
} else {
$prop.$children.setAttribute('hidden', '');
$prop.$childMap.setAttribute('hidden', '');
}
}
});
@@ -366,7 +367,11 @@ exports.methods = {
// when passes length more than one, the ui-section of pipeline state collapse
if (technique.passes.length > 1) {
$container.querySelectorAll('[cache-expand$="PassStates"]').forEach(($pipelineState) => {
$pipelineState.removeAttribute('expand');
const cacheExpand = $pipelineState.getAttribute('cache-expand');
if (!this.defaultCollapsePasses[cacheExpand]) {
$pipelineState.expand = false;
this.defaultCollapsePasses[cacheExpand] = true;
}
});
}
}
@@ -410,7 +415,6 @@ exports.methods = {
'children',
'defines',
'extends',
'pipelineStates',
];
const cacheData = this.cacheData;
@@ -434,7 +438,7 @@ exports.methods = {
cacheData[name] = {};
}
const { type, value } = prop[name];
const { type, value, isObject } = prop[name];
if (type && value !== undefined) {
if (!cacheData[name][passIndex]) {
if (name === 'USE_INSTANCING' && passIndex !== 0) {
@@ -449,7 +453,9 @@ exports.methods = {
}
}
if (prop[name].childMap && typeof prop[name].childMap === 'object') {
if (isObject) {
cacheProperty(value, passIndex);
} else if (prop[name].childMap && typeof prop[name].childMap === 'object') {
cacheProperty(prop[name].childMap, passIndex);
}
}
@@ -503,7 +509,9 @@ exports.methods = {
}
}
if (prop[name].childMap && typeof prop[name].childMap === 'object') {
if (prop[name].isObject) {
updateProperty(prop[name].value, passIndex);
} else if (prop[name].childMap && typeof prop[name].childMap === 'object') {
updateProperty(prop[name].childMap, passIndex);
}
}
@@ -578,6 +586,7 @@ exports.update = async function(assetList, metaList) {
* Method of initializing the panel
*/
exports.ready = function() {
this.defaultCollapsePasses = {};
this.canUpdatePreview = false;
// Used to determine whether the material has been modified in isDirty()
this.dirtyData = {
+1
View File
@@ -34,6 +34,7 @@ exports.style = /* css */`
display: none;
text-align: center;
color: var(--color-focus-contrast-weakest);
margin-top: 8px;
}
`;
@@ -23,6 +23,7 @@ exports.style = /* css */`
display: none;
text-align: center;
color: var(--color-focus-contrast-weakest);
margin-top: 8px;
}
`;
@@ -24,6 +24,7 @@ exports.style = /* css */`
display: none;
text-align: center;
color: var(--color-focus-contrast-weakest);
margin-top: 8px;
}
`;