diff --git a/editor/inspector/assets/animation-graph.js b/editor/inspector/assets/animation-graph.js index d5f58d4f4ec..262bbd10af8 100644 --- a/editor/inspector/assets/animation-graph.js +++ b/editor/inspector/assets/animation-graph.js @@ -29,6 +29,7 @@ exports.style = /* css */` display: none; text-align: center; color: var(--color-focus-contrast-weakest); + margin-top: 8px; } `; diff --git a/editor/inspector/assets/animation-mask.js b/editor/inspector/assets/animation-mask.js index 37fe8506013..4c104654dc7 100644 --- a/editor/inspector/assets/animation-mask.js +++ b/editor/inspector/assets/animation-mask.js @@ -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 { diff --git a/editor/inspector/assets/effect-header.js b/editor/inspector/assets/effect-header.js index 1c3b9c0f10a..12b2e6c1ee9 100644 --- a/editor/inspector/assets/effect-header.js +++ b/editor/inspector/assets/effect-header.js @@ -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 { diff --git a/editor/inspector/assets/effect.js b/editor/inspector/assets/effect.js index 2c88e6f3624..451766f3f77 100644 --- a/editor/inspector/assets/effect.js +++ b/editor/inspector/assets/effect.js @@ -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 { diff --git a/editor/inspector/assets/fbx/animation.js b/editor/inspector/assets/fbx/animation.js index 29fb5382eee..d8cd84b6f55 100644 --- a/editor/inspector/assets/fbx/animation.js +++ b/editor/inspector/assets/fbx/animation.js @@ -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; diff --git a/editor/inspector/assets/json.js b/editor/inspector/assets/json.js index 05b061a3313..8a99f57d225 100644 --- a/editor/inspector/assets/json.js +++ b/editor/inspector/assets/json.js @@ -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; diff --git a/editor/inspector/assets/material.js b/editor/inspector/assets/material.js index 96b6683bc62..739914da483 100644 --- a/editor/inspector/assets/material.js +++ b/editor/inspector/assets/material.js @@ -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 = { diff --git a/editor/inspector/assets/particle.js b/editor/inspector/assets/particle.js index 9f2937358c1..c0527fe84c0 100644 --- a/editor/inspector/assets/particle.js +++ b/editor/inspector/assets/particle.js @@ -34,6 +34,7 @@ exports.style = /* css */` display: none; text-align: center; color: var(--color-focus-contrast-weakest); + margin-top: 8px; } `; diff --git a/editor/inspector/assets/physics-material.js b/editor/inspector/assets/physics-material.js index 9e898b7fadd..0828d0b353b 100644 --- a/editor/inspector/assets/physics-material.js +++ b/editor/inspector/assets/physics-material.js @@ -23,6 +23,7 @@ exports.style = /* css */` display: none; text-align: center; color: var(--color-focus-contrast-weakest); + margin-top: 8px; } `; diff --git a/editor/inspector/assets/render-pipeline.js b/editor/inspector/assets/render-pipeline.js index 8ed4945406b..647ff312a8c 100644 --- a/editor/inspector/assets/render-pipeline.js +++ b/editor/inspector/assets/render-pipeline.js @@ -24,6 +24,7 @@ exports.style = /* css */` display: none; text-align: center; color: var(--color-focus-contrast-weakest); + margin-top: 8px; } `;