fix(editor): show missing components in multi-select inspector

This commit is contained in:
ayuan9957 2026-06-22 11:32:24 +08:00
parent 2e5b2adb0c
commit c0e9dc1efe

View File

@ -8051,7 +8051,20 @@ public:
if (const auto componentRegistry = editorContext.GetModuleRegistry().ResolveService<MetaCoreIComponentTypeRegistry>(); if (const auto componentRegistry = editorContext.GetModuleRegistry().ResolveService<MetaCoreIComponentTypeRegistry>();
componentRegistry != nullptr) { componentRegistry != nullptr) {
for (const auto& descriptor : componentRegistry->GetComponentDescriptors()) { for (const auto& descriptor : componentRegistry->GetComponentDescriptors()) {
if (descriptor.TypeId == "Transform" || descriptor.HasComponent(selectedObject)) { if (descriptor.TypeId == "Transform") {
continue;
}
bool anySelectedObjectCanReceiveComponent = false;
for (const MetaCoreId selectedId : editorContext.GetSelectedObjectIds()) {
const MetaCoreGameObject selectedGameObject = editorContext.GetScene().FindGameObject(selectedId);
if (selectedGameObject && !descriptor.HasComponent(selectedGameObject)) {
anySelectedObjectCanReceiveComponent = true;
break;
}
}
if (!anySelectedObjectCanReceiveComponent) {
continue; continue;
} }