Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.9.0 add fbx preserveMeshInstances #16279

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions editor/i18n/en/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,15 @@ module.exports = {
'If one is not preferred, or one is invalid for use, the time range is robustly calculated.<br>' +
'Some FBX generators may not export this information.',
},
preserveMeshInstances: {
name: 'Preserve Mesh Instances',
title:
'In the FBX model, if a mesh is referenced by multiple nodes (aka, mesh instancing), whether to create only one mesh asset. <br>' +
'If not, each reference will create a mesh asset copy.<br>' +
'This option is by default unchecked but is checked for those models migrated from version prior to V3.9.0,<br>' +
'since in previous versions the instances are always not preserved. <br>' +
'This option is read-only here. To modify this option for special purpose, see manual docs.',
},
smartMaterialEnabled: {
name: 'Smart Material Conversion',
title: 'Convert DCC materials to engine builtin materials which match the internal lighting model.',
Expand Down
4 changes: 4 additions & 0 deletions editor/i18n/zh/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@ module.exports = {
name: '优先使用文件时间范围',
title: '在导出 FBX 动画时,是否优先使用 FBX 文件中记录的动画时间范围。<br>若不使用该时间范围或此范围不可能用,则会粗略地计算动画时间范围。有些 FBX 生产工具中可能并未导出该信息。',
},
preserveMeshInstances: {
name: '保留网格实例',
title: 'FBX 模型中,若网格被多个节点引用(亦称网格实例化),是否仅创建一份网格资产。<br>若否,每处引用都将创建一份网格资产副本。<br>此选项默认勾选,但那些从 v3.9.0 之前的版本迁移上来的模型会自动不勾选,因为之前版本总是不保留网格实例的。<br>此选项在此处仅可读取,若要进行修改,见文档手册。',
},
smartMaterialEnabled: {
name: '材质智能转换',
title: '将 DCC 材质转化为引擎材质, 并匹对 DCC 材质的光照模型',
Expand Down
19 changes: 19 additions & 0 deletions editor/inspector/assets/fbx/fbx.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ exports.template = /* html */`
<option value="60">60</option>
</ui-select>
</ui-prop>
<ui-prop readonly>
<ui-label slot="label" value="i18n:ENGINE.assets.fbx.preserveMeshInstances.name" tooltip="i18n:ENGINE.assets.fbx.preserveMeshInstances.title"></ui-label>
<ui-checkbox slot="content" class="preserveMeshInstances-checkbox"></ui-checkbox>
</ui-prop>
<ui-prop>
<ui-label slot="label" value="i18n:ENGINE.assets.fbx.preferLocalTimeSpan.name" tooltip="i18n:ENGINE.assets.fbx.preferLocalTimeSpan.title"></ui-label>
<ui-checkbox slot="content" class="preferLocalTimeSpan-checkbox"></ui-checkbox>
Expand Down Expand Up @@ -69,6 +73,7 @@ exports.$ = {
legacyFbxImporterCheckbox: '.legacyFbxImporter-checkbox',
animationBakeRateSelect: '.animationBakeRate-select',
preferLocalTimeSpanCheckbox: '.preferLocalTimeSpan-checkbox',
preserveMeshInstancesCheckbox: '.preserveMeshInstances-checkbox',
smartMaterialEnabledCheckbox: '.smartMaterialEnabled-checkbox',
smartMaterialEnabledProp: '.smart-material-prop',
};
Expand Down Expand Up @@ -134,6 +139,20 @@ const Elements = {
updateElementReadonly.call(panel, panel.$.animationBakeRateSelect);
},
},
preserveMeshInstances: {
update() {
const panel = this;

let defaultValue = true;
if (panel.meta.userData.fbx) {
defaultValue = getPropValue.call(panel, panel.meta.userData.fbx.preserveMeshInstances, defaultValue);
}

panel.$.preserveMeshInstancesCheckbox.value = defaultValue;

updateElementInvalid.call(panel, panel.$.preserveMeshInstancesCheckbox, 'fbx.preserveMeshInstances');
},
},
preferLocalTimeSpan: {
ready() {
const panel = this;
Expand Down
Loading